window.onload = function() {
	var out = '';
	$$('#navigation ul li a').each(function(e) {
		if (e.href == window.location.href) {
			e.addClassName('current');
			var path_parts = e.href.split('/');
			for(var i=1;i<path_parts.length;i++) {
			  var path = path_parts[i].replace('.html','');
			  if ($(path)) $(path).show();
			}
			return true;
		}
  });
	//home page tabs
	$$('#tabBoxList a').each(function(e) {
	  e.onmouseover = function() { 
		  [1,2,3,4].each( function(i) { 
				 Element.hide('tabBoxContent0' + i);
			});
			$$('#tabBoxList a').each(function(a) { Element.removeClassName($(a),'active');});
	    Element.show($(this.rel));
			Element.addClassName($(e),'active');
		}
	});
	
}

var app = {
	testimonialTimer : 1,
	testimonialWait  : 20,
	currentTestimonial : 1,
	startTestimonial : function() {
		Effect.Fade('test'+app.currentTestimonial, { duration: app.testimonialTimer,
			afterFinish : function() {
				  if ($('test'+ (app.currentTestimonial+1))) {
						app.currentTestimonial += 1;
					} else {
						app.currentTestimonial = 1;
					}
				  Effect.Appear('test'+app.currentTestimonial, { duration: app.testimonialTimer, 
					  afterFinish : setTimeout(app.startTestimonial,app.testimonialWait * 1000) }) 
			} 
		});
	}
}
