var ProductPage = new function() {	
	
	function customSort(a,b){
		return(a.seq-b.seq);
	}
	
	this.colorObj = function (seq,name,oprice,lprice,copy,image,skus){  
		this.seq = seq;  
		this.name = name; 
		this.oprice = oprice; 
		this.lprice = lprice; 
		this.copy = copy;
		this.image = image;
		this.skus = skus
	}
	
	this.skuObj = function (sku,catentry,size,seq,backdate,backordered){  
		this.sku = sku;  
		this.catentry = catentry; 
		this.size = size; 
		this.seq = seq;
		this.backdate = backdate;
		this.backordered = backordered;
	}
	
	this.customSort = function (a,b){
		return(a.seq-b.seq);
	}
	
	function togSwatch(e){
		var t = YUE.getTarget(e);
		if(YUD.hasClass(t, "colorSwatch")){
			if(!YUD.hasClass(t,"highlight") && !YUD.hasClass(t,"selected")){
				YUD.addClass(t, "highlight");
			}else if(!YUD.hasClass(t,"selected")){
				YUD.removeClass(t,"highlight");
			}
		}else{
			return true;
		}
	}
	
	function highlightSwatch(sw){
		var sibs = YUD.getElementsByClassName("colorSwatch", "img", sw.parentNode);
		for(var i=0; i < sibs.length; i++){
			YUD.removeClass(sibs[i],"selected");
		}
		YUD.addClass(sw, "selected");
		YUD.removeClass(sw, "highlight");
	}
	
	function setColor(seq){
		onesize = false;
		var seqPrefix = '';
		var swatch = $("swatch_" + seq);
		var xlZoomSwatch = $("xlZoomSwatch_" + seq);
		if(typeof seq != 'string' && seq < 10){
			seqPrefix = '0';
		}
		selectedColor = seq;
		
		if(swatch){
			highlightSwatch(swatch);
		}
		if(xlZoomSwatch){
			highlightSwatch(xlZoomSwatch);
		}
				
		for(var y = 0; y != colorArray.length; y++){
			if(colorArray[y].seq == seq){
				//Set Image
				if (template != 'v'){
					$("productImage").src = colorArray[y].image.src;
					$("productImagePrint").src = collPath + collNum + "_" + selectedColor + "_130_print.jpg";
					if($("xlZoomBtn"))
					{
						$("xlZoomImg").src = collPath + collNum + "_" + selectedColor + "_900_" + prodImgExt + ".jpg";
					}
				}
				//Set Color
				color = colorArray[y].name;
				colorStyle.value = color;
				//Set Price
				price = colorArray[y].oprice;
				//Set Copy
				if (colorArray[y].copy != 'null' && colorArray[y].copy != ''){
					copy = colorArray[y].copy;
				} else {
					copy = productCopy;
				}
				//Set Sizes
				listObjsize.length = 0;
				listObjsize.options[0] = new Option(CONSTANTS.PRODUCT_SELECTSIZE);
				for(var t = 0; t != colorArray[y].skus.length; t++){
					if (colorArray[y].skus[t].backordered){
						shipDate = colorArray[y].skus[t].backdate;
						today = new Date();
						month = today.getMonth() +1;
						day = today.getDate();
						
						if(month <10){ 
							month = "0"+month;
						}
						if(day<10){
							day = "0"+day;
						}
						
						now = today.getFullYear() +""+ month +""+ day;
											
						if(shipDate <= now){
							listObjsize.options[t+1] = new Option((colorArray[y].skus[t].size)+" - "+CONSTANTS.PRODUCT_BACKORDERED,colorArray[y].skus[t].catentry);
						}else{
							shipStr = shipDate.substring(4,6) + "/" + shipDate.substring(6,8) + "/" + shipDate.substring(2,4)
							listObjsize.options[t+1] = new Option((colorArray[y].skus[t].size) + " - "+ CONSTANTS.PRODUCT_WILLSHIP(shipStr), colorArray[y].skus[t].catentry);
						}
					} else {
						listObjsize.options[t+1] = new Option((colorArray[y].skus[t].size),colorArray[y].skus[t].catentry);
					}
					if (colorArray[y].skus[t].size == 'ONE SIZE'){
						onesize = true;
						var html = '<input type="hidden" name="size" value="'+colorArray[y].skus[t].catentry+'" />';
				        if(colorArray[y].skus[t].backordered == true){
				        	if(shipDate <= now) html += CONSTANTS.PRODUCT_BACKORDERED+'<br/>';
							else html += CONSTANTS.PRODUCT_WILLSHIP(shipStr) + '<br/>';
						}
						$('sizeBox').innerHTML = html;   
					}
				}
				
				switch(view){
					case "2":
						YUD.setStyle($("zoomFront"), "display", "none");
						YUD.setStyle($("zoomBack"), "display", "inline");
						YUD.setStyle($("xlZoomFront"), "color", "#B4AF9C");
						YUD.setStyle($("xlZoomBack"), "color", "#646055");
						break;
					case "3":
						YUD.setStyle($("zoomInside"), "display", "none");
						YUD.setStyle($("zoomOutside"), "display", "inline");
						YUD.setStyle($("xlZoomInside"), "color", "#B4AF9C");
						YUD.setStyle($("xlZoomOutside"), "color", "#646055");
						break;
					default:
						break;
				}
				
				$('prodCopy').innerHTML = copy;
				$('prodColor').innerHTML = color;
				if($('xlZoomColor')){
					$('xlZoomColor').innerHTML = color;
				}
				$('prodOff').innerHTML = price;
			}	
		}
	}
	
	function setBagOn(submit){
		var oiuForm = document.forms.OrderItemUpdate;
		var currItemBackordered = false;
		if((!onesize) && (listObjsize.selectedIndex == 0)) {
			alert(CONSTANTS.PRODUCT_ERROR_PLEASESELECTSIZE);
			if (submit == 'submit'){
				return false;
			}
		} else if((template == 'v') && oiuForm.sizelist && (oiuForm.sizelist.value == '')){
			alert(CONSTANTS.PRODUCT_ERROR_PLEASESELECTSTYLE);
			if (submit == 'submit'){
				return false;
			}
		} else if (YUD.hasClass($("AddToBag"), "processingBtn")) {
			return;
		} else {
			catentry = OrderItemUpdateObj.size.value;
	
			for(var y = 0; y != colorArray.length; y++){
				if(colorArray[y].name == colorStyle.value){
					for(var t = 0; t != colorArray[y].skus.length; t++){
						if (colorArray[y].skus[t].catentry == catentry){
							OrderItemUpdateObj.partnumber.value = colorArray[y].skus[t].sku;
							currItemBackordered = colorArray[y].skus[t].backordered;
							break;
						}
					}
				}
			}
	        
			YUD.setStyle($("AddToBag"),"cursor", "wait");
	        
	        OrderItemUpdateObj.catEntryId.value = catentry;
	        OrderItemUpdateObj.URL.value = '#';
	        //addDivToHiddenFrame(); /* write div element  */
	        //timeid = setTimeout("updateTimer()",200);/* start the time to check for frame load (dancing around for MAC IE, otherwise use onload event) */
	       	/* prepare to bag item */
	        YUD.replaceClass($("AddToBag"), "addToBagBtn", "processingBtn");// Processing ...
	        HTB.fixPngs();
	       	//OrderItemUpdateObj.target = 'HIDDENPOST';
	        OrderItemUpdateObj.action = '/webapp/wcs/stores/servlet/OrderItemAdd';
	        var oiuCB = {
	        	success: function(o){
					if(o.responseXML.getElementsByTagName('wasItemAdded')[0].firstChild.nodeValue === "true") {	 
	        			YUD.replaceClass($("AddToBag"), "processingBtn", "itemAddedBtn");       			
		        		HTB.fixPngs();
		        		HOL.miniCart.getCart('add');
		        		setTimeout(function(){
		        			YUD.replaceClass($("AddToBag"), "itemAddedBtn", "addToBagBtn");
							if($("size") && $("size").tagName.toUpperCase() == "SELECT"){
								$("size").selectedIndex = 0;
							}else if($("sizelist") && $("sizelist").tagName.toUpperCase() == "SELECT"){
								setColor(initColor);
		        				for(var i=0; i< $("sizelist").options.length; i++){
		        					if($("sizelist").options[i].value == initColor){
		        						$("sizelist").selectedIndex = i;
		        					}
		        				}
							}
							getVBImg();
		        		}, 2500);
		        	} else {
		        		YUD.replaceClass($("AddToBag"), "processingBtn", "addToBagBtn");
		        		alert(o.responseXML.getElementsByTagName('statusMsg')[0].firstChild.nodeValue);
		        	}
		    
		        	YUD.setStyle($("AddToBag"), "cursor", "pointer");
			   	},
	        	failure: function(o){
	        		//alert("failed to add item");
	        		YUD.replaceClass($("AddToBag"), "processingBtn", "addToBagBtn");
	        		HTB.fixPngs();
	        	}
	        }
	      	        
			//var transaction = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback, null);
			YUC.setForm(oiuForm);
			var transaction = YUC.asyncRequest('GET', oiuForm.action, oiuCB, null);
	        
	   		cmAddToBag(onesize);
	        //OrderItemUpdateObj.submit(); /* submit request */
		}
	}
	
	function getVBImg(){
		var cartNum = HTB.readCookie('myCart');
		var cartParts = cartNum ? cartNum.split(",") : null;
		var num = cartParts ? cartParts[0] : null;
		if(num != '0' && cartNum != null){
			YUD.setStyle($('viewBag'), "display", "inline");
		}else{
			return;
		}
	}
	
	function swatchClickHandler(e){
		var t = YUE.getTarget(e);
		function swSeq(swId){ return swId.split("_")[1]; }
		if(YUD.hasClass(t,"colorSwatch")){
			var seq = swSeq(t.id);
			setColor(seq);
		}else if(YUD.hasClass(t, "cycleSwatch")){
			//add behavior for cycling thru colors
			var c = t.parentNode, 
				h = YUD.getElementsByClassName("selected", "img", c)[0],
				sibs = YUD.getElementsByClassName("colorSwatch", "img", c),
				fs = sibs[0], 
				ls = sibs[sibs.length - 1], 
				ns;
			if(t.id.indexOf("Prev") > -1){
				var sib = YUD.getPreviousSibling(h);
				ns = YUD.hasClass(sib, "colorSwatch") ? sib : ls;
			}else{
				var sib = YUD.getNextSibling(h);
				ns = YUD.hasClass(sib, "colorSwatch") ? sib : fs;
			}
			setColor(swSeq(ns.id));
		}else{
			return true;
		}
	}
	
	function displayProdUtil(pu){
		HTB.toggleSelects("hidden");
		YUD.setStyle(pu, "opacity", "0");
		YUD.setStyle(pu, "display", "block");
		var showPU = new YUA(pu, { opacity:{ to:1 } },.25);
		showPU.onComplete.subscribe(function(){
			HTB.fixPngs();
		});
		showPU.animate();
	}
	
	function closeProdUtil(pu){
		var hidePU = new YUA(pu, { opacity:{ to:0 } },.25);
		hidePU.onComplete.subscribe(function(){
			YUD.setStyle(pu, "display", "none");
			if(pu.id == 'eafUtil'){
				YUD.setStyle("EmailFriendForm", "display", "block");
				YUD.setStyle("eafResponse", "display", "none");
			}else if(pu.id == 'wlUtil'){
				YUD.setStyle($("wishListForm"), "display", "block");
				YUD.setStyle("wlResponse", "display", "none");
			}
		});
		hidePU.animate();
		HTB.toggleSelects("visible");
		YUD.setStyle($("sizelist"), "visibility", "visible");
		YUD.setStyle($("size"), "visibility", "visible");
		
	}
	
	function utilIconMouseOnOff(e){
		var t = YUE.getTarget(e);
		HTB.toggle.onoff(t);
		$("utilMessage").innerHTML = t.alt || '';
		HTB.toggle.visibility($("utilMessage"));
	}
	
	function utilIconClick(e){
		var t = YUE.getTarget(e);
		if(YUD.hasClass(t, "utilIcon")){
			switch(t.id){
				case "sizeChartImg":
					openSizeChart(sizeChart);
					break;
				case "wishlistImg":
					//HTB.getFadeUp($("wlFDC"));
					if((!onesize) && (listObjsize.selectedIndex == 0)){
						alert(CONSTANTS.PRODUCT_ERROR_PLEASESELECTSIZE);
					}else if((template == 'v') && (document.forms.OrderItemUpdate.sizelist.value == '')){
						alert(CONSTANTS.PRODUCT_ERROR_PLEASESELECTSTYLE);
					}else{
						prepWishlist();
						displayProdUtil($("wlUtil"));
					}
					break;
				case "eafImg":
					//HTB.getFadeUp($("eafFDC"));
					prepEAF();
					displayProdUtil($("eafUtil"));
					break;
				case "printImg":
					print();
					//alert("printable version of product page");
					break;
				default:
					break;
			}
		}
	}
	function eafSend(){
		var f = $("EmailFriendForm"), r = $("eafResponse");
		var cb = {
			success: function(o){
				$("eafLastRecipient").innerHTML = f.toEmail.value;
				YUD.setStyle(f.parentNode, "cursor", "default");
				YUD.setStyle(f, "display", "none");
				f.toEmail.value = "";
				f.fromEmail.value = "";
				f.bodyEmail.value = "";
				YUD.setStyle(r, "display", "block");
				$("eafUtil").closeTO = setTimeout(function(){ closeProdUtil($("eafUtil")); }, 1000);
			},
			failure: function(o){
				//failed...
				YUD.setStyle(f.parentNode, "cursor", "default");
			}
		}
		YUD.setStyle(f.parentNode, "cursor", "wait");
		if(HTB.validateEmail(f.toEmail) && HTB.validateEmail(f.fromEmail)){
			f.collection.value = collNum;
			f.price.value = $("prodOff").innerHTML;
			f.name.value = $("prodName").innerHTML;
			f.color.value = $("prodColor").innerHTML;
			f.productId.value = productId;
			f.storeId.value = globalStoreId;
			f.catalogId.value = globalCatalogId;
			f.langId.value = -1;
			f.cseq.value = parseInt(selectedColor, 10);
			$("eafMsg").innerHTML = "";
			YUC.setForm(f);
			YUC.asyncRequest("POST", f.action, cb);
		}else{
			YUD.setStyle(f.parentNode, "cursor", "default");
			$("eafMsg").innerHTML = CONSTANTS.PRODUCT_EAF_ERROR_INVALID_ADDRESS;
		}
	}
	
	function wlSubmit(){
		var f = $("wishListForm"), cookie = HTB.readCookie('wishList');
		var cb = {
			success: function(o){
				YUD.setStyle($("wlSubmit"), "cursor", "pointer");
				YUD.setStyle(f, "display", "none");
				f.reset();
			
				if(o.responseXML.getElementsByTagName('wasItemAdded')[0].firstChild.nodeValue === "true") {	 
		        	if(!cookie || cookie == "false"){
						HTB.createCookie('wishList', true);
					}
					YUD.setStyle($("wishListLink"), "display", "inline");
				} else {
					$('wlResponse').innerHTML = o.responseXML.getElementsByTagName('statusMsg')[0].firstChild.nodeValue;
				}
		
				$("wlUtil").closeTO = setTimeout(function(){ closeProdUtil($("wlUtil")); }, 1000);
				YUD.setStyle($("wlResponse"), "display", "block");
			},
			failure: function(o){
				YUD.setStyle($("wlSubmit"), "cursor", "pointer");
			}
		}
		YUD.setStyle($("wlSubmit"), "cursor", "wait");
		YUC.setForm(f);
		YUC.asyncRequest("GET", f.action, cb);
	}
	
	function prepWishlist(){
		var f = $("wishListForm");
		var size;
		var writeColor = true;
		var sizeOptions = onesize && template == 'v' ? document.forms.OrderItemUpdate.sizelist.getElementsByTagName('option') : listObjsize.getElementsByTagName('option');
		if (onesize){
			var catentry = OrderItemUpdateObj.size.value;
			if(template == 'v'){
				writeColor = false;
	    		 for(i = 0; i < sizeOptions.length; i++){
	    	 		if(sizeOptions[i].selected){
	    	 			size = sizeOptions[i].innerHTML;
	    	 		}
	    	 	}
	    	}
		}else{
	    	 var catentry = listObjsize.value;
	    	 for(i = 0; i < sizeOptions.length; i++){
	    	 	if (sizeOptions[i].selected){
	    	 		size = sizeOptions[i].innerHTML;
	    	 	}
	    	 }
	    }
	    f.catEntryId.value = catentry;
	    if(size){
			$("wlSize").innerHTML = size;
		}else{
			YUD.setStyle($("wlSize"), "display", "none");
		}
	    if(writeColor){
			$("wlColor").innerHTML = $("prodColor").innerHTML;
		}
		$("wlPrice").innerHTML = $("prodOff").innerHTML;
		YUD.setStyle($("wlResponse"), "display", "none");
	}
	
	function prepEAF(){
		var f = $("EmailFriendForm");
		$("eafColor").innerHTML = $("prodColor").innerHTML;
		$("eafPrice").innerHTML = $("prodOff").innerHTML;
	}
	
	function openSizeChart(sizeChart){
		if(!sizeChart)
			return;
		
		switch(sizeChart)
		{
			case 3:
				chartDiv = "bettysTopsDiv";
				break;
			case 4:
				chartDiv = "bettysBottomsDiv";
				break;
			case 5:
				chartDiv = "bettysAccDiv";
				break;
			case 6:
				chartDiv = "dudesTopsDiv";
				break;
			case 7:
				chartDiv = "dudesBottomsDiv";
				break;
			default:
				chartDiv = "dudesAccDiv";
				break;
		}
		
		HTB.getFadeUp($("scFDC"));
		showSizeChartContent(chartDiv);
	}
	
	function openXLZoom(e){
		var fdh = YUD.getViewportHeight() - 42;
		YUD.setStyle($("xlZoomFDC"), "height", fdh + "px");
		YUD.setStyle($("xlZoomImgCntnr"), "height", fdh + "px");
		YUD.setStyle($("xlZoomImgFrame"), "height", fdh + "px");
		YUD.setStyle($("xlZoomImgFrame"), "clip", "rect(0px, 900px, " + fdh + "px, 0px)");
		
		HTB.getFadeUp($("xlZoomFDC"));
		
		if(fdh < 830){ //set up scroll
			var d = 900 - (900 - fdh);
			var sh = Math.floor(d/3);
			var dragCenter = (Math.floor(sh/2) - 12);
			
			function setZoomImgY(){
				var xlzi = $("xlZoomImg");
				var trReg = YUD.getRegion("track");
				var drReg = YUD.getRegion("drag");
				YUD.setStyle(xlzi, "top", (trReg.top - drReg.top) * 3 + "px");
				YUD.setStyle($("drag"), "left", "0px");
			}
			
			YUD.setStyle($("drag"), "height", sh + "px");
			
			dd = new HOL.DDRegion("drag", "", { cont: "track" });
			dd.onDrag = setZoomImgY;
			YUD.setStyle($("xlZoomScroll"), "visibility", "visible");
			YUD.setStyle($("scrollHandleCenter"), "top", dragCenter + "px");
			
			function zoomClick(e, sh){
				var t = YUE.getTarget(e);
				var trReg = YUD.getRegion("track");
				var drReg = YUD.getRegion("drag");
				var drag = $("drag");
				var a;
				var toVal;
				if(YUD.hasClass(t, "scrollArr")){
					if(t.id == "up"){
						toVal = YUD.getY(drag) - 10 < trReg.top ? trReg.top : YUD.getY(drag) - 10;
					}else{
						toVal = drReg.bottom + 10 > trReg.bottom ? trReg.bottom - sh : YUD.getY(drag) + 10;
					}
					a = new YAHOO.util.Motion(drag, {points:{ to:[YUD.getX(drag), toVal] }}, .25);
					a.onTween.subscribe(setZoomImgY);
					a.animate();
				} else if(t.id == "track"){
					var ey = YUE.getPageY(e);
					if(ey < drReg.top){
						toVal = ey < trReg.top ? trReg.top : ey;
					}else{
						toVal = ey - sh;
					}
					a = new YAHOO.util.Motion(drag, {points:{ to:[YUD.getX(drag), toVal] }}, .25);
					a.onTween.subscribe(setZoomImgY);
					a.animate();
				}else{
					return true;
				}
			}
			function zoomMD(e, sh){
				var t = YUE.getTarget(e);
				var sch = sh;
				t.scrTO = setTimeout(function(){
					t.scrINT = setInterval(function(){
						var trReg = YUD.getRegion("track");
						var drReg = YUD.getRegion("drag");
						var drag = $("drag");
						if(t.id == "up"){
							if(drReg.top - 5 > trReg.top){
								YUD.setY(drag, drReg.top - 5);
							}else{
								YUD.setY(drag, trReg.top);
								clearInterval(t.scrINT);
							}
						}else{
							if(drReg.bottom + 5 < trReg.bottom){
								YUD.setY(drag, drReg.top + 5);
							}else{
								YUD.setY(drag, trReg.bottom - sh);
								clearInterval(t.scrINT);
							}
						}
						setZoomImgY();
					}, 50);
				}, 250);
			}
			
			//YUE.on($("track"), "click", moveDrag);
			YUE.on($("xlZoomScroll"), "click", zoomClick, sh);
			YUD.getElementsByClassName("scrollArr", "img", "xlZoomScroll", function(el){
				YUE.on($(el), "mousedown", zoomMD, sh);
				YUE.on($(el), "mouseup", function(e){ 
					clearTimeout(el.scrTO); 
					clearInterval(el.scrINT); 
					});
				});
		}
		
		YUE.on($("xlZoomSwatches"),"click",swatchClickHandler);
		YUE.on($("xlZoomSwatches"),"mouseover",togSwatch);
		YUE.on($("xlZoomSwatches"),"mouseout",togSwatch);
	}
	
	this.switchView = function(e,v){
		function swap(i){
			if(!i){ return false; }
			i.src = i.src.substr(0, i.src.length-5) + v + ".jpg";
		}
		swap($("xlZoomImg"));
		swap($("productImage"));
				
		switch(v){
			case "f":
				YUD.setStyle($("zoomFront"), "display", "none");
				YUD.setStyle($("zoomBack"), "display", "inline");
				YUD.setStyle($("xlZoomFront"), "color", "#B4AF9C");
				YUD.setStyle($("xlZoomBack"), "color", "#646055");
				break;
			case "b":
				YUD.setStyle($("zoomFront"), "display", "inline");
				YUD.setStyle($("zoomBack"), "display", "none");
				YUD.setStyle($("xlZoomFront"), "color", "#646055");
				YUD.setStyle($("xlZoomBack"), "color", "#B4AF9C");
				break;
			case "i":
				YUD.setStyle($("zoomInside"), "display", "none");
				YUD.setStyle($("zoomOutside"), "display", "inline");
				YUD.setStyle($("xlZoomInside"), "color", "#B4AF9C");
				YUD.setStyle($("xlZoomOutside"), "color", "#646055");
				break;
			case "o":
				YUD.setStyle($("zoomInside"), "display", "inline");
				YUD.setStyle($("zoomOutside"), "display", "none");
				YUD.setStyle($("xlZoomInside"), "color", "#646055");
				YUD.setStyle($("xlZoomOutside"), "color", "#B4AF9C");
				break;
			default:
				break;
		}
		
		
	}
	
	function prepFB(){
		YUD.getElementsByClassName("switchFront", "img", null, function(el){
			YUE.on(el, "click", ProductPage.switchView,"f");
			//YUE.on(el, "click", function(e){ alert('clicked'); },"f");
		});
		YUD.getElementsByClassName("switchBack", "img", null, function(el){
			YUE.on(el, "click", ProductPage.switchView,"b");
		});
	}
	
	function prepOI(){
		YUD.getElementsByClassName("switchInside", "img", null, function(el){
			YUE.on(el, "click", ProductPage.switchView,"i");
		});
		YUD.getElementsByClassName("switchOutside", "img", null, function(el){
			YUE.on(el, "click", ProductPage.switchView,"o");
		});
	}
	
	this.init = function(){
		var sunrisePage = YUD.hasClass(document.body, "sunrise");
		var btnSuffix = sunrisePage ? "c.gif" : "a.jpg";
			
		YUE.on($("swatches"),"click",swatchClickHandler);
		YUE.on($("swatches"),"mouseover",togSwatch);
		YUE.on($("swatches"),"mouseout",togSwatch);
		
		if($("size") && $("size").tagName == "SELECT"){
			YUE.on($("size"),"change",getVBImg);
		}
		
		var newString = new String(colorArray[0].skus[0].sku)
		var skuDept = parseInt(newString.substr(0,2))
		if((skuDept == '63') || (skuDept == '64')){
			$("sizeChartImg").style.display = "none";
		}
		
		YUE.on($("prodUtils"), "mouseover", utilIconMouseOnOff);
		YUE.on($("prodUtils"), "mouseout", utilIconMouseOnOff);
		YUE.on($("prodUtils"), "click", utilIconClick);
		YUD.getElementsByClassName("closeProdUtil", "img", null, function(el){
			YUE.on(el, "click", function(e){
				var t = YUE.getTarget(e);
				clearTimeout(t.parentNode.closeTO);
				closeProdUtil(t.parentNode);
			});
		});
		
		getVBImg();
		
		setColor(initColor);
		
		if($("sizelist")){
			YUE.on($("sizelist"), "change", function(e){
				setColor($("sizelist").options[$("sizelist").selectedIndex].value);
			});
		}
		
		if($("xlZoomBtn")){
			var xlz = $("xlZoomBtn");
			YUE.on($("productImage"), "click", openXLZoom);
			YUE.on(xlz, "click", openXLZoom);
			YUE.on($("prodImgCntnr"), "mouseover", function() {
				YUD.setStyle(xlz, "visibility", "visible");
			});
			YUE.on($("prodImgCntnr"), "mouseout", function() {
				YUD.setStyle(xlz, "visibility", "hidden");
			});
			YUE.on($("prodImgCntnr"), "mousemove", function(e, el){
				var imgReg = YUD.getRegion(el);
				YUD.setX(xlz, YUE.getXY(e)[0] - 5);
				YUD.setY(xlz, YUE.getXY(e)[1] - 25);
			}, $("prodImgCntnr"));
		}
		
		switch(view){
			case "2":
				prepFB();
				break;
			case "3":
				prepOI();
				break;
			default:
				break;
		}
		
		if($("crossProds")){
			var xProds = YUD.getElementsByClassName("crossProdCntnr", "div", $("crossProds"));
			for(var i = 0; i < xProds.length; i++){
				YUE.on(xProds[i], 'mouseover', function(e,el){ HTB.toggle.visibility(el); },YUD.getElementsByClassName("crossProdInfo", "p", xProds[i])[0]);
				YUE.on(xProds[i], 'mouseout', function(e,el){ HTB.toggle.visibility(el); },YUD.getElementsByClassName("crossProdInfo", "p", xProds[i])[0]);
				
			}
			//YUE.on($("crossProds"), "mouseover", crossProdHandler);
			//YUE.on($("crossProds"), "mouseout", crossProdHandler);
		}
		YUE.on($("AddToBag"), "click", setBagOn);
		
		YUE.on($("eafSend"), "click", eafSend);
		YUE.on($("wlSubmit"), "click", wlSubmit);
	}
	
	if(($('nav_link_12634') || $('nav_link_12635')) && (YUD.hasClass($('nav_link_12634'), 'highlight') || YUD.hasClass($('nav_link_12634'), 'highlight'))){
		if(HTB.readCookie('hol-country') != 'US' && HTB.readCookie('hol-country') != 'CA'){
			window.document.location = '/hol/homepage.html';
		}
	}
	
	YUE.on(window, 'load' , this.init);
}