dojo.registerModulePath("wc","../wc");dojo.require("dojo.number");dojo.require("dojo.has");dojo.require("wc.render.common");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("dijit.layout.TabContainer");dojo.require("dijit.layout.ContentPane");dojo.require("dijit.Tooltip");dojo.require("wc.widget.WCDropDownButton");dojo.require("dijit.Dialog");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");dojo.require("dojo.topic");dojo.subscribe("ajaxRequestInitiated","incrementNumAjaxRequest");dojo.subscribe("ajaxRequestCompleted","decrementNumAjaxRequest");dojo.subscribe("ajaxRequestCompleted","initializeInactivityWarning");var showDropdown=false;var dropDownDlg=null;var productAddedDropDownDlg=null;var originalMiniCartWidth=0;var isIE=(document.all)?true:false;var correctBrowser=false;var requestSubmitted=true;var currentId="";var numAjaxRequests=0;var widgetsList=[];var tabPressed=false;var currentPopup='';var android=null;var ios=null;function getAbsoluteURL(forceNonSSL){if(absoluteURL!=""){var currentURL=document.URL;var currentProtocol="";var forceNonSSL=forceNonSSL?forceNonSSL:false;if(currentURL.indexOf("://")!=-1){currentProtocol=forceNonSSL?"http":currentURL.substring(0,currentURL.indexOf("://"));}
var savedProtocol="";if(absoluteURL.indexOf("://")!=-1){savedProtocol=absoluteURL.substring(0,absoluteURL.indexOf("://"));}
if(currentProtocol!=savedProtocol){absoluteURL=currentProtocol+absoluteURL.substring(absoluteURL.indexOf("://"));}}
return absoluteURL;}
function getImageDirectoryPath(){return imageDirectoryPath;}
function getStyleDirectoryPath(){return styleDirectoryPath;}
function collectorsEmailsignUp(siteId){if(sfIndicator=="HWC"){var emailId=document.getElementById('emailSignupNewsletterEmail');if(emailId&&emailId.value!=''){client.SaveEmailSignup(emailId.value);}else{document.getElementById('emailError').innerHTML="The Email address field cannot be empty.";}}
else{var emailId=document.getElementById('collectorsEmailSignupNewsletterEmail');if(emailId&&emailId.value!=''){if(siteId!=null&&siteId!='')
client.SaveEmailSignup(emailId.value,siteId);else
client.SaveEmailSignup(emailId.value);}else{document.getElementById('emailError').innerHTML="The Email address field cannot be empty.";}}}
function initializeInactivityWarning(){if(storeUserType!="G"&&inactivityTimeout!=0&&document.cookie.indexOf("WC_USERACTIVITY_")>0){if(inactivityTimeoutTracker!=null){clearTimeout(inactivityTimeoutTracker);}
inactivityTimeoutTracker=setTimeout(showInactivityWarningDialog,inactivityTimeout-inactivityWarningDialogBuffer);}}
function showInactivityWarningDialog(){dijit.byId("inactivityWarningPopup").show();if(dialogTimeoutTracker!=null){clearTimeout(dialogTimeoutTracker);}
dialogTimeoutTracker=setTimeout(hideInactivityWarningDialog,inactivityWarningDialogDisplayTimer);}
function hideInactivityWarningDialog(){dijit.byId("inactivityWarningPopup").hide();if(storeUserType!="G"){logout('Logoff?catalogId='+WCParamJS.catalogId+'&langId='+WCParamJS.langId+'&storeId='+WCParamJS.storeId+'&deleteCartCookie=true&URL=LogonForm');}}
function resetServerInactivity(){dojo.xhrPost({url:getAbsoluteURL()+"Ping",handleAs:"json-comment-filtered",content:null,service:this,load:function(serviceResponse,ioArgs){if(serviceResponse.success){initializeInactivityWarning();}else{console.error("Ping service failed");}},error:function(errObj,ioArgs){console.error("Ping service failed");}});}
function byId(r){return document.getElementById(r);}
function focusSetter(){if(dojo.byId("MiniCartFocusReceiver1"))
dojo.byId("MiniCartFocusReceiver1").focus();else
dojo.byId("MiniCartFocusReceiver2").focus();}
function determineFocus(event){if(event.shiftKey&&event.keyCode==dojo.keys.TAB)
{if(event.srcElement)
{if(event.srcElement.id=="MiniCartFocusReceiver1")
{if(dojo.byId("WC_MiniShopCartDisplay_link_5"))
{dojo.byId("WC_MiniShopCartDisplay_link_5").focus();}
dojo.stopEvent(event);}
else if(event.srcElement.id=="MiniCartFocusReceiver2")
{dojo.byId("MiniCartFocusReceiver2").focus();dojo.stopEvent(event);}}
else
{if(event.target.id=="MiniCartFocusReceiver1")
{if(dojo.byId("WC_MiniShopCartDisplay_link_5"))
{dojo.byId("WC_MiniShopCartDisplay_link_5").focus();}
dojo.stopEvent(event);}
else if(event.target.id=="MiniCartFocusReceiver2")
{dojo.byId("MiniCartFocusReceiver2").focus();dojo.stopEvent(event);}}}}
function destroyDialog(contentId){if(contentId==undefined){contentId='quick_cart_container';}
dojo.query('.dijitDialog',document).forEach(function(tag){if(dijit.byNode(tag).id==contentId)
dijit.byNode(tag).destroyRecursive();});if(contentId!=undefined&&contentId=='quick_cart_container'){dropDownDlg=null;}else{productAddedDropDownDlg=null;}}
function hideUnderlayWrapper(){dojo.query('.dijitDialogUnderlayWrapper',document).forEach(function(tag){tag.style.display='none';});}
function loadLink(url){document.location.href=url;}
function clearSearchField(){searchText=document.getElementById("SimpleSearchForm_SearchTerm").value;if(searchText==document.getElementById("searchTextHolder").innerHTML){document.getElementById("SimpleSearchForm_SearchTerm").value="";}
else{document.getElementById("SimpleSearchForm_SearchTerm").select();showAutoSuggestIfResults();autoSuggestHover=false;}}
function fillSearchField(){if(document.getElementById("SimpleSearchForm_SearchTerm").value==""){document.getElementById("SimpleSearchForm_SearchTerm").className="search_input gray_color";document.getElementById("SimpleSearchForm_SearchTerm").value=document.getElementById("searchTextHolder").innerHTML;}
if(!autoSuggestHover){showAutoSuggest(false);}}
function showDropDownMenu(){var showMenu=document.getElementById("header_menu_dropdown");if(document.getElementById("header_menu_dropdown")!=null&&document.getElementById("header_menu_dropdown")!='undefined'){showMenu.style.display="block";}
if(document.getElementById("outerCartContainer")!=null&&document.getElementById("outerCartContainer")!='undefined'){var outershopcart=document.getElementById("outerCartContainer");outershopcart.style.display="block";}}
function initShopcartTarget(){dojo.subscribe("/dnd/drop",function(source,nodes,copy,target){if(source!=target){target.deleteSelectedNodes();}
var actionListScroll=new popupActionProperties();actionListScroll.showProductCompare=showProductCompare;if(target.parent.id=='miniShopCart_dndTarget'){var indexOfIdentifier=source.parent.id.indexOf("_",0);if(indexOfIdentifier>=0){source.parent.id=source.parent.id.substring(indexOfIdentifier+1);}
if(source.node.getAttribute('dndType')=='item'||source.node.getAttribute('dndType')=='package'){categoryDisplayJS.AddItem2ShopCartAjax(source.parent.id,1);}else if(source.node.getAttribute('dndType')=='product'||source.node.getAttribute('dndType')=='bundle'){showPopup(source.parent.id,function(e){return e;},'miniShopCart_dndTarget',null,actionListScroll);}}});}
function initDiscountDetails(){if(document.getElementById("discountDetailsSection")!=null){document.getElementById("discountDetailsSection").style.display="block";}}
function cursor_wait(checkForOpera){var showPopup=true;if(checkForOpera==true){if(dojo.isOpera>0){showPopup=false;}}
if(showPopup){setTimeout('showProgressBar()',500);}}
function showProgressBar(){if(!requestSubmitted){return;}
displayProgressBar();}
function displayProgressBar(){var dialog=dijit.byId('progress_bar_dialog');if(dialog!=null){dialog.closeButtonNode.style.display='none';var progressBar=document.getElementById('progress_bar');progressBar.style.display='block';if(this.currentId!=""){var element=document.getElementById(this.currentId);var pos=dijit.placeOnScreenAroundElement(progressBar,element,{'TR':'TL'});}else{dialog.containerNode.innerHTML=="";progressBar.style.left='';progressBar.style.top='';dialog.containerNode.appendChild(progressBar);dialog.show();}
setTimeout("cursor_clear()",1800000);}}
function setCurrentId(id){if(!requestSubmitted&&this.currentId==""){this.currentId=id;}}
function trim(inword)
{word=inword.toString();var i=0;var j=word.length-1;while(word.charAt(i)==" ")i++;while(word.charAt(j)==" ")j=j-1;if(i>j){return word.substring(i,i);}else{return word.substring(i,j+1);}}
function cursor_clear(){requestSubmitted=false;dojo.topic.publish("requestSubmittedChanged",requestSubmitted);var dialog=dijit.byId('progress_bar_dialog');var progressBar=document.getElementById('progress_bar');if(dialog!=null){if(progressBar!=null){progressBar.style.display='none';}
dialog.hide();this.currentId="";}}
function submitRequest(){if(!requestSubmitted){requestSubmitted=true;dojo.topic.publish("requestSubmittedChanged",requestSubmitted);return true;}
return false;}
function resetRequest(){requestSubmitted=false;dojo.topic.publish("requestSubmittedChanged",requestSubmitted);}
function setPageLocation(newPageLink){if(!submitRequest()){return;}
document.location.href=newPageLink;}
function submitSpecifiedForm(form){if(!submitRequest()){return;}
console.debug("form.action == "+form.action);processAndSubmitForm(form);}
function parseWidget(id)
{}
function parseAllWidgets(){for(var i=0;i<widgetsList.length;i++){parseWidget(widgetsList[i]);}}
function addToWidgetsList(widgetId){widgetsList.push(widgetId);}
function parseWCCEAWidget(id)
{var node;var widget=ceadijit.byId(id);if(widget==null||widget==undefined)
{if(id==null||id==undefined)
{node=ceadojo.body();}
else
{node=ceadojo.byId(id);}
if(node!=null&&node!=undefined)
{if(node.getAttribute("ceadojoType")!=null&&node.getAttribute("ceadojoType")!=undefined)
{ceadojo.parser.instantiate([node]);}
else
{ceadojo.parser.parse(node);}}}}
function parseHeader(id)
{var node=dojo.byId("progress_bar_dialog");var showMenu=document.getElementById("header_menu_loaded");var hideMenu=document.getElementById("header_menu_overlay");if(currentId.length==0&&document.getElementById("header_menu_loaded")!=null&&document.getElementById("header_menu_loaded")!='undefined'&&document.getElementById("header_menu_overlay")!=null&&document.getElementById("header_menu_overlay")!='undefined'&&document.getElementById("header_menu_loaded").style.display=='none')
{setCurrentId((id!=null&&id!=undefined)?id:hideMenu.id);submitRequest();cursor_wait();hideMenu.style.display="none";parseWidget("header_menu_loaded");showMenu.style.display="block";cursor_clear();try{if(window.top._ceaCollabDialog!=undefined||window.top._ceaCollabDialog!=null){dijit.registry.byClass("wc.widget.WCDropDownButton").forEach(function(w){dojo.connect(w,'_onDropDownClick',dojo.hitch(window.top._ceaCollabDialog,"topCategoryClicked",w.getURL()));dojo.connect(w,'onKeyPress',window.top._ceaCollabDialog,function(e){if(e.keyCode==dojo.keys.ENTER){window.top._ceaCollabDialog.topCategoryClicked(w.getURL());}});});}}catch(err){console.log(err);}}}
function hideElementById(elementId){var div=dojo.byId(elementId);div.style.display="none";}
function showElementById(elementId,isInlineBlockElement){var div=dojo.byId(elementId);if(isInlineBlockElement){div.style.display="inline-block";}else{div.style.display="block";}}
function hideBackgroundImage(element){element.style.backgroundImage='none';}
function showBackgroundImage(element){element.style.backgroundImage='url('+getImageDirectoryPath()+getStyleDirectoryPath()+'product_hover_background.png)';}
function checkIE8Browser(){if(dojo.isIE&&dojo.isIE<=8){correctBrowser=true}}
function ApprovalToolLink(idTag,approvalToolLinkURL){checkIE8Browser();if(correctBrowser){RFQwindow=window.open(approvalToolLinkURL);}
else{MessageHelper.formErrorHandleClient(idTag,MessageHelper.messages["ERROR_INCORRECT_BROWSER"]);return;}}
function updateViewAndBeginIndexForCurrencyChange(){if(document.getElementById('fastFinderResultControls')!=null&&document.getElementById('fastFinderResultControls')!='')
{if(document.SetCurrencyPreferenceForm.pageView!=null){document.SetCurrencyPreferenceForm.pageView.value=document.FastFinderForm.pageView.value;}
if(document.SetCurrencyPreferenceForm.beginIndex!=null){document.SetCurrencyPreferenceForm.beginIndex.value=document.FastFinderForm.beginIndex.value;}}
else if(document.getElementById('CategoryDisplay_Widget')!=null&&document.getElementById('CategoryDisplay_Widget')!='')
{if(wc.render.getContextById('CategoryDisplay_Context').properties['pageView']!=''&&document.SetCurrencyPreferenceForm.pageView!=null){document.SetCurrencyPreferenceForm.pageView.value=wc.render.getContextById('CategoryDisplay_Context').properties['pageView'];}
if(wc.render.getContextById('CategoryDisplay_Context').properties['beginIndex']!=''&&document.SetCurrencyPreferenceForm.beginIndex!=null){document.SetCurrencyPreferenceForm.beginIndex.value=wc.render.getContextById('CategoryDisplay_Context').properties['beginIndex'];}}
else if(document.getElementById('Search_Result_Summary')!=null&&document.getElementById('Search_Result_Summary')!='')
{if(wc.render.getContextById('catalogSearchResultDisplay_Context').properties['searchResultsView']!=''&&document.SetCurrencyPreferenceForm.pageView!=null){document.SetCurrencyPreferenceForm.pageView.value=wc.render.getContextById('catalogSearchResultDisplay_Context').properties['searchResultsView'];}
if(wc.render.getContextById('catalogSearchResultDisplay_Context').properties['searchResultsPageNum']!=''&&document.SetCurrencyPreferenceForm.beginIndex!=null){document.SetCurrencyPreferenceForm.beginIndex.value=wc.render.getContextById('catalogSearchResultDisplay_Context').properties['searchResultsPageNum']}}
else if(document.getElementById('Search_Result_Summary2')!=null&&document.getElementById('Search_Result_Summary2')!='')
{if(wc.render.getContextById('contentSearchResultDisplay_Context').properties['searchResultsView']!=''&&document.SetCurrencyPreferenceForm.pageView!=null){document.SetCurrencyPreferenceForm.pageView.value=wc.render.getContextById('contentSearchResultDisplay_Context').properties['searchResultsView'];}
if(wc.render.getContextById('contentSearchResultDisplay_Context').properties['searchResultsPageNum']!=''&&document.SetCurrencyPreferenceForm.beginIndex!=null){document.SetCurrencyPreferenceForm.beginIndex.value=wc.render.getContextById('contentSearchResultDisplay_Context').properties['searchResultsPageNum']}}
try{if(window.top._ceaCollabDialog!=undefined||window.top._ceaCollabDialog!=null){dojo.byId('SetCurrencyPreferenceForm').URL.value=dojo.byId('SetCurrencyPreferenceForm').URL.value+"&coshopChangeCurrency="+
dojo.byId('currencySelection').options[dojo.byId('currencySelection').selectedIndex].value;}}catch(err){console.log(err);}}
function updateViewAndBeginIndexForLanguageChange(){if(document.getElementById('fastFinderResultControls')!=null&&document.getElementById('fastFinderResultControls')!='')
{if(document.LanguageSelectionForm.pageView!=null){document.LanguageSelectionForm.pageView.value=document.FastFinderForm.pageView.value;}
if(document.LanguageSelectionForm.beginIndex!=null){document.LanguageSelectionForm.beginIndex.value=document.FastFinderForm.beginIndex.value;}}
else if(document.getElementById('CategoryDisplay_Widget')!=null&&document.getElementById('CategoryDisplay_Widget')!='')
{if(wc.render.getContextById('CategoryDisplay_Context').properties['pageView']!=''&&document.LanguageSelectionForm.pageView!=null){document.LanguageSelectionForm.pageView.value=wc.render.getContextById('CategoryDisplay_Context').properties['pageView'];}
if(wc.render.getContextById('CategoryDisplay_Context').properties['beginIndex']!=''&&document.LanguageSelectionForm.beginIndex!=null){document.LanguageSelectionForm.beginIndex.value=wc.render.getContextById('CategoryDisplay_Context').properties['beginIndex'];}}
else if(document.getElementById('Search_Result_Summary')!=null&&document.getElementById('Search_Result_Summary')!='')
{if(wc.render.getContextById('catalogSearchResultDisplay_Context').properties['searchResultsView']!=''&&document.LanguageSelectionForm.pageView!=null){document.LanguageSelectionForm.pageView.value=wc.render.getContextById('catalogSearchResultDisplay_Context').properties['searchResultsView'];}
if(wc.render.getContextById('catalogSearchResultDisplay_Context').properties['searchResultsPageNum']!=''&&document.LanguageSelectionForm.beginIndex!=null){document.LanguageSelectionForm.beginIndex.value=wc.render.getContextById('catalogSearchResultDisplay_Context').properties['searchResultsPageNum'];}}
else if(document.getElementById('Search_Result_Summary2')!=null&&document.getElementById('Search_Result_Summary2')!='')
{if(wc.render.getContextById('contentSearchResultDisplay_Context').properties['searchResultsView']!=''&&document.LanguageSelectionForm.pageView!=null){document.LanguageSelectionForm.pageView.value=wc.render.getContextById('contentSearchResultDisplay_Context').properties['searchResultsView'];}
if(wc.render.getContextById('contentSearchResultDisplay_Context').properties['searchResultsPageNum']!=''&&document.LanguageSelectionForm.beginIndex!=null){document.LanguageSelectionForm.beginIndex.value=wc.render.getContextById('contentSearchResultDisplay_Context').properties['searchResultsPageNum'];}}
try{if(window.top._ceaCollabDialog!=undefined||window.top._ceaCollabDialog!=null){dojo.byId('LanguageSelectionForm').action=dojo.byId('LanguageSelectionForm').action+"&langId="+
dojo.byId('languageSelection').options[dojo.byId('languageSelection').selectedIndex].value;}}catch(err){console.log(err);}}
function showHeaderLinksInTwoLines(){if(document.getElementById("header_links")!=null&&document.getElementById("header_links")!='undefined'){if(dojo.contentBox(document.getElementById("header_links")).w>750){if(document.getElementById("header_links1")!=null&&document.getElementById("header_links1")!='undefined'){document.getElementById("header_links1").style.display="block";}
if(document.getElementById("headerHomeLink")!=null&&document.getElementById("headerHomeLink")!='undefined'){document.getElementById("headerHomeLink").style.display="none";}
if(document.getElementById("headerShopCartLink")!=null&&document.getElementById("headerShopCartLink")!='undefined'){document.getElementById("headerShopCartLink").style.display="none";}}
document.getElementById("header_links").style.visibility="visible";}}
function showLinksInOneLine(){if(document.getElementById("header_links")!=null&&document.getElementById("header_links")!='undefined'){document.getElementById("header_links").style.visibility="visible";}}
function isNonNegativeInteger(value){var regExpTester=new RegExp(/^\d*$/);return(value!=null&&value!=""&&regExpTester.test(value));}
function isPositiveInteger(value){return(isNonNegativeInteger(value)&&value!=0);}
function closeAllDialogs(){dijit.registry.byClass("dijit.Dialog").forEach(function(w){w.hide()});}
function setWarningMessageCookie(errorKey){dojo.cookie("signon_warning_cookie",errorKey,{path:"/"});}
function removeCookie(name){dojo.cookie(name,null,{expires:-1});}
function getCookie(c){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var index=cookies[i].indexOf("=");var name=cookies[i].substr(0,index);name=name.replace(/^\s+|\s+$/g,"");if(name==c){return decodeURIComponent(cookies[i].substr(index+1));}}}
function getCookieName_BeginningWith(c){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var index=cookies[i].indexOf("=");var name=cookies[i].substr(0,index);name=name.replace(/^\s+|\s+$/g,"");if(stringStartsWith(name,c)){return name;}}}
function stringStartsWith(basestr,str){return str.length>0&&basestr.substring(0,str.length)===str}
function isStorePreview(contextPathUsed,criteria){if(contextPathUsed.indexOf(criteria)>-1){return true;}
return false;}
function hideESpotInfoPopup(id,event){if(event!=null&&event.type=="keypress"&&event.keyCode!="27"){return;}
else{var quickInfo=dijit.byId(id);if(quickInfo!=null){quickInfo.hide();}}}
function showESpotInfoPopup(id,event){if(event!=null&&event.type=="keypress"&&event.keyCode!="13"){return;}
else{if(!parent.checkPopupAllowed()){return;}
var quickInfo=dijit.byId(id);if(quickInfo!=null){quickInfo.show();}}}
function incrementNumAjaxRequest(){if(numAjaxRequests!='undefined'){numAjaxRequests++;}}
function decrementNumAjaxRequest(){if(numAjaxRequests!='undefined'){if(numAjaxRequests!=0){numAjaxRequests--;}}}
function updateParamObject(params,key,value,toArray,index){if(params==null){params=[];}
if(params[key]!=null&&toArray){if(dojo.lang.isArrayLike(params[key])){if(index!=null&&index!=""){params[key][index]=value;}else{params[key].push(value);}}else{var tmpValue=params[key];params[key]=[];params[key].push(tmpValue);params[key].push(value);}}else{if(index!=null&&index!=""&&index!=-1){params[key+"_"+index]=value;}else if(index==-1){var i=1;while(params[key+"_"+i]!=null){i++;}
params[key+"_"+i]=value;}else{params[key]=value;}}
return params;}
function showSection(id){var section=dojo.byId(id);if(section!=null&&section!='undefined'){section.style.visibility="visible";}}
function hideSection(id){var section=dojo.byId(id);if(section!=null&&section!='undefined'){section.style.visibility="";}}
function shiftTabHideSection(id,event){if(event.shiftKey&&(event.keyCode==dojo.keys.TAB)){hideSection(id);}}
function tabHideSection(id,event,nextId){if(!event.shiftKey&&(event.keyCode==dojo.keys.TAB)){if(null!=nextId){dojo.byId(nextId).focus();}
hideSection(id);dojo.stopEvent(event);}}
function saveShiftTabPress(event){if(event.shiftKey==true&&event.keyCode==9){tabPressed=true;}}
function saveTabPress(event){return;if(event.shiftKey==false&&event.keyCode==9){tabPressed=true;}}
function setFocus(formElementId){if(tabPressed){tabPressed=false;document.getElementById(formElementId).focus();}}
function increaseHeight(containerId,increase){var temp=document.getElementById(containerId).offsetHeight;document.getElementById(containerId).style.height=(temp+increase)+'px';}
function redirectToSignOn(forcedUrl){var href=document.location.href;var index=href.lastIndexOf("s",4);if(index!=-1){var newHref=href;}else{var newHref=href.substring(0,4)+"s"+(href.substring(4));}
dojo.cookie("WC_RedirectToPage_"+WCParamJS.storeId,forcedUrl,{path:'/'});dojo.cookie("WC_DisplaySignInPanel_"+WCParamJS.storeId,"true",{path:'/'});document.location.href=newHref;}
function handlePopup(link,newPopup){if(currentPopup==newPopup){document.location.href=link;}else{currentPopup=newPopup;}}
function isAndroid(){if(android==null){if(navigator!=null){if(navigator.userAgent!=null){var ua=navigator.userAgent.toLowerCase();android=ua.indexOf("android")>-1;}}}
return android;}
function isIOS(){if(ios==null){if(navigator!=null){if(navigator.userAgent!=null){var ua=navigator.userAgent.toLowerCase();ios=(ua.indexOf("ipad")>-1)||(ua.indexOf("iphone")>-1)||(ua.indexOf("ipod")>-1);}}}
return ios;}
function outlineSpots(){dojo.addClass(document.body,'editMode');dojo.query('.carousel > .content').style({zIndex:'auto'});dojo.query(".ESpotInfo").style({display:"block"});dojo.query(".searchScore").style({display:"block"});dojo.query(".editManagedContent").style({display:"block"});var all=dojo.query(".genericESpot,.product,.searchResultSpot,.productDetail,.categorySpot");for(var i=0;i<all.length;i++){var currEl=all[i];if(dojo.hasClass(currEl,"emptyESpot")){var elementWidth=dojo.query('.ESpotInfo',currEl)[0].offsetWidth+4;var elementHeight=dojo.query('.ESpotInfo',currEl)[0].offsetHeight+4;dojo.attr(currEl,'_width',dojo.style(currEl,'width'));dojo.attr(currEl,'_height',dojo.style(currEl,'height'));dojo.style(currEl,{'width':+elementWidth+'px','height':elementHeight+'px'});}
if(dojo.query(".borderCaption",currEl).length==0){dojo.place("<div class='borderCaption'></div>",currEl,'first');}else{dojo.query(".borderCaption",currEl).style({'display':'block'});}
if(currEl.addEventListener){currEl.addEventListener('mouseover',function(evt){if(!window.parent.frames[0].isSpotsShown()){return;}
dojo.query(".caption").style({display:"none"});dojo.style(dojo.query(".caption",this)[0],{display:"block"});evt.stopPropagation();},false);currEl.addEventListener('mouseout',function(evt){if(!window.parent.frames[0].isSpotsShown()){return;}
dojo.query(".caption",this).style({display:"none"});evt.stopPropagation();},false);}else if(currEl.attachEvent){currEl.onmouseover=((function(currEl){return(function(){if(!window.parent.frames[0].isSpotsShown()){return;}
dojo.query(".caption").style({display:"none"});dojo.style(dojo.query(".caption",currEl)[0],{display:"block"});window.event.cancelBubble=true;});})(currEl));currEl.onmouseleave=((function(currEl){return(function(){if(!window.parent.frames[0].isSpotsShown()){return;}
dojo.query(".caption",currEl).style({display:"none"});window.event.cancelBubble=true;});})(currEl));}}}
function hideSpots(){dojo.removeClass(document.body,'editMode');dojo.query('.carousel > .content').style({zIndex:''});dojo.query(".ESpotInfo").style({display:"none"});dojo.query(".caption").style({display:"none"});dojo.query(".searchScore").style({display:"none"});dojo.query(".editManagedContent").style({display:"none"});dojo.query(".borderCaption").style({display:"none"});dojo.query(".emptyESpot").forEach(function(e){dojo.style(e,{'width':dojo.attr(e,'_width')+'px'});dojo.style(e,{'height':dojo.attr(e,'_height')+'px'});});}
function logout(url){setDeleteCartCookie();document.location.href=url;try{if(utag!=='undefined'&&utag!=null&&typeof tealium_event!=='undefined'&&tealium_event!=null){utag.link(tealium_event.sign_out);}}catch(err){console.debug(err);}}
function switchLanguageCurrency(formName){var browserURL=document.location.href;var currentLangSEO='/'+document.getElementById('currentLanguageSEO').value+'/';if(browserURL.indexOf('SearchDisplay')!=-1&&browserURL.indexOf('#')!=-1){var poundTokens=browserURL.split('#');browserURL=poundTokens[0];}
var modifiedFormURL=browserURL;if(browserURL.indexOf(currentLangSEO)!=-1){if(document.getElementById('langSEO'+document.getElementById('languageSelection').options[document.getElementById('languageSelection').selectedIndex].value)){var newLangSEO='/'+document.getElementById('langSEO'+document.getElementById('languageSelection').options[document.getElementById('languageSelection').selectedIndex].value).value+'/';modifiedFormURL=browserURL.replace(currentLangSEO,newLangSEO);}}
if(modifiedFormURL.indexOf('&')!=-1){var tokens=modifiedFormURL.split('&');modifiedFormURL="";for(var i=0;i<tokens.length;i++){if(tokens[i].indexOf('langId=')==-1){if(modifiedFormURL==''){modifiedFormURL=tokens[i];}else{modifiedFormURL=modifiedFormURL+"&"+tokens[i];}}else if(tokens[i].indexOf('langId=')>0){if(i==0){modifiedFormURL=tokens[0].substring(0,tokens[0].indexOf('langId='));}else{modifiedFormURL=modifiedFormURL+"&";}
modifiedFormURL=modifiedFormURL+"langId="+document.getElementById('languageSelection').options[document.getElementById('languageSelection').selectedIndex].value;}}}
document.forms[formName].URL.value=modifiedFormURL;document.forms[formName].languageSelectionHidden.value=document.getElementById('languageSelection').options[document.getElementById('languageSelection').selectedIndex].value;dijit.byId('widget_language_and_currency_popup').hide();if(typeof(GlobalLoginShopOnBehalfJS)!='undefined'&&GlobalLoginShopOnBehalfJS!=null){GlobalLoginShopOnBehalfJS.deleteBuyerUserNameCookie();}
document.getElementById(formName).submit();}
function isParameterExcluded(url,parameterName){try{if(typeof URLConfig==='object'){if(typeof URLConfig.excludedURLPatterns==='object'){for(var urlPatternName in URLConfig.excludedURLPatterns){var exclusionConfig=URLConfig.excludedURLPatterns[urlPatternName];var urlPattern=urlPatternName;if(typeof exclusionConfig==='object'){if(exclusionConfig.urlPattern){urlPattern=exclusionConfig.urlPattern;}
console.debug("URL pattern to match : "+urlPattern);urlPattern=new RegExp(urlPattern);if(url.match(urlPattern)){var excludedParametersArray=exclusionConfig.excludedParameters;for(var excludedParameter in excludedParametersArray){if(parametername==excludedParameter){return true;}}}}}}else{console.debug("The parameter "+parameterName+" is not excluded");}}else{console.debug("No URLConfig defined.")}}catch(err){console.debug("An error occured while trying to exclude "+err);}
return false;}
function appendToURL(url,parameterName,value,allowMultipleValues){allowMultipleValues=(null==allowMultipleValues)?false:allowMultipleValues;var paramPattern=new RegExp(parameterName+"=[^&]+");var newParamString=parameterName+"="+value;if(url.indexOf(newParamString)!=-1){}else if(!paramPattern.test(url)||allowMultipleValues){if(url.indexOf('?')==-1){url=url+'?';}else{url=url+'&';}
url=url+newParamString;}else{url=url.replace(paramPattern,newParamString);}
return url;}
function appendWcCommonRequestParameters(url,allowMultipleValues){allowMultipleValues=(null==allowMultipleValues)?false:allowMultipleValues;if(typeof wcCommonRequestParameters==='object'){for(var parameterName in wcCommonRequestParameters){if(!isParameterExcluded(url,parameterName)){url=appendToURL(url,parameterName,wcCommonRequestParameters[parameterName],allowMultipleValues);}}}
return url;}
function updateFormWithWcCommonRequestParameters(form,allowMultipleValues){allowMultipleValues=(null==allowMultipleValues)?false:allowMultipleValues;if(typeof wcCommonRequestParameters==='object'){for(var parameterName in wcCommonRequestParameters){if(form.action!==undefined&&null!==form.action&&!isParameterExcluded(form.action,parameterName)){var exist=false;dojo.query("input[name="+"'"+parameterName+"']",form).forEach(function(param){if(param.value==wcCommonRequestParameters[parameterName]){exist=true;}else if(!allowMultipleValues){form.removeChild(param);}});if(!exist){if(form.method=='get'){dojo.create("input",{name:parameterName,type:'hidden',value:wcCommonRequestParameters[parameterName]},form);}else{form.action=appendToURL(form.action,parameterName,wcCommonRequestParameters[parameterName],allowMultipleValues);}}}}}}
function processAndSubmitForm(form){updateFormWithWcCommonRequestParameters(form);form.submit();}
function popUpWindow(url){if(url!=null&&url!=undefined){window.open(url,'_blank','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes');}}
function getCommonParametersQueryString(){return"storeId="+WCParamJS.storeId+"&langId="+WCParamJS.langId+"&catalogId="+WCParamJS.catalogId;}
function getFinalViewURL(myURL){var finalViewBeginIndex=myURL.indexOf('finalView');if(finalViewBeginIndex!=-1){var finalViewEndIndex=myURL.indexOf('&',finalViewBeginIndex);if(finalViewEndIndex==-1){var finalViewName=myURL.substring(finalViewBeginIndex+10);}else{var finalViewName=myURL.substring(finalViewBeginIndex+10,finalViewEndIndex);}
var originalActionEndIndex=myURL.indexOf('?');var firstPartURL=myURL.substring(originalActionEndIndex+1,finalViewBeginIndex);if(finalViewEndIndex==-1){var secondPartURL="";}else{var secondPartURL=myURL.substring(finalViewEndIndex);}
if(firstPartURL.charAt(firstPartURL.length-1)=='&'){firstPartURL=firstPartURL.substring(0,firstPartURL.length-1);}
if(firstPartURL.charAt(0)=='&'){firstPartURL=firstPartURL.substring(1);}
if(secondPartURL.charAt(secondPartURL.length-1)=='&'){secondPartURL=secondPartURL.substring(0,secondPartURL.length-1);}
if(secondPartURL.charAt(0)=='&'){secondPartURL=secondPartURL.substring(1);}
var finalURL="";if(firstPartURL!=""){finalURL=finalViewName+'?'+firstPartURL;if(secondPartURL!=""){finalURL=finalURL+'&'+secondPartURL;}}else{finalURL=finalViewName+'?'+secondPartURL;}
return finalURL;}else{return"";}}
dojo.addOnLoad(function(){wc.service.declare({id:"MyAcctAjaxAddOrderItem",actionId:"AjaxAddOrderItem",url:"",formId:"",successHandler:function(serviceResponse){MessageHelper.hideAndClearMessage();MessageHelper.displayStatusMessage(storeNLS["SHOPCART_ADDED"]);dojo.cookie("WC_nextURL_"+WCParamJS.storeId,null,{expires:-1,path:'/'});cursor_clear();},failureHandler:function(serviceResponse){if(serviceResponse.errorMessage){if(serviceResponse.errorMessageKey=="_ERR_NO_ELIGIBLE_TRADING"){MessageHelper.displayErrorMessage(storeNLS["ERROR_CONTRACT_EXPIRED_GOTO_ORDER"]);}else{MessageHelper.displayErrorMessage(serviceResponse.errorMessage);}}
else{if(serviceResponse.errorMessageKey){MessageHelper.displayErrorMessage(serviceResponse.errorMessageKey);}}
cursor_clear();}});});dojo.addOnLoad(function(){wc.service.declare({id:"MyAcctGenericService",actionId:"",url:"",formId:"",successHandler:function(serviceResponse){dojo.cookie("WC_nextURL_"+WCParamJS.storeId,null,{expires:-1,path:'/'});MessageHelper.hideAndClearMessage();finalViewURL=getFinalViewURL(this.url);if(finalViewURL!=""){document.location.href=finalViewURL;}else{MessageHelper.displayStatusMessage(storeNLS["MYACCOUNT_ACTION_PERFORMED"]);cursor_clear();}},failureHandler:function(serviceResponse){if(serviceResponse.errorMessage){MessageHelper.displayErrorMessage(serviceResponse.errorMessage);}
else{if(serviceResponse.errorMessageKey){MessageHelper.displayErrorMessage(serviceResponse.errorMessageKey);}}
cursor_clear();}});});function invokeItemAdd(inUrl){wc.service.getServiceById("MyAcctAjaxAddOrderItem").url=inUrl;var addToCartParams=[];addToCartParams.PasswordRequestAuthenticated='TRUE';if(!submitRequest()){return;}
cursor_wait();dojo.cookie("WC_nextURL_"+WCParamJS.storeId,null,{expires:-1,path:'/'});wc.service.invoke("MyAcctAjaxAddOrderItem",addToCartParams);}
function invokeOtherService(inUrl){wc.service.getServiceById("MyAcctGenericService").url=inUrl;var params=[];params.PasswordRequestAuthenticated='TRUE';if(!submitRequest()){return;}
cursor_wait();dojo.cookie("WC_nextURL_"+WCParamJS.storeId,null,{expires:-1,path:'/'});wc.service.invoke("MyAcctGenericService",params);}
function isUSUser(){if($('#demographicField5Display').is(':checked')){if(GeolocationJS.akamaiCountryCode!='US'){var rewardsDialog=dijit.byId("RewardsDialog");if(rewardsDialog!=undefined)
rewardsDialog.show();console.log("rewardsDialog="+rewardsDialog);}}}
function nullCartTotalCookie(orderId){var parts=location.hostname.split('.');while(parts.length>2)
var subdomain=parts.shift();var upperleveldomain=parts.join('.');dojo.cookie("WC_CartTotal_"+orderId,null,{expires:-1,path:'/',domain:upperleveldomain});var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var index=cookies[i].indexOf("=");var name=cookies[i].substr(0,index);var value=cookies[i].substr(index+1)
name=name.replace(/^\s+|\s+$/g,"");value=value.replace(/^\s+|\s+$/g,"");if(value==orderId){dojo.cookie(name,null,{expires:-1,path:'/'});break;}}}
function validateBotUserAgent(){var botPattern="(googlebot\/|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis)";var re=new RegExp(botPattern,'i');var userAgent=navigator.userAgent;console.info("userAgent: "+userAgent);if(re.test(userAgent)){return true;}else{return false;}}
require(["dojo/_base/event","dojo/_base/lang","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/has","dojo/on","dojo/query","dojo/_base/sniff","dojo/domReady!","dojo/NodeList-dom","dojo/NodeList-traverse"],function(b,c,n,d,h,o,k,m){var g=null;var e=null;var q=null;var f={};var p="";var j="departmentMenu_";var l=function(){if(g==null){g=k(document.documentElement,"mousedown",a);}};var i=function(){if(g!=null){g.remove();g=null;}};var a=function(s){var w=s.target;if(e!=null&&w!=document.documentElement){var x=true;var v=e.getAttribute("data-parent");while(w&&w!=document.documentElement){if(w==e||w==q||n.contains(w,"dijitPopup")||v==w.getAttribute("data-parent")){x=false;break;}w=w.parentNode;}if(w==null){var u=m("div",e);for(var t=0;t<u.length;t++){var r=d.position(u[t]);if(s.clientX>=r.x&&s.clientX<r.x+r.w&&s.clientY>=r.y&&s.clientY<r.y+r.h){x=false;break;}}}if(x){deactivate(e);}}};activate=function(u){var r=(u.id.slice(0,j.length)==j);if(this.ajaxRefresh=="true"&&r){setAjaxRefresh("");wc.render.updateContext("departmentSubMenuContext",{"targetId":u.id});if(typeof cX==="function"){setTimeout(function(){cX("");},1000);}return;}var s=u.getAttribute("data-parent");if(s&&f[s]){deactivate(f[s]);}if(s){activate(document.getElementById(s));}n.add(u,"active");m("a[data-activate='"+u.id+"']").addClass("selected");var t=m("a[data-toggle='"+u.id+"']");t.addClass("selected");if(s){f[s]=u;if(e==null){e=u;q=t.length>0?t[0]:null;l();}}};deactivate=function(s){if(f[s.id]){deactivate(f[s.id]);}n.remove(s,"active");m("a[data-activate='"+s.id+"']").removeClass("selected");m("a[data-toggle='"+s.id+"']").removeClass("selected");var r=s.getAttribute("data-parent");delete f[r];if(s==e){e=null;q=null;i();}};toggle=function(r){if(r!=null){if(n.contains(r,"active")){deactivate(r);}else{activate(r);}}};setUpEventActions=function(){k(document,"a[data-activate]:click",function(s){var r=this.getAttribute("data-activate");activate(document.getElementById(r));b.stop(s);});k(document,"a[data-deactivate]:click",function(s){var r=this.getAttribute("data-deactivate");deactivate(document.getElementById(r));b.stop(s);});k(document,"a[data-toggle]:click",function(s){var r=this.getAttribute("data-toggle");toggle(document.getElementById(r));b.stop(s);});k(document,"a[data-toggle]:keydown",function(t){if(t.keyCode==27){var s=this.getAttribute("data-toggle");deactivate(document.getElementById(s));b.stop(t);}else{if(t.keyCode==40){var s=this.getAttribute("data-toggle");var r=document.getElementById(s);activate(r);m('[class*="menuLink"]',r)[0].focus();b.stop(t);}}});if(o("ie")<10){m("input[placeholder]").forEach(function(r){var u=r.getAttribute("placeholder");if(u){var s=document.createElement("label");s.className="placeholder";s.innerHTML=u;r.parentNode.insertBefore(s,r);var t=function(){s.style.display=(r.value?"none":"block");};window.setTimeout(t,200);k(r,"blur, focus, keyup",t);k(s,"click",function(v){r.focus();});}});}};setUpEventActions();});function setWelcomeMessage(f){var g="G";var e="";var a=dojo.cookie("MATTEL_WELCOME_MSG");if(null!=a&&undefined!=a&&a.trim()!=""){e=a;g="R";console.log("setWelcomeMessageCookie("+g+","+a+")");}else{console.log("firstName cookie value not found: "+a);}var b=document.getElementsByClassName("nav-login");console.info("storeIndicator:"+f);if(null!=f&&undefined!=f&&f=="AG"){b=document.getElementsByClassName("nav-login-ag");}if(b!=null&&b!=undefined){if(g=="G"){if(f=="HW"){for(var d=0;d<b.length;d++){var c=document.createElement("img");c.setAttribute("src","/wcsstore/MattelSAS/images/colors/hw/sign_in.png");b[d].appendChild(c);}}else{if(f=="AG"){for(var d=0;d<b.length;d++){b[d].innerHTML="AG Rewards / Sign in";}}else{for(var d=0;d<b.length;d++){b[d].innerHTML="Sign In / Register";}}}}else{if(e!=null&&e.trim()!=""){for(var d=0;d<b.length;d++){if(null!=f&&undefined!=f&&f=="AG"){b[d].innerHTML="Hello, "+e+"<i class='fa fa-chevron-down'></i>";}else{b[d].innerHTML="Hello, "+e;}}}else{for(var d=0;d<b.length;d++){b[d].innerHTML="My Account";}}}}}HeaderJs={rlcRedirect:function(a){var b={};b["isForumRedirect"]="true";b["storeId"]=WCParamJS.storeId;b["sfIndicator"]=a;cursor_wait();wc.service.invoke("RLCForumRedirectUrl",b);}};