/* WSGC Copyright */
dojo.provide("wsgc");if(!dojo._hasResource["dojo.regexp"]){dojo._hasResource["dojo.regexp"]=true;dojo.provide("dojo.regexp");dojo.regexp.escapeString=function(_1,_2){return _1.replace(/([\.$?*!=:|{}\(\)\[\]\\\/^])/g,function(ch){if(_2&&_2.indexOf(ch)!=-1){return ch;}return "\\"+ch;});};dojo.regexp.buildGroupRE=function(_4,re,_6){if(!(_4 instanceof Array)){return re(_4);}var b=[];for(var i=0;i<_4.length;i++){b.push(re(_4[i]));}return dojo.regexp.group(b.join("|"),_6);};dojo.regexp.group=function(_9,_a){return "("+(_a?"?:":"")+_9+")";};}if(!dojo._hasResource["dojo.cookie"]){dojo._hasResource["dojo.cookie"]=true;dojo.provide("dojo.cookie");dojo.cookie=function(_b,_c,_d){var c=document.cookie;if(arguments.length==1){var _f=c.match(new RegExp("(?:^|; )"+dojo.regexp.escapeString(_b)+"=([^;]*)"));return _f?decodeURIComponent(_f[1]):undefined;}else{_d=_d||{};var exp=_d.expires;if(typeof exp=="number"){var d=new Date();d.setTime(d.getTime()+exp*24*60*60*1000);exp=_d.expires=d;}if(exp&&exp.toUTCString){_d.expires=exp.toUTCString();}_c=encodeURIComponent(_c);var _12=_b+"="+_c,_13;for(_13 in _d){_12+="; "+_13;var _14=_d[_13];if(_14!==true){_12+="="+_14;}}document.cookie=_12;}};dojo.cookie.isSupported=function(){if(!("cookieEnabled" in navigator)){this("__djCookieTest__","CookiesAllowed");navigator.cookieEnabled=this("__djCookieTest__")=="CookiesAllowed";if(navigator.cookieEnabled){this("__djCookieTest__","",{expires:-1});}}return navigator.cookieEnabled;};}if(!dojo._hasResource["wsgc.js.Utils"]){dojo._hasResource["wsgc.js.Utils"]=true;dojo.provide("wsgc.js.Utils");dojo.declare("wsgc.js.Utils",null,{constructor:function(_15,_16){this._savedCartCookie=_15;this._sessionCartCookie=_16;this._registerSearchFieldEvents();this._registerNavHoverEventsForIE();this._registerPopupNewWindowEvents();this._scrollToPaymentPageErrors();this._registerSVCApply();this._registerCreditCardFieldEvents();this._registerPopulateShippingFromBilling();this._registerChangeShipToEvents();this._registerInterstitialEvents();this._setBasketCount();this._registerPlaceOrder();this._registerSVCLRC();this._emailAFriendPreview();dojo.query(".forgotPassword").forEach(dojo.hitch(this,function(_17){dojo.connect(_17,"onclick",this,"handleForgotPasswordClick");}));dojo.connect(dojo.byId("cartForm"),"onsubmit",function(evt){dojo.query(".delete-item").forEach("item.disabled = true");return true;});},DEFAULT_SEARCH_TEXT:"keyword or item #",POPUP_DEFAULT_HEIGHT:460,POPUP_DEFAULT_WIDTH:785,POPUP_DEFAULT_RESIZE:1,POPUP_DEFAULT_NAME:"AppPopup",_savedCartCookie:"",_sessionCartCookie:"",_setBasketCount:function(){var _19=dojo.cookie(this._sessionCartCookie.toUpperCase());if(typeof _19=="undefined"){_19=dojo.cookie(this._savedCartCookie.toUpperCase());}if((typeof _19=="undefined")||(_19.split("|").length<4)){return;}var _1a=_19.split("|")[3];if(dojo.byId("cart-count")){if(_1a!=="0"){dojo.byId("cart-count").innerHTML="("+_1a+")";}else{dojo.byId("cart-count").innerHTML="";}}},_registerSearchFieldEvents:function(){var _1b=dojo.byId("search-field");if(_1b){dojo.connect(_1b,"onfocus",this,function(evt){if(evt.currentTarget.value===this.DEFAULT_SEARCH_TEXT){evt.currentTarget.value="";}});dojo.connect(_1b,"onblur",this,function(evt){if(evt.currentTarget.value==""){evt.currentTarget.value=this.DEFAULT_SEARCH_TEXT;}});}},_registerInterstitialEvents:function(){var _1e=null;if(dojo.query("form.interstitialForm #btn-edit").length>0){_1e=dojo.query("form.interstitialForm #btn-edit")[0];dojo.connect(_1e,"onclick",this,"_handleInterstitialEditClick");}if(dojo.query("form.interstitialForm #btn-continue").length>0){_1e=dojo.query("form.interstitialForm #btn-continue")[0];dojo.connect(_1e,"onclick",this,"_handleInterstitialContinueClick");}},_registerNavHoverEventsForIE:function(){if(dojo.isIE==6){dojo.query("#nav-container li[class~=\"dropDown\"]").forEach(function(_1f){dojo.connect(_1f,"onmouseover",function(evt){dojo.addClass(evt.currentTarget,"dropDownHover");if(!dojo.byId("birthdate.ageValidationBirthmonth")){return;}dojo.style(dojo.byId("birthdate.ageValidationBirthmonth"),"visibility","hidden");dojo.style(dojo.byId("birthdate.ageValidationBirthday"),"visibility","hidden");});dojo.connect(_1f,"onmouseout",function(evt){dojo.removeClass(evt.currentTarget,"dropDownHover");if(!dojo.byId("birthdate.ageValidationBirthmonth")){return;}dojo.style(dojo.byId("birthdate.ageValidationBirthmonth"),"visibility","");dojo.style(dojo.byId("birthdate.ageValidationBirthday"),"visibility","");});});}},_registerPopupNewWindowEvents:function(){dojo.query(".popup").forEach(dojo.hitch(this,function(_22){dojo.connect(_22,"onclick",this,function(evt){evt.preventDefault();evt.stopPropagation();var _24=dojo.attr(evt.currentTarget,"rel");var _25;var _26,_27,_28,_29;try{_25=dojo.fromJson(_24);_26=(_25&&typeof _25.dim!=="undefined"&&typeof _25.dim.height!=="undefined"&&_25.dim.height)?_25.dim.height:this.POPUP_DEFAULT_HEIGHT;_27=(_25&&typeof _25.dim!=="undefined"&&typeof _25.dim.width!=="undefined"&&_25.dim.width)?_25.dim.width:this.POPUP_DEFAULT_WIDTH;_28=(_25&&typeof _25.dim!=="undefined"&&typeof _25.dim.resize!=="undefined"&&_25.dim.resize)?_25.dim.resize:this.POPUP_DEFAULT_RESIZE;_29=(_25&&typeof _25.name!=="undefined"!=="undefined"&&_25.name)?_25.name:this.POPUP_DEFAULT_NAME;}catch(e){_26=this.POPUP_DEFAULT_HEIGHT;_27=this.POPUP_DEFAULT_WIDTH;_28=this.POPUP_DEFAULT_RESIZE;_29=this.POPUP_DEFAULT_NAME;}var url=evt.currentTarget.href;var _2b="toolbar=no,location=no,directories=no,scrollbars=1,resizable="+_28+",height="+_26+",width="+_27+",screenX=4,screenY=4,top=4,left=4";var win=window.open(url,_29,_2b);win.focus();});}));dojo.query(".newWindow").forEach(function(_2d){dojo.connect(_2d,"onclick",this,function(evt){evt.preventDefault();evt.stopPropagation();var _2f=dojo.attr(evt.currentTarget,"rel");var _30;var _31;try{_30=dojo.fromJson(_2f);_31=(_30&&typeof _30.name!=="undefined"!=="undefined"&&_30.name)?_30.name:this.POPUP_DEFAULT_NAME;}catch(e){_31=this.POPUP_DEFAULT_NAME;}var url=evt.currentTarget.href;var _33="toolbar=yes,location=yes,directories=no,scrollbars=1,resizable=1";var win=window.open(url,_31,_33);if(window.focus){win.focus();}});},this);dojo.query(".close").forEach(function(_35){dojo.connect(_35,"onclick",function(evt){evt.preventDefault();evt.stopPropagation();window.close();});});dojo.query(".closeAndContinue").forEach(function(_37){dojo.connect(_37,"onclick",this,"_newParentWindow");},this);dojo.query(".driveParent").forEach(function(_38){dojo.connect(_38,"onclick",this,"_redirectParent");},this);dojo.query(".print").forEach(function(_39){dojo.connect(_39,"onclick",function(evt){evt.preventDefault();evt.stopPropagation();window.print();});});dojo.query(".rollover").forEach(function(_3b){dojo.connect(_3b,"onmouseover",function(evt){var _3d=evt.currentTarget.src.replace("_off","_on");evt.currentTarget.src=_3d;});dojo.connect(_3b,"onmouseout",function(evt){var _3f=evt.currentTarget.src.replace("_on","_off");evt.currentTarget.src=_3f;});dojo.connect(_3b,"onfocus",function(evt){var _41=evt.currentTarget.src.replace("_off","_on");evt.currentTarget.src=_41;});dojo.connect(_3b,"onblur",function(evt){var _43=evt.currentTarget.src.replace("_on","_off");evt.currentTarget.src=_43;});});dojo.query(".delete-item").forEach(function(_44){dojo.connect(_44,"onclick",function(evt){var _46=_44.name;document.cartForm[_46].value="true";});});dojo.query(".checkoutButton").forEach(function(_47){dojo.connect(_47,"onclick",function(evt){dojo.stopEvent(evt);dojo.byId("checkout").value="true";dojo.byId("cartForm").submit();});});},_registerChangeShipToEvents:function(){var _49=dojo.byId("shipToChanged");if(!_49){return;}opener.location="/shoppingcart/";opener.location.reload(true);window.close();},_registerSVCApply:function(){var _4a=dojo.byId("applysvc");if(!_4a){return;}dojo.connect(_4a,"onclick",function(evt){var _4c=dojo.byId("svcApply");_4c.value="yes";});},_registerPlaceOrder:function(){var _4d=dojo.byId("placeOrderButton");if(!_4d){return;}dojo.connect(_4d,"onclick",function(evt){dojo.byId("placeOrder").value="yes";});},_scrollToPaymentPageErrors:function(){var _4f=dojo.byId("paymentInformation");if(!_4f){return;}this.deferredPayment();var _50=dojo.byId("svcError");var _51=dojo.byId("discountsApplied");var _52=dojo.byId("ccError");if(_50){if(dojo.query(".gift-cards-and-help").length>0){dojo.query(".gift-cards-and-help")[0].scrollIntoView(true);}}else{if(_52){if(dojo.query(".payment-information-block").length>0){dojo.query(".payment-information-block")[0].scrollIntoView(true);}}else{if(_51){if(dojo.query(".gift-cards-and-help").length>0){dojo.query(".gift-cards-and-help")[0].scrollIntoView(true);}}}}var _53=dojo.byId("creditCard.payType");if(_53.value==8){dojo.attr("creditCard.cardExpMonth","disabled",true);dojo.attr("creditCard.cardExpYear","disabled",true);dojo.attr("creditCard.cardVerificationNumber","disabled",true);}},_registerCreditCardFieldEvents:function(){var _54=dojo.byId("creditCard.payType");if(!_54){return;}dojo.connect(_54,"onchange",dojo.hitch(this,function(evt){var _56=evt.target.value;var _57=dojo.byId("creditCard.cardExpMonth");var _58=dojo.byId("creditCard.cardExpYear");var _59=dojo.byId("creditCard.cardVerificationNumber");var _5a=dojo.byId("allowZeroExp");if(_56==="8"){_57.selectedIndex=0;dojo.attr(_57,"disabled",true);_58.selectedIndex=0;dojo.attr(_58,"disabled",true);dojo.attr(_59,"disabled",true);_5a.value="Y";}else{dojo.attr(_57,"disabled",false);dojo.attr(_58,"disabled",false);dojo.attr(_59,"disabled",false);_5a.value="N";}this.deferredPayment();}));},_registerPopulateShippingFromBilling:function(){var _5b=dojo.byId("applyBillingAddtoShipping");if(_5b){dojo.connect(_5b,"onclick",function(evt){var _5d=evt.target.checked;if(_5d){dojo.attr("shiptoAddress.fullName",{"value":dojo.byId("billtoAddress.fullName").value,"disabled":"disabled"});dojo.attr("shiptoAddress.addrLine1",{"value":dojo.byId("billtoAddress.addrLine1").value,"disabled":"disabled"});dojo.attr("shiptoAddress.addrLine2",{"value":dojo.byId("billtoAddress.addrLine2").value,"disabled":"disabled"});dojo.attr("shiptoAddress.city",{"value":dojo.byId("billtoAddress.city").value,"disabled":"disabled"});document.getElementById("shiptoAddress.state").value=document.getElementById("billtoAddress.state").value;dojo.byId("shiptoAddress.state").selectedIndex=dojo.byId("billtoAddress.state").selectedIndex;dojo.attr("shiptoAddress.state","disabled","true");dojo.attr("shiptoAddress.zip",{"value":dojo.byId("billtoAddress.zip").value,"disabled":"disabled"});dojo.attr("shiptoAddress.dayPhone",{"value":dojo.byId("billtoAddress.dayPhone").value,"disabled":"disabled"});dojo.attr("shiptoAddress.eveningPhone",{"value":dojo.byId("billtoAddress.eveningPhone").value,"disabled":"disabled"});dojo.query("#ship-account-info input, #ship-account-info select").addClass("disabled");}else{dojo.query("#ship-account-info input, #ship-account-info select").forEach(function(_5e){_5e.removeAttribute("disabled");});dojo.query("#ship-account-info input, #ship-account-info select").removeClass("disabled");}});if(dojo.attr(_5b,"checked")===true){dojo.query("#ship-account-info input, #ship-account-info select").forEach(function(_5f){_5f.setAttribute("disabled","disabled");});}}},handleForgotPasswordClick:function(evt){dojo.stopEvent(evt);var _61=dojo.byId("loginForm");if(_61){_61.action=secureAppUrl+"account/password-request-confirmation.html";_61.submit();}},_handleInterstitialEditClick:function(evt){dojo.stopEvent(evt);dojo.byId("isEditMode").value="1";this._postInterstitialForm();},_handleInterstitialContinueClick:function(evt){dojo.stopEvent(evt);dojo.byId("isEditMode").value="0";this._postInterstitialForm();},_postInterstitialForm:function(){if(dojo.query(".interstitialForm").length>0){var _64=dojo.query(".interstitialForm")[0];_64.submit();}},_forwardToExternalSite:function(win,url){if(win){win.close();}var _67=window.open(url);},_registerSVCLRC:function(){var _68="";dojo.query(".removeSVCLRCButton").forEach(function(_69){dojo.connect(_69,"onclick",function(evt){if(!dojo.attr(evt.currentTarget,"svcnumber")){return false;}_68=dojo.attr(evt.currentTarget,"svcnumber");dojo.byId("removeSvcLrc").value=_68;return true;});});},_newParentWindow:function(evt){var win;var url=evt.currentTarget.href;if(dojo.isFF){try{if(dojo.exists("window.opener.utils._forwardToExternalSite")){window.opener.utils._forwardToExternalSite(window,url);}else{win=window.open(url);window.close();}}catch(e){win=window.open(url);window.close();}}else{win=window.open(url);window.close();}},_redirectParent:function(evt){evt.preventDefault();evt.stopPropagation();var url=evt.currentTarget.href;if(dojo.exists("window.opener")){window.opener.location.href=url;if(dojo.exists("window.opener.focus")){window.opener.focus();}}else{var win=window.open(url);window.close();}window.close();},deferredPayment:function(){var _71=dojo.byId("creditCard.payType").value;var _72=dojo.byId("deferredPayment");if(_72){var _73=dojo.byId("deferPayments");var _74=_73.value.split(",");var _75=dojo.byId("creditCard.payType").options;var _76=dojo.byId("deferredCardType");for(var i=0;i<_74.length;i++){if(_71===_74[i]){for(var j=0;j<_75.length;j++){if(_75[j].value==_71){_76.innerHTML=_75[j].text;}}dojo.style(_72,{"display":"block"});break;}else{dojo.style(_72,{"display":"none"});}}}},_emailAFriendPreview:function(){var _79=dojo.byId("emailAFriend");if(!_79){return;}var _7a=dojo.byId("btn-preview");dojo.connect(_7a,"onclick",function(evt){dojo.byId("preview").value="true";});}});}if(!dojo._hasResource["dojox.xml.parser"]){dojo._hasResource["dojox.xml.parser"]=true;dojo.provide("dojox.xml.parser");dojox.xml.parser.parse=function(str){if(dojo.isIE){var _7d=new ActiveXObject("Microsoft.XMLDOM");_7d.async="false";_7d.loadXML(str);var pe=_7d.parseError;if(pe.errorCode!==0){throw new Error("Line: "+pe.line+"\n"+"Col: "+pe.linepos+"\n"+"Reason: "+pe.reason+"\n"+"Error Code: "+pe.errorCode+"\n"+"Source: "+pe.srcText);}return _7d;}else{var _7f=new DOMParser();var _7d=_7f.parseFromString(str,"text/xml");var de=_7d.documentElement;var _81="http://www.mozilla.org/newlayout/xml/parsererror.xml";if(de.nodeName=="parsererror"&&de.namespaceURI==_81){var _82=de.getElementsByTagNameNS(_81,"sourcetext")[0];if(!_82){_82=_82.firstChild.data;}throw new Error("Error parsing text "+_7d.documentElement.firstChild.data+" \n"+_82);}return _7d;}};}if(!dojo._hasResource["dojox.embed.Flash"]){dojo._hasResource["dojox.embed.Flash"]=true;dojo.provide("dojox.embed.Flash");(function(){var _83,_84;var _85="dojox-embed-flash-",_86=0;function prep(_87){_87=dojo.mixin({expressInstall:false,width:320,height:240,style:null,redirect:null},_87||{});if(!("path" in _87)){console.error("dojox.embed.Flash(ctor):: no path reference to a Flash movie was provided.");return null;}if(!("id" in _87)){_87.id=(_85+_86++);}return _87;};if(dojo.isIE){_83=function(_88){_88=prep(_88);if(!_88){return null;}var _89=_88.path;if(_88.vars){var a=[];for(var p in _88.vars){a.push(p+"="+_88.vars[p]);}_89+=((_89.indexOf("?")==-1)?"?":"&")+a.join("&");}var s="<object id=\""+_88.id+"\" "+"classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "+"width=\""+_88.width+"\" "+"height=\""+_88.height+"\""+((_88.style)?" style=\""+_88.style+"\"":"")+">"+"<param name=\"movie\" value=\""+_89+"\" />";if(_88.params){for(var p in _88.params){s+="<param name=\""+p+"\" value=\""+_88.params[p]+"\" />";}}s+="</object>";return {id:_88.id,markup:s};};_84=(function(){var _8d=10,_8e=null;while(!_8e&&_8d>6){try{_8e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_8d--);}catch(e){}}if(_8e){var v=_8e.GetVariable("$version").split(" ")[1].split(",");return {major:(v[0]!=null)?parseInt(v[0]):0,minor:(v[1]!=null)?parseInt(v[1]):0,rev:(v[2]!=null)?parseInt(v[2]):0};}return {major:0,minor:0,rev:0};})();}else{_83=function(_90){_90=prep(_90);if(!_90){return null;}var _91=_90.path;if(_90.vars){var a=[];for(var p in _90.vars){a.push(p+"="+_90.vars[p]);}_91+=((_91.indexOf("?")==-1)?"?":"&")+a.join("&");}var s="<embed type=\"application/x-shockwave-flash\" "+"src=\""+_91+"\" "+"id=\""+_90.id+"\" "+"name=\""+_90.id+"\" "+"width=\""+_90.width+"\" "+"height=\""+_90.height+"\""+((_90.style)?" style=\""+_90.style+"\" ":"")+"swLiveConnect=\"true\" "+"allowScriptAccess=\"always\" "+"pluginspage=\""+window.location.protocol+"//www.adobe.com/go/getflashplayer\" ";if(_90.params){for(var p in _90.params){s+=" "+p+"=\""+_90.params[p]+"\"";}}s+=" />";return {id:_90.id,markup:s};};_84=(function(){var _95=navigator.plugins["Shockwave Flash"];if(_95&&_95.description){var v=_95.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split(".");return {major:(v[0]!=null)?parseInt(v[0]):0,minor:(v[1]!=null)?parseInt(v[1]):0,rev:(v[2]!=null)?parseInt(v[2]):0};}return {major:0,minor:0,rev:0};})();}dojox.embed.Flash=function(_97,_98){this.id=null;this.movie=null;this.domNode=null;if(_97&&_98){this.init(_97,_98);}};dojo.extend(dojox.embed.Flash,{onReady:function(_99){},onLoad:function(_9a){},init:function(_9b,_9c){this.destroy();_9c=_9c||this.domNode;if(!_9c){throw new Error("dojox.embed.Flash: no domNode reference has been passed.");}this._poller=null;this._pollCount=0,this._pollMax=250;if(dojox.embed.Flash.initialized&&dojox.embed.Flash.available!==0){this.id=dojox.embed.Flash.place(_9b,_9c);this.domNode=_9c;setTimeout(dojo.hitch(this,function(){this.movie=(dojo.isIE)?dojo.byId(this.id):document[this.id];this.onReady(this.movie);this._poller=setInterval(dojo.hitch(this,function(){if(this.movie&&typeof this.movie.PercentLoaded==="function"&&(this.movie.PercentLoaded()==100||this._pollCount++>this._pollMax)){clearInterval(this._poller);delete this._poller;delete this._pollCount;delete this._pollMax;this.onLoad(this.movie);}}),10);}),1);}else{dojo.query("img",dojo.byId(this.domNode)).forEach("dojo.style(item, 'display', 'inline')");}},_destroy:function(){this.domNode.removeChild(this.movie);this.id=this.movie=this.domNode=null;},destroy:function(){if(!this.movie){return;}var _9d=dojo.mixin({},{id:true,movie:true,domNode:true,onReady:true,onLoad:true});for(var p in this){if(!_9d[p]){delete this[p];}}if(this._poller){dojo.connect(this,"onLoad",this,"_destroy");}else{this._destroy();}}});dojo.mixin(dojox.embed.Flash,{minSupported:8,available:_84.major,supported:(_84.major>=8),version:_84,initialized:false,onInitialize:function(){dojox.embed.Flash.initialized=true;},__ie_markup__:function(_9f){return _83(_9f);},proxy:function(obj,_a1){dojo.forEach((dojo.isArray(_a1)?_a1:[_a1]),function(_a2){this[_a2]=dojo.hitch(this,function(){return (function(){return eval(this.movie.CallFunction("<invoke name=\""+_a2+"\" returntype=\"javascript\">"+"<arguments>"+dojo.map(arguments,function(_a3){return __flash__toXML(_a3);}).join("")+"</arguments>"+"</invoke>"));}).apply(this,arguments||[]);});},obj);}});if(dojo.isIE){dojox.embed.Flash.place=function(_a4,_a5){var o=dojox.embed.Flash.__ie_markup__(_a4);_a5=dojo.byId(_a5);if(!_a5){_a5=dojo.doc.createElement("div");_a5.id=o.id+"-container";dojo.body().appendChild(_a5);}if(o){_a5.innerHTML=o.markup;return o.id;}return null;};dojox.embed.Flash.onInitialize();}else{dojox.embed.Flash.place=function(_a7,_a8){var o=_83(_a7);_a8=dojo.byId(_a8);if(!_a8){_a8=dojo.doc.createElement("div");_a8.id=o.id+"-container";dojo.body().appendChild(_a8);}if(o){_a8.innerHTML=o.markup;return o.id;}return null;};dojox.embed.Flash.onInitialize();}})();}if(!dojo._hasResource["wsgc.js.MetricsWrapper"]){dojo._hasResource["wsgc.js.MetricsWrapper"]=true;dojo.provide("wsgc.js.MetricsWrapper");dojo.declare("wsgc.js.MetricsWrapper",null,{constructor:function(){dojo.query("[metrics]").forEach(dojo.hitch(this,function(_aa){dojo.connect(_aa,"onclick",this,"_executeMetricsCall");}));},_executeMetricsCall:function(evt){try{var _ac=dojo.attr(evt.currentTarget,"metrics");eval(_ac);}catch(e){console.debug("Metrics call failed.");}}});}
