productsOn = new Image();
productsOn.src = "/img/nav-products-on.gif";
productsOff = new Image();
productsOff.src = "/img/nav-products.gif";

pressOn = new Image();
pressOn.src = "/img/nav-press-on.gif";
pressOff = new Image();
pressOff.src = "/img/nav-press.gif";

aboutOn = new Image();
aboutOn.src = "/img/nav-about-us-on.gif";
aboutOff = new Image();
aboutOff.src = "/img/nav-about-us.gif";

stockistsOn = new Image();
stockistsOn.src = "/img/nav-stockists-on.gif";
stockistsOff = new Image();
stockistsOff.src = "/img/nav-stockists.gif";

helpOn = new Image();
helpOn.src = "/img/nav-help-on.gif";
helpOff = new Image();
helpOff.src = "/img/nav-help.gif";


function imgOn(n){
	if(document.images[n]){document.images[n].src = eval(n+"On").src}
}

function imgOff(n){
	if(document.images[n]){document.images[n].src = eval(n+"Off").src}
}


function chkForm(){
if(document.getElementById("bootSize").selectedIndex==0){
	alert("Please enter your boot size");
	return false;
}
}

function openDetail(url){
	window.open(url,'details','width=370px,height=420px,resizable=yes');
}

function openSizeGuide(url,name,features){
	window.open(url,name,features);
}

FC.vars = {
	selectors : {
		PROD_IMG : '.prodImage',
		PROD_LGE : '.prodImageLge',
		ZOOM_IMG : '#large img',
		HOME : '#home',
		INTRO : '#productlist1',
		BACKGROUND : '#container .background'
	},
	rotationImages : {
		HOME : ['../img/backgrounds/2009/background_delivery.jpg', '../img/backgrounds/2009/background_retailers.jpg', '../img/backgrounds/2009/background_half.jpg', '../img/backgrounds/2009/background_sale.jpg', '../img/backgrounds/2009/background_home2.jpg', '../img/backgrounds/2009/background_home.jpg']
	},
	variables : {
		ROTATION : 0
	}
};

FC.rotateImg = function(){
	
	FC.vars.variables.ROTATION++;
	var int = $(FC.vars.rotationImages.HOME).length - 1;
	if(FC.vars.variables.ROTATION >= int){FC.vars.variables.ROTATION = 0}
	
	$(FC.vars.selectors.BACKGROUND).animate({"opacity":0},1000,function(){
		$(this).css('background-image', 'url(' + FC.vars.rotationImages.HOME[FC.vars.variables.ROTATION] + ')')
		$(this).animate({"opacity":1},1000);
	});
	
	setTimeout("FC.rotateImg()",5000);
}

FC.imgSwap = function(){
	$(FC.vars.selectors.PROD_IMG).each(function(){
		var __img;
		var __imgRep = $(FC.vars.selectors.PROD_LGE).attr('src');
		var __imgZoom;
		
		$(this).bind('click', function(){ // used to be focus/mouseover
			$(FC.vars.selectors.PROD_IMG).removeClass('sel');
			$(this).addClass('sel');
				__img = $(this).attr('href');

			if ($.browser.msie){
				$(FC.vars.selectors.PROD_LGE).attr('src', __img);
			} else {
				$(FC.vars.selectors.PROD_LGE).stop();
				$(FC.vars.selectors.PROD_LGE).animate({"opacity":0},400,function(){
					$(this).attr('src', __img);
					$(this).animate({"opacity":1},400)
				});
			}
			//create the zoom path by adding a -Z to the regular image path
			var temp = new Array();
			temp = __img.split('.jpg');
			__imgZoom = temp[0] + '-Z.jpg';
			$(FC.vars.selectors.ZOOM_IMG).attr('src', __imgZoom);

		})/*.bind('blur mouseout', function(){
			if ($.browser.msie){
				$(FC.vars.selectors.PROD_LGE).attr('src', __imgRep);
			} else {
				$(FC.vars.selectors.PROD_LGE).stop();
				$(FC.vars.selectors.PROD_LGE).animate({"opacity":0},400,function(){
					$(FC.vars.selectors.PROD_LGE).attr('src', __imgRep);
					$(this).animate({"opacity":1},400)
				});
			}										 
		})*/.bind('click', function(){
			return false;
		})
	});
}

$(document).ready(function(){
	if($(FC.vars.selectors.PROD_IMG).length){FC.imgSwap()};
	if($(FC.vars.selectors.HOME).length){
		setTimeout("FC.rotateImg()",5000)
	};
	if($(FC.vars.selectors.INTRO).length){
		setTimeout("FC.rotateImg()",5000)
	};

	// image zoomer
	$(".all #wrap").anythingZoomer({
       expansionSize: 30,
       speedMultiplier: 1.4
    });
	
	// product text overlay
	if($(".all .productTextArea").length>0){
	
		var __moreInfo = $("div.productTextArea");
		__moreInfo.animate({"opacity":"0"},0);
		//__moreInfo.append("<a href='#' id='textClose'>Close</a>");

		
		var __more = $("ul.more a");
		var __close = $("a#textClose");
		
		__more.toggle(
					  
			function(){
				__moreInfo.animate({"opacity":"1"},500);
				__more.addClass("up");
			},
			function(){
				__moreInfo.animate({"opacity":"0"},500);
				__more.removeClass("up");
			}
			
		);
	
	}
	
	

	
});