//EXECUTES ON LOAD
//JQUERY PRELOAD IMAGES FUNCTION
jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}
//END JQUERY PRELOAD IMAGES FUNCTION

$(document).ready(function(){

//PRELOAD NAV OVER IMAGES
$(".nav").each(function(){
	$.preloadImages("styles/"+styleFolder+"/images/"+$(this).attr("id")+"_over.jpg");
	//BIND CLICK EVENT TO NAV BUTTONS
	$(this).bind("click", function(e){
		location.href = $(this).attr("id").replace("nav_","")+".asp";		
	});
	//END BIND CLICK EVENT TO NAV BUTTONS
});
//END PRELOAD NAV OVER IMAGES

//BIND MOUSE OVER TO SWAP IMAGE TO OVER STATE
$(".nav").bind("mouseover", function(e){
	$(this).css("background-image",$(this).css("background-image").replace($(this).attr("id"), $(this).attr("id") + "_over"));	
});
//END BIND MOUSE OVER TO SWAP IMAGE TO OVER STATE

//BIND MOUSEOUT EVENT TO SWAP IMAGE TO NORMAL STATE
$(".nav").bind("mouseout", function(e){
	$(this).css("background-image",$(this).css("background-image").replace("_over", ""));
});
//END BIND MOUSEOUT EVENT TO SWAP IMAGE TO NORMAL STATE

//BIND CLICK EVENT TO EACH BOTTOM BUTTON
$(".bottom_buttons").each(function(){
	$(this).bind("click", function(e){
		location.href = $(this).attr("id").replace("BT","")+".asp";
	});
});
});//end document.ready

