ACC.product={matchHeightProductDetail:function(){$('.product_detail .image-region').matchHeight({byRow:true});$('.product_detail .text-region .highlight').matchHeight({byRow:true});$('.product_detail .text-region h2').matchHeight({byRow:true});$('.product_detail .text-region ul').matchHeight({byRow:true});$('.product_detail .purchase-region .item-price').matchHeight({byRow:true});$('.product_detail .text-region').matchHeight({byRow:true});$('.product_detail').matchHeight({byRow:true});$('.product_item').matchHeight({byRow:true});},initQuickviewLightbox:function(){this.enableAddToCartButton();},enableAddToCartButton:function(){$('#addToCartButton').removeAttr("disabled");},bindToAddToCartForm:function(){},initCAD:function(){},createYouKuPlayer:function(inUrl,divId){inVid=inUrl.substring(inUrl.lastIndexOf("/")+1);var ykplayer=new YKU.Player(divId,{styleid:'0',client_id:'c2e1459fd5465568',vid:inVid,newPlayer:true});return(ykplayer);},loadYoukuJs:function(){var s=document.createElement("script");s.type="text/javascript";s.src="/_ui/desktop/common/js/youkuApi.js"
$("head").append(s);},removeYoukuJs:function(){$("script[src='/_ui/desktop/common/js/youkuApi.js']").remove();$("link[href*='youku']").remove();},bindPopover:function(){addCadAndSpecEvents();$('[data-toggle="modalcadpdp"]').click(function(e){e.preventDefault();var title=$(this).attr('title');initCad(title);});$('[data-toggle="modalResource"]').click(function(e){e.preventDefault();var videoUrl=$(this).attr('title');if(videoUrl.includes("youku")){$('#youkuplayer').modal();var title=$(this).attr('titlehdr');$('#youkuplayer #youkuVideoLabel').text(title);ACC.product.loadYoukuJs();ACC.product.createYouKuPlayer(videoUrl,"youkuIframeId");}
else{$('#video').attr('src',videoUrl);$('#productVideoone').modal();}});$(".video_close").click(function(){$('.video_iframe, .video_iframe iframe').each(function(index){var leg=$(this).attr("src");if(leg){$(this).attr('src',"stop");ACC.product.removeYoukuJs();}});return true;});$('#productVideoone, #youkuplayer').on('hidden.bs.modal',function(){$('.video_close').trigger('click');return true;});},bindAll:function(){ACC.product.lazyLoadImages();},lazyLoadImages:function(){$('.lazy-image').lazyLoadXT();},productInitAll:function(){this.bindToAddToCartForm();this.initCAD();this.enableAddToCartButton();this.bindPopover();},showOneFilter:function(outerSelf){var totalCount=0;$(outerSelf).find(".checkbox").each(function(){var self=this;totalCount+=1;if(totalCount>maxCount){$(self).addClass("cbOver");}});$(".show_all",outerSelf).html('<div class="showAllText"><a href="javascript:;"><i class="fas fa-plus-square fa-md"></i> Show All</a></div><div class="showLessText"><a href="javascript:;"><i class="fas fa-minus-square fa-md"></i> Show Less</a></div>');$(".show_all",outerSelf).addClass("modeShowAll");$(".cbOver",outerSelf).hide();$(".showLessText",outerSelf).hide();if(totalCount>maxCount){$(".showAllText",outerSelf).show();}
else{$(".showAllText",outerSelf).hide();}},showAllFilter:function(prodOrRes){var showCl;if(prodOrRes=="prod"){showCl=".advanced_search .filter_block .each";}
else{showCl="#advanced_search_my_res .filter-by-holder .list-group-item";}
$(showCl).each(function(){var outerSelf=this;ACC.product.showOneFilter(outerSelf);});},applyShowAllEvent:function(){$(".show_all").on("click",function(){var self=this;var showAllElmt=$(self);var insiderElmt=showAllElmt.closest(".each");if(showAllElmt.hasClass("modeShowAll")){insiderElmt.find(".cbOver").show();$(".showAllText",showAllElmt).hide();$(".showLessText",showAllElmt).show();showAllElmt.removeClass("modeShowAll");}
else{insiderElmt.find(".cbOver").hide();$(".showAllText",showAllElmt).show();$(".showLessText",showAllElmt).hide();showAllElmt.addClass("modeShowAll");}});},loadShowAllFilter:function(){var bsEnv=findBootstrapEnvironment();if(bsEnv=='lg'||bsEnv=='md'){try{ACC.product.showAllFilter("prod");ACC.product.applyShowAllEvent();}
catch(error){}}},initBootstrapToggleButton:function(){$('#show_category_search_check, #show_advanced_search_check').bootstrapToggle({on:" ",off:" "});},compareRemoveItem:function(){var comPrd=$('#modelNumberDelete').text();var vURL=ACC.config.contextPath+'/productcomparison/removeCompareProduct?code='+comPrd;$.ajax({type:'POST',data:"",url:vURL,cache:false,success:function(data){var dataLength=$(data).find('div#totalCounts').text();$('.comparebtn').show();ACC.common.setCompareCountBadge(dataLength);if(parseInt(dataLength)<=5){$('.comparebtn').show();$('.customwarning').empty();}
$('div.cart-table.cartTable div.top-item-grid').replaceWith($(data).find('div.top-item-grid'));$.ajax({type:'POST',data:"",cache:false,url:ACC.config.contextPath+'/productcomparison/removeCompareProductPage',success:function(data){$('#cmpbdyajax').html(data);}});if(dataLength=='0'){$("#countchk").css("display","none");$('#header').remove();$('#compareAll').hide();$('#removeAll').hide();}}});}}
function addCadAndSpecEvents(){$('[data-toggle="modalspecs"]').unbind("click");$('[data-toggle="modalspecs"]').click(function(e){e.preventDefault();var title=$(this).attr('title');var url=ACC.config.contextPath+'/f/getSpecs/?productCode='+title;$.get(url,function(data){var modalspecdata=$('#modal_specs').html(data);$(modalspecdata).modal();});});$('[data-toggle="modalcad"]').unbind("click");$('[data-toggle="modalcad"]').click(function(e){e.preventDefault();var title=$(this).attr('title');var url=ACC.config.contextPath+'/f/getNoCadPopup/?productCode='+title;$.get(url,function(data){var modalCadPopup=$('#modal_cad_empty').html(data);$(modalCadPopup).modal();});});$('[data-toggle="modal2d"]').unbind("click");$('[data-toggle="modal2d"]').click(function(e){e.preventDefault();var title=$(this).attr('title');var url=ACC.config.contextPath+'/f/getResourceSpecs/?productCode='+title;$.get(url,function(data){var result=$(data);var resource=$(result).filter('#pdf_file');var modelNo=$(result).filter('#model');$('#model2d').html(title);$('#modelNbr2d').attr('href',ACC.config.contextPath+'/p/'+title);$('#title2d').html(modelNo);$('.pdf_file').html(resource);if(resource.find("#resourceExists").val()){$('#drawings-viewer-container-error').addClass('hidden');}else{$('#drawings-viewer-container-error').removeClass("hidden");}
init2d(title);$("#modal-footer-error-2d").show();});});};function initCad(title){var cmsSiteUid=$('#cmsSiteUid').val();if(cmsSiteUid=="newport"){cds.cad.init("newport",title);}else if(cmsSiteUid=="mks"){cds.cad.init("newport.mks",title);}
$('#modal_cad').modal();$(".cds-cad-viewer-container").remove();}
function init2d(title){$('#modal_2d').modal();}
$(document).ready(function(){ACC.product.productInitAll();});$(document).ready(function(){$('.carousel').carousel({interval:false})});$(function(){$('.magic-thumb a').click(function(){$('#caption').empty();$('#caption').append('<p>'+$(this).attr('title')+'</p>');});});$(function(){$(".rotation").hide();$(".product-zoom, .magic-rotate").bind("click",function(){$(".zoom, .rotation").hide();if($(this).attr("class")=="product-zoom"){$(".zoom").show();}else{$(".rotation").show();}});});$(function(){$('body').tooltip({selector:'[data-toggle=tooltip]'});});this.imagePreview=function(){xOffset=10;yOffset=30;$("a.preview").hover(function(e){this.t=this.title;this.title="";var c=(this.t!="")?"<br/>"+this.t:"";$("body").append("<p id='preview'><img src='"+this.rel+"' alt='Image preview' />"+c+"</p>");$("#preview").css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").fadeIn("fast");},function(){this.title=this.t;$("#preview").remove();});$("a.preview").mousemove(function(e){$("#preview").css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px");});};$(document).ready(function(){imagePreview();jQuery.extend(jQuery.fn.dataTableExt.oSort,{"natural-asc":function(a,b){return naturalSort(a,b);},"natural-desc":function(a,b){return naturalSort(a,b)*-1;},"numeric-comma-asc":function(a,b){var c=(a=="-")?0:a.replace(/,/,"");var d=(b=="-")?0:b.replace(/,/,"");return(naturalSort(c,d));},"numeric-comma-desc":function(a,b){var c=(a=="-")?0:a.replace(/,/,"");var d=(b=="-")?0:b.replace(/,/,"");return(naturalSort(c,d)*-1);}});});$(window).ready(function(){$('[data-toggle="tooltip"]').tooltip();$(document).on("click","#metricLink",function(){Category.doGridView();});$(document).on("click","#imperialLink",function(){Category.doTableView();});var Category={doGridView:function(){$("#view-toggle").html("Metric <i class=\"fas fa-caret-down\"></i>");return false;},doTableView:function(){$("#view-toggle").html("Imperial <i class=\"fas fa-caret-down\"></i>");return false;}};});function replaceState(urlpage,query){url=urlpage+"?"+query;history.pushState(null,null,url);}
function getParameterValues(param,formSerialize){var url=formSerialize.split('&');for(var i=0;i<url.length;i++){var urlparam=url[i].split('=');if(urlparam[0]==param){return urlparam[1];}}}
window.addEventListener("popstate",function(e){var wHref=window.location.href;if(wHref.indexOf("resourceListing")>-1||(wHref.indexOf("?")==-1&&wHref.indexOf("/c/")>-1)){$('body').append('<div class="ajaxLoading-bg"></div><div class="ajaxLoading-img"></div>');$.ajax({type:'GET',url:wHref,dataType:"html",cache:false,async:true,success:function(data){htmlReplaceAfterAjaxResourceListing(data);}});}else if((wHref.indexOf("?")>-1&&(wHref.indexOf("/search")>-1||wHref.indexOf("/c/")>-1))){$('body').append('<div class="ajaxLoading-bg"></div><div class="ajaxLoading-img"></div>');var typeRequest=getParameterValues('type',wHref);var relUrl=wHref.split("?");var url;if(typeRequest=="resource"){url=relUrl[0]+"/resource";}else{url=relUrl[0];}
var relfacet=relUrl[1].split("=");var form=relUrl[1].replace(relfacet[0],"q");var formSerialize=form;$.ajax({url:url,cache:false,async:true,data:formSerialize,dataType:"html",beforeSend:function(){}}).done(function(data){if(typeRequest=="resource"){htmlReplaceAfterAjaxResource(data);}else{htmlReplaceAfterAjax(data,formSerialize);}});}
if(findBootstrapEnvironment()=='sm'||findBootstrapEnvironment()=='xs'||findBootstrapEnvironment()=='xxs'||findBootstrapEnvironment()=='md'){$(".ajaxLoading-bg, .ajaxLoading-img").remove();}});$(document).on("submit",".compatibility_section .compatibility-component-form",function(event){event.preventDefault();var wHref=window.location.href;var relUrl=wHref.split("?");var url=relUrl[0];if((url.indexOf("/search/resource")>-1)){url=relUrl[0].replace("/resource","");}
$('body').append('<div class="ajaxLoading-bg"></div><div class="ajaxLoading-img"></div>');var formSerialize=$(this).serialize();var relfacet=formSerialize.split("=");var from=formSerialize.replace(relfacet[0],"q1");replaceState(url,from);$.ajax({url:url,cache:false,async:true,data:formSerialize,dataType:"html",beforeSend:function(){}}).done(function(data){htmlReplaceAfterAjax(data,formSerialize);});});var facetValueList=new Array();$(document).on("submit",".search-criteria .faceNavForm",function(event){event.preventDefault();var wHref=window.location.href;var relUrl=wHref.split("?");var url=relUrl[0];if((url.indexOf("/search/resource")>-1)){url=relUrl[0].replace("/resource","");}
$('body').append('<div class="ajaxLoading-bg"></div><div class="ajaxLoading-img"></div>');var formSerialize=$(this).serialize()+"&ajax=true";var relfacet=formSerialize.split("=");var from=formSerialize.replace(relfacet[0],"q1");var facetValue=getParameterValues('facetName',formSerialize);facetValueList.push(facetValue);replaceState(url,from);$.ajax({url:url,cache:false,async:true,data:formSerialize,dataType:"html",beforeSend:function(){}}).done(function(data){htmlReplaceAfterAjax(data,formSerialize);});});$(document).on("submit",".productPageSelectPagination",function(event){event.preventDefault();var wHref=$(this).attr("action");$('body').append('<div class="ajaxLoading-bg"></div><div class="ajaxLoading-img"></div>');var formSerialize=$(this).serialize();$.ajax({url:wHref,cache:false,async:true,data:formSerialize,dataType:"html",beforeSend:function(){}}).done(function(data){htmlReplaceAfterAjax(data,formSerialize);});});var maxCount=6;function htmlReplaceAfterAjax(data,valueForPrice){if($(data).find(".suggested_categories").html()==undefined){$(".suggested_categories").hide();}else{$(".suggested_categories").html($(data).find(".suggested_categories").html());$('.suggested_categories .each').matchHeight({byRow:true});$('.suggested_categories .each .row div').matchHeight({byRow:true});}
$(".catPagination").html($(data).find(".catPagination").html());$(".productPagination").html($(data).find(".productPagination").html());$(".proPagination").html($(data).find(".proPagination").html());$(".productBody").html($(data).find(".productBody").html());$("#category_content").html($(data).find("#category_content").html());$(".compatibilityBlock").html($(data).find(".compatibilityBlock").html());$(".ProductbeardCurmCategory").html($(data).find(".ProductbeardCurmCategory").html());$("#producttab").html($(data).find("#producttab").html());$(".search-criteria").html($(data).find(".search-criteria").html());$(".showing_items_count").html($(data).find(".showing_items_count").html());$(".selectedCategory").html($(data).find(".selectedCategory").html());$(".filterByCondition").html($(data).find(".filterByCondition").html());var str='actualMinPrice';if(valueForPrice.indexOf(str)>-1){$('#priceSlider').attr("aria-expanded","true");$('#priceSlider').removeClass('collapsed');$('#price').addClass('in');}
jQuery.each(facetValueList,function(index,item){$("#filt_"+item).addClass('in');});var bsEnv=findBootstrapEnvironment();if(!(bsEnv=='md'||bsEnv=='lg'||bsEnv=='xl')){$('#advanced_search').hide();}
else{ACC.product.showAllFilter("prod");ACC.product.applyShowAllEvent();}
$('.section table').addClass('dataTable no-footer');$('#productload').show();$('#resourcesload').hide();$('#resourcestab').attr("class","");$('#producttab').attr("class","active");$("div[id^='filt_']").each(function(i,obj){$(obj).prev().removeClass("collapsed");$(obj).addClass('in');$(obj).removeAttr('style');return i<2;});$(".ajaxLoading-bg, .ajaxLoading-img").remove();ACC.common.displayCategoryGridOrList(CLICK_SRC_SOLR_FILTER);}
var facetValueListresource=new Array();$(document).on("submit",".search-criteriaresourcefacet .faceNavResourceForm",function(event){event.preventDefault();var wHref=$(this).attr("action");$('body').append('<div class="ajaxLoading-bg"></div><div class="ajaxLoading-img"></div>');var url="/search";if((wHref.indexOf("/search/resource")>-1)){url=wHref.replace("/resource","");}
var formSerialize=$(this).serialize();var facetValue=getParameterValues('facetName',formSerialize);var relfacet=formSerialize.split("=");var from=formSerialize.replace(relfacet[0],"q1");facetValueListresource.push(facetValue);replaceState(url,from);$.ajax({url:wHref,async:true,cache:false,data:formSerialize,dataType:"html",beforeSend:function(){}}).done(function(data){htmlReplaceAfterAjaxResource(data);});});$(document).on("submit",".resourcePageSelectPagination",function(event){event.preventDefault();var wHref=$(this).attr("action");$('body').append('<div class="ajaxLoading-bg"></div><div class="ajaxLoading-img"></div>');var formSerialize=$(this).serialize();var facetValue=getParameterValues('facetName',formSerialize);facetValueListresource.push(facetValue);$.ajax({url:wHref,async:true,cache:false,data:formSerialize,dataType:"html",beforeSend:function(){}}).done(function(data){htmlReplaceAfterAjaxResource(data);});});function htmlReplaceAfterAjaxResource(data){$(".product-category-grid").html($(data).find(".product-category-grid").html());$(".view-control-container-footer").html($(data).find(".view-control-container-footer").html());$(".view-control-container").html($(data).find(".view-control-container").html());$("#resourcestab").html($(data).find("#resourcestab").html());$(".class_resource_totalProductResult").html($(data).find(".class_resource_totalProductResult").html());$(".class_resource_nextStartPageNumber").html($(data).find(".class_resource_nextStartPageNumber").html());$(".class_resource_nextEndPageNumber").html($(data).find(".class_resource_nextEndPageNumber").html());if(findBootstrapEnvironment()=='sm'||findBootstrapEnvironment()=='xs'||findBootstrapEnvironment()=='xxs'){$(".search-criteriaResourceComponentOffCanvas").html($(data).find(".search-criteriaResourceComponentOffCanvas").html());jQuery.each(facetValueListresource,function(index,item){$("#headingOneOffCanvas"+item+" > a").attr("aria-expanded","true");$("#headingOneOffCanvas"+item+" > a").removeClass("collapsed");$("#collapseOneOffCanvas"+item).addClass('in');$("#collapseOneOffCanvas"+item).attr("aria-expanded","true");$("#collapseOneOffCanvas"+item).attr("style"," ");$('.panel').addClass('active-panel');});}
$(".search-criteriaResource").html($(data).find(".search-criteriaResource").html());jQuery.each(facetValueListresource,function(index,item){$("#heading"+item+" > a").attr("aria-expanded","true");$("#heading"+item+" > a").removeClass("collapsed");$("#collapse0"+item).addClass('in');$("#collapse0"+item).attr("aria-expanded","true");$("#collapse0"+item).attr("style"," ");$('.panel').addClass('active-panel');});$('.filter-overflow').attr('style','display: none');$('.view-more-offcanvasresource').addClass('view-more-offcanvas');if($('.view-more-offcanvasresource').hasClass('view-more-offcanvas')){$('.view-more-offcanvasresource').html('<i class="fas fa-plus-square fa-md"></i> Show All');$('.view-more-offcanvasresource').parents(".list-group").find('.filter-overflow').css("display","none");$('.view-more-offcanvasresource').addClass('view-more-offcanvas');}else{$('.view-more-offcanvasresource').text('<i class="fas fa-minus-square fa-md"></i> Show Less');$('.view-more-offcanvasresource').parents(".list-group").find('.filter-overflow').css("display","block");$('.view-more-offcanvasresource').removeClass('view-more-offcanvas');}
$('#resourcesload').show();$('#productload').hide();$('#ResourcebeardCurmb').hide();var bsEnv=findBootstrapEnvironment();if(!(bsEnv=='md'||bsEnv=='lg'||bsEnv=='xl')){$('#advanced_search_my_res').hide();}
$('#productResourceTab').find('#producttab').attr("class","");$('#productResourceTab').find('#resourcestab').attr("class","active");$(".ajaxLoading-bg, .ajaxLoading-img").remove();ACC.product.loadShowAllFilter();}
$(document).on('click','.add_to_cart_form',function(e){var id=e.target.id;if(id=="qty"){return false;}
var cmsSite=$('#cmsSiteUid').val();var addId=$(this).attr('id');var form=$(this);if(addId!=undefined){var productCode=addId.replace("addToCartForm","");var startProductCode=productCode;productCode=productCode.replace("/","\\/");if(!addId.startsWith("popupAddToCart")&&$('#quickShip'+productCode).val()!=undefined&&$('#quickShip'+productCode).val()&&cmsSite=="mks"){var quantity=1;if(form.find('input[name=qty]')){quantity=form.find('input[name=qty]').val();}
$('#qtyAdd').val(quantity);$('#qtyFromAdd').text(quantity);$('#productCodePostAdd').val(startProductCode);$('#popupProductCode').val(productCode);$('#productModelAdd').text($('#productModel'+productCode).val());$('#productModelAdd').attr("href",$('#productUrl'+productCode).val());$('#productSummaryAdd').html($('#productSummary'+productCode).val());$('#productAvailabilityAdd').text($('#productAvailability'+productCode).val());if($('#productAvailability'+productCode).val()=="In Stock"){$('#productAvailabilityAdd').addClass("in-stock");}else{$('#productAvailabilityAdd').removeClass("in-stock");}
$('#thumbnailImageUrlAdd').attr("href",$('#productUrl'+productCode).val());$('#thumbnailImageAdd').attr("data-src",$('#thumbnail200ImageUrl'+productCode).val());$('#thumbnailImageAdd').attr("src",$('#thumbnail200ImageUrl'+productCode).val());$('#shopAtNewportUrlAdd').attr("href",$('#newportUrl').val()+$('#productUrl'+productCode).val());$.ajax({type:"GET",url:ACC.config.contextPath+"/p/npAvailability",data:{productCode:startProductCode,qty:quantity},async:false,success:function(result){$('#productNPAvailabilityAdd').text("");$('#productNPAvailabilityAdd').removeClass("in-stock");if(result.length>0){console.log("availability",result[0].value);if(result[0].value=="In Stock"){$('#productNPAvailabilityAdd').text(result[0].value);$('#productNPAvailabilityAdd').addClass("in-stock");}else{$('#productNPAvailabilityAdd').text(result[0].value);$('#productNPAvailabilityAdd').removeClass("in-stock");}}else{$('#productNPAvailabilityAdd').text("Contact Us");}},error:function(result){$('#productNPAvailabilityAdd').text("Contact Us");}});$('#mksAddToCart').modal();return false;}}
var addToCartForm=$('.add_to_cart_form');if(addId.startsWith("popupAddToCart")){var productCode=$('#popupProductCode').val();}
productCode=productCode.replace(".","\\.");addToCartForm.ajaxForm({success:function(data){ACC.common.setCartCountBadge($(data).find('#cartCount').val());$('#qtyAddToCart').text($(data).find('#qty').val());$('#thumbnailImageUrlAddToCart').attr("href",ACC.config.contextPath+$('#productUrl'+productCode).val());$('#thumbnailImageAddToCart').attr("data-src",$('#thumbnail200ImageUrl'+productCode).val());$('#thumbnailImageAddToCart').attr("src",$('#thumbnail200ImageUrl'+productCode).val());$('#productModelAddToCart').text($('#productModel'+productCode).val());$('#productModelName').text($('#productName'+productCode).val());$('#productModelAddToCartUrl').attr("href",ACC.config.contextPath+$('#productUrl'+productCode).val());$('#productSummaryAddToCart').html($('#productSummary'+productCode).val());if($(data).find('#productStrikeThruPrice').val()!=""){$("#specialPriceAddToCart").show();$("#strikePriceAddToCart").show();$("#specialPriceAddToCart").text($(data).find('#productPrice').val());$("#strikePriceAddToCart").text($(data).find('#productStrikeThruPrice').val());$("#productPriceAddToCart").hide();}else{$("#productPriceAddToCart").show();$("#productPriceAddToCart").text($(data).find('#productPrice').val());$("#specialPriceAddToCart").hide();$("#strikePriceAddToCart").hide();}
if($(data).find('#availability').val()=="In Stock"){$("#availabilityAddToCart").text($(data).find('#availability').val());$("#availabilityAddToCart").addClass("in-stock");}else if($(data).find('#availability').val()=="viewCart"){$("#availabilityAddToCart").html('<a href="'+ACC.config.contextPath+'/cart">View in Cart</a>');$("#availabilityAddToCart").removeClass("in-stock");}else{$("#availabilityAddToCart").text($(data).find('#availability').val());$("#availabilityAddToCart").removeClass("in-stock");}
if($(data).find('#recommendedProductCount').val()==0){$(".addToCartRecommendedHR").addClass("hidden");}else{$(".addToCartRecommendedHR").removeClass("hidden");}
$(".addToCartRecommendedProducts").html($(data).find('.recommendedProducts').html());$('#addToCartConfirmationModal').modal();$('#mksAddToCart').modal('hide');}});});$(document).on('click','#addToCartAllForm',function(e){var addToCartAllForm=$('#addToCartAllForm');const formIds=new Set();var cartProductDataList=[];var tableId=$(this).data('tableId');var componentId=$(this).data('componentUid');$('#'+tableId).find('form').each(function(){if(this.id){formIds.add(this.id);}});formIds.forEach(function(formId){var $form=$('#'+formId.replace(/\./g,'\\.'));var product=$form.find('input[name="productCodePost"]').val();var qty=$form.find('input[name="qty"]').val();cartProductDataList.push({productCode:product,qty:qty});});var formData={componentId:componentId,cartProductDataList:cartProductDataList};$.ajax({url:"/cart/addall",method:'POST',contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(formData),success:function(result){$('#addToCartAllForm').text('');$('#addToCartAllForm').text(result[0].value);$('#addToCartAllForm').removeAttr('id');ACC.common.setCartCountBadge(result[1].value);},error:function(xhr,status,error){console.error('Error:',error);}});});$(document).on('click','.cart-rp-action',function(){var cmsSite=$('#cmsSiteUid').val();var addId=$(this).closest("form").attr('id');if(addId!=undefined){var productCode=addId.replace("addToCartRPForm","");productCode=productCode.replace("/","\\/");if($('#quickShip'+productCode).val()!=undefined&&$('#quickShip'+productCode).val()&&cmsSite=="mks"){}else{var mom_rp=$(this);var chk_rp=$(this).append('<div class="chk-rp"><i class="fas fa-check white"></i></div>');var this_ini_rp=$(this).children('.ini-rp');var this_ls_rp=$(this).children('.ls-rp');var this_chk_rp=$(this).children('.chk-rp');var cur_width_rp=mom_rp.width();var mom_rp_org_width=parseInt(mom_rp.css('width'));var this_qty_text=$(this).closest("form").find('input[name=qty]');var this_span_addtocart=$(this).closest("form").find('span[id=addtocart-group-btn]');var font_size_rp=parseInt(this_ini_rp.css('font-size'))/1.25;var font_size_norm_rp=parseInt(this_ini_rp.css('font-size'));this_chk_rp.hide();mom_rp.width(cur_width_rp);this_ini_rp.animate({'font-size':font_size_rp,'opacity':0},500,function(){this_ini_rp.hide();this_ls_rp.fadeIn('fast',function(){});});setTimeout(function(){this_ls_rp.fadeOut('fast',function(){this_chk_rp.fadeIn('fast',function(){setTimeout(function(){this_chk_rp.fadeOut('slow',function(){this_chk_rp.remove();this_qty_text.remove();this_span_addtocart.removeClass();mom_rp.css('width',mom_rp_org_width+50);mom_rp.css('background-color','darkgrey');mom_rp.css('border-color','darkgrey');mom_rp.prepend('<i class="fas fa-check white"></i>');mom_rp.removeClass('cart-rp-action');this_ini_rp.html("Added to Cart");this_ini_rp.show();this_ini_rp.animate({'font-size':font_size_norm_rp,'opacity':1},500);});},200);document.dispatchEvent(addToCartCompleted);});});},1000);}}});$(document).on('click','.add_to_cart_rp_form',function(e){var cmsSite=$('#cmsSiteUid').val();var addId=$(this).attr('id');$('.filter-overflow').attr('style','display: none');var productCode=addId.replace("addToCartRPForm","");var addToCartForm=$('.add_to_cart_rp_form');productCode=productCode.replace(".","\\.");addToCartForm.ajaxForm({success:function(data){ACC.common.setCartCountBadge(data.totalItems);}});});$(document).on('click','#disposeCad',function(){if(typeof cds.cadViewer!=="undefined"&&cds.cadViewer){cds.cadViewer.closeScene();}});var viewerExpanded=false;function toggleExpandedViewer(){"use strict";var e=document.getElementById("cad-viewer-container");viewerExpanded=!viewerExpanded;if(viewerExpanded){e.style.height="800px";e.style.width="800px";$('#modal_cad .modal-dialog').css({'max-width':'none','width':'832px'});}else{e.style.height="338px";e.style.width="368px";$('#modal_cad .modal-dialog').css({'max-width':'400px','width':'auto'});}
cds.cadViewer.onWindowResize();}
var show_hide;$(document).on('click','#categories_show_all',function(){$('#resourcesload').hide();if($('#categoryBlock5').css("display")=="none"){show_hide=5;$(".suggested_categories .each:nth-child(n+5)").slideDown(250);}else{show_hide=7;$(".suggested_categories .each:nth-child(n+7)").slideDown(250);}
var showText=$("#showText").val();var catText=$("#catText").val();var lessText=$("#lessText").val();var total=$('#searchResultCount').val();$(this).toggleHTML('<i class="fas fa-plus-square fa-md"></i>&nbsp;'+showText+' '+total+' '+catText,'<i class="fas fa-minus-square fa-md"></i>&nbsp;'+lessText+' '+catText);$(this).attr("id","categories_hide_all");});$(document).on('click','#categories_hide_all',function(){$('#resourcesload').show();if(show_hide==5){$(".suggested_categories .each:nth-child(n+5)").slideUp(250);}else{$(".suggested_categories .each:nth-child(n+7)").slideUp(250);}
var showText=$("#showText").val();var catText=$("#catText").val();var lessText=$("#lessText").val();var total=$('#searchResultCount').val();$(this).toggleHTML('<i class="fas fa-minus-square fa-md"></i>&nbsp;'+lessText+' '+catText,'<i class="fas fa-plus-square fa-md"></i>&nbsp;'+showText+' '+total+' '+catText);$(this).attr("id","categories_show_all");});var facetValueListresourcelist=new Array();$(document).on("submit",".advanced_search .faceNavResourceListForm",function(event){event.preventDefault();var wHref=$(this).attr("action");$('body').append('<div class="ajaxLoading-bg"></div><div class="ajaxLoading-img"></div>');var formSerialize=$(this).serialize();var facetValue=getParameterValues('facetName',formSerialize);facetValueListresourcelist.push(facetValue);replaceState(wHref,formSerialize);$.ajax({url:wHref,async:true,cache:false,data:formSerialize,dataType:"html",beforeSend:function(){}}).done(function(data){htmlReplaceAfterAjaxResourceListing(data);});});$(document).on("submit",".pagination_container .resourceListPageSelectPagination",function(event){event.preventDefault();var wHref=$(this).attr("action");$('body').append('<div class="ajaxLoading-bg"></div><div class="ajaxLoading-img"></div>');var formSerialize=$(this).serialize();$.ajax({url:wHref,async:true,cache:false,data:formSerialize,dataType:"html",beforeSend:function(){}}).done(function(data){htmlReplaceAfterAjaxResourceListing(data);});});function htmlReplaceAfterAjaxResourceListing(data){$(".resourcelistData").html($(data).find(".resourcelistData").html());$(".advanced_search").html($(data).find(".advanced_search").html());if(findBootstrapEnvironment()=='md'||findBootstrapEnvironment()=='lg'){$(".resource_toolbar").html($(data).find(".resource_toolbar").html());}
if(findBootstrapEnvironment()=='sm'){$(".showing_items_count").html($(data).find(".showing_items_count").html());$(".pagination_container").html($(data).find(".pagination_container").html());}
if(findBootstrapEnvironment()=='xs'||findBootstrapEnvironment()=='xxs'){$(".pagination_container").html($(data).find(".pagination_container").html());}
jQuery.each(facetValueListresourcelist,function(index,item){try{$("#filt_"+item).addClass('in');}
catch(err){}});$(".ajaxLoading-bg, .ajaxLoading-img").remove();ACC.product.productInitAll();}
function categoryFacetVal(count){var wHref=window.location.href;var relUrl=wHref.split("?");var vURL=$("#urlValue"+count).val()+"&ajax=true";var relUrl1=vURL.split("=");Url=relUrl[0]+"?q1="+relUrl1[1]+"&"+relUrl[1];history.pushState(null,null,Url);$('body').append('<div class="ajaxLoading-bg"></div><div class="ajaxLoading-img"></div>');$.ajax({type:'GET',url:ACC.config.contextPath+vURL,dataType:"html",success:function(data){if($(data).find(".suggested_categories").html()==undefined){$(".suggested_categories").hide();}
$('.preview-list').addClass('dataTable no-footer');$('.section table').addClass('dataTable no-footer');$(".productBody").html($(data).find(".productBody").html());$("#category_content").html($(data).find("#category_content").html());$(".compatibilityBlock").html($(data).find(".compatibilityBlock").html());$(".ProductbeardCurmCategory").html($(data).find(".ProductbeardCurmCategory").html());$("#producttab").html($(data).find("#producttab").html());$(".search-criteria").html($(data).find(".search-criteria").html());$(".catPagination").html($(data).find(".catPagination").html());$(".productPagination").html($(data).find(".productPagination").html());$(".proPagination").html($(data).find(".proPagination").html());$(".showing_items_count").html($(data).find(".showing_items_count").html());$("#productload").html($(data).find("#productload").html());$(".selectedCategory").html($(data).find(".selectedCategory").html());$(".filterByCondition").html($(data).find(".filterByCondition").html());try{ACC.common.doSetupFilters();ACC.product.loadShowAllFilter();ACC.common.displayCategoryGridOrList(CLICK_SRC_CHANGE_FILTER);}
catch(error){}
if($('#category_content').hasClass('list_view')){$('#view_style_list').trigger("click");}else{$('#view_style_grid').trigger("click");}
ACC.product.initBootstrapToggleButton();$('.section table').addClass('dataTable no-footer');$(".ajaxLoading-bg, .ajaxLoading-img").remove();},error:function(jqXHR,exception){}});}
$(document).ready(function(){$('.youkuvideo').each(function(){var videoUrl=$(this).attr('src');ACC.product.loadYoukuJs();ACC.product.createYouKuPlayer(videoUrl,$(this).attr('id'));})})
document.addEventListener("addToCartCompleted",function(e){$('.check_availability_modal').modal('hide');});$(document).ready(function(){$(document).on("click",'a[href="'+ACC.config.contextPath+'/guest/compareRemoveProductShow"]',function(event){event.preventDefault();var modelNumber=event.target.dataset.product;if(!modelNumber){modelNumber=event.target.parentNode.dataset.product;}
$('#modelNumberDelete').text(modelNumber);$('#compare_remove_product_modal').modal();});$(document).on("click",'#compareRemoveProductForm #deleteListItem',function(event){event.preventDefault();ACC.product.compareRemoveItem();$('.modal').modal('hide');});});$(document).ready(function(){$(document).on("click",".product-model",function(e){var selVal=$('#prodInfoId').attr('title');if(selVal){navigator.clipboard.writeText(selVal);}});$('.print-faqs h3#faq a').click(function(evt){if($('#print-faqs').hasClass("faq-active-panel"))
{$('#print-faqs').removeClass("faq-active-panel");}});$('.print-faqs #collapseFaq .qa-section a').click(function(evt){$('#print-faqs').addClass("faq-active-panel");});});