//document.documentElement.onclick = function(evt) {
//var evt = window.event;
//alert(evt.srcElement.id);
//}
// helper utility for loading function with page load
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
}
else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
// add the function you want to load with the page within addLoadEvent
addLoadEvent(function() {
hideShow();
});
// show/hide function for promo code on basket
function hideShow() {
// check to see if the element is on the page
if(document.getElementById("show-code-link")) {
// get the link on the page
var codeLink = document.getElementById("show-code-link");
codeLink.onclick = makeItHappen;
}
function makeItHappen() {
// get the area
var codeArea = document.getElementById("enter-code-area");
// determine wheather to show or hide
if(codeArea.getAttribute("class") == "hide" || codeArea.getAttribute("className") == "hide") {
codeArea.className = "";
$("show-code-link").style.textDecoration = "none";
}
else {
codeArea.className = "hide";
$("show-code-link").style.textDecoration = "underline";
}
return false;
}
}
function getElementsByClass(searchClass,node,tag) {
var classElements = new Array();
if ( node == null )
node = document;
if ( tag == null )
tag = '*';
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}
function setCookie(sName,sValue,nDays){
var dToday = new Date();
var dExpire = new Date();
if (nDays==null || nDays==0) nDays=1;
dExpire.setTime(dToday.getTime() + 3600000*24*nDays);
document.cookie = sName + "=" + escape(sValue) + ";path=/;expires=" + dExpire.toGMTString();
}
function getCookie(sName){
var oCookie = document.cookie.split("; ");
for (var i=0; i < oCookie.length; i++)
{
var keyValue = oCookie[i].split("=");
if (sName == keyValue[0])
return unescape(keyValue[1]);
}
return null;
}
function printWindow() {
if (window.print) {
window.print();
} else {
alert("Please use [ File >> Print ] in your toolbar to print this page.");
}
}
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
function printList() {
setActiveStyleSheet("layer");
if (window.print) {
window.print();
} else {
alert("Please use [ File >> Print ] in your toolbar to print this page.");
}
}
function swapImg(imgId,imgName) {
objId = document.getElementById(imgId);
objId.src = objId.src.substr(0,objId.src.lastIndexOf("/")) + "/" + imgName;
return false;
}
function showHideCompare(objState) {
if (objState == "show") {
document.getElementById("compare-layer-items").style.visibility = "visible";
} else {
document.getElementById("compare-layer-items").style.visibility = "hidden";
}
}
function swapDivDisplay(objIdShow,objIdHide) {
if (document.getElementById(objIdShow) != null) {
document.getElementById(objIdShow).style.display = "block";
}
if (document.getElementById(objIdHide) != null) {
document.getElementById(objIdHide).style.display = "none";
}
}
function swapDivDisplay(objIdShow,objIdHide,objIdHide2) {
if (document.getElementById(objIdShow) != null) {
document.getElementById(objIdShow).style.display = "block";
}
if (document.getElementById(objIdHide) != null) {
document.getElementById(objIdHide).style.display = "none";
}
if (document.getElementById(objIdHide2) != null) {
document.getElementById(objIdHide2).style.display = "none";
}
}
function viewAllViewLess(objId,objHrefId,objSpanId) {
if (document.getElementById(objId).style.display != "block") {
hideElementsByClassName();
document.getElementById(objId).style.display = "block";
document.getElementById(objHrefId).innerHTML = "View Fewer";
document.getElementById(objSpanId).style.display = "none";
} else {
hideElementsByClassName();
}
}
function hideElementsByClassName() {
var arrElementsUL = document.getElementsByTagName("ul");
var arrElementsA = document.getElementsByTagName("a");
var arrElementsSPAN = document.getElementsByTagName("span")
for(var i = 0; i < arrElementsUL.length; i++) {
if ((arrElementsUL[i]).className == "nav-landing-more") {
(arrElementsUL[i]).style.display = "none";
}
}
for(var i = 0; i < arrElementsA.length; i++) {
if ((arrElementsA[i]).className == "viewall-subcats") {
(arrElementsA[i]).innerHTML = "View All";
}
}
for(var i = 0; i < arrElementsSPAN.length; i++) {
if ((arrElementsSPAN[i]).className == "number-of-subcats") {
(arrElementsSPAN[i]).style.display = "inline";
}
}
}
function enlargeSwatch(productNumber) {
if ($("swatch-large-image").src.indexOf("162") != -1) {
$("view-larger1").innerHTML = "View Smaller";
$("view-larger2").innerHTML = "View Smaller";
//$("swatch-large-image").src = "/assets/product_images/650x650/" + productNumber + "_650x650.jpg";
$("swatch-large-image").src = "https://lumberliquidators.scene7.com/is/image/LumberLiquidators/" + productNumber + "_sw?$650x650$";
$("swatch-large-image").style.width = "650px";
$("mysamples").style.display = "none";
} else {
$("view-larger1").innerHTML = "View Larger";
$("view-larger2").innerHTML = "View Larger";
//$("swatch-large-image").src = "/assets/product_images/162x650/" + productNumber + "_162x650.jpg";
$("swatch-large-image").src = "https://lumberliquidators.scene7.com/is/image/LumberLiquidators/" + productNumber + "_sw?$650x650$";
$("swatch-large-image").style.width = "162px";
$("mysamples").style.display = "block";
}
}
function displayDefaultTab(tabListString) {
var imgArray = tabListString.split("|");
var imgTab = document.getElementById(imgArray[0]);
var imgPath = imgTab.src.substr(0,imgTab.src.lastIndexOf("/")) + "/";
document.getElementById(imgArray[0]).src = imgPath + imgArray[0] + "_over.gif";
document.getElementById(imgArray[0] + "_l").style.display = "block";
}
/*
* toggleTabs is used in product_swatch.jsp
*/
function toggleTabs(imgName,swatchStatus) {
var imgTab = null;
if (swatchStatus == true) {
var imgArray = new Array("tab_swatch","tab_acc_trim_side");
}
for (i = 0; i < imgArray.length; i++) {
if (!document.getElementById(imgArray[i])) {
imgTab = null;
} else {
imgTab = document.getElementById(imgArray[i]);
var imgPath = imgTab.src.substr(0,imgTab.src.lastIndexOf('/')) + '/';
imgTab.src = imgPath + imgArray[i] + '.gif';
imgTab = document.getElementById(imgArray[i]);
imgTab.style.display = "inline";
}
}
document.getElementById(imgName).src = imgPath + imgName + '_over.gif';
if (imgTab != null) {
document.getElementById(imgName).style.display = "inline";
}
}
function fakeEvent(clientX, clientY, screenX, screenY, pageX, pageY, fixX, fixY, parentDiv) {
this.clientX = clientX;
this.clientY = clientY;
this.screenX = screenX;
this.screenY = screenY;
this.pageX = pageX;
this.pageY = pageY;
this.fixX = fixX;
this.fixY = fixY;
this.parentDiv = parentDiv;
}
function startShowTimer(frm, ev, parentDiv) {
var f = function() { showProductInfo(arguments.callee.frm, arguments.callee.ev,parentDiv) };
var fakeEv = new fakeEvent(ev.clientX, ev.clientY,ev.screenX,ev.screenY,ev.pageX,ev.pageY,parentDiv);
f.frm = frm;
f.ev = fakeEv;
f.parentDiv = parentDiv;
showTimer = setTimeout(f, 1000);
}
function startHideTimer(frm, ev) {
clearTimeout(showTimer);
var f = function() { hideProductInfo(arguments.callee.frm, arguments.callee.ev) };
var fakeEv = new fakeEvent(ev.clientX, ev.clientY,ev.screenX,ev.screenY,ev.pageX,ev.pageY);
f.frm = frm;
f.ev = fakeEv;
hideTimer = setTimeout(f, 1000);
}
function cancelHide() {
clearTimeout(hideTimer);
}
function showProductInfo(frm, evt, parentDiv) {
if (frm.accType.value) {
showInfoPopup(frm.accType.value);
productInfoPopup(evt,'show', parentDiv);
}
showTimer = 0;
}
function hideProductInfo(frm, evt) {
productInfoPopup(evt,'hide');
showHideProductInfo('hide');
hideTimer = 0;
}
function visibleProductInfo() {
showHideProductInfo('show');
}
function showHideProductInfo(objState) {
if (objState == "show") {
document.getElementById("product-info-layer").style.visibility = "visible";
} else {
document.getElementById("product-info-layer").style.visibility = "hidden";
}
}
function findLeft(obj) {
var curleft = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
}
}
return curleft;
}
function findTop(obj) {
var curtop = 0;
if (obj.offsetParent) {
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curtop += obj.offsetTop
}
}
return curtop;
}
function productInfoPopup(e,objState, parentDiv) {
objPopup = document.getElementById("product-info-layer");
objDiv = parentDiv;
posX = null;
posY = null;
viewportX = null;
getDocMode = true;
leftPos = null;
topPos = null;
if (self.innerHeight) { //other browsers
viewportX = self.innerWidth + self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop) { //explorer 6 standards-compliant
viewportX = document.documentElement.clientWidth + document.documentElement.scrollLeft;
} else if (document.body) { //explorer 5.5
getDocMode = false;
viewportX = document.body.clientWidth + document.body.scrollLeft;
}
if (objState == "show") {
leftPos = findLeft(objDiv);
topPos = findTop(objDiv) -3;
posX = leftPos;
posY = topPos;
if (posX < leftPos + Math.round((objDiv.offsetWidth)/2)){
posX = leftPos - 3 - objPopup.offsetWidth ;
if (posX < 0 ){
posX = leftPos - 100 + objDiv.offsetWidth ;
}
} else {
posX = leftPos + objDiv.offsetWidth + 3;
if ( posX + objPopup.offsetWidth > viewportX ){
posX = leftPos - 3 - objPopup.offsetWidth;
}
}
objPopup.style.left = posX + "px";
objPopup.style.top = topPos + "px";
//objPopup.style.visibility = "visible";
} else {
//objPopup.style.visibility = "hidden";
}
return false;
}
function popCenterDiv(objId,objState) {
objId = document.getElementById(objId);
var posY = 0;
var posX = 0;
viewportX = null;
viewportHeightY = null;
viewportOffsetY = null;
var objWidth = objId.offsetWidth;
var objHeight = objId.offsetHeight;
getDocMode = true;
if (self.innerHeight) { //other browsers
viewportX = self.innerWidth + self.pageXOffset;
viewportHeightY = self.innerHeight
viewportOffsetY = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop) { //explorer 6 standards-compliant
viewportX = document.documentElement.clientWidth + document.documentElement.scrollLeft;
viewportHeightY = document.documentElement.clientHeight
viewportOffsetY = document.documentElement.scrollTop;
} else if (document.body) { //explorer 5.5
getDocMode = false;
viewportX = document.body.clientWidth + document.body.scrollLeft;
viewportHeightY = document.body.clientHeight
viewportOffsetY = document.body.scrollTop;
}
posY = Math.round(viewportHeightY/2 + viewportOffsetY) - Math.round(objHeight/2);
posX = Math.round(viewportX/2) - Math.round(objWidth/2);
if (objState == "show") {
objId.style.top = posY + "px";
objId.style.left = posX + "px";
objId.style.visibility = "visible";
} else if (objState == "hide") {
objId.style.top = posY + "px";
objId.style.left = posX + "px";
objId.style.visibility = "hidden";
}
}
function comparePopup(e,objState) {
objPopup = document.getElementById("compare-layer");
posX = null;
posY = null;
viewportX = null;
getDocMode = true;
if (self.innerHeight) { //other browsers
viewportX = self.innerWidth + self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop) { //explorer 6 standards-compliant
viewportX = document.documentElement.clientWidth + document.documentElement.scrollLeft;
} else if (document.body) { //explorer 5.5
getDocMode = false;
viewportX = document.body.clientWidth + document.body.scrollLeft;
}
if (objState == "show") {
if (e.pageX || e.pageY) {
posX = e.pageX;
posY = e.pageY;
} else if (e.clientX || e.clientY) {
if (getDocMode == true) {
posX = e.clientX + document.documentElement.scrollLeft;
posY = e.clientY + document.documentElement.scrollTop;
} else {
posX = e.clientX + document.body.scrollLeft;
posY = e.clientY + document.body.scrollTop;
}
}
if (posX + objPopup.offsetWidth > viewportX) {
objPopup.style.left = posX - objPopup.offsetWidth + "px";
} else {
objPopup.style.left = posX + "px";
}
objPopup.style.top = posY - objPopup.offsetHeight + "px";
objPopup.style.visibility = "visible";
} else {
objPopup.style.visibility = "hidden";
}
return false;
}
function goToLink(address) {
var linkURL = address.options[address.selectedIndex].value;
window.top.location.href = linkURL;
address.selectedIndex=0;
}
/*
* This function launches a new web browser window to a specified width, height and features.
* Features string is a comma separated window's feature needed for this new window. For Instance
* If a new window needs a toolbar the feature string must be "toolbar" like needs scroll bar and
* and toolbar then it must be "toolbar,scrollbar". Note that the order of the feature is not required.
* Also it's case insensitive. Therefore, "scrollbar,toolbar" is identical to "Toolbar,ScrollBar".
*
* If the features string is ommitted then all the features are turned off. To turn all the features on
* use the word "all" for features instead of specifying each feature.
*/
function openWindow(address, width, height,features)
{
/* Find out what features need to be enable
*
*/
if(features)
features = features.toLowerCase();
else
features = "";
var toolbar = (features == "all" ? 1 : 0);
var menubar = (features == "all" ? 1 : 0);
var location = (features == "all" ? 1 : 0);
var directories = (features == "all" ? 1 : 0);
var status = (features == "all" ? 1 : 0);
var scrollbars = (features == "all" ? 1 : 0);
var resizable = (features == "all" ? 1 : 0);
if(features != "all")
{
//split features
var feature = features.split(",");
for(i = 0; i < feature.length; i++)
{
if(feature[i] == "toolbar")
toolbar = 1;
else if(feature[i] == "menubar")
menubar = 1;
else if(feature[i] == "location")
location = 1;
else if(feature[i] == "directories")
directories = 1;
else if(feature[i] == "status")
status = 1;
else if(feature[i] == "scrollbars")
scrollbars = 1;
else if(feature[i] == "resizable")
resizable = 1;
}
}
features = "toolbar=" + toolbar + ",";
features += "menubar=" + menubar + ",";
features += "location=" + location + ",";
features += "directories=" + directories + ",";
features += "status=" + status + ",";
features += "scrollbars=" + scrollbars + ",";
features += "resizable=" + resizable;
var newWindow = window.open(address, 'Popup_Window', 'width=' + width + ',height=' + height + ',"' + features + '"');
newWindow.focus();
}
function confirmWindow(url, text) {
if (confirm(text)) {
window.go = url;
window.location = url;
}
}
/*
* toggleTabs is used in product_body.jsp for cross-sells and email a friend tabs
*/
function toggleCrossSellTabs(imgName,tabListString) {
var imgTab = null;
var imgArray = tabListString.split("|");
for (i = 0; i < imgArray.length; i++) {
if (!document.getElementById(imgArray[i])) {
imgTab = null;
} else {
imgTab = document.getElementById(imgArray[i]);
var imgPath = imgTab.src.substr(0,imgTab.src.lastIndexOf('/')) + '/';
imgTab.src = imgPath + imgArray[i] + '.gif';
imgTab = document.getElementById(imgArray[i] + "_l");
imgTab.style.display = "none";
}
}
//not sure what this is, but adding a check first becuase it keeps failing
if(document.getElementById(imgName) != null){
document.getElementById(imgName).src = imgPath + imgName + "_over.gif";
}
if (imgTab != null) {
if(imgName=="tab_acc_trim"){
document.getElementById("tab_prod_desc_l").style.display = "block";
document.getElementById("prod_desc_text").style.display = "none";
}else{
document.getElementById(imgName + "_l").style.display = "block";
document.getElementById("prod_desc_text").style.display = "block";
}
}
}
/*
* setAddTo() and calTotal() are used in product_details_panel.jsp
*/
function setAddTo(addToType) {
document.productForm.addTo.value = addToType;
if (addToType == 2) {
if (document.productForm.quantity.value=="0") {
document.productForm.quantity.value="1";
}
document.productForm.action = 'https://www.lumberliquidators.com/checkout/add_item.cmd';
document.productForm.submit();
}
}
function calTotal(sellingPkgQty,unitPrice,isFlooring,waste,isLinearFt,isCanned,discountPrice,discountThreshold) {
var totalCost;
var qty;
if (isFlooring || isLinearFt || isCanned ) {
if (sellingPkgQty > 0) {
var yourSFT = document.productForm.your_sft.value;
yourSFT = yourSFT * (1+(waste/100)) ;
qty = Math.ceil(yourSFT / sellingPkgQty);
var totalSFT = Math.round(qty * sellingPkgQty * 100) / 100;
if (isFlooring && (totalSFT >= discountThreshold) && (discountPrice < unitPrice) && (discountPrice > 0)){
totalCost = Math.ceil(totalSFT * discountPrice * 100) / 100;
}else{
totalCost = Math.ceil(totalSFT * unitPrice * 100) / 100;
}
document.productForm.quantity.value = qty;
if (isFlooring) {
//add back the disclaimer about the extra 10%
$('.prod-calculator p.disclaimer').removeClass('hideMe');
document.getElementById("box_qty").innerHTML = qty + " boxes";
document.getElementById("total_sft").innerHTML = totalSFT + " sq.ft.";
} else if( isLinearFt) {
document.getElementById("box_qty").innerHTML = qty + " units";
document.getElementById("total_sft").innerHTML = totalSFT + " linear ft.";
} else if(isCanned){
document.getElementById("box_qty").innerHTML = qty + " cans";
document.getElementById("total_sft").innerHTML = totalSFT + " sq.ft.";
}
}else {
totalCost = 0;
document.productForm.your_sft.value = 0;
}
} else {
qty = document.productForm.quantity.value;
totalCost = Math.ceil(qty * sellingPkgQty * unitPrice * 100) / 100;
}
$('.prod-calculator').attr('data-quantity',qty);
$('.prod-calculator .box-num-area').attr('data-quantity',qty);
if(qty == 1){
if (isFlooring) {
$('.prod-calculator .box-num').text(qty+" Box");
}
if (isLinearFt) {
$('.prod-calculator .box-num').text(qty+" Unit");
}
}
if(qty > 1){
if (isFlooring) {
$('.prod-calculator .box-num').text(qty+" Boxes");
}
if (isLinearFt) {
$('.prod-calculator .box-num').text(qty+" Units");
}
}
$('.prod-calculator .box-num-area').attr('data-total-cost',totalCost.toFixed(2));
if( document.getElementById("total_cost") ){
document.getElementById("total_cost").innerHTML = '$' + totalCost.toFixed(2);
}
}
/*
* setBasketAddTo() is used in basket_body.jsp
*/
function setBasketAddTo(addToType) {
document.itemQuantitiesForm.addTo.value = addToType;
document.itemQuantitiesForm.submit();
}
/*
* checkout_calTotal is used in checkout_pop.jsp
*/
function checkout_calTotal(index,sellingPkgQty,unitPrice) {
var totalCost;
var qty;
if (sellingPkgQty > 0) {
var yourLFT = eval("document.checkoutForm.lft" + index + ".value");
qty = Math.ceil(yourLFT / sellingPkgQty);
var totalLFT = Math.round(qty * sellingPkgQty * 100) / 100;
totalCost = Math.ceil(totalLFT * unitPrice * 100) / 100;
document.checkoutForm.quantity[index].value = qty;
}else {
totalCost = 0;
document.checkoutForm.quantity[index].value = 0;
}
}
function checkOutPopup(objState) {
objPopup = document.getElementById("checkout-layer");
if (objState == "show") {
document.getElementById("header").style.opacity = " .3";
document.getElementById("header").style.filter = "alpha(opacity=30)";
document.getElementById("breadcrumb").style.opacity = " .3";
document.getElementById("breadcrumb").style.filter = "alpha(opacity=30)";
document.getElementById("product-beauty").style.opacity = " .3";
document.getElementById("product-beauty").style.filter = "alpha(opacity=30)";
document.getElementById("product-tabs").style.opacity = " .3";
document.getElementById("product-tabs").style.filter = "alpha(opacity=30)";
document.getElementById("product-swatch").style.opacity = " .3";
document.getElementById("product-swatch").style.filter = "alpha(opacity=30)";
objPopup.style.visibility = "visible";
} else {
document.getElementById("header").style.opacity = "1";
document.getElementById("header").style.filter = "alpha(opacity=100)";
document.getElementById("breadcrumb").style.opacity = "1";
document.getElementById("breadcrumb").style.filter = "alpha(opacity=100)";
document.getElementById("product-beauty").style.opacity = "1";
document.getElementById("product-beauty").style.filter = "alpha(opacity=100)";
document.getElementById("product-tabs").style.opacity = " 1";
document.getElementById("product-tabs").style.filter = "alpha(opacity=100)";
document.getElementById("product-swatch").style.opacity = "1";
document.getElementById("product-swatch").style.filter = "alpha(opacity=100)";
objPopup.style.visibility = "hidden";
}
}
/*
* addStoreForProduct() is used in product_details_panel.jsp
*/
function addStoreForProduct(oSelect) {
if(oSelect.value != null) {
document.productForm.storeId.value = oSelect.value;
}else {
document.productForm.storeId.value = 0;
}
}
/*
* toggleCustomerType() is used in register_body.jsp
*/
function toggleCustomerType(oForm) {
if (oForm.emailPreference.checked) {
$("frmcustomerType1").style.display = 'block';
$("lblcustomerType1").style.display = 'inline';
$("frmcustomerType2").style.display = 'block';
$("lblcustomerType2").style.display = 'inline';
$("frmcustomerType3").style.display = 'block';
$("lblcustomerType3").style.display = 'inline';
} else {
$("frmcustomerType1").style.display = 'none';
$("lblcustomerType1").style.display = 'none';
$("frmcustomerType2").style.display = 'none';
$("lblcustomerType2").style.display = 'none';
$("frmcustomerType3").style.display = 'none';
$("lblcustomerType3").style.display = 'none';
}
}
/*
* toggleInternationalAddress() is used in shipping_body.jsp & billing_body.jsp
*/
function toggleInternationalAddress(oForm) {
if (oForm.internationalAddress.checked) {
$("lblState").style.display = 'none';
$("frmObjState").style.display = 'none';
$("lblZip").style.display = 'none';
$("errorZip").style.display = 'none';
$("lblIntState").style.display = 'inline';
$("frmObjIntState").style.display = 'block';
$("lblCountry").style.display = 'inline';
$("frmObjCountry").style.display = 'block';
$("lblIntZip").style.display = 'inline';
$("errorIntZip").style.display = 'block';
if ($("registerPanel")) {
$("registerPanel").style.display = 'none';
oForm.actualPassword.value = '';
oForm.verifyPassword.value = '';
$("pwdMsgFail").style.display = 'none';
$("pwdMsgFormat").style.display = 'none';
$("pwdMsgSuccess").style.display = 'none';
}
oForm.zipCode.maxLength = '15';
if (document.addressBookForm) {
document.addressBookForm.userAddressIndex.disabled = true;
}
} else {
$("lblState").style.display = 'inline';
$("frmObjState").style.display = 'block';
$("lblZip").style.display = 'inline';
$("errorZip").style.display = 'block';
$("lblIntState").style.display = 'none';
$("frmObjIntState").style.display = 'none';
$("lblCountry").style.display = 'none';
$("frmObjCountry").style.display = 'none';
$("lblIntZip").style.display = 'none';
$("errorIntZip").style.display = 'none';
if ($("registerPanel")) {
$("registerPanel").style.display = 'block';
}
oForm.zipCode.maxLength = '10';
if (oForm.country) {
oForm.country.value = '';
}
if (oForm.zipCode.value.length > 10) {
var tmpZip = oForm.zipCode.value;
oForm.zipCode.value = tmpZip.substring(0,10);
}
if (document.addressBookForm) {
document.addressBookForm.userAddressIndex.disabled = false;
}
}
}
/*
* forgotPassword() is used in shipping_body.jsp
*/
function forgotPassword(){
if(confirm("You can reset your password by visiting our Forgot Password page. Go there now?")) {
window.location.href = '../user/forgot_password.jsp';
}
}
/*
* setStoreValues() is used in delivery_body.jsp
*/
function setStoreValues(storeId) {
if (storeId==null) {
document.deliveryForm.pickupStoreId.value = document.deliveryForm.storeMenu.options[document.deliveryForm.storeMenu.selectedIndex].value;
} else {
document.deliveryForm.pickupStoreId.value = storeId;
}
}
/*
* toggleDivs is used in floor_finder_body.jsp
*/
function toggleDivs(imgName,tabListString) {
var imgArray = tabListString.split("|");
for (i = 0; i < imgArray.length; i++) {
imgTab = document.getElementById(imgArray[i]);
var imgPath = imgTab.src.substr(0,imgTab.src.lastIndexOf('/')) + '/';
imgTab.src = imgPath + imgArray[i] + '-off.gif';
imgTab = document.getElementById(imgArray[i] + "-panel");
imgTab.style.display = "none";
}
document.getElementById(imgName).src = imgPath + imgName + "-on.gif";
document.getElementById(imgName + "-panel").style.display = "block";
}
/*
* toggleDivs is used in floor_finder_body.jsp
*/
function toggleDivsNoResults(imgName,tabString) {
imgTab = document.getElementById(tabString);
var imgPath = imgTab.src.substr(0,imgTab.src.lastIndexOf('/')) + '/';
imgTab.src = imgPath + tabString + '-off.gif';
imgTab = document.getElementById(tabString + "-panel");
imgTab.style.display = "none";
document.getElementById(imgName).src = imgPath + imgName + "-on.gif";
document.getElementById(imgName + "-panel").style.display = "block";
}
/*
* Used to bookmark the page
*/
function addToFavorites(params, pagename)
{
if (window.external)
{
window.external.AddFavorite(params, pagename);
}else
{
document.location = params;
alert("Your Browser does not support this function. Please bookmark the page manually.");
}
}
function showSingleChild(parentId, childClassName, childId){
var oParent = document.getElementById(parentId);
var oParentColl = oParent.getElementsByTagName('DIV') || oParent.all;
for(var i=0;i< oParentColl.length;i++){
var oChild = oParentColl.item(i);
if(oChild.className == childClassName){
if(oChild.id == childId){
if(oChild.style.display != "block") oChild.style.display = "block";
else oChild.style.display = "none";
} else {
oChild.style.display = "none";
}
}
}
}
function swapClass(divToChange,oldClass,newClass) {
var el = document.getElementById(divToChange)
var className = el.className;
el.className = className.replace(new RegExp(oldClass), newClass);
}
function changeClass(divToChange,newClass) {
var el = document.getElementById(divToChange)
var className = el.className;
el.className = className.replace(new RegExp('.*'), newClass);
}
function clearText(e, stringToCheck) {
if (stringToCheck == e.value) {
e.value = "";
}
}
function setStore(myStoreId) {
updateMyStore("storeId=" + myStoreId);
changeClass('home-store-finder', 'selected-store');
if (selectedStore != null) selectedStore = true;
return false;
}
function setStoreFromMapLayer(myStoreId) {
updateMyStore("storeId=" + myStoreId);
changeClass('home-store-finder', 'selected-store');
hideStoreLayer();
if (selectedStore != null) selectedStore = true;
return false;
}
function setStoreFromProductList(myStoreId, productId) {
updateMyStoreFromProductList("storeId=" + myStoreId + "&productId=" + productId);
changeClass('home-store-finder', 'selected-store');
if (selectedStore != null) selectedStore = true;
return false;
}
function ajaxStoreSearch() {
updateStorePanel(getStoreParams());
return false;
}
function ajaxStoreSearch(avail, product) {
updateStorePanel(getStoreParams(avail, product));
return false;
}
function displayStoreInformationPanel(params) {
changeClass('store-info-layer', 'loading');
updateStoreInformationPanel(params);
}
function hideStoreLayer() {
changeClass('store-info-layer', 'dead');
}
function displayStoreInformationPanelDirections() {
changeClass('store-info-layer', 'loading');
var params = Form.serialize('storeLayerDirections');
updateStoreInformationPanelDirections(params);
getpopupHead ();
return false;
}
function getStoreParams() {
return "zipCode=" + document.zipEntry.zipCode.value;
}
function getStoreParams(avail, product) {
return "productId=" + product + "&showAvailability=" + avail + "&zipCode=" + document.zipEntry.zipCode.value;
}
function hasSelectedStore() {
return selectedStore;
}
function closeStoreFinder() {
oldStoreFinderClass = $("home-store-finder").className;
if (hasSelectedStore()) {
$("home-store-finder").className = "close-store-finder-selected";
} else {
$("home-store-finder").className = "close-store-finder";
}
}
function openStoreFinder() {
if (hasSelectedStore()) {
$("home-store-finder").className = "search-stores-selected";
} else {
$("home-store-finder").className = "search-stores";
}
$("zipCode").value = "Enter a ZIP code";
}
function openFloorFinder() {
var elementsToDisplay = getElementsByClass("ff-img-home");
elementsToDisplay.each(function(node) { node.style.display = "block";} );
showSingleChild('home-floor-finder','steps','floor-finder-step1');
$("home-floor-finder").className = "open-floor-finder";
}
function closeFloorFinder() {
var elementsToDisplay = getElementsByClass("ff-img-home");
elementsToDisplay.each(function(node) { node.style.display = "none";} );
showSingleChild('home-floor-finder','steps','floor-finder-begin');
$("home-floor-finder").className = "close-floor-finder";
}
function checkPswd(p1,p2,msgFail,msgFormat,msgSuccess){
var oMsgFail = document.getElementById(msgFail)
var oMsgFormat = document.getElementById(msgFormat)
var oMsgSuccess = document.getElementById(msgSuccess)
if(p1 != "" || p2 != ""){
if(p1 == p2){
if (p1.length < 6 || p1.length > 15) {
oMsgFail.style.display = 'none';
oMsgFormat.style.display = 'block';
oMsgSuccess.style.display = 'none';
} else {
oMsgFail.style.display = 'none';
oMsgFormat.style.display = 'none';
oMsgSuccess.style.display = 'block';
}
}
else{
oMsgFail.style.display = 'block';
oMsgFormat.style.display = 'none';
oMsgSuccess.style.display = 'none';
}
}
}
function toggleCompareBox(prodId){
var cBoxName = "checkbox_" + prodId;
if($(cBoxName)){
var oCb = $(cBoxName);
if(oCb.src.indexOf("checkbox_empty") > 0) oCb.src = oCb.src.substr(0,oCb.src.lastIndexOf("/")) + "/checkbox.gif";
else oCb.src = oCb.src.substr(0,oCb.src.lastIndexOf("/")) + "/checkbox_empty.gif";
}
}
function findStores(state){
document.stateSearch.state.value = state;
if(!document.stateSearch.popup){
document.stateSearch.submit();
}else{
findStoresByStatePopup(document.stateSearch);
}
}
function findStorebyCity(oMenu){
if(oMenu.selectedIndex>0){
var stateCity = oMenu.options[oMenu.selectedIndex].text.split(" - ");
document.citySearch.city.value = stateCity[1];
document.citySearch.state.value = stateCity[0];
document.citySearch.submit();
}
}
function showInstructions() {
var instructionalHtml = '';
instructionalHtml = 'You must accept the conditions in the above policy and click
';
instructionalHtml += 'the "Submit Your Order Now" button to complete this order.
';
instructionalHtml += 'If you have a question about your order, please call: 1-800-366-4204';
document.getElementById("instructional_text").innerHTML = instructionalHtml;
}
function displayStoreInformationPanelDirections(storeZip) {
changeClass('store-info-layer', 'loading');
var params = 'zipCode=' + storeZip;
updateStoreInformationPanelDirections(params);
//return false;
}
function changeClass(divToChange,newClass) {
var el = document.getElementById(divToChange)
var className = el.className;
el.className = className.replace(new RegExp('.*'), newClass);
}
function hideStoreLayer() {
changeClass('store-info-layer', 'dead');
}
function submitProductSetMyStoreForm() {
document.productSetMyStoreForm.zipCode.value = document.productForm.myStoreZip.value;
document.productSetMyStoreForm.submit();
}