dojo.registerModulePath("wc","../wc");dojo.require("wc.service.common");dojo.require("dojo.io.iframe");dojo.require("dojo.io.script");dojo.require("dojo.parser");dojo.require("dijit.form.Button");dojo.require("wc.widget.WCMenu");dojo.require("wc.widget.WCDialog");dojo.require("wc.widget.ScrollablePane");dojo.require("dijit.layout.TabContainer");dojo.require("dijit.layout.ContentPane");dojo.require("dijit.Tooltip");dojo.require("wc.widget.WCDropDownButton");dojo.require("dijit.Dialog");dojo.require("dojo.dnd.Source");dojo.require("dojo.currency");dojo.require("dijit.Tree");dojo.require("dojo.back");dojo.require("dijit.form.DateTextBox");dojo.require("wc.widget.RefreshArea");dojo.require("wc.render.RefreshController");dojo.require("wc.render.Context");dojo.require("dojo.cookie");dojo.require("dojox.fx.Shadow");dojo.subscribe("ajaxRequestInitiated","incrementNumAjaxRequest");dojo.subscribe("ajaxRequestCompleted","decrementNumAjaxRequest");var showDropdown=false;var dropDownDlg=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;function $(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(){dojo.query('.dijitDialog',document).forEach(function(tag){if(dijit.byNode(tag).id=='quick_cart_container')
dijit.byNode(tag).destroyRecursive();});dropDownDlg=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 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(){jQuery("#progress_bar_dialog").show();setTimeout("cursor_clear()",120000);}
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;jQuery("#progress_bar_dialog").hide();this.currentId="";}
function submitRequest(){if(!requestSubmitted){requestSubmitted=true;return true;}
return false;}
function resetRequest(){requestSubmitted=false;}
function setPageLocation(newPageLink){if(!submitRequest()){return;}
document.location.href=newPageLink;}
function submitSpecifiedForm(form){if(!submitRequest()){return;}
form.submit();}
function parseWidget(id)
{var node;var widget=dijit.byId(id);if(widget==null||widget==undefined)
{if(id==null||id==undefined)
{node=dojo.body();}
else
{node=dojo.byId(id);}
if(node!=null&&node!=undefined)
{if(node.getAttribute("dojoType")!=null&&node.getAttribute("dojoType")!=undefined)
{dojo.parser.instantiate([node]);}
else
{dojo.parser.parse(node);}}}}
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){var div=dojo.byId(elementId);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);}
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 unescape(cookies[i].substr(index+1));}}}
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{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){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){if(typeof(forcedUrl)!='undefined'){var currentURL=forcedUrl;}else{var currentURL=location.href;}
currentURL="OrderItemMove?continue=1&createIfEmpty=1&updatePrices=0&deleteIfEmpty=*&fromOrderId=*&toOrderId=.&page=&calculationUsageId=-1&URL="+encodeURIComponent("OrderCalculate?URL="+encodeURIComponent(currentURL));document.location.href="LogonForm?myAcctMain=1&storeId="
+WCParamJS.storeId+"&catalogId="+WCParamJS.catalogId
+"&langId="+WCParamJS.langId+"&URL="+encodeURIComponent(currentURL);};dojo.require("dojo.cookie");PhysicalStoreCookieJS={storeArray:null,storeAddressArray:null,arrayMaxSize:1,getStoreIdsFromCookie:function(){var cookieValue=dojo.cookie("WC_physicalStores");this.storeArray=new Array;if(cookieValue!=null){var subValue="";var remainingString=cookieValue;var length=cookieValue.length;var end=remainingString.indexOf(",");if(end>0){while(end>=0){subValue=remainingString.substring(0,end);this.addToStoreArray(subValue);remainingString=remainingString.substring(end+1,length);length=remainingString.length;end=remainingString.indexOf(",")}
subValue=remainingString;this.addToStoreArray(subValue);}
else{if(length>0){this.addToStoreArray(remainingString);}}}
return this.storeArray;},getStoreAddressFromCookie:function(){var cookieValue=dojo.cookie("WC_physicalStoreAddress");this.storeAddressArray=new Array;if(cookieValue){var subValue="";var remainingString=cookieValue;var length=cookieValue.length;var end=remainingString.indexOf(";");if(end>0){while(end>=0){subValue=remainingString.substring(0,end);this.addToStoreAddressArray(subValue);remainingString=remainingString.substring(end+1,length);length=remainingString.length;end=remainingString.indexOf(";")}
subValue=remainingString;this.addToStoreAddressArray(subValue);}
else{if(length>0){this.addToStoreAddressArray(remainingString);}}}
return this.storeAddressArray;},isAddOneStoreIdExceedMax:function(){var exceedMax=false;if((this.getNumStores()+1)>this.arrayMaxSize){exceedMax=true;}
return exceedMax;},setStoreIdsToCookie:function(){var newCookieValue="";for(i=0;i<this.storeArray.length;i++){newCookieValue=newCookieValue+this.storeArray[i];if(i<(this.storeArray.length-1)){newCookieValue=newCookieValue+",";}}
if(newCookieValue.length==0){dojo.cookie("WC_physicalStores",null,{expires:-1});}
else{dojo.cookie("WC_physicalStores",newCookieValue,{path:'/',expires:365});}},setStoreAddressToCookie:function(){var newCookieValue="";for(var i=0,l=this.storeAddressArray.length;i<l;i++){newCookieValue=newCookieValue+this.storeAddressArray[i];if(i<(l-1)){newCookieValue=newCookieValue+";";}}
if(newCookieValue.length==0){dojo.cookie("WC_physicalStoreAddress",null,{expires:-1});}
else{dojo.cookie("WC_physicalStoreAddress",newCookieValue,{path:'/',expires:365});}},addToStoreArray:function(record){if(this.storeArray==null){this.getStoreIdsFromCookie();}
for(i=0;i<this.storeArray.length;i++){if(this.storeArray[i]==record){return;}}
if(this.storeArray.length<this.arrayMaxSize){this.storeArray.push(record);}},addToStoreAddressArray:function(record){if(this.storeAddressArray===null){this.getStoreAddressFromCookie();}
for(var i=0,l=this.storeAddressArray.length;i<l;i++){if(this.storeAddressArray[i]==record){return;}}
if(this.storeAddressArray.length<this.arrayMaxSize){this.storeAddressArray.push(record);}},addToCookie:function(record){this.addToStoreArray(record);this.setStoreIdsToCookie();},addAddressToCookie:function(record){this.addToStoreAddressArray(record);this.setStoreAddressToCookie();},removeFromStoreArray:function(record){if(this.storeArray==null){this.getStoreIdsFromCookie();}
var recordIndex=-1;for(i=0;i<this.storeArray.length;i++){if(this.storeArray[i]==record){recordIndex=i;i=this.storeArray.length;}}
this.storeArray.splice(recordIndex,1);},removeFromStoreAddressArray:function(record){if(this.storeAddressArray===null){this.getStoreAddressFromCookie();}
var recordIndex=-1;for(var i=0,l=this.storeAddressArray.length;i<l;i++){if(this.storeAddressArray[i]==record){recordIndex=i;i=this.storeAddressArray.length;}}
this.storeAddressArray.splice(recordIndex,1);},removeFromCookie:function(record){this.removeFromStoreArray(record);this.setStoreIdsToCookie();},removeAddressFromCookie:function(record){this.removeFromStoreAddressArray(record);this.setStoreAddressToCookie();},clearStoreArray:function(){this.storeArray=new Array;},clearStoreAddressArray:function(){this.storeAddressArray=new Array;},clearCookie:function(){this.clearStoreArray();this.setStoreIdsToCookie();this.clearStoreAddressArray();this.setStoreAddressToCookie();},getNumStores:function(){if(this.storeArray==null){this.getStoreIdsFromCookie();}
return this.storeArray.length;},getPickUpStoreIdFromCookie:function(){var pickUpStoreId=dojo.cookie("WC_pickUpStore");return pickUpStoreId;},setPickUpStoreIdToCookie:function(value){var newPickUpStoreId=value;if(newPickUpStoreId!=null&&newPickUpStoreId!="undefined"&&newPickUpStoreId!=""){var currentPickUpStoreId=this.getPickUpStoreIdFromCookie();if(newPickUpStoreId!=currentPickUpStoreId){dojo.cookie("WC_pickUpStore",null,{expires:-1});dojo.cookie("WC_pickUpStore",newPickUpStoreId);}}},clearPickUpStoreIdFromCookie:function(value){var newPickUpStoreId=value;if(newPickUpStoreId!=null&&newPickUpStoreId!="undefined"&&newPickUpStoreId!=""){var currentPickUpStoreId=this.getPickUpStoreIdFromCookie();if(newPickUpStoreId==currentPickUpStoreId){dojo.cookie("WC_pickUpStore",null,{expires:-1});}}},getValueFromCookie:function(cookieKey){var cookieValue=dojo.cookie(cookieKey);return cookieValue;},setValueToCookie:function(cookieKey,cookieValue){var newValue=cookieValue;if(newValue!=null&&newValue!="undefined"&&newValue!=""){var currentValue=this.getValueFromCookie(cookieKey);if(newValue!=currentValue){dojo.cookie(cookieKey,null,{expires:-1});dojo.cookie(cookieKey,newValue);}}},clearValueFromCookie:function(cookieKey){var currentValue=this.getValueFromCookie(cookieKey);if(currentValue!=null&&currentValue!="undefined"){dojo.cookie(cookieKey,null,{expires:-1});}}};function googleMapsCallback(target){lcbo.mapsUtils.isAPILoaded=true;if(typeof target==="function"){target();}
else{lcbo.StoreFinder.launchStoreLocatorModal.call(lcbo.mapsUtils.triggerTarget);}}
(function($,l){lcbo.mapsUtils={isAPILoaded:false,triggerTarget:null,apiKey:"AIzaSyA_KFvSAoGiOweuOGtmBo7I5pW-CXafHFE",loadGoogleMaps:function(target){this.triggerTarget=target;if(this.isAPILoaded){return window.googleMapsCallback(target);}
var scriptTag=document.createElement('script');scriptTag.setAttribute("type","text/javascript");scriptTag.setAttribute("src","//maps.googleapis.com/maps/api/js?key="+this.apiKey+"&sensor=true&v=3.15&language="+WCParamJS.langId+"&callback=googleMapsCallback");(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(scriptTag);}};lcbo.utils=(function(){var queryToObject=function(str){var dec=decodeURIComponent,qp=str.split("&"),ret={},name,val;for(var i=0,l=qp.length,item;i<l;++i){item=qp[i];if(item.length){var s=item.indexOf("=");if(s<0){name=dec(item);val="";}else{name=dec(item.slice(0,s));val=dec(item.slice(s+1));}
if(typeof ret[name]=="string"){ret[name]=[ret[name]];}
if($.isArray(ret[name])){ret[name].push(val);}else{ret[name]=val;}}}
return ret;};var getQueryByName=function(queryName){queryName=queryName.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regex=new RegExp("[\\?&]"+queryName+"=([^&#]*)"),results=regex.exec(window.location.href);return results===null?"":decodeURIComponent(results[1].replace(/\+/g," "));};var loadScript=function(filePath,callback){var script=document.createElement('script');script.type="text/javascript";if(typeof callback==="function"){if(script.readyState){script.onreadystatechange=function(){if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;callback();}};}else{script.onload=function(){callback();};}}
script.src=filePath;document.body.appendChild(script);};var loadStyle=function(filePath){var link=document.createElement('link');link.rel='stylesheet';link.type='text/css';link.href=filePath;document.head.appendChild(link);};var loadAssets=function(filePath,callback){if(typeof filePath!=="string"){return;}
var assetDir="/wcsstore/LCBO/";if(filePath.indexOf("javascript/")>=0){loadScript(assetDir+filePath,callback);}
else if(filePath.indexOf("css/")>=0){loadStyle(assetDir+filePath);}};return{queryToObject:queryToObject,getQueryByName:getQueryByName,loadAssets:loadAssets};}());lcbo.StoreFinder=(function(){return{'_lastSearchType':null,'_currentForm':null,'_fromPage':null,init:function(){this.displaySelectedStore();lcbo.StoreFinder.bindFeatureClickEvent();lcbo.StoreFinder.bindModalClickEvent();},displaySelectedStore:function(){var storeNum=PhysicalStoreCookieJS.getStoreIdsFromCookie().length>0?PhysicalStoreCookieJS.getStoreIdsFromCookie()[0]:"";if(!storeNum){return;}
var storeAddress=PhysicalStoreCookieJS.getStoreAddressFromCookie().length>0?PhysicalStoreCookieJS.getStoreAddressFromCookie()[0]:"";if(!storeAddress){return;}
var pattern=/http|\/\/|script|eval|expression|onload/ig;if(pattern.test(storeAddress)){return;}
var headerSection=$(".profile-links .location");var headerMobile=$("#nav-m-store-locator .sub-page-list");var storeLocatorUrl="/lcbo/store-locator?catalogId=10001&langId="+WCParamJS.langId+"&orderId=&storeId=10151&fromPage=StoreDetails&citypostalcode=&storeNum="+storeNum;if(headerSection.find(".current-location").length<=0){headerSection.append('<br/><a href="'+storeLocatorUrl+'" class="current-location">'+storeAddress+'</a>');}
else{headerSection.find(".current-location").attr("href",storeLocatorUrl).html(storeAddress);}
if(headerMobile.find(".current-location").length<=0){headerMobile.append('<li class="dropdown-submenu"><a href="'+storeLocatorUrl+'" class="current-location">'+storeAddress+'</a></li>');}
else{headerMobile.find(".current-location").attr("href",storeLocatorUrl).html(storeAddress);}},refreshResults:function(form,fromPage,ageChecked,displayPanel){var $form=$('#'+form),$citypostalcode=$form.find('#storeLocatorCityPostalCode'),$dayofweek=$('#dayOfWeek'),$closehour=$('#closeHour'),postalCodeSearch=($form.find(".button:focus").attr('id')==="cityGo");if(!$dayofweek.val()&&$closehour.val()){$dayofweek.val(new Date().getDay()+1);}
if(!$citypostalcode.val()&&postalCodeSearch){$citypostalcode.focus();$citypostalcode.fadeOut().fadeIn();return false;}
if(fromPage=='StoreLocatorModal'){return true;}else{$form.find('#latitude','#longitude').val('');lcbo.StoreFinder.fetchLocationResults({'fromPage':fromPage,'form':form,'displayPanel':displayPanel,'ageChecked':ageChecked});return false;}},manageCookieFromSearchText:function(){PhysicalStoreCookieJS.setValueToCookie('WC_stFind',1);},changeSearchText:function(searchTerm){PhysicalStoreCookieJS.setValueToCookie("WC_stCity",searchTerm);PhysicalStoreCookieJS.clearValueFromCookie("WC_stFind");},findCurrentLocation:function(param){var setUserLocationAndSubmit=function(lat,lng){lcbo.StoreFinder.setLocation({'form':param.form,'latitude':lat,'longitude':lng});if(param.fromPage=='StoreLocatorModal'){$("#"+param.form).submit();}else{lcbo.StoreFinder.fetchLocationResults({'form':param.form,'fromPage':param.fromPage,'displayPanel':param.displayPanel,'ageChecked':param.ageChecked});lcbo.StoreFinder._lastSearchType="navigator";lcbo.StoreFinder._fromPage=param.fromPage;lcbo.StoreFinder._currentForm=param.form;}};var findCurrentLocationFallback=function(){var savedLocation=lcbo.StoreFinder.getSavedLocation();if(savedLocation){setUserLocationAndSubmit(savedLocation.latitude,savedLocation.longitude);}else{var geoAPI="AIzaSyA_KFvSAoGiOweuOGtmBo7I5pW-CXafHFE";$.ajax({method:"POST",url:"https://www.googleapis.com/geolocation/v1/geolocate?key="+geoAPI,contentType:"application/json",data:'{"considerIp": "true"}'}).done(function(response){lcbo.StoreFinder.saveLocation(response.location.lat,response.location.lng);setUserLocationAndSubmit(response.location.lat,response.location.lng);}).fail(function(response){console.log("geolocation API call failed : ",response);});}};if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(location){lcbo.StoreFinder.saveLocation(location.coords.latitude,location.coords.longitude);setUserLocationAndSubmit(location.coords.latitude,location.coords.longitude);},function(error){findCurrentLocationFallback();});}else{findCurrentLocationFallback();}},saveLocation:function(latitude,longitude){var date=new Date();date.setTime(date.getTime()+(60*60*1000));$.cookie('WC_latitude',latitude,{expires:date,path:'/'});$.cookie('WC_longitude',longitude,{expires:date,path:'/'});},getSavedLocation:function(){var savedLatitude=$.cookie('WC_latitude'),savedLongitude=$.cookie('WC_longitude');if(savedLatitude&&savedLongitude){return{"latitude":savedLatitude,"longitude":savedLongitude};}else{return null;}},setLocation:function(param){lcbo.StoreFinder.manageCookieFromSearchText();$('#'+param.form).find('#latitude').val(param.latitude);$('#'+param.form).find('#longitude').val(param.longitude);},fetchLocationResults:function(param){var form=$('#'+param.form),dayOfWeek=form.find('#dayOfWeek').val(),closeHour=form.find('#closeHour').val(),citypostalcode=form.find('#storeLocatorCityPostalCode').val(),latitude=form.find('#latitude').val(),longitude=form.find('#longitude').val(),productId=form.find('#productId').val(),features=lcbo.StoreFinder.getFeatures(form);dayOfWeek=dayOfWeek==''&&closeHour!=''?new Date().getDay()+1:dayOfWeek;closeHour=closeHour==''&&dayOfWeek!=''?'0':closeHour;var options={'fromPage':param.fromPage,'features':features,'dayOfWeek':dayOfWeek,'closeHour':closeHour,'citypostalcode':citypostalcode,'latitude':latitude,'longitude':longitude,'productId':productId,'displayPanel':param.displayPanel,'ageChecked':param.ageChecked};wc.render.updateContext('storeLocatorResultsContext',options);lcbo.StoreFinder._lastSearchType=param.searchType;lcbo.StoreFinder._fromPage=param.fromPage;lcbo.StoreFinder._currentForm=param.form;},getFeatures:function(form){if(form){return form.find("input[name='features']:checked").map(function(index,checkbox){return $(checkbox).val();}).get().join(",");}},showFeatureFacet:function(){$('.store-locator-features').fadeIn();},bindFeatureClickEvent:function(){$(".store-locator").on("change","#featureFacets input[name='features']",function(e){var _form=$(this).closest("form").attr("id");lcbo.StoreFinder.fetchLocationResults({'form':_form,'fromPage':lcbo.StoreFinder._fromPage});});},bindModalClickEvent:function(){var launchModal=function(event,target){event.preventDefault();var $inlineStoreLocator=$(".store-locator-container .store-locator .store-locator-form");if($inlineStoreLocator.length){$inlineStoreLocator.find("#storeLocatorCityPostalCode").focus();$('html, body').animate({scrollTop:$inlineStoreLocator.offset().top},500);}else{lcbo.mapsUtils.loadGoogleMaps(target);}}
$(".product-content").on("click","[data-action='store-locator']",function(event){launchModal(event,this);});$("[data-action='store-locator']").not(".product-content [data-action='store-locator']").on("click",function(event){launchModal(event,this);});$("[data-click-target]").on("click",function(e){e.preventDefault();$($(this).data('click-target')).click();});},launchStoreLocatorModal:function(){var _url=$(this).attr("href"),_inventorySearch=(_url.indexOf('productId')!=-1),_checkoutPage=(_url.indexOf('fromPage=Checkout')!=-1),_favoritePage=(_url.indexOf("FavoriteStores")!=-1),_modalID="storeLocatorModal",_isModal=(_url.indexOf("isModal=true")!=-1),_categoryPage=(_url.indexOf("fromPage=CategoryPage")!=-1);if(_inventorySearch){_modalID=_modalID+"Pip";}
else if(_checkoutPage){_modalID=_modalID+"Checkout";}
else if(_favoritePage){_modalID=_modalID+"FavoriteStores";}
else if(_categoryPage){_modalID=_modalID+"CategoryPage";}
else{_modalID=_modalID+"Global";}
var $targetModal=$("#"+_modalID);if($targetModal.length){$targetModal.modal("show");}else{if(_url){$.get(_url+(_url.indexOf("?")>-1?"&":"?")+"dialog=true&formName="+_modalID+"Form").done(function(data){$('<div id="'+_modalID+'" class="modal fade store-locator-modal">'+data+'</div>').on('shown.bs.modal',function(e){lcbo.PlaceholderSupport.add.call(this);if(_inventorySearch||_checkoutPage||_favoritePage||_categoryPage||_isModal){lcbo.bindAccordion.init();lcbo.StoreFinder.bindFeatureClickEvent();setupStoreLocatorController();}
$(this).find(":focusable")[0].focus();lcbo.analytics.customEvents("store locator");document.body.style.overflow="hidden";$(this).unbind("shown");}).modal("show").on('hidden.bs.modal',function(e){document.body.style.overflow="visible";if(_categoryPage){window.location.reload();}});});}}},updateWithUserFavStores:function(stores,convertStores){if(convertStores){var stores=$(".store-row:not(.store-hidden)",stores);}else{var stores=$(stores);}
var updateUIElements=function(favStoresIds){var currStoreNum,currFavStoreNum,currStoreRow,favThisEl;$(stores).each(function(i){currStoreRow=$(this);currStoreNum=currStoreRow.data("store-num");for(j=0;j<favStoresIds.length;j++){currFavStoreNum=favStoresIds[j];if(currStoreNum==currFavStoreNum){$(".glyphicon-heart",currStoreRow).css("display","inline-block");$(".glyphicon-heart-empty",currStoreRow).css("display","none");favThisEl=$(".favorite-this",currStoreRow);favThisEl.attr({title:favThisEl.data("remove-fav"),ariaLabel:favThisEl.data("remove-fav"),href:currStoreRow.data("remove-fav-url")});}}});}
if(typeof $.cookie("favStores")=="undefined"){var startIndex,endIndex,favStores;var cookieVal="";$.ajax({url:"/webapp/wcs/stores/servlet/FavStoresListDisplayView?catalogId=10001&storeId=10151&langId="+WCParamJS.langId,type:"GET",dataType:"html",cache:false,}).done(function(data){startIndex=data.indexOf("<div>[");endIndex=data.indexOf("]</div>");favStores=data.substring(startIndex+6,endIndex).split(",");for(k=0;k<favStores.length;k++){var id=favStores[k].trim();cookieVal+=id+",";if(k==favStores.length-1){cookieVal=cookieVal.substring(0,cookieVal.lastIndexOf(","));}}
$.cookie("favStores",cookieVal,{path:"/"});updateUIElements(cookieVal.split(","));}).fail(function(jqXHR,textStatus){console.debug("ERROR calling: FavStoresListDisplayView. Unable to get user's favourite stores. ERROR: "+textStatus);});}else{updateUIElements($.cookie("favStores").split(","));}}}})();lcbo.bindAccordion=(function(){return{init:function(){$(".panel-collapse",".panel-group").on("show.bs.collapse",function(e){if(e.currentTarget===e.target){$(this.parentNode).children(".panel-heading").removeClass("collapsed");}}).on("hide.bs.collapse",function(e){if(e.currentTarget===e.target){var panelHeading=$(this.parentNode).children(".panel-heading");if(!panelHeading.hasClass("collapsed")){panelHeading.addClass("collapsed");}}});}}})();lcbo.storeText=(function(){var _data=[];return{set:function(param){_data[param.key]=param.value;return this;},get:function(key){return(_data[key]||'???'+key+'???');}}})();jQuery.extend(jQuery.expr[':'],{focusable:function(el,index,selector){return $(el).is('a, button, :input, [tabindex]');}});lcbo.PlaceholderSupport=(function(){var _placeholderSupport=function(){var input=document.createElement("input");var support=("placeholder"in input);return support;};var _add=function(){if(!_placeholderSupport()){$(this).find('[placeholder]').each(function(index){var $input=$(this);$input.css("color","#939393");$input.val($input.attr("placeholder"));$input.on("click",function(){if($input.val()===$input.attr("placeholder")){$input.val("");$input.css("color","");}});$input.on("blur",function(){if($input.val()===""){$input.val($input.attr("placeholder"));$input.css("color","#939393");}});});}};return{add:function(){_add.call(this);}};})();lcbo.favorite=(function(){var bindFavEvents=function(){var favContainer=$(".fav-this-item");if(favContainer.length<=0){return;}
var favBtn=favContainer.find(".favorite-this");if(lcbo.isGuest){$(".favorite-this").each(function(i){$(this).attr("href",$("header").find(".sign-in").attr("href"));});}
favBtn.on("click",function(){if($(this).parents(".store-row").length>0){lcbo.ui.deleteFavStoreCookie();}});};return{init:function(){bindFavEvents();}};})();if(typeof l.ui==="undefined"){l.ui={};}
lcbo.ui.initBackToTop=function(){var footerHeight=$("footer").height(),footerWidth=$("footer").outerWidth(),footerPosition=$(document).height()-footerHeight,backToTopEl=$("#back-to-top"),hideDuringAnimation=0;backToTopEl.css("width",footerWidth);backToTopEl.on("click",function(){hideDuringAnimation=1;backToTopEl.hide();$('html, body').animate({scrollTop:0},500,function(){hideDuringAnimation=0});});$(window).scroll(function(){if($(this).scrollTop()>footerHeight&&hideDuringAnimation==0){$("#back-to-top:hidden").stop(true,true).fadeIn();}else{backToTopEl.stop(true,true).fadeOut();}
if(($(this).scrollTop()+$(this).height())>(footerPosition+backToTopEl.outerHeight())){backToTopEl.css("position","static");}else{backToTopEl.css({position:"fixed",width:footerWidth,});}});$(window).resize(function(){footerHeight=$("footer").height(),footerWidth=$("footer").outerWidth(),footerPosition=$(document).height()-footerHeight
backToTopEl.css("width",footerWidth);});};lcbo.ui.updateCartQuantity=function(){var cmdPrefix="/webapp/wcs/stores/servlet/",cmdPostfix="?storeId=10151&catalogId=10001&langId="+WCParamJS.langId,registerURL=cmdPrefix+"CQ5_UserNavView"+cmdPostfix,miniShopCartURL=cmdPrefix+"MiniShopCartDisplayView"+cmdPostfix;$.ajax({url:miniShopCartURL,cache:false}).done(function(response){var newQuantity=$(response).find("#minishopcart_total").attr("data-item-count");$(".header-content").find(".cart-item-count").html(newQuantity);$(".shopping-cart .item-count .num").html(newQuantity);}).fail(function(ex){console.log("Exception: "+ex+" Fetching URL: "+miniShopCartURL);});};lcbo.ui.retryInitSignInModal=function(){lcbo.ui.initSignInModal(true);}
lcbo.ui.initSignInModal=function(retryCheck){var cmdPrefix="/webapp/wcs/stores/servlet/";var cmdPostfix="?storeId=10151&catalogId=10001&langId="+WCParamJS.langId;var registerURL=cmdPrefix+"CQ5_UserNavView"+cmdPostfix;var miniShopCartURL=cmdPrefix+"MiniShopCartDisplayView"+cmdPostfix;var retry=retryCheck;$.ajax({url:registerURL,async:false,cache:false}).done(function(response){var accountDiv=$('.account.hidden-xs.hidden-sm');if(!accountDiv.length){var currPath=encodeURIComponent(window.location.href);var dkHtmlStart=response.indexOf('<div class="account hidden-xs hidden-sm">');var dkHtmlEnd=response.indexOf('<!-- /.account -->');var mbHtmlStart=response.indexOf('<div class="panel-group');var mbHtmlEnd=response.indexOf('<!-- /.account-mobile -->');if(dkHtmlStart>0&&dkHtmlEnd>0){var htmlTextDk=response.substring(dkHtmlStart,dkHtmlEnd);$(".header-content").find(".profile-links").prepend(htmlTextDk);if(currPath.indexOf("AjaxLogonForm")==-1){var signInUrl=$(".sign-in",htmlTextDk).attr("href");signInUrl+="&URL="+currPath;$("header .sign-in").attr("href",signInUrl);}
lcbo.isGuest=false;var signInEl=$("header .sign-in");if(signInEl.length>0){lcbo.isGuest=true;}
if($(".store-locator-container").length>0&&!lcbo.isGuest){lcbo.StoreFinder.updateWithUserFavStores($(".store-locator-container .store-row:not(.store-hidden)"),false);}}
if(mbHtmlStart>0&&mbHtmlEnd>0){var htmlTextMb=response.substring(mbHtmlStart,mbHtmlEnd);$(".nav-mobile").find(".nav-container").prepend(htmlTextMb);if(currPath.indexOf("AjaxLogonForm")==-1){var signInUrl=$(".sign-in",htmlTextMb).attr("href");signInUrl+="&URL="+currPath;$(".nav-mobile .sign-in").attr("href",signInUrl);}
lcbo.isGuest=false;var signInEl=$(".nav-mobile .sign-in");if(signInEl.length>0){lcbo.isGuest=true;}}}}).fail(function(ex){console.log("Exception: "+ex+" Fetching URL: "+registerURL);if(!retry){lcbo.ui.retryInitSignInModal();}});if(!$.cookie("cartCount")){$.ajax({url:miniShopCartURL,async:true,cache:false}).done(function(response){var newQuantity=$(response).find("#minishopcart_total").attr("data-item-count"),cartItemCount=$(".header-content").find(".cart-item-count");newQuantity=Number(newQuantity);if(typeof newQuantity=="number"&&newQuantity>=0){cartItemCount.html(newQuantity);$.cookie("cartCount",newQuantity,{path:"/"});}else{cartItemCount.hide();lcbo.ui.deleteCartCountCookie();}}).fail(function(ex){console.log("Exception: "+ex+" Fetching URL: "+miniShopCartURL);});}else{var newQuantity=Number($.cookie("cartCount")),cartItemCount=$(".header-content").find(".cart-item-count");if(typeof newQuantity=="number"&&newQuantity>=0){cartItemCount.html(newQuantity);}else{cartItemCount.hide();lcbo.ui.deleteCartCountCookie();}}};lcbo.ui.hasCartKillCookie=function(){var cartKill=$.cookie("cartKill");return cartKill;};lcbo.ui.cartItemHeaderCount=function(){var updateCartCTA=$("#updateCart");if(updateCartCTA.length>0){var totalQuantity=updateCartCTA.data("quantity");}else{var totalQuantity=0;}
$(".item-count .num").html(totalQuantity);};lcbo.ui.cartKilledModal=function(){if($.cookie("lang")==="fr"){var killerTitle="Page du paiement inaccessible",killerCTA="CONTINUER",killerContent="Veuillez noter qu'il n'est pas possible de passer des commandes en ligne pour le moment."}else{var killerTitle="Checkout Unavailable",killerCTA="CONTINUE",killerContent="Please note that online ordering is not available at this time."}
var modalEl=".modal.cart-disabled",modalContent=''+'<div class="modal fade cart-disabled">'+'<div class="modal-dialog">'+'<div class="modal-content row">'+'<div class="modal-header">'+'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>'+'</div>'+'<div class="modal-body store-locator">'+'<div class="header row">'+'<h3 class="col-xs-12">'+killerTitle+'</h3>'+'<hr class="divider col-xs-12" />'+'</div>'+'<p>'+killerContent+'</p>'+'<div class="cta" data-dismiss="modal">'+killerCTA+'</div>'+'</div>'+'</div>'+'</div>'+'</div>';$("#checkoutCTA.disabled").add(".add-to-cart-cta.disabled").on("click",function(event){event.preventDefault();if($(modalEl).length==0){$("body").append(modalContent);}
if($(this).hasClass("add-to-cart-cta")&&lcbo.ui.hasCartKillCookie()=="true"){return;}else{$(modalEl).modal("show");}});};lcbo.ui.showCartBanner=function(options){this.resetBannerTimer;var cartBanner=$("#cart-banner");var header=$("header");if(!options){return;}
if(options.notice&&typeof options.notice==="string"){cartBanner.find(".notice").html(options.notice);}
if(options.itemCount&&!isNaN(options.itemCount)){var addItemMessage=cartBanner.find(".added").attr("data-default-msg");addItemMessage=addItemMessage.replace("{0}",options.itemCount);if(parseInt(options.itemCount,10)>1){addItemMessage=addItemMessage.replace("{1}","s");}
else{addItemMessage=addItemMessage.replace("{1}","");}
cartBanner.find(".added").html(addItemMessage);}
if(this.resetBannerTimer!=null){clearTimeout(this.resetBannerTimer);}
var bannerHeight="80px";if(cartBanner.hasClass("large-banner")){bannerHeight="90px";}
cartBanner.css("top","0");if(header.css("position")==="fixed"){if(cartBanner.hasClass("large-banner")){bannerHeight="140px";}
var currMargin=0;if($(".global-msg").length){currMargin=header.css("margin-top");header.css("margin-top","0");}
header.css("top",bannerHeight);}
this.resetBannerTimer=setTimeout(function(){cartBanner.css("top","-"+bannerHeight);header.css("margin-top",currMargin);if(header.css("position")==="fixed"){header.css("top","0");}},6000);};lcbo.ui.initLogonForm=function(){var display=lcbo.utils.getQueryByName("display");var loginError=lcbo.utils.getQueryByName("loginError");var loginErrorSecure=WCParamJS.loginError;if(display==="login"||loginError==="true"||loginErrorSecure==="true"){$(".header-content").find(".sign-in")[0].click();}};lcbo.ui.handleFormSubmit=function(){var form=$("form");requestSubmitted=false;form.each(function(){var currentForm=$(this);if(currentForm.attr("id")==="CatalogSearchForm"){return true;}
var safeGuardThisFormSubmit=false;currentForm.find(":input").each(function(){if(this.getAttribute("name")==="URL"){safeGuardThisFormSubmit=true;return false;}});if(safeGuardThisFormSubmit){currentForm.on("submit",function(){if(!requestSubmitted){requestSubmitted=true;return true;}
return false;});}});};lcbo.ui.deleteCartCountCookie=function(){$.removeCookie("cartCount",{path:"/"});};lcbo.ui.deleteFavStoreCookie=function(){$.removeCookie("favStores",{path:"/"});};lcbo.ui.bindLogoutClickEvent=function(){$(".logout-cta").click(function(){lcbo.ui.deleteCartCountCookie();lcbo.ui.deleteFavStoreCookie();});};lcbo.ui.globalGenericMessageDisplay=function(){var globalMsgEl=$(".global-msg");if(globalMsgEl.length){var headerEl=$("header");globalMsgEl.first().removeClass("hide");if(headerEl.css("position")=="fixed"){var msgHeight=parseInt(globalMsgEl.height()),navMargin=parseInt($("#mainmenu").css("margin-top"));headerEl.css("margin-top",msgHeight);$("#mainmenu").css("margin-top",msgHeight+navMargin);}}};$(document).ready(function(){lcbo.StoreFinder.init();lcbo.bindAccordion.init();lcbo.ui.initBackToTop();lcbo.ui.initSignInModal();lcbo.ui.cartKilledModal();lcbo.favorite.init();lcbo.ui.bindLogoutClickEvent();lcbo.ui.globalGenericMessageDisplay();});window.onload=function(){lcbo.ui.initLogonForm();lcbo.ui.handleFormSubmit();}})(jQuery,(lcbo||(lcbo={})));