$.ajaxSettings.traditional = true; //serializes for Java-style form posts. /* load document variables [ begin ] */ $(function(){ doc = function(){ if (self.innerHeight) { doc.pageYOffset = self.pageYOffset; doc.pageXOffset = self.pageXOffset; doc.innerHeight = self.innerHeight; doc.innerWidth = self.innerWidth; } else if (document.documentElement && document.documentElement.clientHeight) { doc.pageYOffset = document.documentElement.scrollTop; doc.pageXOffset = document.documentElement.scrollLeft; doc.innerHeight = document.documentElement.clientHeight; doc.innerWidth = document.documentElement.clientWidth; } else if (document.body) { doc.pageYOffset = document.body.scrollTop; doc.pageXOffset = document.body.scrollLeft; doc.innerHeight = document.body.clientHeight; doc.innerWidth = document.body.clientWidth; } return doc; } }); function getMouseCoord(e){ (!e) ? e = window.event : e = e; objDoc = new doc(); (e.pageX) ? objDoc.pageX = e.pageX : objDoc.pageX = e.clientX + objDoc.scrollLeft; (e.pageY) ? objDoc.pageY = e.pageY : objDoc.pageY = e.clientY + objDoc.scrollTop; return [e.pageX,e.pageY]; } function openWindow(address, width, height, resizable, scrollbars) { if (!scrollbars) { scrollbars = "no"; } if (!resizable) { resizable = "no"; } var newWindow = window.open(address, 'Popup_Window', 'width=' + width + ',height=' + height + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrollbars + ',resizable=' + resizable); } /* load document variables [ end ] */ /* png transparency [ begin ] */ $(function(){ fixPNG($(".png_ie")); }); function fixPNG(o) { o.each(function(){ s = $(this).attr("src"); s = s.substr(0,s.lastIndexOf("/")) + "/" + $(this).attr("id") + ".png"; if (navigator.appName.indexOf("Microsoft") != -1) { $(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + s + "', sizingMethod='scale')"); } else { $(this).attr("src",s); } }); } /* png transparency [ end ] */ /* search [ begin ] */ $(function() { $(".endeca_search_form").submit(function() { valInput = $.trim($(".search_text_box",this).val()); if (valInput == "enter keyword" || valInput == "") { return false; } else { // replace multiple spaces inbetween words with single space exp = / /g; while (valInput.match(exp)) { valInput = valInput.replace(exp," "); } endecaUrl = "catalog/search.jsp?N=0&Nty=1&Ntpc=1&Ntpr=1&Ns=PRODUCT_SEQUENCE_NO|0&Ntk=AllSearch&Ntx=mode+matchallpartial&Ntt=" + valInput; location.href = "/" + endecaUrl + ""; return false; } }); }); /* search [ end ] */ /* power reviews [ begin ] */ function pwrWriteReview(writeURL) { showProductInfoTab($("#product_info_review_tab")); $.get( writeURL, function(data) { $("#pwr_review_tab").html(data); } ); } function pwrReadReview(readURL) { showProductInfoTab($("#product_info_review_tab")); $.get( readURL, function(data) { $("#pwr_review_tab").html(data); } ); } /* power reviews [ begin ] */ /* epp message tool tip [ begin ] */ $(function(){ initEppMsg(); }); function initEppMsg() { $(".epp_msg").hover(function(i){ msgTitle = $(this).attr("title"); $(this).attr("title",""); $("body").append("
"+msgTitle+"
"); xPos = getMouseCoord(i)[0] - $(".epp_msg_tt").width() - 5; yPos = getMouseCoord(i)[1] - $(".epp_msg_tt").height() - 5; $(".epp_msg_tt").css("left",xPos).css("top",yPos); },function(){ $(this).attr("title",msgTitle); $(".epp_msg_tt").remove(); }); } /* epp message tool tip [ end ] */ /* global popup layer [ begin ] */ $(function(){ $(".case-price-detail").click(function(){ popGlobalLayer("If Purchased Separately","This price shows the total cost of buying the products individually in a Meijer store at our everyday low price."); return false; }); $(".phone_why").click(function(){ popGlobalLayer("Why do you ask?","Some states restrict electronic messages to persons under 18 that present products or services for which they would not qualify, such as special Meijer Credit Card promotions or sales on wine. Meijer ensures we are complying by asking you to confirm your age."); return false; }); $(".birth_date_why").click(function(){ popGlobalLayer("Why do you ask?","Some states restrict electronic messages to persons under 18 that present products or services for which they would not qualify, such as special Meijer Credit Card promotions or sales on wine. Meijer ensures we are complying by asking you to confirm your age."); return false; }); $(".birth_date_meijer1_why").click(function(){ popGlobalLayer("Why do you ask?","We're asking for your birth date to make sure we're accessing the correct account."); return false; }); $(".gift_card_legal").click(function(){ popGiftCardLegal("Meijer Gift Card Terms & Conditions"); return false; }); $(".forgot_password").click(function(){ $("#global_layer").remove(); $("body").append("
"); $.post( "/includes/" + "layer_forgot_password.jsp", function(data) { fixSelect(true); $("#global_layer").html(data); doc = new doc(); $("#global_layer").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#global_layer").height()/2)); $("#global_layer").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#global_layer").width()/2)); fixPNG($(".png_ie")); $(".mid","#global_layer").height($(".inner","#global_layer").height()); $("#global_layer .close").click(function(){ fixSelect(''); $("#global_layer").remove(); return false; }); $.ajax({ type: "POST", url: "/includes/" + "layer_forgot_password.jsp", dataType: "html" }); } ); }); }); function popGlobalLayer(paramTitle, paramContent) { $("#global_layer").remove(); $("body").append("
"); $.post( "/includes/" + "layer_global.jsp", { layerTitle: paramTitle, layerContent: paramContent }, function(data) { fixSelect(true); $("#global_layer").html(data); doc = new doc(); $("#global_layer").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#global_layer").height()/2)); $("#global_layer").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#global_layer").width()/2)); fixPNG($(".png_ie")); $(".mid","#global_layer").height($(".inner","#global_layer").height()); $("#global_layer .close").click(function(){ fixSelect(''); $("#global_layer").remove(); return false; }); } ); } /* global popup layer [ end ] */ /* popup layer with gift card legal cms [ start] */ function popGiftCardLegal(paramTitle) { $("#popup_layer").remove(); $("body").append(""); $.post( "/includes/" + "gift_card_legal.jsp", { layerTitle: paramTitle }, function(data) { fixSelect(true); $("#popup_layer").html(data); doc = new doc(); $("#popup_layer").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#popup_layer").height()/2)); $("#popup_layer").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#popup_layer").width()/2)); fixPNG($(".png_ie")); $(".mid","#popup_layer").height($(".inner","#popup_layer").height()); $("#popup_layer .close").click(function(){ fixSelect(''); $("#popup_layer").remove(); return false; }); } ); } /* popup layer with gift card legal cms [ end ] */ /* popup layer with ensemble product details [ start] */ $(function() { $(".ensemble_product_details").each(function() { $(this).click(function(){ var index = $(this).attr("id"); popEnsembleProdDetails("Ensemble Product Details",index); return false; }); }); }); function popEnsembleProdDetails(paramTitle,index) { $("#popup_layer").remove(); $("body").append(""); $.post( "/catalog/" + "product_info_popup.jsp?productId=" + index, { layerTitle: paramTitle }, function(data) { fixSelect(true); $("#popup_layer").html(data); doc = new doc(); $("#popup_layer").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#popup_layer").height()/2)); $("#popup_layer").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#popup_layer").width()/2)); fixPNG($(".png_ie")); $(".mid","#popup_layer").height($(".inner","#popup_layer").height()); $("#popup_layer .close").click(function(){ fixSelect(''); $("#popup_layer").remove(); return false; }); } ); } /* popup layer with ensemble product details [ end ] */ /* persistent cart [ begin ] */ $(function(){ $(".addToCart").click(function(){ var s=s_gi('newmeijercom'); s.linkTrackVars='events,products'; s.linkTrackEvents='scAdd,scOpen'; var prodName = $('[name=prdName]').val(); var catName = $('[name=catName]').val(); var prodId = $('[name=productId]').val(); var pVarId = $("input[name=productVariantId]").val(); if (pVarId == null) { // We came from the thumbnail page. pVarId = $(this).next().val(); // Hidden field in the DOM. prodName = $(this).next().next().next().val(); catName = $(this).next().next().next().next().val(); prodId = $(this).next().next().next().next().next().val(); } s.products=';' + prodName + ';;;;evar3=' + catName + '|evar19=' + prodId; s.events='scAdd,scOpen'; s.tl(this,'o','Add to Cart'); }); $(".add_to_cart").click(function(){ if ($("input[name=fromProductOrEnsemble]") != null) { var source = "fromProductOrEnsemble"; } else { var source = "other"; } if ($("input[name=fromBasket]").size() > 0){ var source = "fromBasket"; } var pid = $(this).attr("id"); var pVarId = $("input[name=productVariantId]").val(); var pQuantity = $("input[name=quantity]").val(); var pFlag = "N"; if ($("input[name=protectionFlag]").checked) { pFlag = "Y"; } if (pVarId == null) { // We came from the thumbnail page. pVarId = $(this).next().val(); // Hidden field in the DOM. pQuantity = 1; // Default from thumbnail. } addToCart(pVarId,pid.substr(4,pid.length),$("input[name=pCatId]").val(),$("input[name=catId]").val(),$("input[name=subCatId]").val(),pQuantity,this,source); }); $(".add_from_comparison_to_cart").click(function(){ var message = $(this).next().val() +' is currently Out of Stock.'; addToCartFromComparison(this, message); }); $(".add_from_gift_card").each(function(){ $(this).click(function(){ var index = $(this).attr("id").substr(4); var productId = $("input[name=product_id_" + index + "]").val(); var variantId = $("input[name=product_variant_id_" + index + "]").val(); var quantity = $("input[name=quantity_" + index + "]").val(); document.gift_card_index = index; addToCart(variantId, productId, "", "", "", quantity, this, "fromGiftCard"); return false; }); }); $(".add_to_wish_list").each(function(){ $(this).click(function(){ var index = $(this).attr("id").substr(4); var productId = $("input[name=product_id_" + index + "]").val(); var variantId = $("input[name=product_variant_id_" + index + "]").val(); var style = $("input[name=product_style_" + index + "]").val(); document.gift_card_index = index; addToWishlist(variantId, productId, this, "fromGiftCard", style); return false; }); }); $(".add_from_theme").click(function(){ $("input[name=addTo]").val("1"); buttonObj = this; injectProcessing(buttonObj,"",true,"cb"); pVarId = []; $(".pVarId").each(function(i){ pVarId[i] = $(this).val(); }); pId = []; $(".pId").each(function(i){ pId[i] = $(this).val(); }); pQuantity = []; $(".productQuantity").each(function(i){ pQuantity[i] = $(this).val(); }); $.post( "/checkout/add_items_to_order.cmd", { addTo: $("input[name=addTo]").val(), ensembleItemCount:pVarId.length, productId: pId, productVariantId: pVarId, quantity: pQuantity, ensembleId: $("input[name=ensembleId]").val(), categoryId: $("input[name=categoryId]").val(), parentCategoryId: $("input[name=parentCategoryId]").val(), time: (new Date().getTime()) }, function(data) { $(".error_message").css("display","none").html(""); if ($("input[name=cErrors]", data).val() == "true") { var qtyErrs = $("input[name=cErrorHook_3]", data).val(); qtyErrs = qtyErrs.substr(1,qtyErrs.length - 2).split(","); errMsgLen = $(".error_message").length; injectProcessing(buttonObj,"",false,""); for (i = 0; i < qtyErrs.length; i++) { for (j = 0; j < errMsgLen; j++) { if ($(".error_message").filter(":eq(" + j + ")").attr("id") == $.trim(qtyErrs[i].split("=")[0])) { $(".error_message").filter(":eq(" + j + ")").html(qtyErrs[i].split("=")[1]).css("display","block"); } } } } else { loadCartHeader(); $("#persistent_cart").html(data); $("#persistent_cart").show(); injectProcessing(buttonObj,"",false,""); showPersistentCart(); } } ); }); /* Add ensemble items */ $(".add_from_ensemble").click(function(){ $("input[name=addTo]").val("1"); buttonObj = this; injectProcessing(buttonObj,"",true,"cb"); pVarId = []; $(".pVarId").each(function(i){ pVarId[i] = $(this).val(); }); pId = []; $(".pId").each(function(i){ pId[i] = $(this).val(); }); pQuantity = []; $(".productQuantity").each(function(i){ pQuantity[i] = $(this).val(); }); $.post( "/checkout/add_items_to_order.cmd", { addTo: $("input[name=addTo]").val(), ensembleItemCount:pVarId.length, productId: pId, productVariantId: pVarId, quantity: pQuantity, ensembleId: $("input[name=ensembleId]").val(), categoryId: $("input[name=categoryId]").val(), parentCategoryId: $("input[name=parentCategoryId]").val(), time: (new Date().getTime()) }, function(data) { $(".error_message").css("display","none").html(""); if ($("input[name=cErrors]", data).val() == "true") { var qtyErrs = $("input[name=cErrorHook_3]", data).val(); qtyErrs = qtyErrs.substr(1,qtyErrs.length - 2).split(","); errMsgLen = $(".error_message").length; injectProcessing(buttonObj,"",false,""); for (i = 0; i < qtyErrs.length; i++) { for (j = 0; j < errMsgLen; j++) { if ($(".error_message").filter(":eq(" + j + ")").attr("id") == $.trim(qtyErrs[i].split("=")[0])) { $(".error_message").filter(":eq(" + j + ")").html(qtyErrs[i].split("=")[1]).css("display","block"); } } } } else { loadCartHeader(); $("#persistent_cart").html(data); $("#persistent_cart").show(); injectProcessing(buttonObj,"",false,""); showPersistentCart(); } } ); }); $(".add_from_wishlist").click(function(){ populateSelectedList = ""; $(".update_check").each(function(){ if (this.checked == true) { populateSelectedList += "-" + $(this).val(); } }); if (populateSelectedList.length <= 0) { alert("Please select an item to send to your Cart."); return false; } else { $("input[name=selectedList]").val(populateSelectedList); addToCartFromWishlist($("input[name=selectedList]").val(),this); } return false; }); $(".view_cart").click(viewPersistentCart); }); function zipCodeVal() { $("input[name=zipCode]").blur(function() { valInput = $.trim($(this).val()); if (valInput == "") { $(this).attr("value","ZIP Code"); } }); $("input[name=zipCode]").focus(function() { valInput = $.trim($(this).val()); if (valInput == "ZIP Code" || valInput == "") { $(this).attr("value",""); } }); } function addToCart(pVarId,pId,pCatId,catId,subCatId,pQuantity,clickObject,source){ var pFlag = "N"; if ($("input[name=protectionFlag]:checked").val() != null) { pFlag = "Y"; } $("#persistent_cart").show(); $("#header_cart").attr("class","cart_open"); injectProcessing(clickObject,"",true,"cb"); $.get( "/checkout/add_item_to_order.cmd", { productVariantId: pVarId, productId: pId, parentCategoryId: pCatId, categoryId: catId, subCategoryId: subCatId, quantity: pQuantity, protectionFlag: pFlag, giftCardFlag: (source=="fromGiftCard"?"Y":"N"), time: (new Date().getTime()) }, function(data) { try{ if ($("input[name=cErrors]",data).val() == "true") { if (source == "other") { $("#header_cart").attr("class","cart_close"); $("#quick_view").html(data); renderQuickView(pId,pCatId,catId,subCatId,clickObject); } else if(source == "fromGiftCard") { var errorMessage = $(".error_messages",data).filter(":eq(0)").val(); if(errorMessage != null & errorMessage != "") { var msg = $(".error_message").filter(":eq(" + document.gift_card_index + ")"); msg.removeClass("important").removeClass("messaging").addClass("important"); msg.css("display","block").html(errorMessage); } injectProcessing(clickObject,"",false,""); } else { $(".error_message").addClass("important").removeClass("messaging").css("display","none").html(""); $(".error_messages",data).each(function(i){ var thisValue = $(this).val(); $(".error_message").filter(":eq(" + i + ")").css("display","block").html(thisValue); injectProcessing(clickObject,"",false,""); }); } } else if ($("input[name=cErrors]",data).val() == null) { if(source == "fromBasket"){ } else { loadCartHeader(); var message = $("input[name=confirmation_messages]",data).val(); $("#quick_view").remove(); $("#closeBKG").remove(); $("#persistent_cart").html(""); injectLoader("#persistent_cart",true); $.get( "/includes/layer_cart.jsp", {time: (new Date().getTime()), message: message}, function(data) { injectProcessing(clickObject,"",false,""); $("#persistent_cart").html(data); showPersistentCart(); } ); } } injectProcessing(clickObject,"",false,""); }catch(err){ injectProcessing(clickObject,"",false,""); } } ); } function addToCart2(pVarId,pId,pCatId,catId,subCatId,pQuantity,clickObject,source){ var pFlag = "N"; if ($("input[name=protectionFlag]:checked").val() != null) { pFlag = "Y"; } $("#persistent_cart").show(); $("#header_cart").attr("class","cart_open"); injectProcessing(clickObject,"",true,"cb"); $.get( "/checkout/add_item_to_order2.cmd", { productVariantId: pVarId, productId: pId, parentCategoryId: pCatId, categoryId: catId, subCategoryId: subCatId, quantity: pQuantity, protectionFlag: pFlag, giftCardFlag: (source=="fromGiftCard"?"Y":"N"), time: (new Date().getTime()) }, function(data) { try{ if ($("input[name=cErrors]",data).val() == "true") { if (source == "other") { $("#header_cart").attr("class","cart_close"); $("#quick_view").html(data); renderQuickView(pId,pCatId,catId,subCatId,clickObject); } else if(source == "fromGiftCard") { var errorMessage = $(".error_messages",data).filter(":eq(0)").val(); if(errorMessage != null & errorMessage != "") { var msg = $(".error_message").filter(":eq(" + document.gift_card_index + ")"); msg.removeClass("important").removeClass("messaging").addClass("important"); msg.css("display","block").html(errorMessage); } injectProcessing(clickObject,"",false,""); } else { $(".error_messages",data).each(function(i){ var thisValue = $(this).val(); $(".error_message").filter(":eq(" + i + ")").css("display","block").html(thisValue); injectProcessing(clickObject,"",false,""); }); } } else if ($("input[name=cErrors]",data).val() == null) { if(source == "fromBasket"){ } else { loadCartHeader(); var message = $("input[name=confirmation_messages]",data).val(); $("#quick_view").remove(); $("#closeBKG").remove(); $("#persistent_cart").html(""); injectLoader("#persistent_cart",true); $.get( "/includes/layer_cart.jsp", {time: (new Date().getTime()), message: message}, function(data) { injectProcessing(clickObject,"",false,""); $("#persistent_cart").html(data); showPersistentCart(); } ); } } injectProcessing(clickObject,"",false,""); }catch(err){ injectProcessing(clickObject,"",false,""); } } ); } function addToCartFromComparison(clickObject, message){ injectProcessing(clickObject,"",true,"cb"); injectLoader("#persistent_cart",true); $.get( "/includes/layer_cart.jsp", {time: (new Date().getTime()), message: message }, function(data) { loadCartHeader(); injectProcessing(clickObject,"",false,""); $("#persistent_cart").html(data); showPersistentCart(); } ); } function addToWishlist(pVarId, pId, clickObject, source, style){ injectProcessing(clickObject,"",true,"cb"); $.get( "/user/add_item_to_wishlist.cmd", { productVariantId: pVarId, productId: pId, time: (new Date().getTime()) }, function(data) { try{ var msg = $(".error_message").filter(":eq(" + document.gift_card_index + ")"); msg.removeClass("important").removeClass("messaging"); var notMemberMessage = $("input[name=add_to_wishlist_not_member]",data).val(); if (notMemberMessage != null && notMemberMessage != "") { if(source == "fromGiftCard") { msg.css("display","block").html(notMemberMessage).addClass("important"); } } var successMessage = $("input[name=add_to_wishlist_success]",data).val(); if (successMessage != null && successMessage != "") { if(source == "fromGiftCard") { var msg = $(".error_message").filter(":eq(" + document.gift_card_index + ")"); msg.css("display","block").html(successMessage).addClass("messaging"); } sendOmnitureWishlishEvent(style); } injectProcessing(clickObject,"",false,""); }catch(err){ injectProcessing(clickObject,"",false,""); } } ); } function addToCartFromWishlist(itemsToAdd,clickObject) { injectProcessing(clickObject,"inline",true,"vam"); $("#persistent_cart").html(""); injectLoader("#persistent_cart",true); $.post( "/user/add_all_wishlist_items_to_basket.cmd", { selectedList: itemsToAdd }, function(data) { loadCartHeader(); $("#persistent_cart").html(data); showPersistentCart(); } ); } function estimateShippingCart() { var paramOrderIndex = $("input[name=orderIndex]","#persistent_cart").val(); var paramZipCode = $("input[name=zipCode]","#persistent_cart").val(); $("#persistent_cart").html(""); injectLoader("#persistent_cart",true); $.get( "/checkout/update_items_in_cart.cmd", { zipCode: paramZipCode, orderIndex: paramOrderIndex, task: "estimate" }, function(data) { loadCartHeader(); $("#persistent_cart").html(data); showPersistentCart(); } ); } function loadCartHeader() { $.ajax({ type: "POST", url: '/includes/header_cart.jsp', dataType: "html", success: function(data) { if(data != null && data != "") { $("#view_cart").html(data); //Restore the click event on .view_cart $("#view_cart .view_cart").click(viewPersistentCart); } } }); } /* Load the persistent cart and display it. Update the header to show the cart is open. Show loading message while loading. */ function viewPersistentCart(evt) { evt.preventDefault(); $("#header_cart").attr("class","cart_open"); if ($("#persistent_cart").html() == "") { injectLoader("#persistent_cart",true); $("#persistent_cart").show(); $.get( "/includes/layer_cart.jsp", {time: (new Date().getTime())}, function(data) { loadCartHeader(); $("#persistent_cart").html(data); showPersistentCart(); } ); } } function showPersistentCart(){ /* for ie6 */ $("#navparm_dropdown").css('visibility', 'visible'); $("#persistent_cart").show(); $("#header_cart").attr("class","cart_open"); fixSelect(true); location.href = "#"; //take user to top of page arrItemsHeight = new Array(); itemsHeight = 0; $(".item","#persistent_cart").each(function(i){ arrItemsHeight[i] = $(this).height() + 1; // 1 = border if (i < 4) { itemsHeight += $(this).height() + 1; // 1 = border } }); if (($(".added","#persistent_cart").length == $(".item","#persistent_cart").length) || ($(".added","#persistent_cart").length >= 4)) { $(".items","#persistent_cart").height(itemsHeight); } else { $(".items","#persistent_cart").height(itemsHeight - 1); // - 1 for hide last border } fixPNG($(".png_ie")); if (arrItemsHeight.length > 4) { $(".view_less_items img","#persistent_cart").wrap(''); $(".view_more_items img","#persistent_cart").attr("src",'http://www.meijer.com/assets/site/images/widening/btn_cart_layer_on_down.gif').wrap(''); } animating = false; sCount = 4; $(".view_more_items a","#persistent_cart").click(function() { if (animating == false && (sCount + 1 <= arrItemsHeight.length)) { animating = true; curPos = parseInt($(".items_inner","#persistent_cart").css("top")); animateTop = curPos - arrItemsHeight[sCount]; $(".items_inner","#persistent_cart").animate({top: animateTop},"normal",function(){ $(this).css("top",animateTop); }); sCount++; animating = false; } if (sCount > 4) { $(".view_less_items > img, .view_less_items > a > img","#persistent_cart").attr("src",'http://www.meijer.com/assets/site/images/widening/btn_cart_layer_on_up.gif'); } if (sCount == arrItemsHeight.length) { $(".view_more_items > img, .view_more_items > a > img","#persistent_cart").attr("src",'http://www.meijer.com/assets/site/images/widening/btn_cart_layer_off_updown.gif'); } }); $(".view_less_items a","#persistent_cart").click(function() { if (animating == false && (sCount - 1 > 3)) { animating = true; sCount--; curPos = parseInt($(".items_inner","#persistent_cart").css("top")); animateTop = curPos + arrItemsHeight[sCount]; $(".items_inner","#persistent_cart").animate({top: animateTop},"normal",function(){ $(this).css("top",animateTop); animating = false; }); } if (sCount == 4) { $(".view_less_items > img, .view_less_items > a > img","#persistent_cart").attr("src",'http://www.meijer.com/assets/site/images/widening/btn_cart_layer_off_updown.gif'); } if (sCount >= 4) { $(".view_more_items > img, .view_more_items > a > img","#persistent_cart").attr("src",'http://www.meijer.com/assets/site/images/widening/btn_cart_layer_on_down.gif'); } }); $(".remove_from_cart").click(function(){ cmdPath = $(this).next().val(); $("#persistent_cart").html(""); injectLoader("#persistent_cart",true); $.post( cmdPath, function(data) { loadCartHeader(); $("#persistent_cart").html(data); showPersistentCart(); updateCartDisplay(); } ); return false; }); $(".clearCart").click(function(){ cmdPath = $(this).next().val(); $("#persistent_cart").html(""); injectLoader("#persistent_cart",true); $.post( cmdPath, function(data) { loadCartHeader(); $("#persistent_cart").html(data); showPersistentCart(); updateCartDisplay(); } ); return false; }); $(".estimate_shipping","#persistent_cart").click(function(){ estimateShippingCart();return false; }); $(".close_cart","#persistent_cart").click(function(evt) { evt.preventDefault(); $("#persistent_cart").html(""); $("#persistent_cart").hide(); $("#header_cart").attr("class","cart_close"); fixSelect(''); }); zipCodeVal(); updateCartDisplay(); var timer = null; $("#persistent_cart").mouseover( function() { clearTimeout(timer); } ); timer = setTimeout(function() { $("#persistent_cart").html(""); $("#persistent_cart").hide(); $("#header_cart").attr("class","cart_close"); fixSelect(''); sCount = 4; return false; }, 5000); } function updateCartDisplay() { var uniqueItemTotal = parseInt($("input[name=uniqueItemTotal]","#persistent_cart").val()); var getItemQuantityTotal = parseInt($("input[name=getItemQuantityTotal]","#persistent_cart").val()); var checkoutURL = "" + "/checkout/basket.jsp"; if (uniqueItemTotal > 0) { if (getItemQuantityTotal > 1) { $("#view_cart_contents").html("Shopping Cart
" + (getItemQuantityTotal).toString() + " items   " + $("input[name=totalPrice]","#persistent_cart").val() + "   Checkout
"); } else { $("#view_cart_contents").html("Shopping Cart
" + (getItemQuantityTotal).toString() + " item   " + $("input[name=totalPrice]","#persistent_cart").val() + "   Checkout
"); } } else { $("#view_cart_contents").html("Shopping Cart
" + (getItemQuantityTotal).toString() + " items   " + $("input[name=totalPrice]","#persistent_cart").val() + "
"); } $(".view_cart").click(viewPersistentCart); } /* persistent cart [ end ] */ /* quick view [ begin ] */ $(function(){ $(".preview").click(function(e){ e.preventDefault(); if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } injectProcessing(this,"",true,''); var pid = $(this).attr("id"); showQuickView(pid.substr(4,pid.length),$("input[name=pCatId]").val(),$("input[name=catId]").val(),$("input[name=subCatId]").val(),this); }); $(".click-for-price").click(function(e) { if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } // hide the tool tip if is open var theContainer = this.parentNode; var toolTip = theContainer.getElementsByTagName("span")[0]; toolTip.style.left = "-9999px"; injectProcessing(this,"",true,''); var pid = $(this).attr("id"); showPriceView(pid.substr(4,pid.length), $("input[name=pCatId]").val(),$("input[name=catId]").val(),$("input[name=subCatId]").val(),this); e.preventDefault(); }); $(".click-for-price").hover( function () { var theContainer = this.parentNode; var toolTip = theContainer.getElementsByTagName("span")[0]; toolTip.style.left = "95px"; }, function () { var theContainer = this.parentNode; var toolTip = theContainer.getElementsByTagName("span")[0]; toolTip.style.left = "-9999px"; } ); }); /* Back Order Message and Shipping surcharge msg [ begin ] */ $(function(){ $(".backorder-rollover-msg").click(function(e) { if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } // hide the tool tip if is open $(this).parent().find(".backorder-message").css('left','-99999px'); e.preventDefault(); }); $(".backorder-rollover-msg").hover( function () { $('.backorder-message').addClass('showBackorderMsg'); }, function () { $('.backorder-message').removeClass('showBackorderMsg'); } ); }); /* Back Order Message Shipping surcharge msg [ end ] */ function showQuickView(pId,pCatId,catId,subCatId,clickObject) { if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } $("body").append("
"); $("body").append("
"); injectLoader("#quick_view",true); doc = new doc(); $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); $.ajax({ type: "POST", url: "/includes/" + "layer_quick_view.jsp", data: { productId: pId, parentCategoryId: pCatId, categoryId: catId, subCategoryId: subCatId, time: (new Date().getTime()) }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderQuickView(pId,pCatId,catId,subCatId,clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: "/includes/" + "layer_quick_view.jsp", data: { productId: pId, parentCategoryId: pCatId, categoryId: catId, subCategoryId: subCatId, time: (new Date().getTime()) }, dataType: "html" }); } if(parseInt($("#quick_view").css("top")) < 0){ $("#quick_view").css("top", '0'); } } }); sendOmnitureProductViewEvent(pId); } function showPriceView(pId,pCatId,catId,subCatId,clickObject) { if($("#quick_view")) { $("#quick_view").remove(); $("#closeBKG").remove(); } $("body").append("
"); $("body").append("
"); injectLoader("#quick_view",true); doc = new doc(); $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); $.ajax({ type: "POST", url: "/includes/" + "layer_price_view.jsp", data: { productId: pId, parentCategoryId: pCatId, categoryId: catId, subCategoryId: subCatId, time: (new Date().getTime()) }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"inline",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderQuickView(pId,pCatId,catId,subCatId,clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: "/includes/" + "layer_price_view.jsp", data: { productId: pId, parentCategoryId: pCatId, categoryId: catId, subCategoryId: subCatId, time: (new Date().getTime()) }, dataType: "html" }); } } }); } function renderQuickView(pId,pCatId,catId,subCatId,clickObject) { $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); fixPNG($(".png_ie")); $(".mid","#quick_view").height($(".inner","#quick_view").height()); $(".view_alt_img","#quick_view").click(function(){ this.blur(); o = this; $(".product_image","#quick_view").find("img").attr("src",$(o).next().val()); return false; }); $(".add_to_cart","#quick_view").click(function(){ var pageURL = window.document.location.toString(); var isBasketPage = /basket/gi.test(pageURL); if(isBasketPage == true){ $("form[name=productPreviewForm]").append(''); $("form[name=productPreviewForm]").submit(); } else { // used to determine the last input which is located in the layer var i = $("input[name=quantity]").length - 1; var pid = $(this).attr("id"); var pVarId = $("input[name=productVariantId]").eq(i).val(); if(pVarId == null || pVarId == "") pVarId = $("input[name=defaultProductVariantId]").val(); addToCart(pVarId,pid.substr(4,pid.length),$("input[name=pCatId]").val(),$("input[name=catId]").val(),$("input[name=subCatId]").val(),$("input[name=quantity]").eq(i).val(),this,"other"); } }); $(".addToCart", "#quick_view" ).click(function(){ var s=s_gi('newmeijercom'); s.linkTrackVars='events,products'; s.linkTrackEvents='scAdd,scOpen'; var prodName = $('[name=prdName]', "#quick_view").val(); var catName = $('[name=catName]', "#quick_view").val(); var prodId = $('[name=productId]', "#quick_view").val(); s.products=';' + prodName + ';;;;evar3=' + catName + '|evar19=' + prodId; s.events='scAdd,scOpen'; s.tl(this,'o','Add to Cart'); }); $(".add_to_cart2","#quick_view").click(function(){ var pageURL = window.document.location.toString(); var isBasketPage = /basket/gi.test(pageURL); if(isBasketPage == true){ $("form[name=productPreviewForm]").append(''); $("form[name=productPreviewForm]").submit(); } else { // used to determine the last input which is located in the layer var i = $("input[name=quantity]").length - 1; var pid = $(this).attr("id"); var pVarId = $("input[name=productVariantId]").eq(i).val(); if(pVarId == null || pVarId == "") pVarId = $("input[name=defaultProductVariantId]").val(); addToCart2(pVarId,pid.substr(4,pid.length),$("input[name=pCatId]").val(),$("input[name=catId]").val(),$("input[name=subCatId]").val(),$("input[name=quantity]").eq(i).val(),this,"other"); } }); $("#quick_view .close, #quick_view .cancel").click(function(){ $("#quick_view").remove(); $("#closeBKG").remove(); fixSelect(''); return false; }); initEppMsg(); } /* quick view [ end ] */ /* recently viewed items [ begin ] */ $(function(){ if ($('#column_left').length == 0) { $(".action_hide","#rv_items").click(function(){ var src=$(this).find('img').attr('src'); if (! $(this).hasClass('Hide')) { $(".to_hide","#rv_items").css("display","none"); $(this).find('img').attr('src',src.replace('hide','show')); } else { $(".to_hide","#rv_items").css("display","block"); $(this).find('img').attr('src',src.replace('show','hide')); } $(this).toggleClass("Hide"); return false; }); } else { $(".action_hide","#column_left").click(function(){ if ($(".action_hide","#rv_items").html() == "Hide") { $(".to_hide","#rv_items").css("display","none"); $(".heading","#rv_items").css("border-bottom","1px solid #b7b7b7"); $(".action_hide","#rv_items").html("Show"); } else { $(".to_hide","#rv_items").css("display","block"); $(".heading","#rv_items").css("border-bottom","none"); $(".action_hide","#rv_items").html("Hide"); } return false; }); } arrRvItemsHeight = new Array(); rvItemsHeight = 0; $(".item","#rv_items").each(function(i){ arrRvItemsHeight[i] = $(this).height() + 1; // 1 = border if (i < 3) { rvItemsHeight += $(this).height() + 1; // 1 = border } }); $(".items","#rv_items").height(rvItemsHeight - 1 + "px"); // - 1 for hide last border $(".mid","#rv_items").height($(".inner","#rv_items").height() + "px"); if (arrRvItemsHeight.length > 3) { $(".view_less_items img","#rv_items").wrap(""); $(".view_more_items img","#rv_items").attr("src",'/assets/site/images/buttons/btn_rv_on_down.gif').wrap(""); } animating = false; sCount = 3; $(".view_more_items a","#rv_items").click(function() { if (animating == false && (sCount + 1 <= arrRvItemsHeight.length)) { animating = true; curPos = parseInt($(".items_inner","#rv_items").css("top")); animateTop = curPos - arrRvItemsHeight[sCount]; $(".items_inner","#rv_items").animate({top: animateTop},"normal",function(){ $(this).css("top",animateTop); }); sCount++; animating = false; } if (sCount > 2) { window.setTimeout( function(){ $(".view_less_items > img:eq(0)","#rv_items").attr("src","/assets/site/images/buttons/btn_rv_on_up.gif"); } ,100); } if (sCount == arrRvItemsHeight.length) { window.setTimeout( function(){ $(".view_more_items > img:eq(0)","#rv_items").attr("src","/assets/site/images/buttons/btn_rv_off_updown.gif"); } ,100); } }); $(".view_less_items a","#rv_items").click(function() { if (animating == false && (sCount - 1 > 2)) { animating = true; sCount--; curPos = parseInt($(".items_inner","#rv_items").css("top")); animateTop = curPos + arrRvItemsHeight[sCount]; $(".items_inner","#rv_items").animate({top: animateTop},"normal",function(){ $(this).css("top",animateTop); }); animating = false; } if (sCount == 3) { window.setTimeout('$(".view_less_items > img, .view_less_items > a > img","#rv_items").attr("src","/assets/site/images/buttons/btn_rv_off_updown.gif")',100); } if (sCount >= 3) { window.setTimeout('$(".view_more_items > img, .view_more_items > a > img","#rv_items").attr("src","/assets/site/images/buttons/btn_rv_on_down.gif")',100); } }); }); /* recently viewed items [ end ] */ /* endeca refinements menu [ begin ] */ $(function(){ $(".endeca_refinements").find(".r").hover(function(){ $(this).parent().css("background","#fff"); },function(){ $(this).parent().css("background","#dfe7f4"); }); $(".endeca_refinements").find(".close_menu").click(function(){ $(this).parent().parent().parent().css("visibility","hidden"); fixSelect(false); return false; }); $(".endeca_refinements").find(".d").parent().hover(function(){ fixSelect(true); $(this).find("div").css("visibility","visible"); },function(){ fixSelect(false); $(this).find("div").css("visibility","hidden"); }); $(".endeca_refinements ul.refinements li.refined").hover(function(){ $(this).css('background-color', '#4B73BB'); $('a.d', this).css('background-image', 'url(/assets/site/images/catalog/endeca_drop_arrow_on.gif)'); }, function(){ $(this).css('background-color', '#2F58A5'); $('a.d', this).css('background-image', 'url(/assets/site/images/catalog/endeca_drop_arrow_off.gif)'); }); }); /* endeca refinements menu [ end ] */ /* email a friend [ begin ] */ $(function(){ $(".email_a_friend").click(function(){ if ($("input[name=source]") != null && $("input[name=source]").val() == "ensemble") { strId = "&ensembleId=" + $("input[name=ensembleId]").val(); } else { strId = "&productId=" + $("input[name=productId]").val(); } emailAFriend(this); return false; }); }); function emailAFriend(o) { injectProcessing(o,"",true,""); strData = "sendersName=" + $("input[name=sendersName]").val() + "&sendersEmail=" + $("input[name=sendersEmail]").val() + "&recipientName=" + $("input[name=recipientName]").val() + "&recipientEmail=" + $("input[name=recipientEmail]").val() + "&message=" + $("textarea[name=message]").val() + strId; $.ajax({ type: "POST", url: $("input[name=emailAFriendAction]").val(), data: strData, success: function(r) { $("#email_a_friend_shell").html(r); // The click must be rebound because we overwrote // the old click element with our html() method call. $(".email_a_friend").click(function(){ emailAFriend(this); return false; }); if ($(".eaf_success").length > 0) { $("form","#email_a_friend_shell").find("input").val(""); $("form","#email_a_friend_shell").find("textarea").val(""); } } }); } /* email a friend [ end ] */ /* generic functions [ begin ] */ $(function(){ $("input[type=checkbox].click_compare").click(function(){ $("input[type=checkbox]").each(function(i){ $(this).parent().find(".error_message").css("display","none").html(""); }); var checkedboxcount = $("input[type=checkbox].click_compare:checked").length; $("div.comparison-link").css("display", (checkedboxcount > 1) ? "block" : "none"); if (!!$(this).attr("checked")) { if (checkedboxcount > 4) { $(this).parent().find(".error_message").css("display","block").html("You can compare up to 4 products at once."); $(this).removeAttr("checked"); } else if (checkedboxcount > 1) { $("input[type=checkbox].click_compare:checked").each(function(i){ $(this).parent().parent().find(".view_comparison_now").html("View Comparison Now"); }); } } else { $(this).parent().parent().find(".view_comparison_now").html(""); } }); }); $(function(){ initViewComparisonLink($(".click_compare")); }); function initViewComparisonLink(o){ o.each(function(){ checked = $(this).attr("checked"); if ( checked == true) { $(this).parent().parent().find(".view_comparison_now").html("View Comparison Now"); } }); var checkedboxcount = $("input[type=checkbox]:checked").length; if (checkedboxcount > 1) $("div.comparison-link").css("display","block"); else $("div.comparison-link").css("display","none"); } function fixSelect(state) { var ie6 = /MSIE 6.0/i.test(navigator.appVersion); if(ie6) { if ($.browser.msie) { if (state == true) { $("select").css("visibility","hidden"); } else { $("select").css("visibility","visible"); } } } } $(function(){ swapImg($(".rollover"),"both"); }); function swapImg(o,s){ // assumes "_on" and "_off" as the two states if (o.attr("src")) { o.unbind(); imgExt = o.attr("src").substr(o.attr("src").lastIndexOf('.'),o.attr("src").length); imgPath = o.attr("src").substr(0,o.attr("src").lastIndexOf('/')) + '/'; if (s == "both") { o.each(function(){ $(this).hover(function(){ $(this).attr("src",imgPath + $(this).attr("id") + "_on" + imgExt); },function(){ $(this).attr("src",imgPath + $(this).attr("id") + "_off" + imgExt); }); }); } else if (s == "on") { o.attr("src",imgPath + o.attr("id") + "_on" + imgExt); } else if (s == "off") { o.attr("src",imgPath + o.attr("id") + "_off" + imgExt); } } } function injectProcessing(el,cssDisplay,state,classIt) { if (state == true) { $(el).css("display","none"); $("Processing...").insertAfter($(el)); } else { if($(el).next() && $(el).next().attr("type") == "processing") { $(el).next().remove(); } $(el).css("display",cssDisplay); } } function injectLoader(el,state) { if (state == true) { /* for ie6 */ $("#navparm_dropdown").css('visibility', 'hidden'); $(el).prepend("
"); } else { $(".loader",el).remove(); /* for ie6 */ $("#navparm_dropdown").css('visibility', 'visible'); } } function truncateStringByClass(strClassName,strLength) { $("." + strClassName).each(function(){ strDescription = $.trim($(this).text()); if (strDescription.length > strLength) { for (idx = strLength; idx >= 0; idx--) { charVal = strDescription.charAt(idx); if (charVal == "," || charVal == "-" || charVal == " ") { strDescription = strDescription.substring(0,idx) + "..."; $(this).html(strDescription); break; } } } }); } /* generic functions [ end ] */ /* drop down menu for header items [start] */ /* for the 4 dropdowns in the middle of the header */ $(function(){ $(".menu").hover( function(){ dropdown = new myDropdown(this); dropdown.doTimeout(); } , function(){ dropdown.hideDropdown(); dropdown.cancelTimeout(); } ); }); function myDropdown(elem){ this.nav = elem; this.time = 1000; this.timer = null; this.showDropdown = function(){ $("ul", this.nav).show(); } this.hideDropdown = function(){ $("ul", this.nav).hide(); } this.doTimeout = function(){ myNav = this; this.timer = setTimeout("myNav.showDropdown()", this.time); } this.cancelTimeout = function(){ if(this.timer){ window.clearTimeout(this.timer); this.timer = null; } } } /* drop down menu for header items [end] */ function setOperation(opType,needSubmit,addressIndex) { document.addUpdateDeleteAddressForm.operation.value = opType; if(addressIndex) document.addUpdateDeleteAddressForm.selectedAddressIndex.value = addressIndex; if(needSubmit) { if(opType == "EDIT") window.location='/user/address_book.jsp?addressIndex=' + addressIndex; else document.addUpdateDeleteAddressForm.submit(); } } function setAddTo(addToType) { document.productForm.addTo.value = addToType; } // This is an example of sending product data from the server // to the client, then formatting the variants on the client-side // based on certain criteria. function cbFormatter(list, attribute, opt) { // Get the price for this variant.. If this is the primary list, get all related // variants from the group and get their prices as well so we can build a range. var pvds = list.productVariantDropdownSupport; // Get all of the product variants for this attribute var variantGroup = attribute.getVariant().getProductVariantGroup(); var groupVariants = variantGroup.getAllVariants() // Are all of the prices the same within the group? var lowGroupPrice = 999999.00; var highGroupPrice = -1.00; for (var idx = 0; idx < groupVariants.length; idx++) { lowGroupPrice = groupVariants[idx].numericPrice < lowGroupPrice ? groupVariants[idx].numericPrice : lowGroupPrice; highGroupPrice = groupVariants[idx].numericPrice > highGroupPrice ? groupVariants[idx].numericPrice : highGroupPrice; } // Are all of the prices the same within the variant? var variants = variantGroup.getVariantsMatching(attribute.name, attribute.value); var lowVariantPrice = 999999.00; var highVariantPrice = -1.00; var lowVariantDisplay = variants[0].displayPrice; var highVariantDisplay = variants[0].displayPrice; for (var idx = 0; idx < variants.length; idx++) { // Display really needs to be done before the re-assignment... var lowVariantDisplay = parseFloat(variants[idx].numericPrice) < parseFloat(lowVariantPrice) ? variants[idx].displayPrice : lowVariantDisplay; var lowVariantPrice = parseFloat(variants[idx].numericPrice) < parseFloat(lowVariantPrice) ? variants[idx].numericPrice : lowVariantPrice; var highVariantDisplay = parseFloat(variants[idx].numericPrice) > parseFloat(highVariantPrice) ? variants[idx].displayPrice : highVariantDisplay; var highVariantPrice = parseFloat(variants[idx].numericPrice) > parseFloat(highVariantPrice) ? variants[idx].numericPrice : highVariantPrice; } if (lowGroupPrice != highGroupPrice) { // Primary list should display a range - SUV III logic update, no price displayed if (pvds.isPrimary) { if (variants.length > 1) { opt.text = opt.text; } else { if (lowVariantPrice != highVariantPrice) opt.text = opt.text + " " + lowVariantDisplay + " - " + highVariantDisplay; else opt.text = opt.text + " " + attribute.getVariant().displayPrice; } } else { // Secondary lists should show exact price opt.text = opt.text + " " + attribute.getVariant().displayPrice; } } opt.title = opt.text; return opt; } /* This function is called when a subject is changed so that actual subject text can be * stored in to a hidden subject field. Since value of the subject list is a keyword define * in the command configuration file to identify it's email address. */ function setSubject(thisRef) { var formRef = document.forms["contactUsForm"]; //set subject value formRef.elements["subject"].value = (thisRef.options[thisRef.selectedIndex]).text; } /** Omniture functions **/ function sendOmnitureWishlishEvent(style) { /* SiteCatalyst code version: H.20.3. Copyright 1997-2007 Omniture, Inc. More info available at http://www.omniture.com*/ s.pageName="Gift Card"; s.channel=""; s.server=""; s.events="event4"; s.products=";" + style; /************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/ var s_code=s.t();if(s_code)document.write(s_code); } function sendOmnitureProductViewEvent(style) { /* SiteCatalyst code version: H.20.3. Copyright 1997-2007 Omniture, Inc. More info available at http://www.omniture.com*/ s.pageName="Product Quick View"; s.channel=""; s.server=""; s.events="event10"; s.products=";" + style; /************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/ var s_code=s.t();if(s_code)document.write(s_code); } /** Function for opneing old school pop up windows **/ $(function () { $("a") // add additional filters for pop up windows of different sizes .filter(".newindow") .click(function(){ window.open(this.href,"_blank","toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=573,height=600"); return false; }) .end(); $("a") // add additional filters for pop up windows of different sizes .filter(".map-it") .click(function(){ window.open(this.href,"_blank","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=800,height=600"); return false; }) .end(); $(".newindow").attr("title","This link opens in a new window"); $(".map-it").attr("title","This link opens in a new window that shows your store location"); }); $(function () { var checkBoxes = $(".click_compare"); var totalCheckBoxes = checkBoxes.length; for(var i=0; i < totalCheckBoxes; i++) { checkBoxes[i].onclick = selected; } function selected() { // determine if the checkbox is marked if(this.checked) { $("#view-compare-now").css("display", "block"); } else { $("#view-compare-now").css("display", "none"); } } }); $(function () { var relatedWrap = $(".sims")[0]; var relatedProds = $(".sim-prod",relatedWrap); var totalProds = relatedProds.length; for(var i = 0; i < totalProds; i++) { if(i == 1) { relatedWrap.id = "col2"; } else if(i == 2) { relatedWrap.id = "col3"; } else if(i >= 3) { relatedWrap.id = "col4"; } } }); // Swatch functionality $(function(){ //swatch hover $(".swatches-container span.swatch").hover(function(){ if(!$(this).is('.selected-swatch')){ $(this).attr('class', 'swatch-hover'); } }, function(){ if(!$(this).is('.selected-swatch')){ $(this).attr('class', 'swatch'); } }); }); // swatch object function swatch(tmpSwatchUPC, tmpSwatchArr){ this.data = { upc : tmpSwatchUPC, xSmallImg : [], //40px; smallImg : [], //80px mediumImg : [], //115px largeImg : [], //250px xLargeImg : [] //400px } this.init(tmpSwatchArr); } swatch.prototype.init = function(tmpSwatchArr){ for(var i=0; i' + '

