(function(n){function r(){var u=n(".product-variations-table"),i=n(".product-variations-table tbody tr"),r=n(".product-variations-table th");r.each(function(t){var r=n(this).text();i.each(function(){n(this).find("td").each(function(i){t==i&&n(this).attr("data-title",r);return})})}),t()}function t(){i&&(n(".product-variations-table tbody tr").removeClass("even"),n(".product-variations-table tbody tr:even").addClass("even"))}function u(){var t=n(".content-area .overview-link");t.attr("href",t.attr("href")+document.location.hash)}function f(){function i(i,r){var u=n(".readmode-content-viewport .product-variations-table > tbody").children("tr").detach(),r=r==="down"?-1:1;u.sort(function(t,u){var f=n(t).find("td").eq(i).text(),e=n(u).find("td").eq(i).text();return f<e?-1*r:f>e?1*r:0}),u.each(function(t,i){n(".readmode-content-viewport .product-variations-table > tbody:last").append(n(i))}),t()}n("body").on("click",".readmode-content-viewport .product-variations-table th",function(){var t=n(this),u=t.hasClass("sort"),r="up";u&&(r=t.hasClass("sort-up")?"down":"up"),n(".readmode-content-viewport .product-variations-table th").removeClass("sort").removeClass("sort-up").removeClass("sort-down"),t.addClass("sort"),r==="up"?t.addClass("sort-up"):t.addClass("sort-down"),i(t.index(),r)})}var i=n("html").hasClass("oldie");r(),u(),f()})(jQuery),window.valtech=window.valtech||{},valtech.sampleOrderForm=function(n){function nt(n){c=n,h=n}function r(n){return n.replace(/[^0-9\w]/g,"")}function tt(n){return n.steps.forEach(function(n){n.elements.forEach(function(n){var t=[],i="",u="visible: false";n.type==="CheckBox"||n.type==="Disclaimer"||n.type==="MultiValueDisclaimer"?t.push("checked: "+r(n.name)):t.push("value: "+r(n.name)),n.isReadOnly&&t.push("disable: true"),n.required&&(i="css: { invalid: !"+r(n.name)+".valid() && "+r(n.name)+".validationTriggered() }",u="visible: !"+r(n.name)+".valid() && "+r(n.name)+".validationTriggered()"),n.visibleBinding="visible: true",n.labelBinding=i,n.exclamationBinding=u,n.maxLength=n.maxLength===0?"":n.maxLength,n.visibleToEndUser&&n.visibleToHcp||(n.visibleToEndUser?n.visibleBinding="visible: ContactType() === 'enduser'":n.visibleToHcp?n.visibleBinding="visible: ContactType() === 'professional'":n.visibleToEndUser||n.visibleToHcp||(n.visibleBinding="visible: false")),n.bindings=t.join(", ")})}),n}function a(i,r){n.ajax(p,{data:JSON.stringify(i),contentType:"application/json; charset=utf-8",async:!1,type:"POST"}).done(function(n){var u=n.steps.reduce(function(n,t){return t.sortOrder<=r&&n.push(t),n},[]);u.forEach(function(n){var i=n.sortOrder-1,r=t["step"+i];n.elements.forEach(function(n,t){r.fields[t].valid(n.isValid)})}),i=n})}function v(i){n.ajax(c,{data:JSON.stringify(i),contentType:"application/json; charset=utf-8",async:!1,type:"POST",error:function(){t.isErrorDisplay(!0)},success:function(){t.isErrorDisplay(!1)}})}function it(n){var t={},i,u;for(t.isErrorDisplay=ko.observable(!1),n.steps.forEach(function(n,i){var u={},f="step"+i;u.fields=[],t[f]=u,u.validationTriggered=ko.observable(!1),u.unlocked=ko.observable(!1),n.elements.forEach(function(n,f){var e;e=ko.observable(n.value),e.required=n.required,e.valid=ko.observable(n.isValid),e.validationTriggered=ko.computed(function(){return this.validationTriggered()},u),e.step=i,e.field=f,t[r(n.name)]=e,t[r(n.name)].required=n.required,u.fields.push(e)}),u.valid=ko.computed(function(){var n=!0;return this.fields.forEach(function(t){n=n&&t.valid()}),n},u)}),i=0;i<n.steps.length;i++)if(n.steps[i].hasVisibleElements||i==n.steps.length-1){t.currentStep=ko.observable(i+1),u="step"+i,t[u].unlocked(!0);break}return t}function y(n,t){var i;[0,1,2].forEach(function(r){i="step"+r,t[i].fields.forEach(function(t){n.steps[t.step].elements[t.field].value=t(),n.steps[t.step].elements[t.field].value===!1&&(n.steps[t.step].elements[t.field].value=null)})})}function rt(r){r=n.extend({},{onInitializedCallback:function(){},closeCallback:function(){}},r),f.track("ProductDetails"),i||l.push(n.ajax(h).success(function(n){i=n})),o||(o=Handlebars.compile(n("#order-sample-form-template").html())),n.when.apply(this,l).done(function(){function k(i){var f=!1,u=[t.SignUpForNewsletter,t.SignUpContactByEmail,t.SignUpContactByPhone,t.SignUpContactByMail,t.SignUpContactBySms],r=u.length;for(r;r--;)if(u[r]&&u[r].step===i){f=!0;break}f&&n.ajax(w,{data:JSON.stringify({email:t.Email?t.Email():"",signUpForNewsLetter:t.SignUpForNewsletter?t.SignUpForNewsletter():null,contactByEmail:t.SignUpContactByEmail?t.SignUpContactByEmail():null,contactByPhone:t.SignUpContactByPhone?t.SignUpContactByPhone():null,contactByMail:t.SignUpContactByMail?t.SignUpContactByMail():null,contactBySms:t.SignUpContactBySms?t.SignUpContactBySms():null}),contentType:"application/json; charset=utf-8",async:!1,type:"POST"}).done(function(){})}var l=0,p=1,h=1,b=1,d=0,u,c;t||(t=it(i)),Handlebars.registerHelper("step_index",function(){return p}),Handlebars.registerHelper("next_step",function(){return p++,""}),Handlebars.registerHelper("isFirstStep",function(n){return this.sortOrder==1?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("tab_index",function(){return h}),Handlebars.registerHelper("tab_index_zeroBased",function(){return h-1}),Handlebars.registerHelper("tab_next",function(){return h++,""}),Handlebars.registerHelper("tab_no",function(){return b}),Handlebars.registerHelper("tabNo_next",function(){return b++,""}),Handlebars.registerHelper("prev_step",function(){return d}),Handlebars.registerHelper("isSecondStep",function(n){return this.sortOrder===2?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isThirdStep",function(n){return this.sortOrder==3?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isTextarea",function(n){return this.type=="TextArea"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isCheckbox",function(n){return this.type=="CheckBox"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isDisclaimer",function(n){return this.type==="Disclaimer"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isMultiValueDisclaimer",function(n){return this.type==="MultiValueDisclaimer"||this.type==="MultiValueDisclaimerWithText"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("ifCond",function(n,t,i){return n===t?i.fn(this):i.inverse(this)}),Handlebars.registerHelper("isTab",function(n){return this.name=="Tab"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isButton",function(n){return this.name=="Button"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isLabel",function(n){return this.type=="Label"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isMultiValueCheckbox",function(n){return this.type=="MultiValueCheckBoxElement"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isDropdown",function(n){return this.type=="DropDown"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isRichText",function(n){return this.type=="RichTextArea"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isMultiValueDisclaimerWithText",function(n){return this.type=="MultiValueDisclaimerWithText"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isNotCdSizeGuide",function(n){return this.name!="CdSizeGuide"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isHtmlText",function(n){return this.type=="HtmlText"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isDate",function(n){return this.type=="Date"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isErrorMessage",function(n){return this.name=="ErrorMessage"?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("hasVisibleElements",function(n){return this.hasVisibleElements||this.sortOrder==3?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isFirstStepHasVisibleElements",function(n){return i.steps[0].hasVisibleElements?n.fn(this):n.inverse(this)}),Handlebars.registerHelper("isInString",function(n,t,i){return t.indexOf(n)>-1?i.fn(this):i.inverse(this)}),Handlebars.registerHelper("createLink",function(n,t,i){var u=t.split("{link}"),r,f;return u.length<3?t:(r=u[0],r+="<a href='"+i+"' target='_blank' rel='noopener'>",r+=u[1],r+="<\/a>",r+=u[2],f=new Handlebars.SafeString("<label for='"+n+"' class='no-block listitem'>"+r+"<\/label>"),this.type==="Disclaimer"&&(f=new Handlebars.SafeString("<label for='"+n+"' data-bind='"+this.labelBinding+"' class='listitem'><span data-bind='"+this.exclamationBinding+"'>! <\/span>"+r+(this.required?"*":"")+"<\/label>")),f)}),s=JSON.parse(JSON.stringify(i)),l=o(tt(s)),n("#order-sample-form").html(l),ko.applyBindings(t,n("#order-sample-form").parent().get(0)),n("html").hasClass("no-touch")&&(n("#order-sample-form select").selectbox(),n(".step > ul > li").each(function(t){var i=300;i-=t,n(this).css("z-index",i)})),n(function(){n("textarea[maxlength!='']").bind("input propertychange",function(){var t=n(this).attr("maxlength"),i=(n(this).val().match(/\n/g)||[]).length;n(this).val().length+i>t&&n(this).val(n(this).val().substring(0,t-i))})});n("#order-sample-form .steps").on("click","li.clickable",function(){t.currentStep(n(this).data().stepIndex),n(this).data().stepIndex===1&&t.step1.unlocked(!1)});c=n("[data-datepicker]"),c.length&&c.each(function(){var i=n(this),t=i.data(),r={dateFormat:t.dateformat.toLowerCase().replace("yyyy","yy")||"mm-dd-yy",dayNames:t.daynames||["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesMin:t.daynamesmin||["Su","Mo","Tu","We","Th","Fr","Sa"],monthNames:t.monthnames||["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:t.monthnamesshort||["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],firstDay:t.firstday||1,changeMonth:t.changemonth||!0,changeYear:t.changeyear||!0,yearRange:t.yearrange||"1910:nnnn"};i.datepicker(r)});n("#order-sample-form #submit-step-1").on("click",function(n){n&&n.preventDefault(),y(i,t),a(i,1),t.step0.valid()&&(i.steps[1].hasVisibleElements?(t.currentStep(2),t.step1.unlocked(!0),f.track("ContactInfo")):(v(i),t.currentStep(3),t.step0.unlocked(!1),f.track("Completed"))),t.step0.validationTriggered(!0),e()});n("#order-sample-form #submit-step-2").on("click",function(n){n&&n.preventDefault(),y(i,t),a(i,2),t.step1.valid()&&(v(i),t.isErrorDisplay()?(t.isErrorDisplay(!0),t.currentStep(2),t.step1.unlocked(!0),f.track("ContactInfo")):(t.isErrorDisplay(!1),t.currentStep(3),t.step0.unlocked(!1),t.step1.unlocked(!1),f.track("Completed"))),t.step1.validationTriggered(!0),k(1),e()});n("#order-sample-form #submit-step-3").on("click",function(n){n&&n.preventDefault(),k(2),r.closeCallback.call(this),e()});n("#back-to-step-1").on("click",function(n){n&&n.preventDefault(),t.currentStep(1),t.step1.unlocked(!1),e()});u=n(".step > .country-selector-link").detach(),u&&(n("label[for=Country]").append(u),u=null);n(".country-selector-link").on("click",function(t){t&&t.preventDefault(),n("#order-sample-form").trigger("countrySelector.click"),setTimeout(function(){document.location.hash="#countryselector"},700)});r.onInitializedCallback.call(this)})}function e(){n("#freeOrder").scrollTop(n("#freeOrder").position().top)}function ut(){t&&t.currentStep&&t.currentStep()===3&&(t=null,i=null,s=null)}var u=n("#order-sample-form"),h=u.data("getFormUrl"),p=u.data("validateFormUrl"),c=u.data("submitFormUrl"),w=u.data("newsletterSignup"),ft=u.data("sku"),b=u.data("productName"),k=encodeURIComponent(u.data("trackingCategory")),d=encodeURIComponent(b),g="/Funnel/SampleOrderForm/{category}/{step}/{product}/".replace("{category}",k).replace("{product}",d),o,i,s,t,l=[],f={track:function(n){var t=g.replace("{step}",n);valtech.tracking.tracker.trackPageview(t)}};return{initialize:rt,deinitialize:ut,url:nt}}(jQuery,undefined),function(n){function t(){return n(window).width()>valtech.settings.breakpointTablet?"wide":"narrow"}var i=function(){function i(){n(".mainwrapper").show();var t=n(this).parents(".fancybox-inner").length;t>0?n.fancybox.close():($FormWrapper.hide(),$closeButton.attr("href","#")),valtech.sampleOrderForm.deinitialize()}urlparts=window.location.href.split("#"),anchor=urlparts[0],$orderLink=n(".order-sample-btn,.order-sample-badge"),$closeButton=n(".topbox .closebutton"),$FormWrapper=n(".order-sample-form");var r=function(){valtech.sampleOrderForm.initialize({onInitializedCallback:function(){if(t()==="wide"||n("html").hasClass("oldie")){var i=n("#freeOrder");i.css({"max-height":n(window).height()-180+"px",overflow:"auto","overflow-x":"hidden"}),n.fancybox({type:"inline",content:$FormWrapper,maxWidth:840,fitToView:!1,autoSize:!0,scrolling:"no",closeBtn:!1,wrapCSS:"sample-order-popup",padding:0,afterShow:function(){n(this.content).attr("tabindex",1).focus()}})}else $orderLink.attr("href",anchor+"#freeOrder"),n(".mainwrapper").hide(),$FormWrapper.slideDown("slow")},closeCallback:i})};$orderLink.on("click",r);$closeButton.live("click",i);n("#order-sample-form").on("countrySelector.click",i);n("#order-sample-form").data("init-form-on-load")=="True"&&r()};n(document).ready(i)}(jQuery),function(n){var i={getMode:n(window).width()>valtech.settings.breakpointTablet?"wide":"narrow"},t={button:n(".order-product-btn"),content:n("#external_product-content")},r=function(){if(!t.content.length)return!1;t.button.on("click",function(r){if(i.getMode==="wide"||n("html").hasClass("oldie"))r.preventDefault(),n.fancybox({type:"inline",content:t.content,maxWidth:840,fitToView:!1,autoSize:!0,scrolling:"no",closeBtn:!1,wrapCSS:"external_product-popup",padding:0,afterShow:function(){n("#external_product-content .btn-back, #external_product-content .close-button").live("click.close.external_product",function(t){t.preventDefault(),n.fancybox.close()}),n("#external_product-content .btn-submit").live("click.continue.external_product",function(){return n.fancybox.close(),!0}),n(this.content).attr("tabindex",1).focus()}});else return!0})};n(document).ready(r)}(jQuery)