var changeStoreLayerCommand = new Array(8); changeStoreLayerCommand[0] = '/includes/change_store_popup_body.jsp'; changeStoreLayerCommand[1] = '/custserv/save_user_store.cmd'; var changeStoreLayerContainerId = "#widget-changeStore"; var changeStoreLayerCloseButClass = ".widget-close-but"; var changeStoreLoadingHTML = '
' + '
' + '
' + '
' + '
Loading...
' + '
' + '
' + '
' + '
'; var changeStoreSimpleHTML = '
'; /* Function(s) to Show the storeSelection Layer */ function showChangeStoreLayer() { showChangeStoreLayerLoading(changeStoreLoadingHTML); var requestURL = changeStoreLayerCommand[0]; $.ajax({ type: "POST", url: requestURL, dataType: "html", timeout: 15000, complete: function() { $(changeStoreLayerCloseButClass).click(function() { hideChangeStoreLayer(); }); }, success: function(data) { positionChangeStoreLayer(); hideChangeStoreLayerLoading(); $(changeStoreLayerContainerId).append(data); $(changeStoreLayerContainerId).show(); return true; }, error: function() { hideChangeStoreLayerLoading(); return false; } }); } function showChangeStoreLayerLoading(htmlToShow) { $(changeStoreLayerContainerId).remove(); //load, position, show new layer $("body").append(htmlToShow); $(changeStoreLayerContainerId).show(); } function hideChangeStoreLayerLoading() { $(changeStoreLayerContainerId + " *").remove(); $(changeStoreLayerContainerId).html(""); } //Center the positionstoreSelectionLayer function positionChangeStoreLayer() { $(changeStoreLayerContainerId).center(); } function hideChangeStoreLayer() { $(changeStoreLayerContainerId).hide(); $(changeStoreLayerContainerId).remove(); } function changeUserStore(storeId) { changeUserStoreWithParams(storeId, false, false); } function changeUserStoreWithParams(storeId, prevStrTogoFlag, currStrTogoFlag) { if (prevStrTogoFlag && !currStrTogoFlag) { StoreLocator.change.prompt(null); } else { var params = "storeId=" + storeId; var postURL = changeStoreLayerCommand[1] + "?" + params; hideChangeStoreLayer(); showChangeStoreLayerLoading(changeStoreLoadingHTML); positionChangeStoreLayer(); $.ajax({ type: "POST", url: postURL, dataType: "html", timeout: 15000, complete: function() { }, success: function(data) { location.reload(true); // Reload once we've set the store on the server. }, error: function() { } }); } } // sfarrugia - 1/5/2010 - Moved code from here to common.js //dkh - 12/8/2009 - Setting to http //utility function to jump to the store locator page - always http function jumpToStoreLocatorPage() { document.location = "https://www.hannaford.com/locations"; // window.location } function changeStoreStage2() { if (isSignedIn()) { if (hasHomeStoreSelected() && hasAlternateStoreSelected()) { showChangeStoreLayer(); } else { jumpToStoreLocatorPage(); } } else { jumpToStoreLocatorPage(); } } function changeStore() { if (isCakePage() || isMeatPage()) { var storeChange = confirm("If you change stores your selections will be lost, are you sure you want to change stores?"); if (storeChange) { changeStoreStage2(); } } else { changeStoreStage2(); } }