// JavaScript Document// JavaScript Document


$(document).ready(function() {

//preload images
jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
  	//alert(arguments[i]);
    jQuery("<img>").attr("src", arguments[i]);
  }
}

//image array
$.preloadImages("http://www.mhmgear.com/images/navigation-products-on.png","http://www.mhmgear.com/images/navigation-technology-on.png","http://www.mhmgear.com/images/navigation-our-story-on.png","http://www.mhmgear.com/images/navigation-lifestyle-on.png");

var sPath = window.location.pathname;
var tempPath = 'images/';
sPath = sPath.replace(tempPath, "");
var sPage = sPath.substring(sPath.lastIndexOf('/', 1) + 1);
if(sPage.indexOf('/') > 0)
	sPage = sPage.replace('/', '');
sPage = sPage.replace(".php", "");
if(sPage.length > 0){
	var imgs,i;
	imgs=document.getElementsByTagName('img');
	for(i in imgs){
		try{
			var sPart = imgs[i].src.substring(imgs[i].src.lastIndexOf('/') + 1);
			sPart = sPart.replace("navigation-","");
			sPart = sPart.replace("-up.gif","");
			if(sPart == sPage){
				imgs[i].src = imgs[i].src.replace("-up","-on");
			}
		}catch(err){}
	}
}





//image array
$.preloadImages("http://www.mhmgear.com/images/navigation-products-over.png","http://www.mhmgear.com/images/navigation-technology-over.png","http://www.mhmgear.com/images/navigation-our-story-over.png","http://www.mhmgear.com/images/navigation-lifestyle-over.png");

//rollover image swap
$("#rollover img").hover(
 function()
 {
  this.src = this.src.replace("-up","-over");
 },
 function()
 {
  this.src = this.src.replace("-over","-up");
 }
);

});
