Venda.namespace("ProductDetail");Venda.ProductDetail.jq=jQuery;var jqzoom=!1;Venda.ProductDetail.onhandvalue="";Venda.ProductDetail.etayear="";Venda.ProductDetail.etamonth="";Venda.ProductDetail.etaday="";Venda.ProductDetail.prodsku="";Venda.ProductDetail.releaseyear="";Venda.ProductDetail.releasemonth="";Venda.ProductDetail.releaseday="";Venda.ProductDetail.releaseDate="";Venda.ProductDetail.etaDate="";Venda.ProductDetail.allImages=[];Venda.ProductDetail.ImageSwatch=[];
Venda.ProductDetail.multiAddImage=[];Venda.ProductDetail.isOpen=!1;Venda.ProductDetail.configObjArea={objDropdown:null,objDefaultImage:null,objProduct:null,objMediumArea:null,objLinkArea:null,objAlternateViewArea:null};Venda.ProductDetail.configDefault={productName:"",mediumAltText:"",mediumTitleText:"",viewLargeTitle:"",viewLargeText:"",largeNotAvailText:"",largeNotAvailAltText:"",loadingImage:"",noImage:""};
Venda.ProductDetail.configImageware={enableImageware:"",zoomableText:"",zoomableImagelink:"",zoomableTextlink:""};Venda.ProductDetail.configAlternateView={alternateViewPagedStyle:"",alternateViewBehavior:"",alternateViewAltText:"",alternateViewTitleText:"",alternateViewHeaderText:""};Venda.ProductDetail.configPopupPanel={popupHeader:"",loadingHeader:"",loadingPanel:"",closePanel:"",closePanelTitle:"",closeTextLink:""};
Venda.ProductDetail.configJZoomImage={enableJZoomImage:null,jqClassname:"",jqTitle:"",jsetting:""};Venda.ProductDetail.stockInstruction={outOfStockMessage:"",emwbisLink:"",etaDateMessage:"",releaseMessage:"",stockIndicatorID:""};Venda.ProductDetail.init=function(a,b){for(var c in b)this[a][c]=b[c]};
Venda.ProductDetail.activeJzoom=function(){var a=Venda.ProductDetail.configJZoomImage.jqClassname,b=Venda.ProductDetail.configJZoomImage.jsetting;Venda.ProductDetail.configJZoomImage.enableJZoomImage&&(jQuery(a).attr({title:Venda.ProductDetail.configJZoomImage.jqTitle}),jQuery(a).jqzoom(b))};Venda.ProductDetail.removeZoom=function(){jQuery("div.jqZoomPup").remove();jQuery(".jqZoomWindow").remove()};Venda.ProductDetail.loadImage=function(a,b){this.allImages[a]=b};
Venda.ProductDetail.checkAttr1Filter=function(a){var a=a.toLowerCase(),b=["color","colors","colour","colours"],c=!1,d;for(d in b)typeof b[d]!="function"&&a.match(b[d])!=null&&(c=!0);return c};Venda.ProductDetail.changeSet=function(a){this.allImages[a]&&(this.changeMainImage({attValue:a}),this.changeViewLargeLink({attValue:a,no:0}),this.changeAlternateViewSet({attValue:a,no:0}),this.changeDropdown(a),typeof sliderRender=="function"&&sliderRender())};
Venda.ProductDetail.changeSetForGrid=function(a){this.allImages[a]&&(this.changeMainImage({attValue:a}),this.changeViewLargeLink({attValue:a,no:0}),this.changeAlternateViewSet({attValue:a,no:0}))};
Venda.ProductDetail.showMainImage={imgObj:null,doIt:function(){setTimeout("Venda.ProductDetail.showMainImage.hideLoading()",1500)},hideLoading:function(){if(document.getElementById("loadingMain"))document.getElementById("loadingMain").style.display="none";Venda.ProductDetail.showMainImage.imgObj.style.display="block"},setImg:function(a){this.imgObj=a}};
Venda.ProductDetail.getImageTag=function(a){var b="",c="";a.isAltImage&&a.imgChange&&(c=this.configAlternateView.alternateViewBehavior=="onmouseover"?' onclick="return false;">':">",b=a.countData==0?'<div class="isFirst"><a href="'+a.imgChange+'" '+this.configAlternateView.alternateViewBehavior+"=\"Venda.ProductDetail.changeMainImage({attValue: '"+a.attValue+"', no: "+a.currentImage+"}); Venda.ProductDetail.changeViewLargeLink({attValue: '"+a.attValue+"', no: "+a.currentImage+"}); Venda.ProductDetail.highlightAltView('#productdetail-altview',this); return false;\" title=\""+
a.imgTitle+'"'+c+'<img src="'+a.imgSource+'" alt="'+a.imgAlt+'"></a></div>':a.isLastImage==""?'<div class="isLast"><a href="'+a.imgChange+'" '+this.configAlternateView.alternateViewBehavior+"=\"Venda.ProductDetail.changeMainImage({attValue: '"+a.attValue+"', no: "+a.currentImage+"}); Venda.ProductDetail.changeViewLargeLink({attValue: '"+a.attValue+"', no: "+a.currentImage+"}); Venda.ProductDetail.highlightAltView('#productdetail-altview',this); return false;\" title=\""+a.imgTitle+'"'+c+'<img src="'+
a.imgSource+'" alt="'+a.imgAlt+'"></a></div>':a.countData%2==0?'<div class="isOdd"><a href="'+a.imgChange+'" '+this.configAlternateView.alternateViewBehavior+"=\"Venda.ProductDetail.changeMainImage({attValue: '"+a.attValue+"', no: "+a.currentImage+"}); Venda.ProductDetail.changeViewLargeLink({attValue: '"+a.attValue+"', no: "+a.currentImage+"}); Venda.ProductDetail.highlightAltView('#productdetail-altview',this); return false;\" title=\""+a.imgTitle+'"'+c+'<img src="'+a.imgSource+'" alt="'+a.imgAlt+
'"></a></div>':'<div class="isEven"><a href="'+a.imgChange+'" '+this.configAlternateView.alternateViewBehavior+"=\"Venda.ProductDetail.changeMainImage({attValue: '"+a.attValue+"', no: "+a.currentImage+"}); Venda.ProductDetail.changeViewLargeLink({attValue: '"+a.attValue+"', no: "+a.currentImage+"}); Venda.ProductDetail.highlightAltView('#productdetail-altview',this); return false;\" title=\""+a.imgTitle+'"'+c+'<img src="'+a.imgSource+'" alt="'+a.imgAlt+'"></a></div>');if(a.isMainImage){if(a.imgSource==
""&&a.noImage!="")a.imgSource=a.noImage;this.configImageware.enableImageware!=""?b=this.allImages[a.attValue].clicked[a.currentImage]==!0?this.configImageware.zoomableImagelink+'<img src="'+a.imgSource+'" alt="'+a.imgAlt+'"></a>':this.configImageware.zoomableImagelink+this.configDefault.loadingImage+'<img src="'+a.imgSource+'" alt="'+a.imgAlt+'" style="display:none" onload="Venda.ProductDetail.showMainImage.setImg(this); Venda.ProductDetail.showMainImage.doIt();"></a>':a.imgPopup!=""?(b=this.allImages[a.attValue].clicked[a.currentImage]==
!0?'<a href="'+a.imgPopup+'" onclick="Venda.ProductDetail.removeZoom(); Venda.ProductDetail.doPopup(\''+a.attValue+"',this.href, "+a.currentImage+'); return false;" title="'+a.imgTitle+'" class="zoomlarge"><img src="'+a.imgSource+'" alt="'+a.imgAlt+'"></a>':'<a href="'+a.imgPopup+'" onclick="Venda.ProductDetail.removeZoom(); Venda.ProductDetail.doPopup(\''+a.attValue+"',this.href, "+a.currentImage+'); return false;" title="'+a.imgTitle+'" class="zoomlarge"><img src="'+a.imgSource+'" alt="'+a.imgAlt+
'" onload="Venda.ProductDetail.showMainImage.setImg(this); Venda.ProductDetail.showMainImage.doIt();"></a>',jqzoom=!0):b=this.allImages[a.attValue].clicked[a.currentImage]==!0?'<img src="'+a.imgSource+'" alt="'+this.configDefault.largeNotAvailAltText+'">':'<img src="'+a.imgSource+'" alt="'+this.configDefault.largeNotAvailAltText+'"  onload="Venda.ProductDetail.showMainImage.setImg(this); Venda.ProductDetail.showMainImage.doIt();">'}return b};
Venda.ProductDetail.changeMainImage=function(a){var b=a.attValue,c=a.no|0;this.configObjArea.objMediumArea.innerHTML=this.getImageTag({noImage:this.configDefault.noImage.medium,imgSource:this.allImages[b].setmalt[c],imgPopup:this.allImages[b].setlalt[c],attValue:b,imgAlt:this.configDefault.mediumAltText,imgTitle:this.configDefault.mediumTitleText,currentImage:c,isMainImage:!0});jqzoom==!0&&Venda.ProductDetail.activeJzoom();this.allImages[b].clicked[a.no]=!0;this.configImageware.enableImageware!=""&&
YAHOO.util.Event.addListener(["zoom_img2"],"click",Venda.Widget.Lightbox.showImageware)};
Venda.ProductDetail.changeViewLargeLink=function(a){var b="",b=a.attValue,c=a.no||0,a=this.allImages[b].setlalt[a.no],b=this.configImageware.enableImageware!=""?this.configImageware.zoomableTextlink+this.configImageware.zoomableText+"</a>":a!=""?'<a href="'+a+'" onclick="Venda.ProductDetail.doPopup(\''+b+"',this.href, "+c+'); return false;" title="'+this.configDefault.viewLargeTitle+'">'+this.configDefault.viewLargeText+"</a>":"&nbsp;";this.configObjArea.objLinkArea.innerHTML=b;this.configImageware.enableImageware!=
""&&YAHOO.util.Event.addListener(["zoom_link2"],"click",Venda.Widget.Lightbox.showImageware)};
Venda.ProductDetail.changeAlternateViewSet=function(a){for(var a=a.attValue,b="",c=0,d=a?this.configDefault.productName+" - "+a+" - "+this.configAlternateView.alternateViewAltText:this.configDefault.productName+" - "+this.configAlternateView.alternateViewAltText,e=0;e<this.allImages[a].setmalt.length;e++)this.allImages[a].setxsalt[e]!=""&&this.allImages[a].setmalt[e]!=""&&(b+=this.getImageTag({currentImage:e,imgSource:this.allImages[a].setxsalt[e],imgChange:this.allImages[a].setmalt[e],isLastImage:this.allImages[a].setxsalt[e+
1],attValue:a,imgAlt:d+(c+1),imgTitle:d+(c+1),countData:c,isAltImage:!0}),c++);c!=0&&(b='<p class="altviewHeader">'+this.configAlternateView.alternateViewHeaderText+"</p>"+b);if(c==1)this.configObjArea.objAlternateViewArea.className="isOne";this.configObjArea.objAlternateViewArea.innerHTML=b};Venda.ProductDetail.highlightAltView=function(a,b){Venda.ProductDetail.jq(a).find("a").removeClass("selected");Venda.ProductDetail.jq(b).addClass("selected")};
Venda.ProductDetail.changeDropdown=function(a){for(var b=0;b<this.configObjArea.objDropdown.options.length;b++)if(this.configObjArea.objDropdown.options[b].value==a)this.configObjArea.objDropdown.selectedIndex=b;this.configObjArea.objProduct.changeAttributes(this.configObjArea.objDropdown)};
Venda.ProductDetail.createPopupPage=function(a,b){YAHOO.util.Event.addListener(document,"keydown",Venda.ProductDetail.handleKeyPress);var c=0,d="",e=a?this.configDefault.productName+" - "+a+" - "+this.configAlternateView.alternateViewAltText:this.configDefault.productName+" - "+this.configAlternateView.alternateViewAltText;if(this.configAlternateView.alternateViewPagedStyle!="")for(var f=0;f<this.allImages[a].setxsalt.length;f++)this.allImages[a].setxsalt[f]!=""&&this.allImages[a].setlalt[f]!=""&&
(this.configAlternateView.alternateViewPagedStyle=="image"?(d=f==b?d+'<a href="'+this.allImages[a].setlalt[f]+'" '+this.configAlternateView.alternateViewBehavior+'="Venda.ProductDetail.changePopup(this); Venda.ProductDetail.highlightAltView(\'#alternateViewList\',this); return false;" class="selected" title="'+e+(f+1)+'"':d+'<a href="'+this.allImages[a].setlalt[f]+'" '+this.configAlternateView.alternateViewBehavior+'="Venda.ProductDetail.changePopup(this); Venda.ProductDetail.highlightAltView(\'#alternateViewList\',this); return false;" title="'+
e+(f+1)+'"',d=this.configAlternateView.alternateViewBehavior=="onmouseover"?d+' onclick="return false;"><img src="'+this.allImages[a].setxsalt[f]+'" alt="'+e+(f+1)+'"></a>':d+'><img src="'+this.allImages[a].setxsalt[f]+'" alt="'+e+(f+1)+'"></a>'):(d=f==b?d+'<a href="'+this.allImages[a].setlalt[f]+'" '+this.configAlternateView.alternateViewBehavior+'="Venda.ProductDetail.changePopup(this); Venda.ProductDetail.highlightAltView(\'#alternateViewList\',this); return false;" class="selected" title="'+e+
(f+1)+'"':d+'<a href="'+this.allImages[a].setlalt[f]+'" '+this.configAlternateView.alternateViewBehavior+'="Venda.ProductDetail.changePopup(this); Venda.ProductDetail.highlightAltView(\'#alternateViewList\',this); return false;" title="'+e+(f+1)+'"',d=this.configAlternateView.alternateViewBehavior=="onmouseover"?d+' onclick="return false;"><span>'+(f+1)+"</span></a>":d+"><span>"+(f+1)+"</span></a>"),c++);c!=0&&c!=1&&(d='<div id="alternateViewList"><p class="altviewHeader">'+this.configAlternateView.alternateViewHeaderText+
"</p>"+d+"</div>");c==1&&(d='<div id="alternateViewList" class="isOne"><p class="altviewHeader">'+this.configAlternateView.alternateViewHeaderText+"</p>"+d+"</div>");return d};
Venda.ProductDetail.doPopup=function(a,b,c){a=this.createPopupPage(a,c);Venda.ProductDetail.isOpen=!0;b='<div id="mainImage"><a onclick="Venda.ProductDetail.enlargePanel.hide(); return false;" href="#" title="'+this.configPopupPanel.closePanelTitle+'"><img src="'+b+'" id="enlargedpopup" name="enlargedpopup" onload="Venda.ProductDetail.setWidthPanel(Venda.ProductDetail.enlargePanel, this); Venda.ProductDetail.loadingPanel.hide(); Venda.ProductDetail.enlargePanel.show();"></a></div>';c='<div id="closeWindow"><a href="#" onclick="Venda.ProductDetail.enlargePanel.hide(); return false;">'+
this.configPopupPanel.closeTextLink+"</a></div>";Venda.ProductDetail.loadingPanel.setHeader('<div class="tl"></div><span>'+Venda.ProductDetail.configPopupPanel.loadingHeader+'</span><div class="tr"></div>');Venda.ProductDetail.loadingPanel.setBody('<div class="loading-img"></div>');Venda.ProductDetail.loadingPanel.render(document.body);Venda.ProductDetail.loadingPanel.show();Venda.ProductDetail.enlargePanel.setHeader('<div class="tl"></div><span>'+Venda.ProductDetail.configPopupPanel.popupHeader+
'</span><div class="tr"></div>');Venda.ProductDetail.enlargePanel.setBody('<div class="popupContents">'+b+a+c+"</div>");Venda.ProductDetail.enlargePanel.render(document.body)};Venda.ProductDetail.handleKeyPress=function(a){if(Venda.ProductDetail.isOpen&&a.keyCode===27)Venda.ProductDetail.isOpen=!1,YAHOO.util.Event.preventDefault(a),Venda.ProductDetail.enlargePanel.hide()};Venda.ProductDetail.changePopup=function(a){Venda.ProductDetail.jq("#enlargedpopup").attr({src:a.href})};
Venda.ProductDetail.setWidthPanel=function(a,b){document.getElementById("tag-invtname").style.display="inline";var c=b.width>document.getElementById("tag-invtname").offsetWidth+100?b.width+20:document.getElementById("tag-invtname").offsetWidth+130;a.cfg.setProperty("width",c+"px");document.getElementById("tag-invtname").style.display="none"};var xPosition=(document.documentElement.clientWidth-550)/2;
Venda.ProductDetail.loadingPanel=new YAHOO.widget.Panel("loading_panel",{width:"240px",fixedcenter:!0,close:!0,draggable:!1,zindex:3,modal:!0,visible:!1});Venda.ProductDetail.enlargePanel=new YAHOO.widget.Panel("enlarge_panel",{fade:0.24,fixedcenter:!1,close:!0,draggable:!0,zindex:4,modal:!0,visible:!1,x:xPosition,y:10});Venda.ProductDetail.initTabHeight=function(a){for(var b=a.length,c=0;c<b;c++)Venda.Platform.EqualHeight.set(a[c])};
Venda.ProductDetail.checkInStock=function(){var a=this.etamonth+"/"+this.etaday+"/"+this.etayear,b=this.releasemonth+"/"+this.releaseday+"/"+this.releaseyear;jQuery("#"+this.stockInstruction.stockIndicatorID).hide();jQuery("#qtybox").hide();jQuery("#addproductbox").hide();jQuery("#buynowbox").hide();jQuery("#preorderbox").hide();if(this.onhandvalue=="default")this.onhandvalue=defaultOnhand;Number(this.onhandvalue)<=0?(jQuery("#"+this.stockInstruction.stockIndicatorID).html('<p class="nostock">'+this.stockInstruction.outOfStockMessage+
"</p>"),a.match("//")==null&&(this.checkDate(a)||jQuery("#"+this.stockInstruction.stockIndicatorID).append('<p class="eta">'+this.stockInstruction.etaDateMessage+a+"</p>")),jQuery(this.stockInstruction.emwbisLink).show(),jQuery("#"+this.stockInstruction.stockIndicatorID).show()):(jQuery("#addproductbox input").attr("id","addproduct"),jQuery("#preorderbox input").attr("id",""),jQuery("#qtybox").show(),jQuery("#addproductbox").show(),jQuery("#buynowbox").show(),jQuery("#preorderbox").hide(),jQuery(this.stockInstruction.emwbisLink).hide(),
jQuery("#"+this.stockInstruction.stockIndicatorID).html(""));if(Number(this.onhandvalue)>0&&b.match("//")==null&&(this.checkDate(b)||(jQuery("#preorderbox input").attr("id","addproduct"),jQuery("#addproductbox input").attr("id",""),jQuery("#qtybox").show(),jQuery("#addproductbox").hide(),jQuery("#buynowbox").hide(),jQuery("#preorderbox").show(),jQuery("#"+this.stockInstruction.stockIndicatorID).html('<p class="release">'+this.stockInstruction.releaseDateMessage+b+"</p>"),jQuery("#"+this.stockInstruction.stockIndicatorID).show()),
Venda.Widget.MinicartPopup.windowsettings.noreload=="1"))YAHOO.util.Event.onDOMReady(Venda.Widget.MinicartPopup.gatherAdds)};Venda.ProductDetail.checkDate=function(a){return new Date>new Date(a)};Venda.ProductDetail.ListAttributes=[];Venda.ProductDetail.attributesUUID="";Venda.ProductDetail.availList=[];
Venda.ProductDetail.createList=function(a){jQuery("#"+a+"_"+Venda.ProductDetail.attributesUUID+" option:not(option:first)");var b=[];jQuery("#"+a+"_"+Venda.ProductDetail.attributesUUID+" option:not(option:first)").each(function(a){b[a]=jQuery(this).text()});Venda.ProductDetail.ListAttributes[a]=b};
Venda.ProductDetail.loadSwatch=function(a,b,c,d){var e=[],f="",h="";Venda.ProductDetail.createList(a);for(var e=Venda.ProductDetail.ListAttributes[a],g=0;g<e.length;g++)attrClass=e[g].split(" ").join(""),c=="img"?h=Venda.ProductDetail.ImageSwatch[e[g]]==""?e[g]:'<img src="'+Venda.ProductDetail.ImageSwatch[e[g]]+'" alt="'+e[g]+'" >':c=="text"&&(h='<span class="swatch">'+e[g]+"</span>"),doFunc=d=="1"?"Venda.ProductDetail.changeAttrSet('"+a+"','"+e[g]+"','"+attrClass+"');":"Venda.ProductDetail.changeSelect('"+
a+"','"+e[g]+"','"+attrClass+"');",f=f+'<a href="#" class="'+a+attrClass+'" onClick="'+doFunc+' return false;" title="'+e[g]+'">'+h+"</a>",firstOption=a+e[0].split(" ").join("");document.getElementById(b).innerHTML=f;jQuery("."+firstOption).trigger("click")};
Venda.ProductDetail.changeSelect=function(a,b,c){var d=jQuery("#"+a+"_"+Venda.ProductDetail.attributesUUID);d.val(b);d.trigger("change");var d=[],e="";jQuery("#productdetail-"+a+" a").each(function(){jQuery(this).removeClass("selected")});jQuery("."+a+c).addClass("selected");switch(a){case "att1":a="att2";e="att1";break;case "att2":a="att1",e="att2"}var c=0,f;for(f in product.attributeValues)product.attributeValues[f].values[e]==b&&(d[c]=product.attributeValues[f].values[a].split(" ").join(""),c++);
jQuery("#productdetail-"+a+" a").each(function(){jQuery(this).addClass("hide")});for(b=0;b<d.length;b++)jQuery("."+a+d[b]).removeClass("hide")};Venda.ProductDetail.doMultiAddImage=function(){jQuery(".attributeImage img").each(function(){multiAddImageClass=jQuery(this).attr("class");jQuery(this).attr("src",Venda.ProductDetail.multiAddImage[multiAddImageClass])})};
Venda.ProductDetail.changeAttrSet=function(a,b,c){Venda.ProductDetail.changeSetForGrid(b);jQuery("#productdetail-"+a+" a").each(function(){jQuery(this).removeClass("selected")});jQuery("."+a+c).addClass("selected");jQuery(".multiList .prodMulti .qty").val("0");jQuery(".multiList div.prodMulti").each(function(){jQuery(this).addClass("hide")});a=b.split(" ").join("");jQuery(".multiList .prodMulti").each(function(){var a=jQuery(this).children("div:eq(0)").attr("class").split(" ").join("");jQuery(this).children("div:eq(0)").attr("class",
a)});jQuery("."+a).parents().removeClass("hide")};
Venda.ProductDetail.checkAdd=function(a,b){var c=[],d="",e=jQuery("select[name=att1] option:selected").text()+jQuery("select[name=att2] option:selected").text();getProduct(b).checkAvailable()||c.push(getProduct(b).checkAvailable());if(c.length!=0)return alert("Please choose a variant of the product(s) you are adding to the basket."),!1;else{for(var f in product.attributeValues)if(e==f)d=product.attributeValues[f].data.atrsku;jQuery("#tag-itemsAdded").remove();jQuery("body").append('<div id="tag-itemsAdded"></div>');
jQuery("#tag-itemsAdded").html(d).hide()}c=/(^-?[1-9](\d{1,2}(\,\d{3})*|\d*)|^0{1})$/;d=jQuery("#qty");if(d.val()=="0"||d.val()==""||c.test(d.val())==!1)return alert(jQuery("#tag-qtymsg").text()),!1};

