// JavaScript Document$(document).ready(function() {
	


$(document).ready(function() {
$("#side1 li.inItem").hide();

			$("#topnav li").mouseover(function() {
										  $(this).addClass('highlight2');
										  });
		$("#topnav li").mouseout(function() {
										  $(this).removeClass('highlight2');
										  });
		
			$(".row >  ul li").mouseover(function() {
										  $(this).removeClass('highlight2');
										  });
		$(".row >  ul li").mouseout(function() {
										  $(this).removeClass('highlight2');
										  });

	$(".row >  ul li").mouseover(function() {
										  $(this).addClass('arrow');
										  });
		$(".row >  ul li").mouseout(function() {
										  $(this).removeClass('arrow');
										  });
		
		
	
	

	
	
	
	$(".row >  ul li a").hover(   
						  
	// this is called on when the mouse enters a link
	function (e) {
		// this is a variable that contains a HTML DOM object. This makes $this a jQuery object 
		// pointing to the same DOM element
		$this = $(this)
		// this animates the padding-left to 24px in 300 milliseconds
		
		$this.stop().animate({
			// these are the CSS properties to animate to
			// there are no dashes. padding-left becomes paddingLeft
			paddingLeft : '4px'
		}, {queue:false,duration:200});
	},
 
	// this is called when the mouse leaves the link
	function () {
		// this is a variable that contains a HTML DOM object. This makes $this a jQuery object 
		// pointing to the same DOM element
		$this = $(this)
		// this animates the padding-left back to 12px (the original value) in 300 milliseconds
		$this.animate({
			// these are the CSS properties to animate to
			// there are no dashes. padding-left becomes paddingLeft
			paddingLeft : '0px'
		}, {queue:false,duration:200});
	}
);



	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
	
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width();
				});	
			};
		})(jQuery); 
		
		if ( $(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			//Calculate each row
			$(this).find(".row").each(function() {							   
				$(this).calcSubWidth();
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			$(this).find(".sub").css({'width' :biggestRow});
			$(this).find(".row:last").css({'margin':'0'});
			
		} else { //If row does not exist...
			
			$(this).calcSubWidth();
			//Set Width
			$(this).find(".sub").css({'width' : rowWidth});
			
		}
	}
	
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}


	var config = {    
		 sensitivity: 6, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 50, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 250, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};

	$("ul#topnav li .sub").css({'opacity':'1'});
	$("ul#topnav li").hoverIntent(config);


//lefthand school nav


$("#side1 li.mainItem").mouseover(function()
{
   $("#side1 li.inItem").slideDown(300).next("#side1 li.inItem").slideDown(300);

});







});