Globalize.culture(Global.CultureCode);var Stoneasy=function(){function o(){if($(window).ajaxStart(function(){Stoneasy.startLoad()}).ajaxStop(function(){Stoneasy.stopLoad()}),s(),t(),i(),h(),SmartSearch.init(),CustomerStatusMenu.init(),typeof $.fancybox=="function"){$(".fancybox-custom").fancybox({autoSize:!0,autoDimensions:!0,minWidth:500});$(".fancybox-custom-iframe").fancybox({type:"iframe",titleShow:!1,width:1170,height:550,minHeight:550,scrolling:"auto",topRatio:.2});$(".fancybox-custom-iframe-close").on("click",function(){parent.$.fancybox.close()})}else console.log("no fancybox function");$(".auto-link").each(function(n,t){var i=$("a:first",t);i.length>0&&$(this).css({cursor:"pointer"}).click(function(){return document.location.href=i.attr("href"),!1})});$("body").off("click","[data-quantity-change]");$("body").on("click","[data-quantity-change]",function(e){e.preventDefault();var $field=$(this).parent().find("input[type=text]"),val=parseInt($field.val(),10),newval=eval(val+$(this).data("quantity-change"));$field.val(Math.max(0,newval));$field.trigger("quantity-changed")});$("body").on("change","[data-integer-only=1]",function(){var t=$(this),i=t.val(),n=parseInt(i,10);isNaN(n)&&(n=0);n=Math.max(0,n);n!=i&&(t.val(n),t.trigger("quantity-changed"))});$("body").on("change","[data-decimal-only=1]",function(){var t=$(this),i=t.val(),n=Globalize.parseFloat(i,10);isNaN(n)&&(n=0);n=Math.max(0,n);n!=i&&(t.val(Globalize.format(n,"n4")),t.trigger("quantity-changed"))});$("body").on("click","[data-toggle=scroll]",function(){var n=$(this),t=n.attr("href"),i=n.attr("data-target")||t&&t.replace(/.*(?=#[^\s]+$)/,"");return r(i,n.attr("data-scroll-offset")),!1});$("body").on("click","[data-toggle=edit]",function(n){var t=$(this),r=t.attr("href"),i=$(t.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),u=$(t.attr("data-button"));n.preventDefault();$("[disabled]",i).each(function(){var n=$(this);n.data("fixed")===!0?n.attr("disabled","disabled"):n.removeAttr("disabled")});$("i:not('.js-no-show-on-edit')",i).show();$("[data-toggle=edit]",i).hide();u.removeAttr("disabled")});$("body").off("click",".delete");$("body").on("click",".delete",function(n){n.preventDefault();var t=$(this),i=t.attr("href");$("#delete-confirmation-button").attr("href",i);t.data("title")!=undefined&&$("#delete-confirmation").find(".modal-header").find("h4").text(t.data("title"));t.data("message")!=undefined&&$("#delete-confirmation").find(".modal-body").text(t.data("message"));t.data("ok")!=undefined&&$("#delete-confirmation").find(".modal-footer").find("#delete-confirmation-button").text(t.data("ok"));t.data("cancel")!=undefined&&$("#delete-confirmation").find(".modal-footer").find("#delete-cancel-button").text(t.data("cancel"));$("#delete-confirmation").on("click","#delete-confirmation-button",function(){Stoneasy.blockScreen()});$("#delete-confirmation").modal("show")});$("body").on("click",".post",function(n){n.preventDefault();var t=$(this),i=t.attr("href");$("#post-confirmation-button").attr("href",i);t.data("title")!=undefined&&$("#post-confirmation").find(".modal-header").find("h4").text(t.data("title"));t.data("message")!=undefined&&$("#post-confirmation").find(".modal-body").text(t.data("message"));t.data("ok")!=undefined&&$("#post-confirmation").find(".modal-footer").find("#post-confirmation-button").text(t.data("ok"));t.data("cancel")!=undefined&&$("#post-confirmation").find(".modal-footer").find("#post-cancel-button").text(t.data("cancel"));$("#post-confirmation").on("click","#post-confirmation-button",function(){Stoneasy.blockScreen()});$("#post-confirmation").modal("show")});$("body").on("click","a[disabled=disabled]",function(){return console.log("disabled link"),!1});c()}function t(){$("[rel=tooltip]").tooltip({html:"true"});$("[rel=tooltip-bottom]").tooltip({placement:"bottom",html:"true"});$(".tooltip-bottom").tooltip({placement:"bottom",html:"true"});$("[data-toggle='popover']").popover({html:"true",trigger:"hover",placement:"bottom"})}function i(){$(".datepicker").datepicker("remove");$(".datepicker").datepicker({format:"dd/mm/yyyy",weekStart:1,autoclose:!0});$(".datepicker-month").datepicker({format:"mm/yyyy",weekStart:1,autoclose:!0,startView:"months",minViewMode:"months"})}function s(){$(".nt-js-imagebox").on("click",function(){var t=$(this),o=t.attr("title")||"&nbsp;",u=t.attr("data-description"),f=t.attr("href"),s=parseInt(t.attr("data-width")||480)+32,i='<div class="modal fade">  <div class="modal-dialog" style="width: '+s+'px">    <div class="modal-content">      <div class="modal-header">        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;<\/span><span class="sr-only">Close<\/span><\/button>        <h4 class="modal-title">'+o+'<\/h4>      <\/div>      <div class="modal-body">        <p class="text-center">          <img src="'+f+'">        <\/p>',r,e;return u&&(i=i+'      <p class="text-muted">'+u+"<\/p>"),i=i+"      <\/div>    <\/div>  <\/div><\/div>",r=$(i).appendTo("body"),r.on("hidden.bs.modal",function(){r.remove()}).modal({show:!0}),e=new EventData("imagebox",t.data("trackcategory")||"image",t.data("tracklabel")||"src",t.data("trackvalue")||f),n(e),!1})}function h(){$("body").off("click",".js-submit-button");$("body").on("click",".js-submit-button",function(){var n=$(this);n.find("i").removeClass("hide");n.prop("disabled",!0);n.closest("form").submit()})}function c(){$("body").on("click","a",function(){var t=$(this),i=typeof t.attr("href")!="undefined"?t.attr("href"):"",r,u;if(i.match(/^javascript:/i))return!0;if(r=new EventData(t.data("trackaction")||"click",t.data("trackcategory")||"link",t.data("tracklabel")||"text",t.data("trackvalue")||t.text()),u=i.match(document.domain.split(".").reverse()[1]+"."+document.domain.split(".").reverse()[0]),i.match(/^mailto\:/i))r.category="email";else if(i.match(/\..*$/))r.action="download";else if(i.match(/^https?\:/i)&&!u)r.category="external";else if(i.match(/^tel\:/i))r.category="telephone";else return!0;return(n(r),typeof t.attr("target")=="undefined"||t.attr("target").toLowerCase()!=="_blank")?(setTimeout(function(){location.href=i},400),!1):!0})}function l(n){$(n).on("click","#checkall",function(){$(n).find("input[type=checkbox]").each(function(){$(this).attr("checked",$(n).find("#checkall").is(":checked"))})});$(n).not("#checkall").on("click","input[type=checkbox]",function(){$(this).is(":checked")||$(n).find("#checkall").attr("checked",!1)})}function r(n,t){var i,r;return n=="#top"?($("html,body").animate({scrollTop:0},300),!0):(i=$(n),i=i.length&&i||$("[name="+n.slice(1)+"]"),i.length)?(r=i.offset().top-(t||15),$("html,body").animate({scrollTop:r},800),!0):!1}function a(n,t,i){u(n,"#feedback",t,i)}function u(n,t,i,r){$(".modal-content",t).removeClass("alert-success");$(".modal-content",t).removeClass("alert-danger");n?($(".modal-content",t).addClass("alert-success"),$(".modal-content",t).children().children(".js-close-btn").hide()):($(".modal-content",t).addClass("alert-danger"),$(".modal-content",t).children().children(".js-close-btn").show());$("#feedbackmsg").html(r);$(t).modal("show");n&&window.setTimeout(function(){e($(t))},i)}function v(n){console.log(n);n.isSuccess===!1&&Stoneasy.showFeedback(!1,3e3,n.message)}function y(){$("body").css("cursor","progress");$(".nt-modal-overlay").remove();$("<div class='nt-modal-overlay'><\/div>").hide().prependTo("body").delay(300).fadeIn(200);NProgress.start()}function p(){$("body").css("cursor","progress");$(".nt-modal-overlay").remove();$("<div class='nt-modal-overlay'><\/div>").hide().prependTo("body").fadeIn(200);NProgress.start()}function f(){$("body").css("cursor","default");$(".nt-modal-overlay").remove();NProgress.done()}function w(){$("a").each(function(){$(this).removeClass("disabled")})}function e(n){n.modal("hide");$("body").removeClass("modal-open");window.setTimeout(function(){$(".modal-backdrop").remove()},500)}function b(n){n+="";for(var i=n.split("."),t=i[0],u=i.length>1?"."+i[1]:"",r=/(\d+)(\d{3})/;r.test(t);)t=t.replace(r,"$1 $2");return t+u}function k(){return $(".responsive-xs").is(":visible")?"xs":$(".responsive-sm").is(":visible")?"sm":$(".responsive-md").is(":visible")?"md":$(".responsive-lg").is(":visible")?"lg":""}function n(n){window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:"track-event",action:n.action.toLowerCase().trim(),category:n.category.toLowerCase().trim(),label:n.label.toLowerCase().trim(),value:n.value})}return{init:o,initTooltip:t,initDatepicker:i,initCheckBoxesIn:l,smoothScrollTo:r,showFeedback:a,showFeedbackWithSelector:u,handleResponse:v,blockScreen:p,unblockScreen:f,startLoad:y,stopLoad:f,releaseControls:w,closeModal:e,addThousandSeparator:b,getResponsiveSize:k,trackEvent:n}}();Stoneasy.init()