var serverName=getServerName();var jsonvariable="";var greyoutSwatch="";var xmlAsString="";var carouselXslLoaded=false;var skuXslLoaded=false;var skuXsl;var carouselXSL;var XSLTSkuCompiled;var XSLTCarouselCompiled;var XSLTSkuProc;var XSLTCarouselProc;var skuXsltProcessor;var collectionXsltProcessor;var collnXslLoad=false;var fileName="sku.js";var alertQVSSOnload=true;var alertSKUClick=true;var xmlSkuAsString;var skuIdPers="";var skuId="";var ivTemp=null;function S7ConfigObject(){this.contentRoot="http://s7d5.scene7.com/";this.isViewerRoot=this.contentRoot+"s7viewers/";this.isRoot=this.contentRoot+"is/image/";this.skinsRoot=this.contentRoot+"skins/";this.staticRoot=this.contentRoot+"is/content/";this.videoRoot=this.contentRoot+"e2/";var a=navigator.userAgent.toLowerCase();this.isIeWin=a.indexOf("msie")!=-1&&a.indexOf("win")!=-1&&a.indexOf("opera")==-1&&a.indexOf("webtv")==-1;this.isFsCommand=true;}S7ConfigObject.prototype.setFlashParam=function(d){var e="";for(var c=1;c<arguments.length;c=c+2){if(c+1<arguments.length){e+="&"+escape(arguments[c])+"="+escape(arguments[c+1]);}}e=e.substr(1);if(this.divId>this.maxDivs){this.divId=1;}var a="flash_setvariables_"+d+"_"+this.divId;this.divId++;if(!document.getElementById(a)){var f=document.createElement("div");f.id=a;document.body.appendChild(f);}document.getElementById(a).innerHTML="";var b;b="<embed src='"+this.isViewerRoot+"/flash/gateway.swf' FlashVars='lc="+d+"&fq="+escape(e)+"' width='0' height='0' type='application/x-shockwave-flash'></embed>";document.getElementById(a).innerHTML=b;};function docWrite(a){document.write(a);}var S7ConfigClient=new S7ConfigObject();var root=S7ConfigClient.isViewerRoot;var imageServer=S7ConfigClient.isRoot;function resizeStage(a,d){var b=myName;var c=((navigator.appName=="Safari")||(navigator.userAgent.toLowerCase().indexOf("safari")>-1));var f=null;if(!c){f=document.embeds[b];}var e=false;if(f){e=true;}else{e=false;}if(!c&&e){f.width=a;f.height=d;}else{setWidth(b,a);setHeight(b,d);}}function getLayer(a){if(document.getElementById){return document.getElementById(a).style;}if(document.all){return document.all[a].style;}if(document.layers){return document[a];}}function setWidth(b,a){b=getLayer(b);if(document.getElementById){b.width=a;}else{if(document.all){b.posWidth=a;}else{if(b.clip){b.clip.width=a;}}}}function setHeight(a,b){a=getLayer(a);if(document.getElementById){a.height=b;}else{if(document.all){a.posHeight=b;}else{if(a.clip){a.clip.height=b;}}}}function genInstance(){var a=new Date();var b="ZoomMX"+a.getHours()+a.getMinutes()+a.getSeconds();return b;}function setImage(a,b){if(!b){b="s7flyout";}if(document.embeds&&document.embeds[b]){document.embeds[b].setImage(a);}else{document.getElementById(b).setImage(a);}}function changeImage(a){alert(a);}function outputStatus(a){alert("e.success = "+a.success+"\ne.id = "+a.id+"\ne.ref = "+a.ref);}var myName=genInstance();var viewerType="flyoutviewer";var imageName;var flashvars={};var params={allowScriptAccess:"Always",menu:"false",quality:"high",scale:"noscale",salign:"tl",bgcolor:"#FFFFFF",wmode:"transparent"};var attributes={id:myName,name:myName};var viewerUrl="";viewerUrl+=S7ConfigClient.isViewerRoot;viewerUrl+="flash/"+viewerType+".swf?";viewerUrl+="&serverUrl="+S7ConfigClient.isRoot;viewerUrl+="&instanceName="+myName;viewerUrl+="&border=ffffff,0";viewerUrl+="&transparent=true";if(pageId==="skuskuset"||pageId==="collection"){viewerUrl+="&flyout=400,200,360,0";}else{viewerUrl+="&flyout=420,200,360,0";}viewerUrl+=image_location;viewerUrl+="&zoomFactor=3.0";viewerUrl+="&transition=fade";var ivGlobal;function collectionSwatchClick(h,b,d){var j=$("h5#stepone").text();var a=$("#stage #chatholder").html();var c;if(!xmlSkuAsString){loadXMLStringForSkuset();c=$("#stage .delinfo li.expectdel").html();}else{c=$("#stage .delinfo li.expectdel").html();if(window.ActiveXObject){xmlSkuAsString=document.getElementById("skufilterbrowse").innerHTML;}else{xmlSkuAsString=$("#skufilterbrowse").html();}}xmlSkuStrAsObj=loadSkuXMLString(xmlSkuAsString);applyTransformationCollection(xmlSkuStrAsObj,h,c,b,d);var g="#"+h+"_"+h;$(g).parent().addClass("selected");if(document.getElementById("chatcontent")!=null){var f=document.getElementById("chatcontent").innerHTML;var e=$("#stage div#chatholder");e.html(f);}else{var e=$("#stage div#chatholder");e.html(a);}$("h5#stepone").html(j);}var TRANSXSL={captureSelect:function(SKU,NUM,pageName){if(typeof(quickView)=="undefined"||typeof(quickView)==undefined||quickView!==true){if(document.getElementById("check")==null&&document.getElementById("shareThisDum")!=null&&document.getElementById("shareThis")!=null){var innerDiv=document.createElement("div");innerDiv.setAttribute("id","check");document.getElementById("shareThisDum").appendChild(innerDiv);$("div#check").replaceWith($("div#shareThis"));}}var qsURL="";var errorURL="";if(typeof(quickView)!="undefined"&&quickView===true){qsURL=skuQuickviewURL;errorURL=ajaxQuickviewErrorURL;}else{qsURL=skusetURL;errorURL=ajaxErrorURL;}var methodName=arguments.callee.name;var t_displayResult_start=new Date().getTime();var isBrandPage=false;loadXMLStringForSkuset();xmlSkuDoc=null;xmlSkuStrAsObj=loadSkuXMLString(xmlSkuAsString);if(isBrandPage==undefined||isBrandPage==false){applyTransformationSku(xmlSkuStrAsObj,SKU,pageName);}var specialFlag=$("#spcl").val();var href="/office/supplies/skuinfotabs?partNumber="+NUM+"&catentryId="+SKU+"&pageName=skuskuset&isSpecial="+specialFlag+"&URL=/";var randomNumForIE=Math.floor(Math.random()*1000001);try{if(eval("typeof (fnPCChangeSkuInfo) == 'function'")){fnPCChangeSkuInfo(xmlSkuStrAsObj,NUM);}$.ajax({url:href+"&r="+randomNumForIE,type:"GET",dataType:"xml",timeout:20000,error:function(a,b,c){debugMessages.push("SkuSetPage: timeout or xml parse error on "+qsURL);$("#debug").append("<br />SkuSetPage: timeout or xml parse error on "+qsURL);if(propertyValues.ajaxLoggingSwitch=="ON"){var ajaxExecutionTime=(new Date().getTime())-t_displayResult_start;errorURL=errorURL+"&methodName="+methodName+"&fileName="+fileName+"&ajaxURL="+encodeURIComponent(href)+"&timeTaken="+ajaxExecutionTime+"&perfLogSwitch="+propertyValues.ajaxPerformanceSwitch;$.ajax({url:errorURL,type:"POST",dataType:"xml",timeout:20000,success:function(){$("#pseudoblanket").removeClass("hide");$("#ajaxErrorMsg").removeClass("hide");$("dl.error dd").html(propertyValues.compAjaxErrorString+' <a href="javascript:getTheURLAndProceed();">Try again</a>');}});}},success:function(returnObj){var temp="";var sellpoint="";var tabcontainerElement=$("#tabcontainer");if(typeof(quickView)!="undefined"&&quickView===true){tabcontainerElement=$("#divOverlay #tabcontainer");}var $chatContainer=$("#stage div#chatholder");$(returnObj).find("skuinfo").each(function(){var $innerContent=$(this).find("info").text();var $chatContent=$(this).find("chat").text();var $skubannerContent=$(this).find("skubanner").text();if(typeof(quickView)=="undefined"||typeof(quickView)==undefined||quickView!==true){temp=trim($chatContent).substring(trim($chatContent).indexOf("<script src"),trim($chatContent).indexOf("</p>"));if(document.getElementById("sellpoint")!=null){$sellpoint=$(this).find("sellpoint").text();$sellCut=trim($sellpoint).substring(trim($sellpoint).indexOf("vsr_sku="),trim($sellpoint).indexOf(";"));$sellonload=document.getElementById("sellpoint").innerHTML;$replacesellonload=trim($sellonload).substring(trim($sellonload).indexOf("vsr_sku="),trim($sellonload).indexOf("; window.show_vsr_button"));sellpoint=$sellonload.replace($replacesellonload,$sellCut);}}tabcontainerElement.html($innerContent);populateTabArray();if(typeof(quickView)!="undefined"&&quickView===true){skuQuickViewLoadEvent(ivGlobal,NUM,true,false);}else{$chatContainer.html($chatContent);skuQuickViewLoadEvent(ivGlobal,NUM,false,false);$($skubannerContent).appendTo(".skuinfo1");$("#skubannerholder").removeClass("hide");}});if(typeof(quickView)=="undefined"||typeof(quickView)==undefined||quickView!==true){if(document.getElementById("shareThis")!=null){$("div#shareths").replaceWith($("div#shareThis"));}if(document.getElementById("webcolloutput")!=null){document.getElementById("webcolloutput").innerHTML=temp;}if(document.getElementById("sellpntoutput")!=null){document.getElementById("sellpntoutput").innerHTML=sellpoint;}if($("#reqrecsidebar").html()){showme("reqrecsidebar");}}if(window.ActiveXObject){if(getIEVersion()>=9){removeHashForIE9();}}}});}catch(e){}}};var xmlSkuDoc;function loadSkuXMLString(a){if(window.DOMParser&&!xmlSkuDoc){var b=new DOMParser();xmlSkuDoc=b.parseFromString(a,"text/xml");}else{if(window.ActiveXObject&&!xmlSkuDoc){xmlSkuDoc=new ActiveXObject("MSXML2.DOMDocument");xmlSkuDoc.async="false";xmlSkuDoc.loadXML(a);}}return xmlSkuDoc;}function createXMLHttpRequest(){if(window.ActiveXObject){try{return new ActiveXObject("Msxml2.DOMDocument");}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(a){}try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(a){}}try{return new XMLHttpRequest();}catch(a){}console.log("XMLHttpRequest not supported");return false;}function unencodeSkuHTMLFromResultDocument(a){a=a.replace(/&lt;/g,"<");a=a.replace(/&gt;/g,">");a=a.replace(/&amp;quot;/g,'"');a=a.replace(/&amp;reg;/g,"&reg;");if((navigator.userAgent.lastIndexOf("Chrome/")>0)||(navigator.userAgent.lastIndexOf("Safari/")>0)){a=a.replace(/%24thb%24/g,"$thb$");}return a;}function loadSkuXMLDoc(b){var a=createXMLHttpRequest();a.open("GET",b,false);a.send("");return a.responseXML;}function loadSkuXMLDocForIE(b){var a=new ActiveXObject("MSXML2.FreeThreadedDomDocument");a.async=false;a.load(b);if(a.parseError.errorCode!=0){alert("Stylesheet not loaded.\n Error in line "+a.parseError.line+" position "+a.parseError.linePos+"\nError Code: "+a.parseError.errorCode+"\nError Reason: "+a.parseError.reason+"Error Line: "+a.parseError.srcText);return(null);}return a;}function applyTransformationSku(xmlSkuObj,selectedSKU,pageName){if(window.ActiveXObject){if(skuXslLoaded==false){skuXsl=loadSkuXMLDocForIE("/office/supplies/StaplesUSB2CPAS/cat/skuset.xsl");XSLTSkuCompiled=new ActiveXObject("MSXML2.XSLTemplate");XSLTSkuCompiled.stylesheet=skuXsl.documentElement;XSLTSkuProc=XSLTSkuCompiled.createProcessor();skuXslLoaded=true;}XSLTSkuProc.input=xmlSkuObj;XSLTSkuProc.addParameter("selectedSKU",selectedSKU);XSLTSkuProc.addParameter("pageName",pageName);XSLTSkuProc.addParameter("exitURL","http://"+serverName+"/product_");if(isKiosk){XSLTSkuProc.addParameter("iskiosk","1");}XSLTSkuProc.transform();var stageElement=$("#stage");if(pageName=="quickview"){stageElement=$("#divOverlay #stage");}stageElement.empty();stageElement.html('<span style= "display:none">none</span>'+unencodeSkuHTMLFromResultDocument(XSLTSkuProc.output));var scripts=$(stageElement).find("script");for(var i=0;i<scripts.length;i++){var code="";if(scripts[i].innerHTML){code=scripts[i].innerHTML;}if(code){window.execScript(code,"JavaScript");}}}else{if(document.implementation&&document.implementation.createDocument){if(skuXslLoaded==false){skuXsl=loadSkuXMLDoc("/office/supplies/StaplesUSB2CPAS/cat/skuset.xsl");skuXsltProcessor=new XSLTProcessor();skuXsltProcessor.importStylesheet(skuXsl);skuXslLoaded=true;}skuXsltProcessor.setParameter(null,"selectedSKU",selectedSKU);skuXsltProcessor.setParameter(null,"pageName",pageName);skuXsltProcessor.setParameter(null,"exitURL","http://"+serverName+"/product_");if(isKiosk){skuXsltProcessor.setParameter(null,"iskiosk","1");}resultSkuDocument=skuXsltProcessor.transformToFragment(xmlSkuObj,document);var stageElement=$("#stage");if(pageName=="quickview"){stageElement=$("#divOverlay #stage");}stageElement.empty();stageElement.html(resultSkuDocument);stageElement.html(unencodeSkuHTMLFromResultDocument(stageElement.html()));var scripts=$(stageElement).find("script");for(var i=0;i<scripts.length;i++){var code="";if(scripts[i].innerHTML){code=scripts[i].innerHTML;}if(code){eval(code);}}}}}var tabUL;var switchtabcount=0;function removeTab(a){$("#"+a).remove();}function addTab(d,a,c,f){if(!tabUL){if(quickView){tabUL=$("#divOverlay #tabUL");}else{tabUL=$("#tabUL");}}var b=d+"_tab";var e=d+"_content";tabArray[b]=e+","+c;tabUL.append('<li id="'+b+'">'+'<a href="#'+e+'" onclick="switchtab(this,\''+a+"','"+f+"'); return false;\"><span>&nbsp;</span>"+a+"</a>"+"</li>");}function addPersonalizedToCart(url,formId){var formName=$("#"+formId)[0];var params="";var suffix="";var elementName="";for(var i=0;i<formName.elements.length;i++){elementName=formName.elements[i].name;if((elementName.indexOf("quantity_")>-1)||(elementName.indexOf("partNumber_")>-1)||(elementName.indexOf("catentryId_")>-1)||(elementName.indexOf("cmArea_")>-1)){suffix=elementName.substring((elementName.lastIndexOf("_")+1),elementName.length);var str="document."+formId+".quantity_"+suffix+".value";try{if(formName.elements[i].value!=""&&eval(str)!=""){params+="&"+elementName+"="+formName.elements[i].value;}}catch(err){}}}if(params!=""){window.location.href=url+params;}}function remotelyswitchtab(a,c,b){switchtab($("#"+a+" > a:first")[0],c,b);}function switchtab(f,h,b){var a="";if($("#divOverlay").length){a=$("#divOverlay");}else{a=$(document);}if(propertyValues.analyticsSwitch=="ON"&&switchtabcount>0){s_prodTab(h);}tabUL=a.find("#tabUL");switchtabcount++;tagElement(h,"Tabs","SKU:"+b);var k=f.parentNode;var g=tabArray[k.id].split(",");tabUL.find("li").removeClass("tabactive");a.find("div[id*='_content']").addClass("hide");a.find("div[id^='custom_'][id$='content']").addClass("hide");a.find("div.g02").addClass("hide");a.find("div.g01").addClass("hide");try{var c=document.getElementById(g[0]+"_ondemand");var j=c.innerHTML;if(c.innerHTML!=ondemandContentArray[g[0]+"_ondemand"]){c.innerHTML=ondemandContentArray[g[0]+"_ondemand"];}}catch(d){}a.find("#"+k.id).addClass("tabactive");showme(g[0]);if(g[1]=="true"){if(typeof(quickView)=="undefined"||typeof(quickView)==undefined||quickView!==true){showme("reqrecsidebar");}}else{if(g[1]!=""){showme(g[1]);}}}function setupImages(){imgArrayMax=imgArray.length;imgArrayUbound=imgArrayMax-1;counterMessage=counterMessage.replace(/\{1\}/,imgArrayMax);if(imgArrayUbound>=1){preLoad(1);}if(imgArrayUbound>=2){preLoad(imgArrayUbound);}}function preLoad(a){if(!document.getElementById("productimage-"+a)){var b=document.getElementById("productimage-0").cloneNode(false);b.src=imgPath.replace(/\{1\}/,imgArray[a]);b.id="productimage-"+a;b.className="hide";document.getElementById("productimagelink").appendChild(b);}}function displayPrice(a){$(a).parents(".pricenew").css("zIndex",8010);$(a).parents(".theprice").siblings(".mathflyout").removeClass("hide");}function hidePrice(a){$(a).parents(".pricenew").css("zIndex",0);$(a).parents(".theprice").siblings(".mathflyout").addClass("hide");}function previousImage(){currentIndex--;if(currentIndex<0){currentIndex=imgArrayUbound;}updateAndPreload(currentIndex);}function nextImage(){currentIndex++;if(currentIndex>imgArrayUbound){currentIndex=0;}updateAndPreload(currentIndex);}function updateAndPreload(a){$("#productimage img").addClass("hide");if(imgArrayUbound>0){if(a-1<0){preLoad(imgArrayUbound);}else{preLoad(a-1);}if(a+1>imgArrayUbound){preLoad(0);}else{preLoad(a+1);}}$("#productimage-"+a).removeClass("hide");$("#imagecounter").html(counterMessage.replace(/\{0\}/,a+1));}var tabArray;function populateTabArray(){var a=document.getElementById("tabData").value;var b=a.split("|");for(var d=0;d<b.length;d=d+1){var c=b[d].split("/");tabArray[c[0]]=c[1];}tabUL=$("#divOverlay #tabUL");}function compareWithSimilar(e,a,c){var b;if(c!=undefined){var d=c.parents(".skuinfo1").find("div.pimg2 img.std").attr("src");b=d.substring((1+d.lastIndexOf("/")),d.lastIndexOf("_sc7"));}else{if(typeof(imgcomp)!="undefined"){b=imgcomp;}}if(a!=undefined){window.location.href=a+"#viewDetails='compareView'&compareList=["+"'"+e+"-"+b+"'"+"]";}}function skuQuickViewLoadEvent(iv,curPartNum,quickView,onLoad){var t_qvssonload_start=(new Date()).getTime();if(!quickView){if(ivTemp==null){ivTemp=iv;}else{iv=ivTemp;}}if(typeof(iv)!="undefined"){if(iv!=undefined&&typeof(curPartNum)!="undefined"){var matchFound=false;var show=true;for(var one in iv){if(one==curPartNum){matchFound=true;}}if(matchFound){var leadTimeDesc="";if(eval("iv['"+curPartNum+"'].iv")=="1"){if(quickView){$("#divOverlay .d115").removeClass("hide");}else{$(".d115").removeClass("hide");}}else{if(quickView){$("#divOverlay .oos").removeClass("hide");}else{$(".oos").removeClass("hide");}$(".showpic").addClass("hide");if(quickView){$("#divOverlay .spic").addClass("hide");}else{$(".spic").addClass("hide");}show=false;}leadTimeDesc=eval("iv['"+curPartNum+"'].leadTimeDesc");}else{if(typeof(skuSetPNum)!="undefined"&&skuSetPNum==curPartNum){leadTimeDesc=iv.skuSetLTDesc;}}if(show){if(quickView){$("#divOverlay #stage .delinfo li.expectdel").append(leadTimeDesc);$("#divOverlay #stage .delinfo li.expectdel").removeClass("hide");}else{$("#stage .delinfo li.expectdel").append(leadTimeDesc);$("#stage .delinfo li.expectdel").removeClass("hide");}}}if(quickView){$(".quickview").find("#questionanswersnippet").addClass("hide");$(".quickview").find("#noquestionanswersnippet").addClass("hide");$(".quickview").find(".stbutton").addClass("hide");$(".quickview").find(".rvlink").addClass("hide");$(".quickview").find(".qw").removeClass("hide");$(".quickview").find("#fulldetails").removeClass("hide");$(".quickview").find(".pr-snapshot-write-review").addClass("hide");}else{$("ul#tabUL li").removeClass("hide");var mtSku=document.getElementById("matchToolSku");if(mtSku!=undefined&&mtSku.value=="false"){$("#tabcontainer").find(".cmp").removeClass("hide");}}}if(onLoad){iv.tstamp=new Date();ivGlobal=iv;if(!quickView){refreshSkuHash();}}else{$("#tabcontainer script").each(function(){eval($(this).text());});}var t_qvssonload_end=new Date().getTime();if(alertQVSSOnload){var eqvsstime=t_qvssonload_end-t_qvssonload_start;$("#debug").append("<br /> PerfQVSSOnload ="+eqvsstime);}}var hasChangeActionForSku=true;var collAttrIdRefresh;var skuidForRefresh="";function refreshSkuHash(){hashvalue=location.hash;if(hashvalue!=undefined&&hashvalue.length>1&&hashvalue.indexOf("=")!=-1){var jsonStg='"'+hashvalue.substring(1).replace(/&/g,',"');jsonStg=jsonStg.replace(/=/g,'":');var jsonHash=eval("({"+jsonStg+"})");if(jsonHash.id!=undefined&&trim(jsonHash.id)!=""){skuidForRefresh=jsonHash.id;}if(jsonHash.collAttrId!=undefined&&trim(jsonHash.collAttrId)!=""){collAttrIdRefresh=jsonHash.collAttrId;}if(window.ActiveXObject){if(getIEVersion()<9){updateTitle();}}if(skuidForRefresh.indexOf("swatch")>=0){setTimeout("SWATCH.swatchClick(skuidForRefresh,'hashChange');",1000);}else{if(skuidForRefresh.indexOf("dropdown")>=0){setTimeout("SWATCH.selectDropdown('hashChange',skuidForRefresh);",1000);}else{skuidForRefresh=getSkuSetIdFromXml();setTimeout("SWATCH.collectionSwatchClick(collAttrIdRefresh,skuidForRefresh,'0','hashChange');",1000);if(window.ActiveXObject){if(getIEVersion()>=9){if(document.title.indexOf("#collAttrId")!=-1){document.title=document.title.split("#collAttrId")[0];}}}}}}}function getSkuSetIdFromXml(){var e,c,b;loadXMLStringForSkuset();xmlSkuStrAsObj=loadSkuXMLString(xmlSkuAsString);if(window.ActiveXObject){c=getIEVersion();if(c>=9){var a=xmlSkuStrAsObj.getElementsByTagName("product");for(var d=0;d<a.length;d++){tempProdNode=a[d];if(tempProdNode.getAttribute("type")=="skuset"){b=tempProdNode;}}}else{b=xmlSkuStrAsObj.selectSingleNode('//productcatalog/product[@type="skuset"]');}e=b.getAttribute("id");}else{b=selectSingleNodeForNonIE(xmlSkuStrAsObj,'//productcatalog/product[@type="skuset"]');e=b.getAttribute("id");}return e;}function displayHash(a,c){if(c!=="hashChange"){hasChangeActionForSku=false;}var b=new Array();if(a!=undefined&&trim(a)!=""){b[b.length]="id='"+a+"'";}if(c!=="hashChange"){if(b.length>0){document.location.hash="#"+b.join("&");}}if(window.ActiveXObject){if(getIEVersion()>=9){if(document.title.indexOf("#id")!=-1){document.title=document.title.split("#id")[0];}}}}function displayHashForCollection(c,b){if(b!=="hashChange"){hasChangeActionForSku=false;}var a=new Array();if(c!=undefined&&trim(c)!=""){a[a.length]="collAttrId='"+c+"'";}if(b!=="hashChange"){if(a.length>0){document.location.hash="#"+a.join("&");}}if(window.ActiveXObject){if(getIEVersion()>=9){if(document.title.indexOf("#collAttrId")!=-1){document.title=document.title.split("#collAttrId")[0];}}}}window.onhashchange=hashChangeFuncSku;function hashChangeFuncSku(){hashvalue=location.hash;var skuid="";var collAttrId;if(hasChangeActionForSku){if(hashvalue!=undefined&&hashvalue.length>0){if(hashvalue.indexOf("=")!=-1){var jsonStg='"'+hashvalue.substring(1).replace(/&/g,',"');jsonStg=jsonStg.replace(/=/g,'":');var jsonHash=eval("({"+jsonStg+"})");if(jsonHash.id!=undefined&&trim(jsonHash.id)!=""){skuid=jsonHash.id;}if(jsonHash.collAttrId!=undefined&&trim(jsonHash.collAttrId)!=""){collAttrId=jsonHash.collAttrId;}if(skuid.indexOf("swatch")>=0){SWATCH.swatchClick(skuid,"hashChange");}else{if(skuid.indexOf("dropdown")>=0){SWATCH.selectDropdown("hashChange",skuid);}else{skuid=getSkuSetIdFromXml();SWATCH.collectionSwatchClick(collAttrId,skuid,"0","hashChange");}}}}else{if(pageId==="skuskuset"){location.reload(true);}}}else{hasChangeActionForSku=true;}}function getCollectionDetails(catEntryId,partNumber,colFlag){if(typeof(quickView)=="undefined"||typeof(quickView)==undefined||quickView!==true){if(document.getElementById("check")==null&&document.getElementById("shareThisDum")!=null&&document.getElementById("shareThis")!=null){var innerDiv=document.createElement("div");innerDiv.setAttribute("id","check");document.getElementById("shareThisDum").appendChild(innerDiv);$("div#check").replaceWith($("div#shareThis"));}}var swatchHeader=$("h5#stepone").text();var collectionChat=$("#stage #chatholder").html();var carouselPage;if($("#collection_box").length){carouselPage=$("#collection_box .perpage ul").find("li.active").text();}var t_skuclick_start=(new Date()).getTime();var methodName=arguments.callee.name;var t_displayResult_start=new Date().getTime();var taburl="/office/supplies/skuinfotabs?partNumber="+partNumber+"&catentryId="+catEntryId+"&pageName=skuskuset";taburl="http://"+serverName+taburl;var randomNumForIE=Math.floor(Math.random()*1000001);try{$.ajax({url:taburl+"&r="+randomNumForIE,type:"GET",dataType:"xml",timeout:20000,error:function(a,b,c){debugMessages.push("CollectionPage: timeout or xml parse error on "+collectionURL);$("#debug").append("<br />CollectionPage: timeout or xml parse error on "+collectionURL);if(propertyValues.ajaxLoggingSwitch=="ON"){var ajaxExecutionTime=(new Date().getTime())-t_displayResult_start;ajaxErrorURL=ajaxErrorURL+"&methodName="+methodName+"&fileName="+fileName+"&ajaxURL="+encodeURIComponent(taburl)+"&timeTaken="+ajaxExecutionTime+"&perfLogSwitch="+propertyValues.ajaxPerformanceSwitch;$.ajax({url:ajaxErrorURL,type:"POST",dataType:"xml",timeout:20000,success:function(){$("#pseudoblanket").removeClass("hide");$("#ajaxErrorMsg").removeClass("hide");$("dl.error dd").html(propertyValues.compAjaxErrorString+' <a href="javascript:getTheURLAndProceed();">Try again</a>');}});}},success:function(returnObj){var tempColl="";var sellpointColl="";var tabcontainerElement=$("#tabcontainer");if(typeof(quickView)!="undefined"&&quickView===true){tabcontainerElement=$("#divOverlay #tabcontainer");}$(returnObj).find("skuinfo").each(function(){var $innerContent=$(this).find("info").text();var $chatContent=$(this).find("chat").text();if(typeof(quickView)=="undefined"||typeof(quickView)==undefined||quickView!==true){tempColl=trim($chatContent).substring(trim($chatContent).indexOf("<script src"),trim($chatContent).indexOf("</p>"));if(document.getElementById("sellpoint")!=null){$sellpoint=$(this).find("sellpoint").text();$sellCut=trim($sellpoint).substring(trim($sellpoint).indexOf("vsr_sku="),trim($sellpoint).indexOf(";"));$sellonload=document.getElementById("sellpoint").innerHTML;$replacesellonload=trim($sellonload).substring(trim($sellonload).indexOf("vsr_sku="),trim($sellonload).indexOf("; window.show_vsr_button"));sellpointColl=$sellonload.replace($replacesellonload,$sellCut);}}tabcontainerElement.html($innerContent);populateTabArray();skuQuickViewLoadEvent(ivGlobal,partNumber,false,false);});if(typeof(quickView)=="undefined"||typeof(quickView)==undefined||quickView!==true){if(document.getElementById("shareThis")!=null){if(document.getElementById("shareths")!=null){$("div#shareths").replaceWith($("div#shareThis"));}}if(document.getElementById("webcolloutput")!=null){document.getElementById("webcolloutput").innerHTML=tempColl;}if(document.getElementById("sellpntoutput")!=null){document.getElementById("sellpntoutput").innerHTML=sellpointColl;}if($("#reqrecsidebar").html()){showme("reqrecsidebar");}}$("h5#stepone").html(swatchHeader);if(window.ActiveXObject){if(getIEVersion()>=9){if(document.title.indexOf("#collAttrId")!=-1){document.title=document.title.split("#collAttrId")[0];}}}}});}catch(e){alert("Exception"+e);}var json=eval("("+jsonvariable+")");var greyoutSwatchArr=eval("("+greyoutSwatch+")");var catIdValue=json[catEntryId];var attrValues="";var swatchAttrValues="";for(var i=0;i<catIdValue.length;i++){attrValues=attrValues+catIdValue[i];var greyoutSwatchArrId=greyoutSwatchArr[catIdValue[i]];if(typeof(greyoutSwatchArrId)=="undefined"){var selectswatch=catIdValue[i];}else{for(var j=0;j<greyoutSwatchArrId.length;j++){if(greyoutSwatchArrId[j]==selectswatch){}else{swatchAttrValues=swatchAttrValues+greyoutSwatchArrId[j];if(j!=greyoutSwatchArrId.length-1){swatchAttrValues=swatchAttrValues+"|";}}}}if(i!=catIdValue.length-1){attrValues=attrValues+"|";}}var xmlSkuStrAsObj;var isBrandPage=false;loadXMLStringForSkuset();xmlSkuStrAsObj=loadSkuXMLString(xmlSkuAsString);if(isBrandPage==undefined||isBrandPage==false){refreshSkuHeader(xmlSkuStrAsObj,attrValues,catEntryId,colFlag,carouselPage);if(eval("typeof (fnPCChangeSkuInfo) == 'function'")){fnPCChangeSkuInfo(xmlSkuStrAsObj,partNumber);}}var divId="#"+partNumber+"_"+catEntryId;$(divId).parent().addClass("selected");var t_skuclick_end=new Date().getTime();if(alertSKUClick){var etime=t_skuclick_end-t_skuclick_start;$("#debug").append("<br /> PerfSwatchClick ="+etime);}var attrvalueId=swatchAttrValues.split("|");var count=0;for(var i=0;i<attrvalueId.length;i++){var id=attrvalueId[i];if(count==0){$("div.selectSwatch ul li[class!=selected] a[rel!="+id+"]").addClass("disableSwatch").attr("href","javascript:void(0);").removeAttr("onclick");count++;}else{$("div.selectSwatch ul li[class!=selected] a[rel="+id+"]").removeClass("disableSwatch");}}if($("#tabcontainer #chatcontent").html()!=null){var chatText=$("#tabcontainer #chatcontent").html();var $chatContainer=$("#stage div#chatholder");$chatContainer.html(chatText);}else{$("#stage div#chatholder").html(collectionChat);}}function applyXslTransformationCarousel(xmlCarouselStrAsObj,selectedSWATCH){if(window.ActiveXObject){if(carouselXslLoaded==false){carouselXSL=loadSkuXMLDocForIE("/office/supplies/StaplesUSB2CPAS/cat/collection_carousel.xsl");XSLTCarouselCompiled=new ActiveXObject("MSXML2.XSLTemplate");XSLTCarouselCompiled.stylesheet=carouselXSL.documentElement;XSLTCarouselProc=XSLTCarouselCompiled.createProcessor();carouselXslLoaded=true;}XSLTCarouselProc.input=xmlCarouselStrAsObj;XSLTCarouselProc.addParameter("selectedSWATCH",selectedSWATCH);XSLTCarouselProc.transform();var stageElement=document.getElementById("collection_box");stageElement.innerHTML="";stageElement.innerHTML='<span style= "display:none">none</span>'+unencodeSkuHTMLFromResultDocument(XSLTCarouselProc.output);var scripts=stageElement.getElementsByTagName("script");for(var k=0;k<scripts.length;i++){var code="";if(scripts[k].innerHTML){code=scripts[k].innerHTML;}if(code){window.execScript(code,"JavaScript");}}}else{if(document.implementation&&document.implementation.createDocument){if(collnXslLoad==false){carouselXSL=loadSkuXMLDoc("/office/supplies/StaplesUSB2CPAS/cat/collection_carousel.xsl");collectionXsltProcessor=new XSLTProcessor();collectionXsltProcessor.importStylesheet(carouselXSL);collnXslLoad=true;}collectionXsltProcessor.setParameter(null,"selectedSWATCH",selectedSWATCH);resultCarouselDocument=collectionXsltProcessor.transformToFragment(xmlCarouselStrAsObj,document);var stageElement=document.getElementById("collection_box");stageElement.innerHTML="";stageElement.appendChild(resultCarouselDocument);stageElement.innerHTML=unencodeSkuHTMLFromResultDocument(stageElement.innerHTML);var scripts=stageElement.getElementsByTagName("script");for(var j=0;j<scripts.length;j++){var code="";if(scripts[j].innerHTML){code=scripts[j].innerHTML;}if(code){eval(code);}}}}}function applyTransformationCollection(a,c,d,e,b){refreshSkuHeader(a,c,e,b);$("#stage .delinfo li.expectdel").html(d);$("#stage .delinfo li.expectdel").removeClass("hide");}function refreshSkuHeader(xmlSkuObj,selectedSWATCH,skuSetId,colFlag,carouselPage){if(window.ActiveXObject){if(skuXslLoaded==false){skuXsl=loadSkuXMLDocForIE("/office/supplies/StaplesUSB2CPAS/cat/skuset.xsl");XSLTSkuCompiled=new ActiveXObject("MSXML2.XSLTemplate");XSLTSkuCompiled.stylesheet=skuXsl.documentElement;XSLTSkuProc=XSLTSkuCompiled.createProcessor();skuXslLoaded=true;}XSLTSkuProc.input=xmlSkuObj;XSLTSkuProc.addParameter("selectedSKU",skuSetId);XSLTSkuProc.addParameter("pageName","Collection");XSLTSkuProc.addParameter("appendPriceFlag","0");XSLTSkuProc.addParameter("selectedSWATCH",selectedSWATCH);XSLTSkuProc.addParameter("colFlag",colFlag);XSLTSkuProc.addParameter("exitURL","http://"+serverName+"/product_");XSLTSkuProc.transform();var stageElement=document.getElementById("stage");stageElement.innerHTML="";stageElement.innerHTML='<span style= "display:none">none</span>'+unencodeSkuHTMLFromResultDocument(XSLTSkuProc.output);var scripts=stageElement.getElementsByTagName("script");for(var i=0;i<scripts.length;i++){var code="";if(scripts[i].innerHTML){code=scripts[i].innerHTML;}if(code){window.execScript(code,"JavaScript");}}}else{if(document.implementation&&document.implementation.createDocument){if(skuXslLoaded==false){skuXsl=loadSkuXMLDoc("/office/supplies/StaplesUSB2CPAS/cat/skuset.xsl");skuXsltProcessor=new XSLTProcessor();skuXsltProcessor.importStylesheet(skuXsl);skuXslLoaded=true;}skuXsltProcessor.setParameter(null,"selectedSKU",skuSetId);skuXsltProcessor.setParameter(null,"pageName","Collection");skuXsltProcessor.setParameter(null,"appendPriceFlag","0");skuXsltProcessor.setParameter(null,"selectedSWATCH",selectedSWATCH);skuXsltProcessor.setParameter(null,"colFlag",colFlag);skuXsltProcessor.setParameter(null,"exitURL","http://"+serverName+"/product_");resultSkuDocument=skuXsltProcessor.transformToFragment(xmlSkuObj,document);var stageElement=document.getElementById("stage");stageElement.innerHTML="";stageElement.appendChild(resultSkuDocument);stageElement.innerHTML=unencodeSkuHTMLFromResultDocument(stageElement.innerHTML);var scripts=stageElement.getElementsByTagName("script");for(var i=0;i<scripts.length;i++){var code="";if(scripts[i].innerHTML){code=scripts[i].innerHTML;}if(code){eval(code);}}}}applyXslTransformationCarousel(xmlSkuObj,selectedSWATCH);prepCarousel("collection_box",true);if(carouselPage>1){pageChanger($("#collection_box"),carouselPage,0);}}function loadXMLStringForSkuset(){if(typeof(quickView)!="undefined"&&typeof(quickView)!=undefined&&quickView===true){if(window.ActiveXObject){xmlSkuAsString=document.getElementById("divOverlay").getElementsByTagName("xml")[0].innerHTML;}else{xmlSkuAsString=$("#divOverlay #skufilterbrowse").html();}}else{xmlSkuAsString=$("#skufilterbrowse").html();}}
