dojo.require("dojo.dnd.move");dojo.require("dijit.Dialog");var m1,replaceOrderItemId,initPopup=function(){m1=new dojo.dnd.Moveable("second_level_category_popup",{handle:"popupHeader"})};dojo.addOnLoad(initPopup);function showPopupButton(a){if(document.getElementById("popupButton_"+a)!=null&&document.getElementById("popupButton_"+a)!="undefined")document.getElementById("popupButton_"+a).style.visibility="visible"} function hidePopupButton(a){if(document.getElementById("popupButton_"+a)!=null&&document.getElementById("popupButton_"+a)!="undefined")document.getElementById("popupButton_"+a).style.visibility="hidden"} function showPopup(a,h,f,m,j,d,k,l,e,c){if(d==null||d!=null&&d.type!="keypress"||d!=null&&d.type=="keypress"&&d.keyCode==13){resetPopUp();if(e==null)e=new popupActionProperties;document.getElementById("loadingimage").style.display="";if(e.showAddToCart)if(document.getElementById("addToCartAjaxButton"))document.getElementById("addToCartAjaxButton").style.visibility="visible";else{if(document.getElementById("addToCartButton"))document.getElementById("addToCartButton").style.visibility="visible"}else if(document.getElementById("addToCartAjaxButton"))document.getElementById("addToCartAjaxButton").style.visibility= "hidden";else if(document.getElementById("addToCartButton"))document.getElementById("addToCartButton").style.visibility="hidden";if(e.showWishList)if(document.getElementById("addToWishListLinkAjax"))document.getElementById("addToWishListLinkAjax").style.display="block";else{if(document.getElementById("addToWishListLink"))document.getElementById("addToWishListLink").style.display="block"}else if(document.getElementById("addToWishListLinkAjax"))document.getElementById("addToWishListLinkAjax").style.display= "none";else if(document.getElementById("addToWishListLink"))document.getElementById("addToWishListLink").style.display="none";if(e.showProductCompare){if(document.getElementById("addToCompareLink"))document.getElementById("addToCompareLink").style.display="block"}else if(document.getElementById("addToCompareLink"))document.getElementById("addToCompareLink").style.display="none";if(e.showReplaceCartItem)if(document.getElementById("replaceCartItemAjax"))document.getElementById("replaceCartItemAjax").style.display= "block";else{if(document.getElementById("replaceCartItemNonAjax"))document.getElementById("replaceCartItemNonAjax").style.display="block"}else if(document.getElementById("replaceCartItemAjax"))document.getElementById("replaceCartItemAjax").style.display="none";else if(document.getElementById("replaceCartItemNonAjax"))document.getElementById("replaceCartItemNonAjax").style.display="none";if(!e.showAddToCart&&!e.showWishList){if(document.getElementById("productPopUpQty"))document.getElementById("productPopUpQty").disabled= true}else if(document.getElementById("productPopUpQty"))document.getElementById("productPopUpQty").disabled=false;if(c==null)document.getElementById("productPopUpQty").value=1;else document.getElementById("productPopUpQty").value=c;dijit.byId("second_level_category_popup").closeButtonNode.style.display="none";dijit.byId("second_level_category_popup").show();dojo.query(".dijitDialogUnderlayWrapper",document).forEach(function(b){b.style.display="none"});d={};d.storeId=f;d.langId=m;d.catalogId=j;d.productId= h;d.sellerName=a;dojo.xhrPost({url:getAbsoluteURL()+"GetCatalogEntryDetailsByID",handleAs:"json-comment-filtered",content:d,service:this,load:populatePopUp,error:function(){console.debug("CatalogEntryThumbnailDisplay.showPopup: Unexpected error occurred during an xhrPost request.")}})}} function populatePopUp(a,h){var f=a.catalogEntry.catalogEntryIdentifier.uniqueID,m=a.catalogEntry.catalogEntryIdentifier.field4,j=false;if(a.catalogEntry.catalogEntryTypeCode=="ProductBean")j=true;var d=false;if(a.catalogEntry.catalogEntryTypeCode=="BundleBean")d=true;var k=false;if(a.catalogEntry.catalogEntryTypeCode=="ItemBean")k=true;var l=false;if(a.catalogEntry.catalogEntryTypeCode=="PackageBean")l=true;document.getElementById("productName").innerHTML=a.catalogEntry.description[0].name;var e= dojo.byId("baseUrlImageDir").innerHTML;if(a.catalogEntry.description[0].thumbnail!=a.catalogEntry.objectPath)document.getElementById("productFullImage").src=a.catalogEntry.description[0].thumbnail;else document.getElementById("productFullImage").src=e+"images/NoImageIcon.jpg";if(a.catalogEntry.offerPrice)document.getElementById("productPrice").innerHTML=a.catalogEntry.offerPrice;document.getElementById("productLongDescription").innerHTML=a.catalogEntry.description[0].longDescription+"<br />";e=""; for(var c in a.catalogEntryAttributes.attributes)if(a.catalogEntryAttributes.attributes[c].usage=="Descriptive")e=e+a.catalogEntryAttributes.attributes[c].name+" : "+a.catalogEntryAttributes.attributes[c].value.value+"<br />";document.getElementById("productDescriptiveAttributes").innerHTML=e;document.getElementById("productSKUValue").innerHTML=a.catalogEntry.catalogEntryIdentifier.externalIdentifier.partNumber;document.getElementById("productMoreInfoLink").href=a.catalogEntryURL;for(c in a.catalogEntryPromotions)document.getElementById("productPromotions").innerHTML= a.catalogEntryPromotions[c]+"<br />";var b="";e="[";for(c in a.catalogEntryAttributes.attributes)if(a.catalogEntryAttributes.attributes[c].usage=="Defining")if(j)if(h.args.content.sellerName==""){b=b+'<label for="attrValue_'+c+'" class="nodisplay"></label><span>'+a.catalogEntryAttributes.attributes[c].name+"* : </span>";b=b+'<select name="attrValue" style="height:18px;" id="attrValue_'+c+'" onChange="JavaScript:categoryDisplayJS.setSelectedAttribute(\''+a.catalogEntryAttributes.attributes[c].name.replace("'", "\\'")+"',this.options[this.selectedIndex].value);\">";b=b+'<option value="">'+document.getElementById("selectText").innerHTML+"</option>";for(var i in a.catalogEntryAttributes.attributes[c].allowedValue)if(a.catalogEntryAttributes.attributes[c].name=="Seller Name"&&a.catalogEntryAttributes.attributes[c].allowedValue[i].value!=0||a.catalogEntryAttributes.attributes[c].name!="Seller Name"){var g=a.catalogEntryAttributes.attributes[c].allowedValue[i].value;if(g.indexOf("&amp;")>0)g=g.replace("&amp;", "");g=g.replace(/^[\s]+/,"").replace(/[\s]+$/,"").replace(/[\s]{2,}/," ");b=b+'<option value="'+g+'">'+a.catalogEntryAttributes.attributes[c].allowedValue[i].value+"</option>"}b+="</select><br />"}else if(a.catalogEntryAttributes.attributes[c].name!="Seller Name"){b=b+'<label for="attrValue_'+c+'" class="nodisplay"></label><span>'+a.catalogEntryAttributes.attributes[c].name+"* : </span>";b=b+'<select name="attrValue" style="height:18px;" id="attrValue_'+c+'" onChange="JavaScript:categoryDisplayJS.setSelectedAttribute(\''+ a.catalogEntryAttributes.attributes[c].name.replace("'","\\'")+"',this.options[this.selectedIndex].value);\">";b=b+'<option value="">'+document.getElementById("selectText").innerHTML+"</option>";for(i in a.catalogEntryAttributes.attributes[c].allowedValue){g=a.catalogEntryAttributes.attributes[c].allowedValue[i].value;if(g.indexOf("&amp;")>0)g=g.replace("&amp;","");g=g.replace(/^[\s]+/,"").replace(/[\s]+$/,"").replace(/[\s]{2,}/," ");b=b+'<option value="'+g+'">'+a.catalogEntryAttributes.attributes[c].allowedValue[i].value+ "</option>"}b+="</select><br />"}else{b=b+a.catalogEntryAttributes.attributes[c].name+" : "+h.args.content.sellerName+"<br />";categoryDisplayJS.setSelectedAttribute(a.catalogEntryAttributes.attributes[c].name,h.args.content.sellerName)}else b=b+a.catalogEntryAttributes.attributes[c].name+" : "+a.catalogEntryAttributes.attributes[c].value.value+"<br />";if(b!="")b+="<br />";document.getElementById("productAttributes").innerHTML=b;for(c in a.entitledItems){b=a.entitledItems[c].catentry_id;categoryDisplayJS.setItemSellerMap(b, a.entitledItems[c].seller_id);e=e+'{"catentry_id" : "'+b+'","Attributes" : {';for(i in a.entitledItems[c].Attributes){b=a.entitledItems[c].Attributes[i];if(b.indexOf("&amp;")>0)b=b.replace("&amp;","");b=b.replace(/^[\s]+/,"").replace(/[\s]+$/,"").replace(/[\s]{2,}/," ");e=e+'"'+b+'" : "'+i+'",'}b=e.lastIndexOf(",");e=e.substring(0,b);e+="}}";if(c<a.entitledItems.length-1)e+=","}e+="]";document.getElementById("entitledItem").innerHTML=e;if(d){if(document.getElementById("productPopUpQty"))document.getElementById("productPopUpQty").disabled= true;document.getElementById("productActions").style.display="none";document.getElementById("moreinfo").style.display="block"}else{document.getElementById("productActions").style.display="block";document.getElementById("moreinfo").style.display="none"}if(d)if(document.getElementById("addToCartAjaxButton"))document.getElementById("addToCartAjaxButton").style.visibility="hidden";else{if(document.getElementById("addToCartButton"))document.getElementById("addToCartButton").style.visibility="hidden"}else{if(document.getElementById("addToCartLinkAjax"))if(j){d= document.getElementById("addToCartLinkAjax");d.href="JavaScript:categoryDisplayJS.Add2ShopCartAjax('entitledItem',document.getElementById('productPopUpQty').value); hidePopup('second_level_category_popup');"}else{d=document.getElementById("addToCartLinkAjax");d.href="JavaScript:categoryDisplayJS.AddItem2ShopCartAjax('"+f+"',document.getElementById('productPopUpQty').value,'"+m+"'); hidePopup('second_level_category_popup');"}if(document.getElementById("addToCartLink"))if(j){d=document.getElementById("addToCartLink"); d.href="#";d.onclick=new Function("categoryDisplayJS.Add2ShopCart('entitledItem_"+f+"',document.getElementById('OrderItemAddForm_"+f+"'),document.getElementById('productPopUpQty').value); hidePopup('second_level_category_popup');return false;")}else{d=document.getElementById("addToCartLink");d.href="#";d.onclick=new Function("categoryDisplayJS.AddItem2ShopCart(document.getElementById('OrderItemAddForm_"+f+"'),document.getElementById('productPopUpQty').value); hidePopup('second_level_category_popup');return false;")}}if(document.getElementById("addToWishListLinkAjax"))if(k|| l)document.getElementById("addToWishListLinkAjax").href="JavaScript:categoryDisplayJS.AddItem2WishListAjax("+f+"); hidePopup('second_level_category_popup');";else document.getElementById("addToWishListLinkAjax").href="JavaScript:categoryDisplayJS.Add2WishListAjax('entitledItem_"+f+"'); hidePopup('second_level_category_popup');";else if(document.getElementById("addToWishListLink")){document.getElementById("addToWishListLink").href="#";if(k||l)document.getElementById("addToWishListLink").onclick=new Function("categoryDisplayJS.AddItem2WishList(document.getElementById('OrderItemAddForm_"+ f+"'));hidePopup('second_level_category_popup');return false;");else document.getElementById("addToWishListLink").onclick=new Function("categoryDisplayJS.Add2WishList('entitledItem_"+f+"',document.getElementById('OrderItemAddForm_"+f+"')); hidePopup('second_level_category_popup');return false;")}if(document.getElementById("addToCompareLink"))document.getElementById("addToCompareLink").href="JavaScript:categoryDisplayJS.Add2CompareAjax('"+f+"', '"+a.productCompareImagePath+"', '"+a.catalogEntryURL+ "','"+a.catalogEntry.description[0].name+"'); delayHidePopup();";if(document.getElementById("replaceCartItemAjax"))document.getElementById("replaceCartItemAjax").href="JavaScript:categoryDisplayJS.ReplaceItemAjax('entitledItem_"+f+"',document.getElementById('productPopUpQty').value); hidePopup('second_level_category_popup');";if(document.getElementById("replaceCartItemNonAjax")){document.getElementById("replaceCartItemNonAjax").href="#";document.getElementById("replaceCartItemNonAjax").onclick=new Function("categoryDisplayJS.ReplaceItemNonAjax('entitledItem_"+ f+"',document.getElementById('productPopUpQty').value,document.getElementById('ReplaceItemForm')); hidePopup('second_level_category_popup');return false;")}document.getElementById("loadingimage").style.display="none";document.getElementById("hidepopupall").value=0;gobackFocus()} function resetPopUp(){document.getElementById("hidepopupall").value=1;document.getElementById("productName").innerHTML="";document.getElementById("productPrice").innerHTML="";document.getElementById("productLongDescription").innerHTML="";document.getElementById("productDescriptiveAttributes").innerHTML="";document.getElementById("productSKUValue").innerHTML="";document.getElementById("productMoreInfoLink").href="#";document.getElementById("productPromotions").innerHTML="";if(document.getElementById("productPopUpQty")){document.getElementById("productPopUpQty").disabled= false;document.getElementById("productPopUpQty").value="1"}document.getElementById("productAttributes").innerHTML="";if(document.getElementById("addToCartLinkAjax"))document.getElementById("addToCartLinkAjax").href="#";else if(document.getElementById("addToCartLink"))document.getElementById("addToCartLink").href="#";if(document.getElementById("addToWishListLinkAjax"))document.getElementById("addToWishListLinkAjax").href="";else if(document.getElementById("addToWishListLink"))document.getElementById("addToWishListLink").href= "";if(document.getElementById("addToCompareLink"))document.getElementById("addToCompareLink").href="";if(document.getElementById("replaceCartItemAjax"))document.getElementById("replaceCartItemAjax").href="";else if(document.getElementById("replaceCartItemNonAjax"))document.getElementById("replaceCartItemNonAjax").href="";if(dojo.byId("baseUrlImageDir")){var a=dojo.byId("baseUrlImageDir").innerHTML;dojo.byId("productFullImage").src=a+"images/NoImageIcon.jpg"}categoryDisplayJS.selectedAttributes={}; categoryDisplayJS.selectedProducts={}}function hidePopup(a,h){if(document.getElementById("hidepopupall").value!="2"){if(!(h!=null&&h.type=="keypress"&&h.keyCode!="27")){var f=dijit.byId(a);f!=null&&f.hide()}}else document.getElementById("hidepopupall").value="0"}function saveChangeOrderItemId(a){replaceOrderItemId=a}function popupActionProperties(){this.showProductCompare=this.showWishList=this.showAddToCart=true;this.showReplaceCartItem=false} function gobackFocus(){document.getElementById("closeLink").focus()} function setbackFocus(a){if(a.shiftKey&&a.keyCode==dojo.keys.TAB){if(document.getElementById("replaceCartItemNonAjax")&&document.getElementById("replaceCartItemNonAjax").style.display!="none")document.getElementById("replaceCartItemNonAjax").focus();else if(document.getElementById("replaceCartItemAjax")&&document.getElementById("replaceCartItemAjax").style.display!="none")document.getElementById("replaceCartItemAjax").focus();else if(document.getElementById("addToCompareLink")&&document.getElementById("addToCompareLink").style.display!= "none")document.getElementById("addToCompareLink").focus();else if(document.getElementById("addToWishListLink")&&document.getElementById("addToWishListLink").style.display!="none")document.getElementById("addToWishListLink").focus();else document.getElementById("addToWishListLinkAjax")&&document.getElementById("addToWishListLinkAjax").style.display!="none"?document.getElementById("addToWishListLinkAjax").focus():document.getElementById("productMoreInfoLink").focus();dojo.stopEvent(a)}} function delayHidePopup(){setTimeout(dojo.hitch(this,"hidePopup","second_level_category_popup"),200)};
