function openMessage(n){var t=new Spry.Effect.Blind(n,{duration:1500,from:"0%",to:"100%"});t.start()}function closeMessage(n){if(document.getElementById(n).style.display!=="none"&&document.getElementById(n).style.height!=="100%"){resetmessage=function(){document.getElementById(n).style.display="none";document.getElementById(n).style.height="";t=null};var t=new Spry.Effect.Blind(n,{duration:1500,from:"100%",to:"0%",finish:resetmessage});t.start()}}function createNewReviewWindow(n){window.open(n,"ProductReview","scrollbars=1,width=600,height=575")}function viewAllPhotos(n){day=new Date;id=day.getTime();eval("page"+id+" = window.open('item/allphotos/"+n+"', '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=400');")}function viewSpecSheet(n){day=new Date;id=day.getTime();eval("page"+id+" = window.open('specs/"+n+".htm', '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=400');")}function submit_addtofastord(){document.addtocart.addtofastord.value="yes";document.addtocart.addtowishlist.value="";document.addtocart.submit()}function clearsubmits(){document.addtocart.addtowishlist.value="";document.addtocart.addtofastord.value=""}function closeToast(n){$(n).toast("dispose");$(".toast-holder").hide()}function showModelImage(){document.getElementById("item_photo").src=imgPath+"/model_med/"+modelImage}function flagColorProperty(n){for(var t,r,u="",i=0;i<itemProperties.length;i++)t=itemProperties[i].stars,r=itemProperties[i].colorName,n===r&&(u=t==="*"?"one-star":t==="**"?"two-star":t==="***"?"tri-star":"X");return u}function loginMessage(){showAlert("Login","Please login to add items to your Wishlist.","info")}function checkQtys(){var n=!1;return $('#addtocart input[type="number"]').each(function(){isNumeric($(this).val())&&(n=!0)}),n===!1?(showAlert("How many?","Please enter a quantity for the sizes you want.","question"),!1):!0}function isNumeric(n){return parseFloat(n)==n}function newSizeChartWindow(){newWin=window.open("/item/clothingsizechartcompact#"+brandId,"ClothingSizeChart","scrollbars=1,location=0,height=400,width=750");newWin.focus()}function FormatMoney(n){places=2;symbol="$";thousand=",";decimal=".";var i=n,u=i<0?"-":"",r=parseInt(i=Math.abs(+i||0).toFixed(places),10)+"",t=(t=r.length)>3?t%3:0;return symbol+u+(t?r.substr(0,t)+thousand:"")+r.substr(t).replace(/(\d{3})(?=\d)/g,"$1"+thousand)+(places?decimal+Math.abs(i-r).toFixed(places).slice(2):"")}function specSheetCheck(){$.ajax({url:"/home/ajaxspecsheetexists/"+brandStyleUrl,method:"GET",dataType:"text",timeout:3e3,success:function(n){n==="True"&&($("#custSpecSheetLink").show(),$("#custSpecSheetLink").html(specSheetLink))}})}$(document).ready(function(){function c(r){n[r].image!==undefined&&(t==="model"&&(t="colors"),i=n[r].image,document.getElementById("item_photo").src=imgPath+"/"+t+"_item/"+i,document.getElementById("item_photo").setAttribute("data-magnify-src",imgPath+"/"+t+"_large/"+i),$(".zoom").magnify())}function l(){$.ajax({url:"/item/ajaxitemoptions/"+itemid+"?requestcolor="+requestcolor,cache:!1,dataType:"json",timeout:15e3,success:function(t){n=t;h=!0;f()}})}function a(){$.ajax({type:"GET",url:"/home/ajaxloggedin/",cache:!1,dataType:"text",timeout:1e4,success:function(n){o=n;s=!0;f()}})}function f(){s&&h&&(y(),w(),p(),b(),k(),it(),v())}function v(){o!=="true"&&hasMap&&$(".custMapMsgItem").show()}function y(){var t="<!-- swatches --> ";jQuery.each(n,function(n,i){var r=i.color,u=i.swatch,f="https://blankshirts.s3-us-west-1.amazonaws.com/shared/images/no-swatch.svg";u===undefined&&(u=f);t+='<a href="" class="swatchlinks" id="swatch_link'+n+'" title="'+r+'"                 data-toggle="tooltip" data-placement="top" >                <img src="'+imgPath+"/swatches/"+brandImgUrl+"-"+u+'"                 class="'+flagColorProperty(r)+'" alt="'+r+'" title="'+r+'"                 onerror="this.onerror=null;this.src=(\''+f+"');\"/>                <\/a>"});$("#swatch-grid").html(t)}function p(){var t='<select id="color_dropdown" name="color" class="custom-select">',i=[];jQuery.each(n,function(n,t){i.push(t.color)});jQuery.each(i.sort(),function(n,i){var r=i;t+='<option value="'+r+'">'+r+"<\/option>"});t+=' <\/select><span id="youSelected"><\/span> ';$("#colorDropdown").html(t)}function w(){jQuery.each(n,function(t,i){n[t].instock=0;jQuery.each(i.sizes,function(i,r){r.instock&&(n[t].instock=1)});n[t].instock||($("#swatch_link"+t).className="custOos")})}function b(){jQuery.each(n,function(n,t){t.default&&(u=n)})}function k(){if(u===null){var t=0,i=1e4,f=!1;jQuery.each(n,function(n,r){if(r.selected)return t=n,f=!0,!1;r.instock===1&&jQuery.each(r.sizes,function(r,u){jQuery.each(u.prices,function(r,u){u<=i&&(i=u,t=n)})})});r(t,f)}else r(u,!0)}function r(t,r){showColorImg===!0&&(r===undefined&&(r=!0),r&&c(t));document.getElementById("color_dropdown")&&($("#color_dropdown").val(g(t)),nt(t),tt(t));i=n[t].image;var u=n[t].color,f=n[t].swatch;document.getElementById("colorPreview").innerHTML='<img src="'+imgPath+"/swatches/"+brandImgUrl+"-"+f+'" class="swatch-preview" alt="'+u+'" />'}function d(n){var t=-1;return $(".swatchlinks").each(function(){if(this.title===n)return t=parseInt(this.id.replace("swatch_link","")),!1}),t}function g(n){return $("#swatch_link"+n).attr("title")}function nt(t){var r=n[t],o=document.getElementById("item_data_table_holder"),s=15,i='<thead class="thead-light"><tr>',f,e,u;for(i+='<th class="quantity">&nbsp;<\/th>',jQuery.each(r.sizes,function(n,t){i+='<th class="text-center">'+t.size+"<\/th>"}),i+="<\/tr><\/thead>",i+="<tr>",i+='<td class="quantity">Quantity <\/td>',r.sizes.length==1?(f="",e="",r.sizes[0].stock===0&&(f=" disabled",e="N/A"),i+='<td class="inputs"> <input name="qty_'+r.sizes[0].id+'"  class="qty-optids form-control form-control-sm w-75" type="number" min="0" placeholder="'+e+'"'+f+"> <\/td>"):jQuery.each(r.sizes,function(n,t){var r="",u="";t.stock===0&&(r=" disabled",u="N/A");i+='<td class="inputs"> <input name="qty_'+t.id+'"  class="qty-optids form-control form-control-sm" type="number" min="0" placeholder="'+u+'"'+r+"> <\/td>"}),i+="<\/tr>",i+='<tr class="prices-stock" ><td class="brackets">',u=0;u<priceColumns.length;u++)i+=" "+priceColumns[u]+"<br>";i+="<\/td>";jQuery.each(r.sizes,function(n,t){i+='<td class="prices">';jQuery.each(t.prices,function(n,t){t===undefined&&(t="N/A");i+=" "+FormatMoney(t)+" <br> "});i+="<\/td>"});i+="<\/tr>";i+='<tr  class="prices-stock"><td class="stock">In Stock<\/td> ';jQuery.each(r.sizes,function(n,t){i+=r.instock?t.stock<s?'<td class="stock">0<\/td>':'<td class="stock">'+t.stock+"<\/td>":'<td class="stock">0<\/td>'});i+="<\/tr>";o.innerHTML='<table id="item-prices" class="table table-sm">'+i+"<\/table>"}function tt(t){var u=n[t],f=document.getElementById("item_data_table_holder_mobile"),e=15,i='<thead class="thead-light"><tr>',r;for(i+='<th class="quantity">Quantity<\/th>',i+='<th class="sizes">Size<\/th>',r=0;r<priceColumns.length;r++)i+='<th class="prices"> '+priceColumns[r]+" <\/th>";i+='<th class="">Stock<\/th>';i+="<\/tr>";jQuery.each(u.sizes,function(n,t){var o=t.size,s=t.stock,h=t.id,r="",f="";t.stock===0&&(r=" disabled",f="N/A");i+="<tr>";i+='<th class="inputs"><input name="qty_'+h+'" type="number" class="qty-optids form-control" maxlength="5"  placeholder="'+f+'"'+r+"/><\/th>";i+='<th class="size">'+o+"<\/th>";jQuery.each(t.prices,function(n,t){t===undefined&&(t="N/A");i+='<td class="price">'+FormatMoney(t)+"<\/td>"});i+=u.instock?t.stock<e?'<td class="stock">0<\/td>':'<td class="stock">'+s+"<\/td>":'<td class="stock">0<\/td>';i+="<\/tr>"});f.innerHTML='<table id="item-prices-mobile" class="table-bordered table table-sm table-striped">'+i+"<\/table>"}function it(){var i,r,f,t,e,o,u,n;if(itemProperties.length>0){for(i='<div class="custColorLegend">             <div class="item_properties my-1">',n=0;n<itemProperties.length;n++)f=itemProperties[n].stars,u=itemProperties[n].divIndex,itemProperties[n].prop.indexOf("/")>0?(t=itemProperties[n].prop.split("/"),e=t[0],o=t[1],r!==itemProperties[n].prop&&(i+='<div class="property_'+u+' prop_not_selected">                             <div class="legend-thumb"><\/div>'+e+"% Cotton / "+o+"% Polyester blend<\/div>")):itemProperties[n].prop.indexOf("!")>0?(t=itemProperties[n].prop.split("!"),material=t[1],r!==itemProperties[n].prop&&(i+='<div class="property_'+u+' prop_not_selected"> 100% '+material+"<\/div>")):itemProperties[n].prop.indexOf("^")>0&&(t=itemProperties[n].prop.replace(/\^/g," / "),r!==itemProperties[n].prop&&(i+='<div class="property_'+u+' prop_not_selected">'+f+" "+t+"<\/div>")),r=itemProperties[n].prop;i+="<\/div><\/div>";$("#itemPropertiesTable").html(i)}}function e(n){n==="reviews"&&($("#productReviewsTab, #custItemPageReviews").addClass("active"),$("#descriptionTab, #custItemPageDescrip, #brandInfoTab, #custBrandInfoArea").removeClass("active"));n==="itemDescrip"&&($("#descriptionTab, #custItemPageDescrip").addClass("active"),$("#productReviewsTab, #custItemPageReviews, #brandInfoTab, #custBrandInfoArea").removeClass("active"));$("html, body").animate({scrollTop:$(".custTabSectionContainer").offset().top},1e3)}var n,u=null,o="false",s=!1,h=!1,t="model",i;l();a();specSheetCheck();$(".zoom").magnify();$(".prod-angle button").click(function(){var r=$(this).html().toLowerCase(),n;t=r==="front"?"colors":r;n=i;r==="model"&&(n=modelImage);$("#item_photo").attr("src",imgPath+"/"+t+"_item/"+n);$("#item_photo").attr("data-magnify-src",imgPath+"/"+t+"_large/"+n);$(".zoom").magnify();$("#item_enlarge").attr("href",imgPath+"/"+t+"_large/"+n)});$(document).on("click",".swatchlinks",function(n){n.preventDefault();r(this.id.replace("swatch_link",""))});$(document).on("change","#color_dropdown",function(){var n=d($(this).val());r(n)});$(".custGoToDescrip").on("click",function(n){n.preventDefault();e("itemDescrip")});$(".custGoToReviews").on("click",function(n){n.preventDefault();e("reviews")});$("#openReviews").on("click",function(n){n.preventDefault();createNewReviewWindow("/item/itemreview?itemid="+itemid)});$(".showModel").on("click",function(n){n.preventDefault();showModelImage()});$(".viewPhotos").on("click",function(n){n.preventDefault();viewAllPhotos(item)});$("#sizeChart").on("click",function(n){n.preventDefault();newSizeChartWindow()});$(".reviewsLink").on("click",function(n){n.preventDefault();$("#custItemPageDescrip a").removeClass("active");$("#custBrandInfoArea a").removeClass("active");$("#custItemPageReviews a").addClass("active");$("#descriptionTab").removeClass("active");$("#brandInfoTab").removeClass("active");$("#productReviewsTab").addClass("active");$("#productReviewsTab").tab("show");$([document.documentElement,document.body]).animate({scrollTop:$("#itemTabs").offset().top},1e3)})});$("#addtocart-btn").on("click",function(){if(checkQtys()!==!1){$("#slider-cart").slideDown("fast");timeout=setTimeout(function(){$("#slider-cart").slideUp("slow")},1500);var n=parseInt($(".headcartqty").html());jsonObj=[];$(".qty-optids").each(function(){$(this).val()!==""&&(n+=parseInt($(this).val()),option={},option.QTY=$(this).val(),option.ITEMOPTION_ID=$(this).attr("name").replace("qty_",""),jsonObj.push(option))});$.ajax({contentType:"application/json; charset=utf-8",dataType:"text",type:"POST",url:"/cart/ajaxadditems",data:JSON.stringify(jsonObj)}).done(function(){$(".headcartqty").html(n)}).fail(function(){showAlert("Error","There was a problem adding item to cart","error")})}});$("#wishlist-btn").on("click",function(){var t=[],n,i=0;if($(".qty-optids").each(function(){$(this).val()&&(n={},n.optid=$(this).attr("name").replace("qty_",""),n.qty=$(this).val(),t.push(n),i+=parseInt($(this).val()))}),t.length===0){showAlert("How many?","Please enter a quantity for the sizes you want.","question");return}$.ajax({contentType:"application/json; charset=utf-8",dataType:"text",type:"POST",url:"/wishlist/ajaxadd",data:JSON.stringify(t)}).done(function(n){n==="Success"?($("#slider-list").slideDown("fast"),timeout=setTimeout(function(){$("#slider-list").slideUp("slow")},1500),$(".headwishqty").html(parseInt($(".headwishqty").html())+i)):appAlert.fire({title:"Login",text:n,icon:"warning",showCancelButton:!0,confirmButtonText:"Go to Login",cancelButtonText:"Not Now",reverseButtons:!0}).then(function(n){if(n.value)window.location.href="/account/login";else if(n.dismiss===Swal.DismissReason.cancel)return!1})}).fail(function(){showAlert("Error","There was a problem adding item to cart","error")})})