");
}
$(".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 + '.