$(document).ready(function() {
	
	jQuery.preloadImages = function()
	{
	  for(var i = 0; i<arguments.length; i++)
	  {
	    jQuery("<img>").attr("src", arguments[i]);
	  }
	}
	
	function stripslashes(str)
	{
		return str.replace(/\//g, '');
	}
	
	function convertAmp(str){
		str= str.replace(/\&amp;/g,'&');
		str= str.replace(/\&quot;/g,'""');
		return str;
	}

	// Get an Array Of The Images
		
	for (var item in homePromo) {
		$.preloadImages('/a/img/home/'+homePromo[item]['image']);
		//console.log('preloaded' + '/a/img/home/'+homePromo[item]['image']);
	}
	
	// Attach the hover event
	$(".prodCatNav a").hover(function () {
		$(".prodCatNav a").removeClass('current');
		$(this).addClass('current');
		
		// replace content
		lnkText = stripslashes($(this).attr("href"));		
		$("#content").css('background-image', 'url(/a/img/home/'+homePromo[lnkText].image+')');
		$("#product h1").html(homePromo[lnkText].heading);
		$("#product #subText").html(homePromo[lnkText].text);  
		$("#product p a").attr("href", homePromo[lnkText].href); 
	});
	
});