/*
	JQUERY MODIFICATIONS
*/

/* TOP NAV CONFIGURATION - http://cherne.net/brian/resources/jquery.hoverIntent.html */
var topNavHover = {
	sensitivity: 10, // number = sensitivity threshold (must be 1 or higher)
	interval: 75, // number = milliseconds for onMouseOver polling interval
	over: topNavDrop, // function = onMouseOver callback (required)
	timeout: 150, // number = milliseconds delay before onMouseOut
	out: topNavClear // function = onMouseOut callback (required)
};

var topNavCount = 0;

function topNavDrop(){ $("ul", this).fadeIn("fast"); }
function topNavClear(){ $("ul", this).fadeOut("fast"); }

$(document).ready(function(){
	
	/* TOP NAV HOVER */
	$("#Menu li").hoverIntent( topNavHover );
	$("#Menu img").hover(
		function(){
			var imgSrc = $(this).attr('src');
			if(imgSrc.indexOf('_off') != -1){
				newImgOn = imgSrc.replace('_off','_on');
				$(this).attr('src',newImgOn);
				topNavCount = 1;
			}else{
				topNavCount = 0;
			}
		},
		function(){
			if(topNavCount != 0){
				var imgSrc = $(this).attr('src');
				if(imgSrc.indexOf('_on')){
					newImgOff = imgSrc.replace('_on','_off');
					$(this).attr('src',newImgOff);
					topNavCount = 0;
				}
			}	
		}
	
	);


});