Sorry, this image is
not available in
'+ swatchName + '.

' + '
'; $(mainImgContainer).append(msg); noSwatchTimer = setTimeout('removeNoSwatchMessage();', 5000); } function removeNoSwatchMessage(){ $("#no-swatch-message").remove(); clearTimeout(noSwatchTimer); } var lib = { data : { eCertThemeSelection : "0" }, obj : { itemSlider : function(settings) { if(arguments.length > 0) { this.init(settings); } } } }; lib.obj.itemSlider.prototype = function(settings) { if(arguments.length > 0){ this.init(settings); } }; /* itemSlider Object Code */ lib.obj.itemSlider.prototype.init = function(settings) { var settings = $.extend({ viewport: "#widget-slider-viewport", content: "#widget-slider-content", next: "#widget-slider-next", prev: "#widget-slider-prev", first: "#widget-slider-first", last: "#widget-slider-last", item: "div", direction: "vertical", showAmount: 3, interval : 350, easing : "linear", scrollAmount : 1, groupIndicator : "#widget-indicator" }, settings); this.viewport = settings.viewport; this.content = settings.content; this.next = settings.next; this.prev = settings.prev; this.first = settings.first; this.last = settings.last; this.item = settings.item; this.interval = settings.interval; this.easing = settings.easing; this.direction = settings.direction; this.showAmount = settings.showAmount; this.sliderInfo = new Object(); this.sliderInfo.index = 0; this.scrollAmount = settings.scrollAmount; this.groupIndicator = settings.groupIndicator; this.groupIndicatorImg = $("img", settings.groupIndicator).attr('src'); this.groupIndicatorOnPath = $("img", settings.groupIndicator).attr('src').replace('_off.png', '_on.png'); this.sliderInfo.end = $(this.item).size() - this.showAmount; /* Check Overflows (initial) */ $(this.item + " *").add( $(this.item) ).each(function() { if( $(this).css("overflow") == "auto" ) { $(this).addClass("is__overflow"); } }); /* ----------------- */ this.initGrouupIndicator(); if ( $(this.viewport).size() > 0 ) { this.overflowBeforeMove(); this.overflowAfterMove(); $(this.next).hide(); $(this.prev).hide(); if( $(this.item).size() > this.showAmount ) { $(this.next).show(); } if( this.direction == "vertical" ) { this.sliderInfo.itemSize = $(this.item).eq(0).height(); } else { this.sliderInfo.itemSize = $(this.item).eq(0).width(); $(this.content).css("width", (this.sliderInfo.itemSize * $(this.item).size()) + "px"); } this.removeEvents(); $(this.next + "," + this.prev + "," + this.first + "," + this.last).click(function(evt){ evt.preventDefault(); }); this.createEvents(); } }; lib.obj.itemSlider.prototype.overflowBeforeMove = function() { $(this.content + " .is__overflow").css("overflow", "hidden"); }; lib.obj.itemSlider.prototype.overflowAfterMove = function() { $(this.item).slice(this.sliderInfo.index, this.sliderInfo.index + this.showAmount).each(function() { if( $(this).hasClass("is__overflow") ) { $(this).css("overflow", "auto"); } $(".is__overflow", this).css("overflow", "auto"); }); }; lib.obj.itemSlider.prototype.createEvents = function() { var currObj = this; $(this.prev).bind("click.itemSlider", function(evt) { currObj.backward(); }); $(this.next).bind("click.itemSlider", function(evt) { currObj.forward(); }); $(this.first).bind("click.itemSlider", function(evt){ currObj.toFirst(); }); $(this.last).bind("click.itemSlider", function(evt){ currObj.toLast(); }); }; lib.obj.itemSlider.prototype.removeEvents = function() { $(this.prev).unbind("click.itemSlider"); $(this.next).unbind("click.itemSlider"); $(this.last).unbind("click.itemSlider"); $(this.first).unbind("click.itemSlider"); }; lib.obj.itemSlider.prototype.move = function() { this.removeEvents(); this.overflowBeforeMove(); /* Make index is in range */ if( this.sliderInfo.index > this.sliderInfo.end ) { this.sliderInfo.index = this.sliderInfo.end; } else if( this.sliderInfo.index < 0 ) { this.sliderInfo.index = 0 } /* --------------- */ /* show/hide buttons */ if( this.sliderInfo.index == this.sliderInfo.end ) { $(this.next).hide(); } else if(this.sliderInfo.end > 0 ) { $(this.next).show(); } if( this.sliderInfo.index == 0 ) { $(this.prev).hide(); } else { $(this.prev).show(); } /* ----------------------- */ /* Move the item */ var currObj = this; var newPos = this.sliderInfo.index * this.sliderInfo.itemSize * -1; if (this.direction == "vertical") { var params = { top : newPos }; } else { var params = { left : newPos }; } $(this.content).animate( params, { duration : this.interval, easing : this.easing, complete : function() { currObj.createEvents(); currObj.overflowAfterMove(); currObj.indicateGroup(); } } ); /* ---------------------- */ }; lib.obj.itemSlider.prototype.initGrouupIndicator = function(){ var numItems = $(this.item).size(); var numPages = Math.ceil(numItems / this.scrollAmount); var numIndicators = $("img", this.groupIndicator).size(); while(numIndicators > numPages){ $("img", this.groupIndicator).eq(numIndicators-1).remove(); numIndicators--; } this.indicateGroup(); }; lib.obj.itemSlider.prototype.indicateGroup = function() { var page = Math.ceil(this.sliderInfo.index / this.scrollAmount); $("img", this.groupIndicator).attr('src', this.groupIndicatorImg); $("img", this.groupIndicator).eq(page).attr('src', this.groupIndicatorOnPath); }; lib.obj.itemSlider.prototype.forward = function() { this.sliderInfo.index += this.scrollAmount; this.move(); }; lib.obj.itemSlider.prototype.backward = function() { this.sliderInfo.index -= this.scrollAmount; this.move(); }; lib.obj.itemSlider.prototype.toFirst = function() { this.sliderInfo.index = 0; this.move(); }; lib.obj.itemSlider.prototype.toLast = function() { this.sliderInfo.index = this.sliderInfo.end; this.move(); }; /* ----------------------- */ /* ------------------------------------ Begin Order2Store script ------------------------------------ */ $(function(){ $(".selectGiftCard").click(function(e){ if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } injectProcessing(this,"",true,''); showGiftCardLayer(this); e.preventDefault(); }); $(".addEditShippingAddress").click(function(e){ e.preventDefault(); if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } injectProcessing(this,"",true,''); var userAddressIndex = this.id; showAddEditShippingAddressLayer(this, userAddressIndex); }); $(".updateItemInOrder").click(function(e){ e.preventDefault(); if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } injectProcessing(this,"",true,''); var pid = $(this).attr("id"); showQuickViewWithUrl(pid, this.href, this); }); }); function showGiftCardLayer(clickObject) { $("body").append("
"); $("body").append("
"); injectLoader("#quick_view",true); doc = new doc(); $.ajax({ type: "POST", url: "/includes/" + "layer_gift_card.jsp", data: { time: (new Date().getTime()) }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"inline",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderGiftCardLayer(clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: "/includes/" + "layer_gift_card.jsp", data: { time: (new Date().getTime()) }, dataType: "html" }); } } }); } function renderGiftCardLayer(clickObject) { fixPNG($(".png_ie")); setTimeout (function(){ $("#preview_layer_mid").height($(".inner","#quick_view").height()); $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); },5); $("#quick_view .close, #quick_view .cancel").click(function(){ $("#quick_view").remove(); $("#closeBKG").remove(); fixSelect(''); return false; }); } function showAddEditShippingAddressLayer(clickObject, addressIndex) { $("body").append("
"); $("body").append("
"); injectLoader("#quick_view",true); doc = new doc(); $.ajax({ type: "POST", url: "/includes/" + "layer_add_edit_shipping_address.jsp", data: { userAddressIndex: addressIndex, time: (new Date().getTime()) }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"inline",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderAddEditShippingAddressLayer(clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: "/includes/" + "layer_add_edit_shipping_address.jsp", data: { userAddressIndex: addressIndex, time: (new Date().getTime()) }, dataType: "html" }); } } }); } function renderAddEditShippingAddressLayer(clickObject) { fixPNG($(".png_ie")); setTimeout (function(){ $("#preview_layer_mid").height($(".inner","#quick_view").height()); $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); },5); $("#quick_view .close, #quick_view .cancel").click(function(){ $("#quick_view").remove(); $("#closeBKG").remove(); fixSelect(''); return false; }); } function order2StoreSelect(obj, orderIndex, itemIndex, dest) { if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } injectProcessing(obj,"",true,''); showSelectStore(obj, orderIndex, itemIndex, dest); } var geocoder = null; function mapsLoaded() { geocoder = new GClientGeocoder(); } function showSelectStore(clickObject, oIndex, iIndex, destination) { // Loading the maps function dynamically using the google api $.getScript('https://www.google.com/jsapi?key=ABQIAAAAduU_Tbdl94AiRUnkfPldlBQPChpJTF5NRtOSEmZdOauN5yiNphTlAAWGnfYgXa0JTSBvt62yfveAJA', function() { google.load('maps','2',{callback : mapsLoaded}); }); if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } $("body").append("
"); $("body").append("
"); injectLoader("#quick_view",true); doc = new doc(); $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); $.ajax({ type: "POST", url: "/includes/" + "layer_select_store.jsp", data: { orderIndex: oIndex, itemIndex: iIndex, dest: destination, time: (new Date().getTime()) }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"inline",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderSelectStore(clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: "/includes/" + "layer_select_store.jsp", data: { orderIndex: oIndex, itemIndex: iIndex, dest: destination, time: (new Date().getTime()) }, dataType: "html" }); } } }); } function renderSelectStore(clickObject) { $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); fixPNG($(".png_ie")); $(".mid","#quick_view").height($(".inner","#quick_view").height()); $("#quick_view .close").click(function(){ $("#quick_view").remove(); $("#closeBKG").remove(); fixSelect(''); return false; }); $("#quick_view .cancel").click(function(){ $("#quick_view").remove(); $("#closeBKG").remove(); fixSelect(''); return false; }); $(".get_local_locator_results","#quick_view").click(function(e){ e.preventDefault(); submitGeoCodeForm(); return false; }); initEppMsg(); } function queryStores(clickObject, oIndex, iIndex) { $.ajax({ type: "POST", url: "/checkout/locate_store.cmd", data: {orderIndex: oIndex, itemIndex: iIndex, radius: '50', boolCreateMap: $("input[name=boolCreateMap]", "#quick_view").val(), cityStateZip: $("input[name=cityStateZip]", "#quick_view").val(), latitude: $("input[name=latitude]", "#quick_view").val(), longitude: $("input[name=longitude]", "#quick_view").val(), firstNameAlt1: $("input[name=firstNameAlt1]", "#quick_view").val(), lastNameAlt1: $("input[name=lastNameAlt1]", "#quick_view").val(), firstNameAlt2: $("input[name=firstNameAlt2]", "#quick_view").val(), lastNameAlt2: $("input[name=lastNameAlt2]", "#quick_view").val(), dest: $("input[name=dest]", "#quick_view").val(), phoneNumber: $("input[name=phoneNumber]", "#quick_view").val(),time: (new Date().getTime()) }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"inline",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderSelectStore(clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: "/includes/" + "layer_select_store.jsp", data: {orderIndex: oIndex, itemIndex: iIndex, dest: $("input[name=dest]", "#quick_view").val(), time: (new Date().getTime()) }, dataType: "html" }); } } }); } function queryStoresByState(clickObject, oIndex, iIndex) { $.ajax({ type: "POST", url: "/checkout/locate_store_by_state.cmd", data: {orderIndex: oIndex, itemIndex: iIndex, radius: '1000', state: $("input[name=state]", "#quick_view").val(), firstNameAlt1: $("input[name=firstNameAlt1]", "#quick_view").val(), lastNameAlt1: $("input[name=lastNameAlt1]", "#quick_view").val(), firstNameAlt2: $("input[name=firstNameAlt2]", "#quick_view").val(), lastNameAlt2: $("input[name=lastNameAlt2]", "#quick_view").val(),dest: $("input[name=dest]", "#quick_view").val(), phoneNumber: $("input[name=phoneNumber]", "#quick_view").val(), time: (new Date().getTime()) }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"inline",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderSelectStore(clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: "/checkout/locate_store_by_state.cmd", data: {orderIndex: oIndex, itemIndex: iIndex, radius: $("input[name=radius]", "#quick_view").val(), state: $("input[name=state]", "#quick_view").val(), dest: $("input[name=dest]", "#quick_view").val(), time: (new Date().getTime()) }, dataType: "html" }); } } }); } function giftMessageSelect(obj, oIndex, dest, src) { if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } injectProcessing(obj,"",true,''); showGiftMessage(obj, oIndex, dest, src); } function showGiftMessage(clickObject, oIndex, destination, source) { // Loadding the maps function dynamically using the google api if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } $("body").append("
"); $("body").append("
"); injectLoader("#quick_view",true); doc = new doc(); $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); $.ajax({ type: "POST", url: "/includes/" + "layer_gift_message.jsp", data: { orderIndex: oIndex, dest: destination, src: source, time: (new Date().getTime()) }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"inline",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderGiftMessage(clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: "/includes/" + "layer_gift_message.jsp", data: { orderIndex: oIndex, dest: destination, src: source, time: (new Date().getTime()) }, dataType: "html" }); } } }); } function renderGiftMessage(clickObject) { $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); fixPNG($(".png_ie")); $(".mid","#quick_view").height($(".inner","#quick_view").height()); $("#quick_view .close, #quick_view .cancel").click(function(){ $("#quick_view").remove(); $("#closeBKG").remove(); fixSelect(''); return false; }); $(".get_local_locator_results","#quick_view").click(function(e){ e.preventDefault(); submitGeoCodeForm(); return false; }); initEppMsg(); } function subscribePopup(email, obj) { if ($("#quick_view").length > 0) { $("#quick_view").remove(); } injectProcessing(obj,"",true,''); showSubscribeLayer(email, obj); } function showSubscribeLayer(email, clickObject) { $("body").append("
"); injectLoader("#quick_view",true); doc = new doc(); $.ajax({ type: "POST", url: "/includes/" + "layer_subscribe.jsp", data: { emailAddress: email, time: (new Date().getTime()) }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"inline",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderSubscribeLayer(clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: "/includes/" + "layer_subscribe.jsp", data: { emailAddress: email, time: (new Date().getTime()) }, dataType: "html" }); } } }); } function renderSubscribeLayer(clickObject) { fixPNG($(".png_ie")); setTimeout (function(){ $("#preview_layer_mid").height($(".inner","#quick_view").height()); $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); },5); $("#quick_view .close, #quick_view .cancel").click(function(){ $("#quick_view").remove(); fixSelect(''); return false; }); $("#quick_view .btn-submit").click(function(){ subscribe(this); }); $("#quick_view .why-do-you-ask").click(function(){ $("#quick_view .subscribe-terms-conditions").show(); }); } function showQuickViewWithUrl(pId, strUrl, clickObject) { if ($("#quick_view").length > 0) { $("#quick_view").remove(); $("#closeBKG").remove(); } $("body").append("
"); $("body").append("
"); injectLoader("#quick_view",true); doc = new doc(); $("#quick_view").css("top",Math.round(doc.innerHeight/2) + doc.pageYOffset - Math.round($("#quick_view").height()/2)); $("#quick_view").css("left",Math.round(doc.innerWidth/2) + doc.pageXOffset - Math.round($("#quick_view").width()/2)); $.ajax({ type: "POST", url: strUrl, data: { time: (new Date().getTime()) }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"inline",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderQuickView('','','','',clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: strUrl, data: { time: (new Date().getTime()) }, dataType: "html" }); } } }); sendOmnitureProductViewEvent(pId); } function showPickUpPeopleEditLayer(clickObject, orderCde, pickup1, pickup2, itemLineNumber, destUrl) { $("body").append("
"); $("body").append("
"); injectLoader("#quick_view",true); doc = new doc(); $.ajax({ type: "POST", url: "/includes/" + "layer_select_pickup_person.jsp", data: { orderCode: orderCde, pickupPerson1: pickup1, pickupPerson2: pickup2, lineSequenceNum: itemLineNumber, destURL: destUrl }, success: function(r) { fixSelect(true); injectProcessing(clickObject,"inline",false,''); injectLoader("#quick_view",false); $("#quick_view").html(r); renderAddEditShippingAddressLayer(clickObject); if ($.browser.msie) { $.ajax({ type: "GET", url: "/includes/" + "layer_select_pickup_person.jsp", data: { orderCode: orderCde, pickupPerson1: pickup1, pickupPerson2: pickup2, lineSequenceNum: itemLineNumber, destURL: destUrl }, dataType: "html" }); } } }); } function layer_select_pickup_person() { //For layer_select_pickup_person.jsp var selectPickupPersonDefaultVal = "First Name and Last Name"; $('#pickupAlt1, #pickupAlt2') .focus(function() { var searchVal = this.value; if (searchVal === selectPickupPersonDefaultVal ) { this.value = ""; $(this).css('color','#333333'); } }) .blur(function() { if ($.trim(this.value).length === 0) { this.value = selectPickupPersonDefaultVal; $(this).css('color','#A4A4A4'); } }) .blur(); $('#selectPickupPerson .submit a').click(function(evt){ evt.preventDefault(); $('#selectPickupPerson').submit(); }); //client-side input validation $('#selectPickupPerson').submit(function(evt){ var regex = /^[a-zA-Z][a-zA-Z '-.]*$/; var gtg = true; $('input[type=text]',this).each(function(){ if (!regex.test(this.value)) { $('div.important', this.parentNode).html('Please only use text for this name field.'); gtg = false; } else { if (this.value === selectPickupPersonDefaultVal) { this.value = ""; } $('div.important', this.parentNode).html(''); } }); return gtg; }); } /* ------------------------------------ End Order2Store script ------------------------------------ */