// document initialize
$(document).ready(function(){ 
	
  // primary navigation
	$("ul.sf-menu").superfish({
		dropShadows:   false,
		animation: {opacity:'show',height:'show'},
		speed: 'fast'
	}); 

	// search button rollover
	$('#inp-Submit').hover(
		function() {$(this).addClass('inp-Submit-hover');},
		function() {$(this).removeClass('inp-Submit-hover');}
	);
	
	
	// news ticker
	$("#ticker").jCarouselLite({  
	  vertical: true,  
    visible: 1,  
    auto:4000,  // miliseconds - how long each news line stays up
    speed:1000  // miliseconds - transition speed
  });

  // sponsor logos
	$('#sponsor-logos').innerfade({ 
		animationtype: 'fade', 
		speed: 100,     // miliseconds - transition speed
		timeout: 6000, // miliseconds - how long each logo stays up
		type: 'sequence', 
		containerheight: '50px' 
	}); 
	
});


$(document).ready(function() {
		
		var inPath = function(text) {
			return (document.location.pathname.indexOf(text) > 0)
		}
		
		var expandMenu = function(topLevelId) {
			$("#" + topLevelId + " img").attr("src", "/assets/images/subNav_ico_open.gif");
			$("#" + topLevelId + " ul").attr("style", "display: block");
		}
		
		if (document.location.pathname.indexOf('underclassmen') > 0) {
			expandMenu('subnav-admissions-underclassmen');
		}
		else if (document.location.pathname.indexOf('math_science_engineering') > 0) {
			expandMenu('subnav-admissions-math-sci');
		}
		else if (document.location.pathname.indexOf('how_to_apply') > 0) {
			expandMenu('subnav-admissions-how-to-apply');
		}
		else if (document.location.pathname.indexOf('graduates_and_professionals') > 0) {
			expandMenu('subnav-admissions-grads-pros');
		}
		else if (document.location.pathname.indexOf('faqSpanish') > 0) {
			expandMenu('subnav-admissions-faq-spanish');
		}
		else if (document.location.pathname.indexOf('faq') > 0) {
			expandMenu('subnav-admissions-faq');
		}
		
		
		if (inPath('family_friends')) {
			$('.secondLevelUL').hide();
		}
		
		if (inPath('what_others_say') || inPath('partner_testimonials') || inPath('in_the_media') || inPath('impact')) {
			expandMenu('what_others_say_subnav');
		}
		
		if (inPath('program_benefits') || inPath('finances') || inPath('training_development') || inPath('safety') || inPath('career_support')) {
			expandMenu('program_benefits_tier3');
		}
		
		if (inPath('selection_process') || inPath('how_we_select') || inPath('our_corps') || inPath('application_details')) {
			expandMenu('selection_process_tier3');
		}
		
});

