'); if ($j('.item.singleton:visible .email_in_stock').length) { var tsmem = $j('.item.singleton:visible .email_in_stock').clone(); $j(tsmem).find('a').html('Email me when in stock'); $j('.temp-stock-msg').append(tsmem); } $('html').addClass('hide-cart'); } else { $('html').removeClass('hide-cart'); } /* */ var magiD = $j('#product_tab_content_0').html(); $j('.set1 .product_short_description').html(magiD); /* */ var curSto = $j('.item.singleton:visible').find('.stock').clone(); $j('.dropdown_sub_items .stock').remove(); $j('.dropdown_sub_items').append(curSto); /* */ $j('.egift_psmb').each(function() { $j(this).removeClass('cellelected'); if ($j(this).find('.selected').length) { $j(this).addClass('cellelected'); } }); /* */ var newImg = $j('#main_image_img').attr('src').replace('/standard/','/giant/'); $j('#main_image_img').attr('src',newImg); $j('.alt_images:visible .alt_image img[data-slow]').each(function() { var newImg = $j(this).attr('data-slow').replace('/thumbnail/','/standard/'); $j(this).attr('src',newImg); $j(this).removeAttr('data-slow'); }); /* */ $j('.alt_images:visible').trigger('refresh.owl.carousel'); /* */ //console.log(tcpsDataProduct); if (typeof tcpsDataProduct !== 'undefined') { $j('.set1 .product-tags').html(tcpsDataProduct.tags); var str = tcpsDataProduct.tags; linkAny(str); } //console.log('it ran a SAVE') } //console.log('it ran this abs') if (!$j('html').hasClass('psm-auto') && $j('.shoSel').length) { $j('#add_single .psmSectionContainer.ready').each(function() { if ($j("#MainImageMessage").html() == "This item is out of stock." && $j(this).find('.psmSectionBlock.notinstock.selected').length == 1) { $j('html').addClass('psm-auto') $j(this).find('.psmSectionBlock').click(); console.log('here clicked 4') } }); }} productSelectorCheckCounted = function() { for(var type in tcpsData[tcpsCurrentSelection]['set']) { if(typeof(tcpsCurrentSet['_set'+type]) == 'undefined') { return false; } } return true; } productSelectorCheckSelected = function() { if($("#vwitem").val() == '') { for(var type in tcpsData[tcpsCurrentSelection]['set']) { if(typeof(tcpsCurrentSet['_set'+type]) == 'undefined') { alert("Please select a "+tcpsData[tcpsCurrentSelection]['set'][type]['name']+"."); return false; } } } if(!productSelectorInStock()){ alert("Sorry, the selected product is not in stock."); return false; } if(!productSelectorEgiftCheck()){ return false; } if(quickCartAction == 2) { $j('#add_single').append(' '); } if(quickCartAction == 3) { $j('#add_single').append(' '); } return QuickCart_addToCart('add_single'); } productSelectorEgiftCheck = function() { var value = ""; if($j("#egift_info_list").length > 0){ $j("#egift_info_list li div").children().each( function(){ if($j(this).attr('id') !== "undefined" && $j(this).attr('id') !== ""){ //alert($j(this).attr('id'));// return false; var egift_field_id = $j(this).attr('id'); $j("#"+egift_field_id).css("border", "1px solid"); if(typeof egift_field_id != "undefined"){ if(egift_field_id.indexOf("message") == -1 && $j("#"+egift_field_id).val() == ""){ $j("#"+egift_field_id).css("border", "2px solid #c66"); value = "Please complete the required fields"; return; } if(egift_field_id.indexOf("email_address") != -1 && $j("#"+egift_field_id).val() != ""){ if(!$j("#"+egift_field_id).val().match(/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/)){ value = "Please enter a valid email address"; return; } if($j("#"+egift_field_id).val() != $j("#verify_email_address").val()){ value = "Email addresses do not match"; return; } } } } }); } if($j("#egift_info_list_additional").length > 0){ $j("#egift_info_list_additional li div").children().each( function(){ if($j(this).attr('id') !== "undefined" && $j(this).attr('id') !== ""){ var egift_field_id_additional = $j(this).attr('id'); $j("#"+egift_field_id_additional).css("border", "1px solid"); if(typeof egift_field_id_additional != "undefined"){ if(egift_field_id_additional.indexOf("message") == -1 && $j("#"+egift_field_id_additional).val() == ""){ $j("#"+egift_field_id_additional).css("border", "2px solid #c66"); value = "Please complete the required fields"; return; } if(egift_field_id_additional.indexOf("email_address") != -1 && $j("#"+egift_field_id_additional).val() != ""){ if(!$j("#"+egift_field_id_additional).val().match(/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/)){ value = "Please enter a valid email address"; return; } if($j("#"+egift_field_id_additional).val() != $j("#verify_email_address").val()){ value = "Email addresses do not match"; return; } } } } }); } if(value !== ""){ alert(value); return false; }else{ return true; } } sendCertona = function(){ if($j('#quick_view_stage').length > 0){ pos = $j('#main_image_img').attr('src').lastIndexOf("/") + 1; productid = $j('#main_image_img').attr('src').substr(pos); combinedid = 36956 + '-'+ productid.substring(0, productid.length - 4); resx.itemid = combinedid; resx.event = "quickview" certonaResx.run(); } } productSelectorFindProduct = function() { var number_items=0; for(var c in tcpsData[tcpsCurrentSelection]['set']) { number_items++; } for(var p in tcpsData[tcpsCurrentSelection]['products']) { var hc=0; for(var type in tcpsData[tcpsCurrentSelection]['products'][p]) { if(typeof(tcpsCurrentSet['_set'+type]) != 'undefined' && typeof(tcpsData[tcpsCurrentSelection]['set'][type]['set'][tcpsCurrentSet['_set'+type]]) != 'undefined' && tcpsData[tcpsCurrentSelection]['set'][type]['set'][tcpsCurrentSet['_set'+type]]['name'] == tcpsData[tcpsCurrentSelection]['products'][p][type]) { hc++; } } if(hc == number_items) { document.getElementById('vwitem').value = p; ProductSingletonHideItems(); document.getElementById('item-'+p).style.display = 'block'; } } } // callback is called with the product id productSelectorForeach = function(set, callback) { for(var p in tcpsData[tcpsCurrentSelection]['products']) { var found = true; for(var t in tcpsData[tcpsCurrentSelection]['set']) { if(typeof(set['_set'+t]) == 'undefined') continue; if(typeof(tcpsData[tcpsCurrentSelection]['products'][p][t]) == 'undefined' || typeof(tcpsData[tcpsCurrentSelection]['set'][t]['set'][set['_set'+t]]['name']) == 'undefined' || tcpsData[tcpsCurrentSelection]['products'][p][t] != tcpsData[tcpsCurrentSelection]['set'][t]['set'][set['_set'+t]]['name']) { found = false; break; } } if(found && callback(p) === false) { break; } } } productSelectorInStock = function(set) { set = set || tcpsCurrentSet; var inStock = false; productSelectorForeach(set, function(p) { if(tcpsData[tcpsCurrentSelection]['products'][p]['in_stock']) { inStock = true; return false; } }); return inStock; } productSelectorQuantity = function(set) { set = set || tcpsCurrentSet; var quantity = "0"; productSelectorForeach(set, function(p) { if(tcpsData[tcpsCurrentSelection]['products'][p]['quantity']) { quantity = tcpsData[tcpsCurrentSelection]['products'][p]['quantity']; return false; } }); return quantity; } productSelectorExists = function(set) { set = set || tcpsCurrentSet; var exists = false; productSelectorForeach(set, function(p) { exists = true; return false; }); return exists; } productSelectorGetTypes = function() { var types = [], typesStr = ""; for(var type in tcpsData[tcpsCurrentSelection]['set']) { types.push(tcpsData[tcpsCurrentSelection]['set'][type]['name'].toLowerCase()); } for(var i = 0; i < types.length; i++) { if(i > 0) { if(i == types.length - 1) { typesStr += " or "; } else { typesStr += ", "; } } typesStr += types[i]; } return typesStr; } productSelectorCheckStock = function(t,selectedIndex,showTooltip) { productSelectorFindProduct(); var typeCount = 0; var exists = productSelectorExists(); var inStock = productSelectorInStock(); var quantity = productSelectorQuantity(); var set; for(var type in tcpsData[tcpsCurrentSelection]['set']) { typeCount++; set = {}; for(var currentType in tcpsCurrentSet) { set[currentType] = tcpsCurrentSet[currentType]; } var typeExists = false; var typeInStock = false; for(var item in tcpsData[tcpsCurrentSelection]['set'][type]['set']) { if(dispQuantityThreshold > 0){ $("#psmSection"+tcpsCurrentSelection+type+item).find('span').remove(); } set['_set'+type] = item; if(productSelectorExists(set)) { $("#psmSection"+tcpsCurrentSelection+type+item).removeClass("notexist"); typeExists = true; } else { $("#psmSection"+tcpsCurrentSelection+type+item).addClass("notexist"); } if(productSelectorInStock(set)) { $("#psmSection"+tcpsCurrentSelection+type+item).removeClass("notinstock"); if(showTooltip && dispQuantityThreshold>0){ quantity = productSelectorQuantity(set); if(quantity>0 && quantity'+quantity+''); } } typeInStock = true; } else { $("#psmSection"+tcpsCurrentSelection+type+item).addClass("notinstock"); } } if(!typeExists) exists = false; if(!typeInStock) inStock = false; } $("#psmSection"+tcpsCurrentSelection).toggleClass("notexist", !exists); $("#psmSection"+tcpsCurrentSelection).toggleClass("notinstock", !inStock); if(showTooltip && tcpsChildren > 1) { if(!exists) { productSelectorSetTooltip(true, t, selectedIndex, "Sorry, this combination