
var POPUPWIDTH=475;var POPUPHEIGHT=425;var popupDisplayTimer;var dimmerTimer;var contentTimer;var errorTimer;var product;var productDiv;var productId;var tempProductId;var movePosition=true;var alternateColors=new Array();var currentProduct=null;var selectedSku="";var selectedSkuValue="";var brands=false;loadImage("../../../../../images/enhancements/loading_image.gif",255,255);loadImage("../../../../../images/enhancements/b_addtocart_waiting.gif");function getCurrentColor(productId){var url="../../../../../results/fragments/productLookupXML.jsp@productId="+productId;new Ajax.Request(url,{method:"get",onSuccess:function(response){var xmlDOM=null;if(isIE()){xmlDOM=new ActiveXObject("Microsoft.XMLDOM");xmlDOM.loadXML(response.responseText);}else{var vParser=new DOMParser();xmlDOM=vParser.parseFromString(response.responseText,"text/xml");}
var product=xmlObject(xmlDOM,"product")[0];currentProduct=new Product(product);}});}
function addItemToCart(){addAttribute("addToCartImg","src","../../../../../images/enhancements/b_addtocart_waiting.gif");addAttribute("addToCartImg","alt","Please wait for product to be added to your cart");addAttribute("addToCartImg","class","");addAttribute("addToCartImg","className","");removeOnClickForAddToCart();var sku=selectedSkuValue;var quantity=$("quantity").value;var url="../../../../../global/fragments/addItemToCart.jsp@dcs_action=additemtocart&url_catalog_ref_id="+sku+"&url_product_id="+productId+"&url_quantity="+quantity;new Ajax.Request(url,{method:"get",onSuccess:function(response){window.location="../../../../../checkout/cart.jsp";},onFailure:function(){alert("Could not load shopping cart");}});}
function loadAddItemToCart(){if(xmlHTTP.readyState==4){if(xmlHTTP.status==200||xmlHTTP.status==0){closeQuickLookPopup();displayNewProduct(productId);}}}
function addItemToWishList(){prepAJAX();var sku=selectedSkuValue;var url="../../../../../catalog/fragments/addToGiftList.jsp@productId="+productId+"&skuId="+sku;xmlHTTP.onreadystatechange=loadAddItemToWishList;xmlHTTP.open("GET",url,true);xmlHTTP.send(null);}
function loadAddItemToWishList(){if(xmlHTTP.readyState==4){if(xmlHTTP.status==200||xmlHTTP.status==0){if(isIE()){xmlDOM.loadXML(xmlHTTP.responseText);}else{var vParser=new DOMParser();xmlDOM=vParser.parseFromString(xmlHTTP.responseText,"text/xml");}
if(xmlInfo(xmlDOM,"result",0)=="success"){window.location=xmlInfo(xmlDOM,"redirectURL",0);}}}}
function loadProduct(productId){var url="../../../../../results/fragments/productLookupXML.jsp@productId="+productId;prepAJAX();xmlHTTP.onreadystatechange=loadProductXML;xmlHTTP.open("GET",url,true);xmlHTTP.send(null);}
function loadProductXML(){if(xmlHTTP.readyState==4){if(xmlHTTP.status==200||xmlHTTP.status==0){product=null;if(isIE()){xmlDOM.loadXML(xmlHTTP.responseText);}else{var vParser=new DOMParser();xmlDOM=vParser.parseFromString(xmlHTTP.responseText,"text/xml");}
product=xmlObject(xmlDOM,"product")[0];loadDefaultPopup();populateQuickLook(product);}else{alert(xmlHTTP.status+": Problem retrieving XML data");}}}
function addOnClickForTab(){var value="changeQuickLookPopupTab('detailTab', 'tab_details', 'detailsInfo')";var obj=$("detailImg");if(isIE()){obj.attachEvent("onclick",changeTabForIE);}else{obj.setAttribute("onclick",value);}}
function addOnClickForAddToCart(){var addToCartObj=$("addToCartImg");var addToListObj=$("addToListImg");if(isIE()){addToCartObj.attachEvent("onclick",addItemToCart);addToListObj.attachEvent("onclick",addItemToWishList);}else{addToCartObj.setAttribute("onclick","addItemToCart()");addToListObj.setAttribute("onclick","addItemToWishList()");}
showSeeItemInCartLink();}
function addOnClickForClose(){var obj=$("closeImg");if(isIE()){obj.attachEvent("onclick",closeQuickLookPopup);}else{obj.setAttribute("onclick","closeQuickLookPopup()");}}
function addOnClickForColor(objName,tProductId,colorImage,iterator){colorImage="../../../../../../store"+colorImage;loadColorImage(colorImage);var obj=$(objName);if(isIE()){obj.attachEvent("onclick",function(){onClickColorChange(tProductId,iterator);});obj.attachEvent("onmouseover",function(){changeColorOver(objName,iterator);showMouseOverImage(colorImage,tProductId);hideSelectSizeError();});obj.attachEvent("onmouseout",function(){changeColorOut(objName);clearMouseOverImage();});}else{obj.setAttribute("onclick","onClickColorChange('"+tProductId+"',"+iterator+")");obj.setAttribute("onmouseover","changeColorOver('"+objName+"',"+iterator+"); showMouseOverImage('"+colorImage+"','"+tProductId+"'); hideSelectSizeError()");obj.setAttribute("onmouseout","changeColorOut('"+objName+"'); clearMouseOverImage();");}}
function addOnClickForSelectSizeCart(){var obj=$("addToCartImg");if(isIE()){obj.attachEvent("onclick",displaySelectSizeError);}else{obj.setAttribute("onclick","displaySelectSizeError()");}}
function displaySelectSizeError(){if(isIE()){$("errorSelectSizeCart").style.display="block";$("errorSelectSize").style.display="block";}else{Effect.Appear("errorSelectSizeCart",{duration:0.5});Effect.Appear("errorSelectSize",{duration:0.5});}
errorTimer=setTimeout(hideSelectSizeError,5000);}
function hideSelectSizeError(){clearTimeout(errorTimer);if(isIE()){$("errorSelectSizeCart").style.display="none";$("errorSelectSize").style.display="none";}else{Effect.Fade("errorSelectSizeCart",{duration:0.5});Effect.Fade("errorSelectSize",{duration:0.5});}}
function addOnMouseOverForSize(objName,tSkuId,tSize){var obj=$(objName);if(isIE()){obj.attachEvent("onmouseover",function(){changeSizeOver(objName);hideSelectSizeError();});obj.attachEvent("onmouseout",function(){changeSizeOut(objName);});obj.attachEvent("onclick",function(){updateSize(objName,tSkuId,tSize);});}else{obj.setAttribute("onmouseover","changeSizeOver('"+objName+"'); hideSelectSizeError();");obj.setAttribute("onmouseout","changeSizeOut('"+objName+"')");obj.setAttribute("onclick","updateSize('"+objName+"', '"+tSkuId+"', '"+tSize+"')");}}
function addOnMouseOverForUnavailable(objName,pSkuId,pSize){var obj=$(objName);if(isIE()){obj.attachEvent("onmouseover",displayUnavailableMessage);obj.attachEvent("onmouseout",hideUnavailableMessage);}else{obj.setAttribute("onmouseover","displayUnavailableMessage()");obj.setAttribute("onmouseout","hideUnavailableMessage()");}}
function displayUnavailableMessage(){$("errorSizeUnavailable").style.visibility="visible";}
function hideUnavailableMessage(){$("errorSizeUnavailable").style.visibility="hidden";}
function changeTabForIE(){changeQuickLookPopupTab("detailTab","tab_details","detailsInfo");}
function changeColorOver(objName,iterator){displayProductInfo(alternateColors[iterator]);$(objName).className="colorHover";clearTimeout(dimmerTimer);clearTimeout(contentTimer);$("sizeText").style.display="none";$("sizeDimmer").style.display="block";}
function displayProductInfo(productObj){setValue("title",productObj.name);setValue("colorDescription",productObj.colorDescription);setValue("style","Style: "+productObj.styleDescription);setValue("wasPrice",productObj.wasPrice);var nowPrice=productObj.wasPrice==""?productObj.nowPrice:"<span>"+productObj.nowPrice+"</span>";setValue("nowPrice",nowPrice);setValue("sizeDimmer","");setValue("salesText",productObj.salesText);$("sizeText").style.display="inline";for(var i=0;i<productObj.skus.length;i++){addElement("sizeDimmer","span","size_"+i);if(productObj.skuAvailable[i]=="true"){addAttribute("size_"+i,"class","sizeBox");addAttribute("size_"+i,"className","sizeBox");}else{addAttribute("size_"+i,"class","sizeBoxUnavailable");addAttribute("size_"+i,"className","sizeBoxUnavailable");}
addText("size_"+i,productObj.getSizeText(i));}}
function changeColorOut(objName){$(objName).className="";dimmerTimer=setTimeout("$('sizeDimmer').style.display='none'",125);contentTimer=setTimeout(function(){displayProductInfo(currentProduct);},125);}
function changeSizeOver(objName){if(objName!=selectedSku){$(objName).className="sizeBoxHover";}}
function changeSizeOut(objName){if(selectedSku!=objName){$(objName).className="sizeBox";}else{$(objName).className="sizeBoxSelected";}}
function imageLoaded(loadingImage,loadedImage){hideElement(loadingImage);displayElement(loadedImage);}
function removeOnClickForAddToCart(){var obj=$("addToCartImg");if(isIE()){obj.attachEvent("onclick",null);}else{obj.removeAttribute("onclick");}}
function updateSize(objName,tSkuId,tSize){if(isIE()){$("addToCartImg").detachEvent("onclick",displaySelectSizeError);}
var skus=$("sizeImages").getElementsByTagName("span");for(i=0;i<skus.length;i++){if(skus[i].className=="sizeBoxSelected"){skus[i].className="sizeBox";}}
selectedSku=objName;selectedSkuValue=tSkuId;$(objName).className="sizeBoxSelected";setValue("sizeHeader","Select Size ");addElement("sizeHeader","span","sizeText");addText("sizeText",tSize);addAttribute("addToCartImg","src","../../../../../images/enhancements/b_addtocart.gif");addAttribute("addToCartImg","class","addToCartImg");addAttribute("addToCartImg","className","addToCartImg");addAttribute("addToCartImg","alt","Add to Cart");addAttribute("addToListImg","src","../../../../../images/enhancements/b_addtowishlist_on.gif");addAttribute("addToListImg","class","addToCartImg");addAttribute("addToListImg","className","addToCartImg");addOnClickForAddToCart();}
function addQuantityOptions(highNum){for(var i=1;i<=highNum;i++){$("quantity").options.add(createOption(i,i));}}
function setProductImage(productImage){productImage="../../../../../../store"+productImage;var productImageInfo="<img id=\"loadingImg\" src=\"../../../../../images/enhancements/loading_image.gif\"/><img id=\"productImg\" onload=\"imageLoaded('loadingImg', 'productImg')\" src=\""+productImage+"\"/>";if(window.opera){productImageInfo="<img id=\"productImg\" src=\""+productImage+"\" style=\"display:block\"/>";}
setValue("image",productImageInfo);}
function loadDefaultPopup(){setValue("qlContent","");addElement("qlContent","div","errorSelectSizeCart");addElement("qlContent","div","errorSelectSize");if(isIE()){$("errorSelectSize").style.display="none";$("errorSelectSizeCart").style.display="none";}else{addAttribute("errorSelectSize","style","display:none; visibility:visible");addAttribute("errorSelectSizeCart","style","display:none; visibility:visible");}
addElement("qlContent","div","qlHeader");addElement("qlHeader","div","closeTab");addElement("closeTab","img","closeImg");addAttribute("closeImg","src","../../../../../images/enhancements/b_close.gif");addOnClickForClose();addElement("qlHeader","div","qlPopupHeader");addElement("qlContent","div","imagePrice");addAttribute("imagePrice","class","imagePrice");addAttribute("imagePrice","className","imagePrice");addElement("imagePrice","div","salesText");addElement("imagePrice","div","errorSizeUnavailable");setValue("errorSizeUnavailable","Sorry.  Size Unavailable.");addElement("imagePrice","div","image");addElement("imagePrice","div","imageOver");addElement("imagePrice","div","title");addElement("imagePrice","div","colorDescription");addElement("imagePrice","div","style");addElement("imagePrice","div","wasPrice");addElement("imagePrice","div","nowPrice");addElement("imagePrice","div","moreDetails");addElement("qlContent","div","unavailableInfo");addElement("qlContent","div","displayInfo");addElement("displayInfo","div","sizeColorTab");addElement("sizeColorTab","img","sizeColorImg");addAttribute("sizeColorImg","src","../../../../../images/enhancements/tab_sizecolor.gif");addElement("displayInfo","div","detailTab");addElement("detailTab","img","detailImg");addAttribute("detailImg","src","../../../../../images/enhancements/tab_details_grey.gif");addAttribute("detailImg","style","cursor:pointer");addOnClickForTab();addElement("displayInfo","div","detailBox");addElement("detailBox","div","sizeColorInfo");addElement("sizeColorInfo","h2","colorHeader");setValue("colorHeader","Select Color");addElement("sizeColorInfo","div","colorImages");addElement("sizeColorInfo","h2","sizeHeader");setValue("sizeHeader","Select Size");addElement("sizeHeader","span","sizeText");addElement("sizeColorInfo","div","sizeDimmer");$("sizeDimmer").style.display="none";addElement("sizeDimmer","div","dimmerText");setValue("dimmerText","Select color to view<br/>size availability");addElement("sizeColorInfo","div","sizeImages");addElement("sizeColorInfo","h2","quantityHeader");setValue("quantityHeader","Select Quantity");addElement("sizeColorInfo","span","qtyText");setValue("qtyText","Qty._3A ");addElement("sizeColorInfo","select","quantity");addAttribute("quantity","name","quantity");addQuantityOptions(5);addElement("detailBox","div","detailsInfo");addElement("sizeColorInfo","div","addToCart");addAttribute("addToCart","class","addToCart");addAttribute("addToCart","className","addToCart");}
function populateQuickLook(product){$("sizeDimmer").style.display="none";setValue("qlPopupHeader","&nbsp;");setValue("title",xmlInfo(product,"name",0));setProductImage(xmlInfo(product,"image",0));clearMouseOverImage();setValue("colorDescription",xmlInfo(product,"colorDescription",0));setValue("style","Style: "+xmlInfo(product,"style",0)+" "+xmlInfo(product,"colorId",0));if(xmlInfo(product,"active",0)=="false"||xmlInfo(xmlObject(product,"price")[0],"sale",0)=="no-sale"){setValue("unavailableInfo","This product is unvailable");removeElement("qlContent","displayInfo");removeElement("imagePrice","wasPrice");removeElement("imagePrice","nowPrice");}else{try{removeElement("qlContent","unavailableInfo");}
catch(e){}
if(xmlInfo(xmlObject(product,"price")[0],"original",0)!="no-sale"){setValue("wasPrice",xmlInfo(xmlObject(product,"price")[0],"original",0));setValue("nowPrice","<span>"+xmlInfo(xmlObject(product,"price")[0],"sale",0));setValue("salesText","SALE!");}else{setValue("salesText","");setValue("wasPrice","");setValue("nowPrice",xmlInfo(xmlObject(product,"price")[0],"sale",0));}
var moreDetails="<a href=\"../../../../../catalog/product.jsp@productId="+xmlInfo(product,"productId",0)+"\" id=\"moreDetailsLink\">more details</a>";setValue("moreDetails",moreDetails);var detailsInfo="";for(i=0;i<xmlObject(xmlObject(product,"otherdetails")[0],"detail").length;i++){detailsInfo+="<div>"+xmlInfo(xmlObject(product,"otherdetails")[0],"detail",i)+"</div>";}
detailsInfo="<div>"+xmlInfo(product,"description",0)+"</div>"+detailsInfo;detailsInfo+="<div id=\"detailsMoreDetails\">"+moreDetails+"</div>";setValue("detailsInfo",detailsInfo);setValue("addToCart","");addElement("addToCart","img","addToCartImg");addAttribute("addToCartImg","src","../../../../../images/enhancements/b_addtocart_off.gif");addAttribute("addToCartImg","alt","You must select a size to add to cart");addOnClickForSelectSizeCart();addElement("addToCart","img","addToListImg");addAttribute("addToListImg","src","../../../../../images/enhancements/b_addtowishlist_off.gif");addAttribute("addToListImg","alt","Add to Wish List");setValue("colorImages","");var alternateColorsSet=false;if(currentProduct==null||currentProduct.name!=xmlInfo(product,"name",0)){alternateColors=new Array();}else{alternateColorsSet=true;}
for(i=0;i<xmlObject(xmlObject(product,"colors")[0],"color").length;i++){var colorImage=xmlAttribute(xmlObject(xmlObject(product,"colors")[0],"color")[i],"thumbnail");var colorProductId=xmlAttribute(xmlObject(xmlObject(product,"colors")[0],"color")[i],"productId");var colorId="thumb_"+colorProductId;var colorText=xmlInfo(xmlObject(product,"colors")[0],"color",i);var selected=xmlAttribute(xmlObject(xmlObject(product,"colors")[0],"color")[i],"selected");var iterator=i;if(alternateColorsSet==false){new AlternateProduct(colorProductId,iterator);}
addElement("colorImages","img",colorId);addAttribute(colorId,"src","../../../../../../store"+colorImage);addAttribute(colorId,"alt",colorText);if(selected=="true"){addAttribute(colorId,"class","thumbSelected");addAttribute(colorId,"className","thumbSelected");currentProduct=new Product(product);}else{addOnClickForColor(colorId,colorProductId,colorImage,iterator);}}
setValue("sizeText","");setValue("sizeImages","");if(xmlObject(xmlObject(product,"sizes")[0],"size").length==1){var sizeSku=xmlAttribute(xmlObject(xmlObject(product,"sizes")[0],"size")[0],"sku");var sizeText=xmlInfo(xmlObject(product,"sizes")[0],"size",0);var sizeName="size_"+sizeSku;addElement("sizeImages","span",sizeName);setValue(sizeName,sizeText);updateSize(sizeName,sizeSku,sizeText);}else{for(i=0;i<xmlObject(xmlObject(product,"sizes")[0],"size").length;i++){var sizeSku=xmlAttribute(xmlObject(xmlObject(product,"sizes")[0],"size")[i],"sku");var sizeAvailable=xmlAttribute(xmlObject(xmlObject(product,"sizes")[0],"size")[i],"available");var sizeText=xmlInfo(xmlObject(product,"sizes")[0],"size",i);var sizeName="size_"+sizeSku;addElement("sizeImages","span",sizeName);if(sizeAvailable=="false"){addAttribute(sizeName,"class","sizeBoxUnavailable");addAttribute(sizeName,"className","sizeBoxUnavailable");addOnMouseOverForUnavailable(sizeName,sizeSku,sizeText);}else{addAttribute(sizeName,"class","sizeBox");addAttribute(sizeName,"className","sizeBox");addOnMouseOverForSize(sizeName,sizeSku,sizeText);}
setValue(sizeName,sizeText);}}}}
function changeQuickLookPopupTab(tabDiv,tabImage,contentDiv){var otherDiv=tabDiv=="sizeColorTab"?"detailTab":"sizeColorTab";var otherImage=tabImage=="tab_sizecolor"?"tab_details":"tab_sizecolor";var otherContentDiv=contentDiv=="sizeColorInfo"?"detailsInfo":"sizeColorInfo";setValue(tabDiv,"<img src=\"../../../../../images/enhancements/"+tabImage+".gif\"/>");setValue(otherDiv,"<img src=\"../../../../../images/enhancements/"+otherImage+"_grey.gif\" style=\"cursor:pointer\" onclick=\"changeQuickLookPopupTab('"+otherDiv+"', '"+otherImage+"', '"+otherContentDiv+"');\"/>");displayElement(contentDiv);hideElement(otherContentDiv);}
function clearQuickLookTimer(){clearTimeout(popupDisplayTimer);}
function closeQuickLookPopup(){hideElement("quicklook");}
function displayQuickLook(tProductDiv,tProductId){if($("quicklook").getStyle("display")=="none"){resetSku();tempProductId=tProductId;productDiv=tProductDiv;productDiv.style.position="relative";prepAJAX();displayQuickLookButton();}}
function hideQuickLookButton(tProductId){tempProductId="";setTimeout("tryHideQuickLookButton('"+tProductId+"');",1);}
function tryHideQuickLookButton(tProductId){if(tProductId!=tempProductId){$("item"+tProductId+"quickLookButton").hide();}}
function displayQuickLookButton(){$("item"+tempProductId+"quickLookButton").show();}
function onClickColorChange(tProductId,iterator){omnitureRollover(tProductId);currentProduct=alternateColors[iterator];productId=tProductId;populateQuickLook(currentProduct.xml);}
function qlDisplayPopup(pProductId,showSizeWarning){productId=pProductId;omnitureRollover(productId);if(movePosition){setValue("qlContent","");changePosition();showLoadingScreen();}else{movePosition=true;}
loadProduct(productId);displayElement("quicklook");if(showSizeWarning=="true"){setTimeout("displaySelectSizeError()",500);setTimeout("addSeeItemInCartLink(productId);",500);}}
function addSeeItemInCartLink(pProductId){$j("#quantity").after(" <a id=\"seeItemInCartLink\" style=\"display: none;\" href=\"javascript:priceMaskPopUp('"+pProductId+"', 'quickLooks')\">See Price in Cart</a>");}
function showSeeItemInCartLink(){$j("#seeItemInCartLink").show();}
function resetSku(){selectedSku="";selectedSkuValue="";}
function showLoadingScreen(){addElement("qlContent","div","loadingScreen");addElement("loadingScreen","img","loadingImg");addAttribute("loadingImg","src","../../../../../images/enhancements/loading_image.gif");}
function changeLeft(){var rightMost=productDiv.offsetLeft;rightMost=rightMost+POPUPWIDTH>getViewportWidth()?productDiv.offsetLeft-POPUPWIDTH+57:rightMost;rightMost=rightMost<0?0:rightMost;$("quicklook").style.left=rightMost+"px";}
function changePosition(){changeLeft();changeTop();}
function changeTop(){var topMost=productDiv.offsetTop-100;var screenTop=document.viewport.getScrollOffsets().top;var screenHeight=getViewportHeight();topMost=(topMost+POPUPHEIGHT)>(screenTop+screenHeight)?(screenTop+screenHeight)-POPUPHEIGHT-25:topMost;topMost=topMost<screenTop?screenTop+25:topMost;$("quicklook").style.top=topMost+"px";}
function omnitureRollover(tProductId){var s=s_gi(scServerCode);s.linkTrackVars="events,products";s.linkTrackEvents="event9";s.events="event9";s.products=";"+tProductId;s.tl(this,"o","QuickLook");}