$(document).ready(function() {
//hover for the side navigation
$('#sidenav img').each(function() {
	var imgFile = $(this).attr('src');
	var preloadImage = new Image();
  var imgExt = /(\.\w{3,4}$)/;
  preloadImage.src = imgFile.replace(imgExt,'_h$1');
		
	$(this).hover(
		function() {
			$(this).attr('src', preloadImage.src);
		},
		function () {
			$(this).attr('src', imgFile);
		}
	); // end hover
}); // end each
}); // end ready()
$(document).ready(function() {
//hover for the mainnavigation
$('#mainnav img').each(function() {
	var imgFile = $(this).attr('src');
	//$(this).css("border", "none");
	var preloadImage = new Image();
  var imgExt = /(\.\w{3,4}$)/;
  preloadImage.src = imgFile.replace(imgExt,'_h$1');
		
	$(this).hover(
		function() {
			$(this).attr('src', preloadImage.src);
		},
		function () {
			$(this).attr('src', imgFile);
		}
	); // end hover
}); // end each
}); // end ready()
//wait till the documents ready
$(document).ready(function(){
	//find the element that will have the hover effect
	$(".headlink").hover(function(){
		// show subMenu with slide animation
		$(this).find(".submenu").stop(true, true).slideDown("fast").show();
	}, function(){
		$(this).find(".submenu").stop(true, true).slideUp(400);
	});
});
