// JavaScript Document

jQuery(document).ready(function() { 
	
	/**
	 * Main navigation
	 */
	jQuery("div#navigation li").each( function() {
											   
		var link = jQuery(this).find('a');
		
		// If this is the home page
		if (location.pathname == '/' && link.attr('href') == '/') {
			jQuery("div#navigation li").removeClass("on");
			jQuery(this).addClass("on");
			
		// Check to see if this is a top level nav item
		} else if ((location.pathname.indexOf(link.attr('href')) > -1) && link.attr('href') != '/') {
			jQuery("div#navigation li").removeClass("on");
			jQuery(this).addClass("on");
			
		// Is this a sub page (We're using the Breadcrumbs to work this out - is there a better way?)
		} else {
			/*jQuery("div#breadcrumbs a").each( function() {							
				if ((link.attr('href').indexOf(jQuery(this).attr('href')) > -1) && jQuery(this).attr('href') != '/') {
					jQuery("div#navigation li a").removeClass("on");
					link.addClass("on");
				}
			});*/
		}
	});
	
	
	/**
	 * Logo home link
	 */
	jQuery("#logo").click( function(e) {
		location.href = "/";							
	});
	
	
	/**
	 * Home page programs carousel
	 */
	jQuery("#program_carousel_carousel").jCarouselLite({
	    visible: 1,
		auto: 6000,
	    start: 0,
		speed: 600,
		btnNext: ".program_carousel_next",
        btnPrev: ".program_carousel_prev",
		vertical: false,
		circular: true
	});
	
	
	/**
	 * Home page testimonial cycle
	 */
	jQuery('#testimonial_content').cycle({ 
		fx: 'fade',
		speed:  '1000', 
		timeout: '12000'
	});
	
});
