dojo.registerModulePath("wc","../wc");dojo.require("wc.service.common");dojo.require("dojo.io.iframe");dojo.require("dojo.io.script");dojo.require("dojo.parser");dojo.require("dijit.form.Button");dojo.require("wc.widget.WCMenu");dojo.require("wc.widget.WCDialog");dojo.require("wc.widget.ScrollablePane");dojo.require("dijit.layout.TabContainer");dojo.require("dijit.layout.ContentPane");dojo.require("dijit.Tooltip");dojo.require("wc.widget.WCDropDownButton");dojo.require("dijit.Dialog");dojo.require("dojo.dnd.Source");dojo.require("dojo.currency");dojo.require("dijit.Tree");dojo.require("dojo.back");dojo.require("dijit.form.DateTextBox");dojo.require("wc.widget.RefreshArea");dojo.require("wc.render.RefreshController");dojo.require("wc.render.Context");dojo.require("dojo.cookie");var showDropdown=false;var dropDownDlg=null;var isIE=(document.all)?true:false;var requestSubmitted=true;var currentId="";var currentOrderItemId="";var isAjaxPromotionCodeManage=false;var isAjaxPrepareOrder=false;function loadLink(a){document.location.href=a}function cursor_wait(a){var b=true;if(a==true){if(dojo.isOpera>0){b=false}}if(b){setTimeout("showProgressBar()",500)}}function showProgressBar(){if(!requestSubmitted){return}var b=dijit.byId("progress_bar_dialog");if(b!=null){b.closeButtonNode.style.display="none";var c=document.getElementById("progress_bar");c.style.display="block";if(this.currentId!=""){var a=document.getElementById(this.currentId);var d=dijit.placeOnScreenAroundElement(c,a,{TR:"TL"})}else{b.containerNode.innerHTML=="";c.style.left="";c.style.top="";b.containerNode.appendChild(c);b.show()}setTimeout("cursor_clear()",40000)}}function setCurrentId(a){if(!requestSubmitted&&this.currentId==""){this.currentId=a}}function trim(c){word=c.toString();var b=0;var a=word.length-1;while(word.charAt(b)==" "){b++}while(word.charAt(a)==" "){a=a-1}if(b>a){return word.substring(b,b)}else{return word.substring(b,a+1)}}function cursor_clear(){requestSubmitted=false;var a=dijit.byId("progress_bar_dialog");var b=document.getElementById("progress_bar");if(a!=null){if(b!=null){b.style.display="none"}a.hide();this.currentId=""}}function submitRequest(){if(!requestSubmitted){requestSubmitted=true;return true}return false}function setPageLocation(a){if(!submitRequest()){return}document.location.href=a}function submitSpecifiedForm(a){if(!submitRequest()){return}a.submit()}function parseWidget(c){var a;var b=dijit.byId(c);if(b==null||b==undefined){if(c==null||c==undefined){a=dojo.body()}else{a=dojo.byId(c)}if(a!=null&&a!=undefined){if(a.getAttribute("dojoType")!=null&&a.getAttribute("dojoType")!=undefined){dojo.parser.instantiate([a])}else{dojo.parser.parse(a)}}}}function addVariationsToShoppingList(h,m,r,p,a){if(dojo.byId("requestFromShopListPage")!=null){dojo.byId("requestFromShopListPage").value=h}showDropdown=true;var b=0;var q="tr";var k=dojo.byId("seelistvariationdisplay");var t=k.getElementsByTagName(q);var u=t[0].getElementsByTagName("th");var e=dojo.byId("rememberedMultipleItemDisplay").value;for(var o=1;o<t.length;o++){var l=t[o].cells[1].innerHTML;var f=l.replace(/^\s*<[^>]+>(.*?)<.*$/img,"$1");var g=dojo.byId("itemQuantity_"+f).value;if(g>0){b++;break}}if(b==0){if(null!=dijit.byId("ValidationDialog")){dijit.byId("ValidationDialog").closeButtonNode.style.display="none";dijit.byId("ValidationDialog").show();setTimeout(dojo.hitch("ValidationDialog",function(){dijit.focus(dojo.query("a","ValidationDialog")[0])}),75)}}else{if(m=="G"||e=="true"){dojo.byId("isRFQ").value="false";if(e!="true"){dojo.byId("rfqShopList_Username_Textbox").value=""}dojo.byId("rfqShopList_Password_Textbox").value="";dijit.byId("rfqShopList_Logon_popup").closeButtonNode.style.display="none";dijit.byId("rfqShopList_Logon_popup").show();var n=window.location.href;if(n.indexOf("?")!=-1){}else{n=n+"?"}dojo.byId("guestUserForShopList").value=true;if(dojo.byId("moreThanOneItemVariations")!=null&&MI.variationData.length!=1){dojo.cookie("variationItemsToShopList",getSelectedVariations())}if(dojo.cookie("rememberMe")=="true"){var d="Logoff?storeId="+r+"&catalogId="+p+"&langId="+a+"&URL=OrganizationRegistrationAddForm?storeId="+r+"&catalogId="+p+"&langId="+a;dojo.byId("rfqShopListRegister").href=d}else{var c="OrganizationRegistrationAddForm?storeId="+r+"&catalogId="+p+"&langId="+a+"&requestFromPage=variationsAddToSL&rFQcatalogEntryId="+MI.variationSubData[0].catentry_id+"&rFQleafletCode="+MI.variationSubData[0].leafletCode+"&currentURL="+n.replace(/&/g,"xx");dojo.byId("rfqShopListRegister").href=c}setTimeout(dojo.hitch("rfqShopList_Logon_popup",function(){dijit.focus(dojo.query("a","rfqShopList_Logon_popup")[0])}),75)}else{var s=[];dojo.byId("productShoppingListName").innerHTML="";dojo.byId("registeredUser").value=true;wc.render.updateContext("ProductAddShoppingListContext",{currentPage:"ProductPageWithVariation",storeId:r})}}}function addToShoppingList(m,g,e,l,c,d,n,b,h){if(dojo.byId("requestFromShopListPage")!=null){dojo.byId("requestFromShopListPage").value=g}var k=dojo.byId("rememberedSingleItemDisplay").value;if(m.length==1){if(d=="G"||k=="true"){dojo.byId("isRFQ").value="false";if(k!="true"){dojo.byId("rfqShopList_Username_Textbox").value=""}dojo.byId("rfqShopList_Password_Textbox").value="";dijit.byId("rfqShopList_Logon_popup").closeButtonNode.style.display="none";dijit.byId("rfqShopList_Logon_popup").show();var f=window.location.href;if(f.indexOf("?")!=-1){}else{f=f+"?"}if(dojo.cookie("rememberMe")=="true"){var o="Logoff?storeId="+n+"&catalogId="+b+"&langId="+h+"&URL=OrganizationRegistrationAddForm?storeId="+n+"&catalogId="+b+"&langId="+h+"&requestFromPage="+requestFromPage;dojo.byId("rfqShopListRegister").href=o}else{var a="OrganizationRegistrationAddForm?storeId="+n+"&catalogId="+b+"&langId="+h+"&requestFromPage=productaddSL&rFQcatalogEntryId="+e+"&rFQleafletCode="+l+"&productPageQuantity="+c+"&currentURL="+f.replace(/&/g,"xx");dojo.byId("rfqShopListRegister").href=a}setTimeout(dojo.hitch("rfqShopList_Logon_popup",function(){dijit.focus(dojo.query("a","rfqShopList_Logon_popup")[0])}),75)}else{dojo.byId("productShoppingListName").innerHTML="";wc.render.updateContext("ProductAddShoppingListContext",{currentPage:"ProductPage",storeId:n})}}else{if(null!=dijit.byId("ValidationDialog")){dijit.byId("ValidationDialog").closeButtonNode.style.display="none";dijit.byId("ValidationDialog").show();setTimeout(dojo.hitch("ValidationDialog",function(){dijit.focus(dojo.query("a","ValidationDialog")[0])}),75)}}}function hideElementById(a){var b=dojo.byId(a);b.style.display="none"}function showElementById(a){var b=dojo.byId(a);b.style.display="block"}rfqHelperJS={properties:new Object(),addressForRFQModify:"",setProperty:function(a,b){this.properties[a]=b},getProperty:function(a){return this.properties[a]},getWindowStateKey:function(){var a="MiniRFQSegment";var c=this.getProperty("sessionId");var b=0;if(c){for(i=0;i<c.length;i++){}}a=a+b;return a},load:function(a){if(a==null||typeof a=="undefined"||a==""){alert("Please provide a key");return}return this._load(a)},save:function(a,b){if(a==null||typeof a=="undefined"||a==""){alert("Please provide a key");return}if(b==null||typeof b=="undefined"||b==""){alert("Please provide a key value");return}this._save(a,b)},_save:function(g,f,h,l,d,a,e){if(this.currentProvider=="flash"){var k=this;var b=function(m,n){if(m==dojo.storage.FAILED){alert("You do not have permission to store data for this web site. Press the Configure button to grant permission.")}else{if(m==dojo.storage.SUCCESS){}}};try{dojo.storage.put(g,f,b)}catch(c){alert(c)}}else{f=dojo.toJson(f);dojo.cookie(g,f,{path:"/"})}},_load:function(b){if(this.currentProvider=="flash"){var a=dojo.storage.get(b);return a}else{var c=dojo.cookie(b);c=dojo.fromJson(c);return c}},getWindowState:function(){var b=this.getWindowStateKey();var a=this.load(b);if(a!=null){return a}else{this.save(b,"close");return"close"}},toggleWindowState:function(){var b=this.getWindowStateKey();var a=this.load(b);if(a==null||a=="close"){this.save(b,"open")}else{this.save(b,"close")}},setWindowState:function(b){var a=this.getWindowStateKey();this.save(a,b)},connectEventForTransformRFQ:function(){if(dijit.byId("ConfirmationRFQDialog")!=null){dojo.connect(dijit.byId("ConfirmationRFQDialog"),"onCancel",null,goToRFQPage);dojo.connect(dijit.byId("ConfirmationRFQDialog"),"_onKey",function(a){if(a.keyCode){if(a.keyCode==dojo.keys.ESCAPE){goToRFQPage()}else{return}}})}},eventBlockingHandlerForRFQ:function(a){if(a.target.id!="signout"){if(dijit.byId("rfqOrderBlockDialog")!="undefined"){dijit.byId("rfqOrderBlockDialog").closeButtonNode.style.display="none";dijit.byId("rfqOrderBlockDialog").show()}}},blockComponentsForRFQOrder:function(){dojo.connect(dojo.byId("head"),"onmousedown",this.eventBlockingHandlerForRFQ);dojo.connect(dojo.byId("menu"),"onmousedown",this.eventBlockingHandlerForRFQ);dojo.query("ul","menu").forEach(function(a){dojo.connect(a,"onmouseover",MI.menuClearCurrent)});dojo.connect(dojo.byId("CatalogSearchForm"),"onmousedown",this.eventBlockingHandlerForRFQ);dojo.connect(dojo.byId("sidebar"),"onmousedown",this.eventBlockingHandlerForRFQ);dojo.connect(dojo.byId("footer"),"onmousedown",this.eventBlockingHandlerForRFQ)}};compareProductJS={compareCounter:0,compareRowCounter:0,compareItemCatEntry:new Object(),compareItems:new Array(),langId:"-1",storeId:"",catalogId:"",properties:new Object(),errorMessages:new Object(),setCommonParameters:function(c,a,b){this.langId=c;this.storeId=a;this.catalogId=b},setErrorMessage:function(a,b){this.errorMessages[a]=b},getErrorMessage:function(a){var b=this.errorMessages[a];if(b==null){b="Could not get the message value for specified key "+a}return b},setProperty:function(a,b){this.properties[a]=b},getProperty:function(a){return this.properties[a]},getStorageKey:function(){var c="CompareItems";var b=this.getProperty("sessionId");var a=0;for(i=0;i<b.length;i++){a=a+b.charCodeAt(i)}c=c+a;return c},getWindowStateKey:function(){var a="MiniCompareSegment";var c=this.getProperty("sessionId");if(c!=null){var b=0;for(i=0;i<c.length;i++){}a=a+b;return a}else{return a}},load:function(a){if(a==null||typeof a=="undefined"||a==""){alert("Please provide a key");return}return this._load(a)},save:function(a,b){if(a==null||typeof a=="undefined"||a==""){alert("Please provide a key");return}if(b==null||typeof b=="undefined"||b==""){alert("Please provide a key value");return}this._save(a,b)},clear:function(){MessageHelper.hideAndClearMessage();if(this.currentProvider=="flash"){dojo.storage.clear()}else{if(this.compareCounter>0){this.compareItems=[];dojo.cookie("cObj",null,{path:"/"});var g=this.getStorageKey();dojo.cookie(g,null,{path:"/"});this.setWindowState("close");this.initializeCompare();var d=document.getElementById("CompareForm");var e=document.getElementById("compareZone");var f=e.childNodes;for(i=0;i<f.length;i++){e.removeChild(f[i])}document.getElementById("WC_CompareZoneDisplayf_div_4").style.display="none";var c=document.createElement("div");c.setAttribute("id","compareDropZoneImg");c.setAttribute("class","items");c.innerHTML=d.clearMsg.value;var b=document.createElement("div");b.innerHTML="&nbsp;";c.appendChild(b);e.appendChild(c);document.getElementById("compareDropZoneImg").style.padding="5px";if(document.getElementById("compareProductPage")!=null&&document.getElementById("compareProductPage")!="undefined"){if(document.getElementById("compareProductPage").value){var a=document.CompareForm.action+"?storeId="+document.CompareForm.storeId.value+"&catalogId="+document.CompareForm.catalogId.value+"&langId="+document.CompareForm.langId.value+"&categoryId= ";document.location.href=a}}MessageHelper.displayStatusMessage(MessageHelper.messages.COMPARE_ITEMS_CLEAR)}}},remove:function(b,c){if(this.currentProvider=="flash"){dojo.storage.remove(b)}else{var d=this.getStorageKey();var a=this.load(d);if(a!=null){this.compareItemCatEntry=a}delete this.compareItemCatEntry[b];this.save(d,this.compareItemCatEntry);this.compareProducts();this.compareItems=dojo.fromJson(dojo.cookie("cObj"));for(i=0;i<this.compareItems.length;i++){if(this.compareItems[i][3]==c){this.compareItems.splice(i,1)}}dojo.cookie("cObj",dojo.toJson(this.compareItems),{path:"/"})}},_save:function(g,f,h,l,d,a,e){if(this.currentProvider=="flash"){var k=this;var b=function(m,n){if(m==dojo.storage.FAILED){alert("You do not have permission to store data for this web site. Press the Configure button to grant permission.")}else{if(m==dojo.storage.SUCCESS){}}};try{dojo.storage.put(g,f,b)}catch(c){alert(c)}}else{f=dojo.toJson(f);dojo.cookie(g,f,{path:"/"})}},_load:function(b){if(this.currentProvider=="flash"){var a=dojo.storage.get(b);return a}else{var c=dojo.cookie(b);c=dojo.fromJson(c);return c}},initializeCompare:function(){var g=this.getStorageKey();this.compareCounter=0;this.compareRowCounter=0;this.compareItemCatEntry=new Object();var m=this.load(g);if(m!=null){this.compareItemCatEntry=m}if(document.getElementById("compareZone")!=null){var b=document.getElementById("compareZone");var l=b.childNodes;for(d=0;d<l.length;d++){if(l[d].id!="compareDropZoneImg"){b.removeChild(l[d])}}var c="AjaxCompareDisplay";c=c+"?storeId="+this.storeId+"&catalogId="+this.catalogId+"&langId="+this.langId;for(catEntryIdentifier in this.compareItemCatEntry){c=c+"&catentry=";c=c+catEntryIdentifier;if(catEntryIdentifier!=0){this.compareCounter++}}if(dojo.fromJson(dojo.cookie("cObj"))!=null){var h=dojo.fromJson(dojo.cookie("cObj"));c=c+"&cm=";for(var d=0;d<h.length;d++){h[d][1]=unescape(encodeURIComponent(h[d][1]));c=c+h[d];c=c+";"}}var k=document.getElementById("itemCounter");k.innerHTML=this.compareCounter;if(this.compareCounter>0){this.addToTool("compareZone",c);document.getElementById("WC_CompareZoneDisplayf_div_4").style.display="block"}else{document.getElementById("WC_CompareZoneDisplayf_div_4").style.display="none";var a=document.getElementById("CompareForm");var b=document.getElementById("compareZone");var l=b.childNodes;for(d=0;d<l.length;d++){b.removeChild(l[d])}var f=document.createElement("div");f.setAttribute("id","compareDropZoneImg");f.setAttribute("class","items");f.innerHTML=a.clearMsg.value;var e=document.createElement("div");e.innerHTML="&nbsp;";f.appendChild(e);b.appendChild(f);document.getElementById("compareDropZoneImg").style.padding="5px"}}},Add2CompareAjax:function(d,f,c,b){MessageHelper.hideAndClearMessage();var e=this.getStorageKey();if(dojo.cookie("cObj")!=null){this.compareItems=dojo.fromJson(dojo.cookie("cObj"))}if(d in this.compareItemCatEntry||d==null){dijit.byId("ValidationItemExistsDialog").closeButtonNode.style.display="none";dojo.byId("ValidationItemExistsDialog_MessageArea").innerHTML=dojo.byId("ItemExistsMessage").innerHTML;dijit.byId("ValidationItemExistsDialog").show()}else{this.compareCounter++;if(this.compareCounter<=4){document.CompareForm.catentryId[this.compareCounter-1].value=d;this.compareItemCatEntry[d]=f;var a=MI.variationData[0].itemDescription;a=a.replace(",","2comma");a=a.replace("&","2amp");a=a.replace(";","2colon");if(this.compareItems.length==0){dojo.cookie("cObj",null,{expires:-1});this.compareItems[0]=new Array(MI.variationData[0].partNumber,a,MI.variationData[0].smallImage,MI.variationData[0].leafletCode)}else{this.compareItems[this.compareItems.length]=new Array(MI.variationData[0].partNumber,a,MI.variationData[0].smallImage,MI.variationData[0].leafletCode)}dojo.cookie("cObj",null,{expires:-1});dojo.cookie("cObj",dojo.toJson(this.compareItems));this.save(e,this.compareItemCatEntry,-1);if(this.getWindowState()=="close"){this.setWindowState("open");MI.toggleSidebar(document.getElementById("linkCompareToggle"),document.getElementById("bodyComparison"))}this.initializeCompare();if(document.getElementById("compareProductPage")!=null&&document.getElementById("compareProductPage")!="undefined"){if(document.getElementById("compareProductPage").value){this.compareProducts()}}if(null!=dijit.byId("AddToComparatorConfirmationPopupDialog")){dojo.byId("AddToComparatorConfirmationPopupDialogItemImage").src=f;dojo.byId("AddToComparatorConfirmationPopupDialogItemName").innerHTML=b[0].itemDescription;dijit.byId("AddToComparatorConfirmationPopupDialog").closeButtonNode.style.display="none";dijit.byId("AddToComparatorConfirmationPopupDialog").show()}}else{dijit.byId("ValidationItemExistsDialog").closeButtonNode.style.display="none";dojo.byId("ValidationItemExistsDialog_MessageArea").innerHTML=dojo.byId("MaxItemsPresentMessage").innerHTML;dijit.byId("ValidationItemExistsDialog").show()}}},AddItems2CompareAjax:function(b,m){MessageHelper.hideAndClearMessage();var o=this.getStorageKey();var q=false;dragImagePath="";descVar="";var a;var p;if(dojo.byId("AddItemsToComparator")!=null){a=dojo.byId("AddItemsToComparator").getElementsByTagName("tbody")[0];var n=a.getElementsByTagName("tr");for(var f=0;f<n.length;f++){a.removeChild(n[f])}}if(dojo.cookie("cObj")!=null){this.compareItems=dojo.fromJson(dojo.cookie("cObj"))}for(var f=0;f<m.length;f++){var r=m[f][0];console.warn("catEntryIdentifier > "+r);if(r in this.compareItemCatEntry||r==null){dijit.byId("ValidationItemExistsDialog").closeButtonNode.style.display="none";dojo.byId("ValidationItemExistsDialog_MessageArea").innerHTML=dojo.byId("ItemExistsMessage").innerHTML;dijit.byId("ValidationItemExistsDialog").show();break}else{this.compareCounter++;if(this.compareCounter<=4){document.CompareForm.catentryId[this.compareCounter-1].value=r;this.compareItemCatEntry[r]=dragImagePath;var h=MI.variationData[0].itemDescription;h=h.replace(",","2comma");h=h.replace("&","2amp");h=h.replace(";","2colon");for(var d=0;d<MI.variationData.length;d++){if(MI.variationData[d].catentry_id==r){if(this.compareItems==null){this.compareItems=new Array()}if(this.compareItems.length==0){dojo.cookie("cObj",null,{expires:-1});this.compareItems[0]=new Array(MI.variationData[d].partNumber,h,MI.variationData[d].smallImage,MI.variationData[d].leafletCode)}else{this.compareItems[this.compareItems.length]=new Array(MI.variationData[d].partNumber,h,MI.variationData[d].smallImage,MI.variationData[d].leafletCode)}break}}this.save(o,this.compareItemCatEntry,-1);dojo.cookie("cObj",null,{expires:-1});dojo.cookie("cObj",dojo.toJson(this.compareItems));if(this.getWindowState()=="close"){this.setWindowState("open");MI.toggleSidebar(document.getElementById("linkCompareToggle"),document.getElementById("bodyComparison"))}this.initializeCompare();if(document.getElementById("compareProductPage")!=null&&document.getElementById("compareProductPage")!="undefined"){if(document.getElementById("compareProductPage").value){this.compareProducts()}}var c=m[f][2];for(var d=0;d<MI.variationData.length;d++){if(MI.variationData[d].leafletCode==c){dragImagePath=MI.variationData[d].smallImage;descVar=MI.variationData[d].itemDescription;break}}var g=document.createElement("tr");var l=document.createElement("td");l.className="comparatorImgTd";var e=document.createElement("img");e.src=dragImagePath;l.appendChild(e);var k=document.createElement("td");k.className="comparatorTextTd";k.innerHTML=descVar;g.appendChild(l);g.appendChild(k);if(null!=dijit.byId("AddToComparatorConfirmationPopupDialog")){if(dojo.byId("AddItemsToComparator")!=null){a.appendChild(g);q=true}}}else{dijit.byId("ValidationItemExistsDialog").closeButtonNode.style.display="none";dojo.byId("ValidationItemExistsDialog_MessageArea").innerHTML=dojo.byId("MaxItemsPresentMessage").innerHTML;dijit.byId("ValidationItemExistsDialog").show();break}}}if(q){dijit.byId("AddToComparatorConfirmationPopupDialog").closeButtonNode.style.display="none";dijit.byId("AddToComparatorConfirmationPopupDialog").show()}},preCompareProducts:function(){MessageHelper.hideAndClearMessage();if(this.compareCounter<1){dojo.byId("WC_CompareZoneDisplayf_links_2_1").style.display="none";dojo.byId("COMPARE_MINITEMS").style.display="block";dojo.byId("AddToComparatorPromoLightBox_gotocart_button").style.display="none";dojo.byId("AddToComparatorPromoLightBox_MinItems").style.display="block"}else{dojo.byId("AddToComparatorPromoLightBox_MinItems").style.display="none";dojo.byId("AddToComparatorPromoLightBox_gotocart_button").style.display="block";dojo.byId("COMPARE_MINITEMS").style.display="none";dojo.byId("WC_CompareZoneDisplayf_links_2_1").style.display="block"}},preCompareProducts1:function(){MessageHelper.hideAndClearMessage();if(this.compareCounter<=1){dojo.byId("WC_CompareZoneDisplayf_links_2_1").style.display="none";dojo.byId("COMPARE_MINITEMS").style.display="block"}else{dojo.byId("COMPARE_MINITEMS").style.display="none";dojo.byId("WC_CompareZoneDisplayf_links_2_1").style.display="block"}},getWindowState:function(){var b=this.getWindowStateKey();var a=this.load(b);if(a!=null){return a}else{this.save(b,"close");return"close"}},toggleWindowState:function(){var b=this.getWindowStateKey();var a=this.load(b);if(a==null||a=="close"){this.save(b,"open")}else{this.save(b,"close")}},setWindowState:function(b){var a=this.getWindowStateKey();this.save(a,b)},compareProducts:function(){var c=this.getStorageKey();var a=this.load(c);if(a!=null){this.compareItemCatEntry=a}if(document.CompareForm!=null&&document.CompareForm!="undefined"){var b="webapp/wcs/stores/servlet/CompareProductsDisplay?storeId="+document.CompareForm.storeId.value+"&catalogId="+document.CompareForm.catalogId.value+"&langId="+document.CompareForm.langId.value+"&categoryId="+document.CompareForm.categoryId.value+"&top="+document.CompareForm.top.value}else{var b="webapp/wcs/stores/servlet/CompareProductsDisplay?storeId="+this.storeId+"&catalogId="+this.catalogId+"&langId="+this.langId}for(catEntryIdentifier in this.compareItemCatEntry){b=b+"&catentryId="+catEntryIdentifier}document.location.href=b},addToTool:function(b,a){var c;if(window.XMLHttpRequest){c=new XMLHttpRequest()}else{if(window.ActiveXObject){c=new ActiveXObject("Microsoft.XMLHTTP")}else{alert("Your browser does not support XMLHTTP!")}}c.onreadystatechange=function(){if(c.readyState==4){var d=document.getElementById(b);d.innerHTML="";try{d.innerHTML=c.responseText}catch(f){var g=document.createElement("div");g.innerHTML=c.responseText;d.appendChild(g)}}};c.open("GET",a,true);c.send(null)},init:function(){dojo.subscribe("/dnd/drop",function(e,a,h,f){f.deleteSelectedNodes();var c="";var g="";var d="";if(f.parent.id=="compareZone"){var b=e.parent.id.indexOf("_",0);if(b>=0){e.parent.id=e.parent.id.substring(b+1)}if(document.getElementById("compareImgPath_"+e.parent.id)!=null&&document.getElementById("compareImgPath_"+e.parent.id)!=undefined){g=document.getElementById("compareImgPath_"+e.parent.id).value}if(document.getElementById("compareProductDetailsPath_"+e.parent.id)!=null&&document.getElementById("compareProductDetailsPath_"+e.parent.id)!=undefined){c=document.getElementById("compareProductDetailsPath_"+e.parent.id).value}if(document.getElementById("compareImgDescription_"+e.parent.id)!=null&&document.getElementById("compareImgDescription_"+e.parent.id)!=undefined){d=document.getElementById("compareImgDescription_"+e.parent.id).value}compareProductJS.Add2CompareAjax(e.parent.id,g,c,d)}})}};lastViewedProductJS={productCounter:0,productRowCounter:0,maxProducts:3,viewedProductCatEntry:new Array(),langId:"-1",storeId:"",catalogId:"",expiredPassword:"",properties:new Object(),errorMessages:new Object(),setCommonParameters:function(d,a,c,b){this.langId=d;this.storeId=a;this.catalogId=c;this.expiredPassword=b},setErrorMessage:function(a,b){this.errorMessages[a]=b},getErrorMessage:function(a){var b=this.errorMessages[a];if(b==null){b="Could not get the message value for specified key "+a}return b},setProperty:function(a,b){this.properties[a]=b},getProperty:function(a){return this.properties[a]},getStorageKey:function(){var a="LastViewedItemgroups";return a},getWindowStateKey:function(){var a="LastViewedSegment";var c=this.getProperty("sessionId");if(c!=null){var b=0;for(i=0;i<c.length;i++){}a=a+b;return a}else{return a}},load:function(a){if(a==null||typeof a=="undefined"||a==""){alert("Please provide a key");return}return this._load(a)},save:function(a,b){if(a==null||typeof a=="undefined"||a==""){alert("Please provide a key");return}if(b==null||typeof b=="undefined"||b==""){alert("Please provide a key value");return}this._save(a,b)},_save:function(g,f,h,l,d,a,e){if(this.currentProvider=="flash"){var k=this;var b=function(m,n){if(m==dojo.storage.FAILED){alert("You do not have permission to store data for this web site. Press the Configure button to grant permission.")}else{if(m==dojo.storage.SUCCESS){}}};try{dojo.storage.put(g,f,b)}catch(c){alert(c)}}else{f=dojo.toJson(f);dojo.cookie(g,f,{path:"/"})}},_load:function(b){if(this.currentProvider=="flash"){var a=dojo.storage.get(b);return a}else{var c=dojo.cookie(b);c=dojo.fromJson(c);return c}},initializeLastViewedList:function(){var d=this.getStorageKey();this.productCounter=0;this.productRowCounter=0;this.viewedProductCatEntry=new Array();var a=this.load(d);if(a!=null){this.viewedProductCatEntry=a}this.productCounter=this.viewedProductCatEntry.length;console.log("LV length--"+this.productCounter);var b=document.getElementById("LastViewedZoneDisplay_Context");if(!b){return}var c=b.childNodes;for(i=0;i<c.length;i++){if(c[i].id!="lastViewedZoneImg"){b.removeChild(c[i])}}var f=0;var e=3;if(false&&document.getElementById("ProductPage")!=null&&document.getElementById("ProductPage")!="undefined"){f=0;e=this.viewedProductCatEntry.length}else{f=0;e=this.viewedProductCatEntry.length;if(this.viewedProductCatEntry.length>=3){f=0;e=3}}if(this.productCounter>0&&(this.expiredPassword=="undefined"||this.expiredPassword=="")&&this.expiredPassword!=1){this.addToList("LastViewedZoneDisplay_Context",this.viewedProductCatEntry)}},addToList:function(k,o){var g=document.createElement("table");var c=document.createElement("tbody");c.setAttribute("id","lastViewedItemsTable");g.appendChild(c);for(i=(o.length-1);i>=0;i--){var l=document.createElement("tr");l.setAttribute("id","lastViewedRow"+i);var b=document.createElement("td");b.setAttribute("id","lastViewedCatentry"+o[i].id);var q=document.createElement("div");q.setAttribute("id","lastViewedCatentryContainer"+o[i].id);var r=document.createElement("a");r.setAttribute("id","lastViewedCatentryContainer_"+o[i].id);r.setAttribute("href",o[i].p);var h=document.createElement("img");var a=isIE?"className":"class";h.setAttribute(a,"toolbox-thumb");h.setAttribute("src",o[i].i);h.onerror=function(e){this.src="/wcsstore/ManutanStorefrontAssetStore/images/icons/nophoto-small.png"};var f=document.createElement("p");f.setAttribute(a,"toolbox-info");var p=document.createTextNode(unescape(o[i].n));f.appendChild(p);r.appendChild(h);r.appendChild(f);q.appendChild(r);b.appendChild(q);l.appendChild(b);c.appendChild(l)}var d=document.getElementById(k);try{d.appendChild(g);if(document.getElementById("linkViewedToggle")!=null&&document.getElementById("bodyViewed")!=null){MI.toggleSidebar(document.getElementById("linkViewedToggle"),document.getElementById("bodyViewed"))}}catch(n){var m=document.createElement("div");m.appendChild(g);d.appendChild(m)}},getWindowState:function(){var b=this.getWindowStateKey();var a=this.load(b);if(a!=null){return a}else{this.save(b,"close");return"close"}},toggleWindowState:function(){var b=this.getWindowStateKey();var a=this.load(b);if(a==null||a=="close"){this.save(b,"open")}else{this.save(b,"close")}},setWindowState:function(b){var a=this.getWindowStateKey();this.save(a,b)},Add2History:function(g,d,h,c){var e=this.getStorageKey();this.viewedProductCatEntry=new Array();var a={id:g,i:d,p:h,n:c};this.productCounter=0;var l=this.load(e);if(l!=null){this.viewedProductCatEntry=l}var k=false;for(j=0;j<this.viewedProductCatEntry.length;j++){if(this.viewedProductCatEntry[j].id==g){k=true}}if(k||g==null){var b=false;for(counter=0;counter<this.viewedProductCatEntry.length-1;counter++){if(this.viewedProductCatEntry[counter].id==g){b=true}if(b){this.viewedProductCatEntry[counter]=this.viewedProductCatEntry[counter+1]}}if(b){this.viewedProductCatEntry[this.viewedProductCatEntry.length-1]=a}this.save(e,this.viewedProductCatEntry,-1)}else{for(counter in this.viewedProductCatEntry){if(this.viewedProductCatEntry[counter]!="undefined"){this.productCounter++}}this.productCounter++;if(this.productCounter<=this.maxProducts){this.viewedProductCatEntry[this.productCounter-1]=a;this.save(e,this.viewedProductCatEntry,-1)}else{var f=new Array();for(i=0;i<this.maxProducts-1;i++){this.viewedProductCatEntry[i]=this.viewedProductCatEntry[i+1]}this.viewedProductCatEntry[this.maxProducts-1]=a;this.save(e,this.viewedProductCatEntry,-1);this.productCounter=4}this.initializeLastViewedList()}},init:function(){}};function addOnLoad(k,B,A,a,C,h,f,z,m,t,g,r,l,v,b,d,D,c,y,q,s,u,p,w,E){CommonContextsJS.setCommonParameters(k,B,A);compareProductJS.setCommonParameters(k,B,A);compareProductJS.setProperty("sessionId",document.getElementById("sessionId").value);compareProductJS.init();compareProductJS.initializeCompare();parseWidget("compareZoneDisplay");parseWidget("ValidationItemExistsDialog");parseWidget("infoBoxTextArea");lastViewedProductJS.setCommonParameters(k,B,A,a);lastViewedProductJS.setProperty("sessionId",document.getElementById("sessionId").value);lastViewedProductJS.initializeLastViewedList();if(typeof(rfqHelperJS)!="undefined"){rfqHelperJS.setProperty("sessionId",document.getElementById("sessionId").value)}else{console.warn("rfqHelperJS="+typeof(rfqHelperJS))}dojo.connect(document.CatalogSearchForm,"onkeypress",function(G){if(G.keyCode==60||G.keyCode==62||G.charCode==60||G.charCode==62){G.preventDefault()}});dojo.connect(document.Logon,"onkeypress",function(G){if(G.keyCode==60||G.keyCode==62||G.charCode==60||G.charCode==62){G.preventDefault()}});parseWidget("rfqShopList_Logon_popup");parseWidget("checkoutLogon_popup");parseWidget("MiniShoppingCart");parseWidget("MIMiniRFQDisplayList");parseWidget("ConfirmationRFQDialog");parseWidget("rfqProductDisplay");parseWidget("ProductAddShoppingListDialog");parseWidget("ProductAddShoppingListRefreshArea");parseWidget("ImportShoppingListDisplay");parseWidget("eInvoiceSuccessDialog");ServicesDeclarationJS.setCommonParameters(k,B,A);CommonControllersDeclarationJS.setControllerURL("ImportShoppingListDisplayController",C);if(h!=null&&h!=""&&h=="true"){if(rfqHelperJS!=undefined){rfqHelperJS.connectEventForTransformRFQ()}}var F=y;if(t=="false"&&f=="shoplist"&&z!="G"&&a!="1"){if(dojo.byId("productShoppingListName")!=null){dojo.byId("productShoppingListName").innerHTML=""}wc.render.updateContext("ProductAddShoppingListContext",{currentPage:"ProductPage",storeId:B})}else{if(t=="false"&&f=="ProductPageWithVariation"&&z!="G"&&a!="1"){if(dojo.byId("productShoppingListName")!=null){dojo.byId("productShoppingListName").innerHTML=""}wc.render.updateContext("ProductAddShoppingListContext",{currentPage:"ProductPageWithVariation",storeId:B})}else{if(t=="false"&&f=="basketPage"&&z!="G"&&a!="1"){if(dojo.byId("productShoppingListName")!=null){dojo.byId("productShoppingListName").innerHTML=""}if(F==""||F!=0){wc.render.updateContext("ProductAddShoppingListContext",{currentPage:"BasketPage",storeId:B})}}else{if(t=="false"&&f=="orderItem"&&z!="G"&&a!="1"){if(dojo.byId("orderitemdisplay_import_shoppinglist")!=null&&dojo.byId("orderitemdisplay_import_shoppinglist").style.display=="none"){dojo.byId("orderitemdisplay_import_shoppinglist").style.display="block";wc.render.updateContext("ImportShoppingListDisplayRefreshContext",{storeId:B})}}else{if(m=="basketPgImportSL"&&z!="G"&&a!="1"){selectShoppingList("orderitemdisplay_import_shoppinglist",B);dojo.byId("orderitemdisplay_import_shoppinglist").focus()}else{if(t=="true"&&dojo.byId("existRFQId")==null&&z!="G"&&a!="1"){dojo.byId("requestFromPage").value=m;if(document.getElementById("RFQsessionId")!=null){categoryDisplayJS.setProperty("sessionId",document.getElementById("RFQsessionId").value)}if(m=="product"){var e=dojo.fromJson(dojo.cookie("prdVariationObject"));var o=dojo.cookie("prdVariationCurrency");if(e!=null&&o!=null){categoryDisplayJS.AddItems2RFQ(o,e)}}else{if(m=="miniRFQ"){categoryDisplayJS.LogonAdd2RFQ(D)}else{if(m=="orderDisplay"){var c=c;var x=y;if(x==0){dojo.byId("MessageArea").style.display="block";dojo.byId("ErrorMessageText").innerHTML=c+" "+q}else{if(rfqHelperJS!=undefined){rfqHelperJS.connectEventForTransformRFQ()}categoryDisplayJS.AddItemFromBasketToRFQ(x,l,c)}}}}}}}}}}var n=c;if(z!="G"&&n!=""&&dojo.byId("existRFQId")==null){dojo.byId("MessageArea").style.display="block";dojo.byId("ErrorMessageText").innerHTML=n+" "+s}if(z=="G"){if(dojo.byId("account")!=null){dojo.byId("account").style.display="block"}if(dojo.byId("loggedin")!=null){dojo.byId("loggedin").style.display="none"}}else{if(dojo.byId("account")!=null){dojo.byId("account").style.display="none"}if(dojo.byId("loggedin")!=null){dojo.byId("loggedin").style.display="block"}}if(u){dijit.byId("eInvoiceSuccessDialog").closeButtonNode.style.display="none";dijit.byId("eInvoiceSuccessDialog").show();setTimeout(dojo.hitch("eInvoiceSuccessDialog",function(){dijit.focus(dojo.query("a","eInvoiceSuccessDialog")[0])}),75)}parseWidget("password_retrival_popup");if(w=="0"){if(document.getElementById("RFQsessionId")!=null){categoryDisplayJS.setProperty("sessionId",document.getElementById("RFQsessionId").value);keepRFQOpen()}MessageHelper.setMessage("RFQ_REMOVEITEM",p)}checkCookieOnLoad(E,z)}function getCookie(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return""}function setCookie(b,c,a){if(document.cookie.length>0){c_start=document.cookie.indexOf(b+"=");var d=new Date();d.setDate(d.getDate()+a);document.cookie=b+"="+escape(c)+((a==null)?"":";expires="+d.toGMTString())+";path=/"}}function checkCookieOnLoad(b,c){var a=document.getElementById("autosuggestcheck");if(c!="G"){checkValue=getCookie(b)}else{checkValue=getCookie("guest")}if(checkValue==null||checkValue==""){if(a!=null){a.checked=true}}else{if(checkValue=="true"){a.checked=true}else{a.checked=false}}}function checkCookie(b,c){var a=document.getElementById("autosuggestcheck");if(c!="G"){setCookie(b,a.checked,365)}else{setCookie("guest",a.checked,365)}}function showRFQShopListLogonPopup(l,g,c,h,b,e){if(dojo.byId("requestFromPage")!=null&&l!="undefined"){dojo.byId("requestFromPage").value=l}if(l!=null&&l!="undefined"&&l=="orderDisplay"){if(rfqHelperJS!=undefined){rfqHelperJS.connectEventForTransformRFQ()}}var f=dojo.byId("remembered").value;if(g.length==1){if(c=="G"||f=="yes"){dojo.byId("isRFQ").value="true";if(f!="yes"){dojo.byId("rfqShopList_Username_Textbox").value=""}dojo.byId("rfqShopList_Password_Textbox").value="";dijit.byId("rfqShopList_Logon_popup").closeButtonNode.style.display="none";dijit.byId("rfqShopList_Logon_popup").show();if(l=="product"){var d=window.location.href;if(d.indexOf("?")!=-1){}else{d=d+"?"}var a="OrganizationRegistrationAddForm?storeId="+h+"&catalogId="+b+"&langId="+e+"&requestFromPage="+l+"&rFQcatalogEntryId="+dojo.byId("rFQcatalogEntryId").value+"&rFQquantity="+dojo.byId("rFQquantity").value+"&rFQcurrency="+dojo.byId("rFQcurrency").value+"&rFQprice="+dojo.byId("rFQprice").value+"&rFQleafletCode="+dojo.byId("rFQleafletCode").value+"&rFQvariationData="+dojo.byId("rFQvariationData").value+"&currentURL="+d.replace(/&/g,"xx");dojo.byId("rfqShopListRegister").href=a}else{if(dojo.cookie("rememberMe")=="true"){var k="Logoff?storeId="+h+"&catalogId="+b+"&langId="+e+"&URL=OrganizationRegistrationAddForm?storeId="+h+"&catalogId="+b+"&langId="+e+"&requestFromPage="+l;dojo.byId("rfqShopListRegister").href=k}else{if(l=="miniRFQ"){var a="OrganizationRegistrationAddForm?storeId="+h+"&catalogId="+b+"&langId="+e+"&requestFromPage="+l;dojo.byId("rfqShopListRegister").href=a}else{if(l=="orderDisplay"){var d=window.location.href;var a="OrganizationRegistrationAddForm?storeId="+h+"&catalogId="+b+"&langId="+e+"&requestFromPage="+l+"&rFQItemCount="+dojo.byId("rFQItemCount").value+"&rFQcurrency="+dojo.byId("rFQcurrency").value+"&currentURL="+d.replace(/&/g,"xx");dojo.byId("rfqShopListRegister").href=a}}}}this.focusFirstInput("rfqShopList_Logon_popup")}}else{if(dijit.byId("ValidationDialog")!=null){dijit.byId("ValidationDialog").closeButtonNode.style.display="none";dijit.byId("ValidationDialog").show();setTimeout(dojo.hitch("ValidationDialog",function(){dijit.focus(dojo.query("a","ValidationDialog")[0])}),75)}}}function showRFQShopListLogonPopup2(n,k,c,l,b,f){if(dojo.byId("requestFromPage")!=null&&n!="undefined"){dojo.byId("requestFromPage").value=n}var h=dojo.byId("rememberedMultipleItemDisplay").value;var e=getSelectedVariations();var g=e.length;if(g==0){if(dijit.byId("ValidationDialog")!=null){dijit.byId("ValidationDialog").closeButtonNode.style.display="none";dijit.byId("ValidationDialog").show();setTimeout(dojo.hitch("ValidationDialog",function(){dijit.focus(dojo.query("a","ValidationDialog")[0])}),75)}}else{if(c=="G"||h=="true"){dojo.byId("isRFQ").value="true";if(h!="true"){dojo.byId("rfqShopList_Username_Textbox").value=""}dojo.byId("rfqShopList_Password_Textbox").value="";dijit.byId("rfqShopList_Logon_popup").closeButtonNode.style.display="none";dijit.byId("rfqShopList_Logon_popup").show();if(n=="product"){var d=window.location.href;if(d.indexOf("?")!=-1){}else{d=d+"?"}if(dojo.cookie("rememberMe")=="true"){var m="Logoff?storeId="+l+"&catalogId="+b+"&langId="+f+"&URL=OrganizationRegistrationAddForm?storeId="+l+"&catalogId="+b+"&langId="+f;dojo.byId("rfqShopListRegister").href=m}else{var a="OrganizationRegistrationAddForm?storeId="+l+"&catalogId="+b+"&langId="+f+"&requestFromPage="+n+"&rFQcatalogEntryId="+dojo.byId("rFQcatalogEntryId").value+"&rFQquantity="+dojo.byId("rFQquantity").value+"&rFQcurrency="+dojo.byId("rFQcurrency").value+"&rFQprice="+dojo.byId("rFQprice").value+"&rFQleafletCode="+dojo.byId("rFQleafletCode").value+"&rFQvariationData="+dojo.byId("rFQvariationData").value+"&currentURL="+d.replace(/&/g,"xx");dojo.byId("rfqShopListRegister").href=a}}this.focusFirstInput("rfqShopList_Logon_popup")}}}function focusFirstInput(a){setTimeout(dojo.hitch(a,function(){dijit.focus(dojo.query("input",a)[0])}),75)}function showPasswordRetrievalPopup(){dojo.byId("MIResetPasswordLightBox_div_main").style.display="block";dojo.byId("MIResetPasswordLightBox_Success").style.display="none";dojo.byId("MIResetPasswordLightBox_Failure").style.display="none";dojo.byId("miResetPasswordLightBox_UserEmail_DoNotMatch").style.display="none";dojo.byId("loginBox").style.display="none";dijit.byId("password_retrival_popup").closeButtonNode.style.display="none";dijit.byId("password_retrival_popup").show()}function submitEInvoice(b,c,a){if(c=="G"){if(dojo.byId("returnPage")!=null){dojo.byId("returnPage").value="EInvoice"}MI.toggleLogin(b)}else{window.location.href=a}}function setLeafletCodeToURL(d,e){var c=d.indexOf("&leafcode=");console.warn("firstIndex="+c);var a=d.indexOf("&",c+1);console.warn("nextIndex="+a);var b=d.substring(0,c);console.warn("leafcodeURL1="+b);if(c>0&&a>-1){b=b+"&leafcode="+e+d.substring(a,d.length)}else{b=b+"&leafcode="+e}console.warn("leafcodeURL2="+b);return b}function setReplacedLeafletCodeToURL(c,d){var b=c.indexOf("?");console.warn("firstIndex="+b);if(b>-1){var a=c.substring(0,b+1);a=a+"leafcode="+d;console.warn("replacedLeafcodeURL="+a);return a}else{return c}}function removeDots(a){if(dojo.byId(a)!=null&&dojo.byId(a).value!=null&&dojo.byId(a).value!=""){dojo.byId(a).value=dojo.byId(a).value.replace(/[\.]/g,"")}}function showPopupButton(b){if(document.getElementById("popupButton_"+b)!=null&&document.getElementById("popupButton_"+b)!="undefined"){var a=document.getElementById("popupButton_"+b);a.style.visibility="visible"}}function hidePopupButton(b){if(document.getElementById("popupButton_"+b)!=null&&document.getElementById("popupButton_"+b)!="undefined"){var a=document.getElementById("popupButton_"+b);a.style.visibility="hidden"}}function changeRememberMeValue(a){if(dojo.byId(a).value=="false"){dojo.byId(a).value="true"}else{dojo.byId(a).value="false"}if(dojo.byId(a).value=="true"){dojo.cookie("rememberMe",dojo.byId(a).value,{path:"/",expires:30})}}function showPasswordRetrievalPopup2(){dojo.byId("MIResetPasswordLightBox_div_main").style.display="block";dojo.byId("MIResetPasswordLightBox_Success").style.display="none";dojo.byId("MIResetPasswordLightBox_Failure").style.display="none";dojo.byId("miResetPasswordLightBox_UserEmail_DoNotMatch").style.display="none";dijit.byId("password_retrival_popup").closeButtonNode.style.display="none";dijit.byId("password_retrival_popup").show()}function deleteRememberMeCookies(){dojo.cookie("rememberMe","false",{path:"/",expires:-1});dojo.cookie("currentView","",{path:"/",expires:-1});dojo.cookie("itemsPerPage","",{path:"/",expires:-1})};
