f60794b5deaa41b2ad8c74d7f805b30360b494dfca38322ba736af110c5c73cc

Source Code:

var WebApiService,LanguageService,mcWeb,mc;if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(){"use strict";var n=jQuery.fn.jquery.split(" ")[0].split(".");if(n[0]<2&&n[1]<9||1==n[0]&&9==n[1]&&n[2]<1||3<n[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4");}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var i=!1,r=this;n(this).one("bsTransitionEnd",function(){i=!0});return setTimeout(function(){i||n(r).trigger(n.support.transition.end)},t),this};n(function(){n.support.transition=function(){var i=document.createElement("bootstrap"),n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var t in n)if(i.style[t]!==undefined)return{end:n[t]};return!1}();n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(n){"use strict";var i='[data-dismiss="alert"]',t=function(t){n(t).on("click",i,this.close)},r;t.VERSION="3.4.0";t.TRANSITION_DURATION=150;t.prototype.close=function(i){function e(){u.detach().trigger("closed.bs.alert").remove()}var f=n(this),r=f.attr("data-target"),u;r||(r=(r=f.attr("href"))&&r.replace(/.*(?=#[^\s]*$)/,""));r="#"===r?[]:r;u=n(document).find(r);i&&i.preventDefault();u.length||(u=f.closest(".alert"));u.trigger(i=n.Event("close.bs.alert"));i.isDefaultPrevented()||(u.removeClass("in"),n.support.transition&&u.hasClass("fade")?u.one("bsTransitionEnd",e).emulateTransitionEnd(t.TRANSITION_DURATION):e())};r=n.fn.alert;n.fn.alert=function(i){return this.each(function(){var r=n(this),u=r.data("bs.alert");u||r.data("bs.alert",u=new t(this));"string"==typeof i&&u[i].call(r)})};n.fn.alert.Constructor=t;n.fn.alert.noConflict=function(){return n.fn.alert=r,this};n(document).on("click.bs.alert.data-api",i,t.prototype.close)}(jQuery),function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.button"),f="object"==typeof i&&i;r||u.data("bs.button",r=new t(this,f));"toggle"==i?r.toggle():i&&r.setState(i)})}var t=function(i,r){this.$element=n(i);this.options=n.extend({},t.DEFAULTS,r);this.isLoading=!1},r;t.VERSION="3.4.0";t.DEFAULTS={loadingText:"loading..."};t.prototype.setState=function(t){var i="disabled",r=this.$element,f=r.is("input")?"val":"html",u=r.data();t+="Text";null==u.resetText&&r.data("resetText",r[f]());setTimeout(n.proxy(function(){r[f](null==u[t]?this.options[t]:u[t]);"loadingText"==t?(this.isLoading=!0,r.addClass(i).attr(i,i).prop(i,!0)):this.isLoading&&(this.isLoading=!1,r.removeClass(i).removeAttr(i).prop(i,!1))},this),0)};t.prototype.toggle=function(){var t=!0,i=this.$element.closest('[data-toggle="buttons"]'),n;i.length?(n=this.$element.find("input"),"radio"==n.prop("type")?(n.prop("checked")&&(t=!1),i.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==n.prop("type")&&(n.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),n.prop("checked",this.$element.hasClass("active")),t&&n.trigger("change")):(this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active"))};r=n.fn.button;n.fn.button=i;n.fn.button.Constructor=t;n.fn.button.noConflict=function(){return n.fn.button=r,this};n(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var r=n(t.target).closest(".btn");i.call(r,"toggle");n(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),r.is("input,button")?r.trigger("focus"):r.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){n(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.carousel"),f=n.extend({},t.DEFAULTS,u.data(),"object"==typeof i&&i),e="string"==typeof i?i:f.slide;r||u.data("bs.carousel",r=new t(this,f));"number"==typeof i?r.to(i):e?r[e]():f.interval&&r.pause().cycle()})}var t=function(t,i){this.$element=n(t);this.$indicators=this.$element.find(".carousel-indicators");this.options=i;this.paused=null;this.sliding=null;this.interval=null;this.$active=null;this.$items=null;this.options.keyboard&&this.$element.on("keydown.bs.carousel",n.proxy(this.keydown,this));"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",n.proxy(this.pause,this)).on("mouseleave.bs.carousel",n.proxy(this.cycle,this))},u,r;t.VERSION="3.4.0";t.TRANSITION_DURATION=600;t.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0};t.prototype.keydown=function(n){if(!/input|textarea/i.test(n.target.tagName)){switch(n.which){case 37:this.prev();break;case 39:this.next();break;default:return}n.preventDefault()}};t.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(n.proxy(this.next,this),this.options.interval)),this};t.prototype.getItemIndex=function(n){return this.$items=n.parent().children(".item"),this.$items.index(n||this.$active)};t.prototype.getItemForDirection=function(n,t){var i=this.getItemIndex(t),r;return("prev"==n&&0===i||"next"==n&&i==this.$items.length-1)&&!this.options.wrap?t:(r=(i+("prev"==n?-1:1))%this.$items.length,this.$items.eq(r))};t.prototype.to=function(n){var i=this,t=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(n>this.$items.length-1||n<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){i.to(n)}):t==n?this.pause().cycle():this.slide(t<n?"next":"prev",this.$items.eq(n))};t.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&n.support.transition&&(this.$element.trigger(n.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this};t.prototype.next=function(){if(!this.sliding)return this.slide("next")};t.prototype.prev=function(){if(!this.sliding)return this.slide("prev")};t.prototype.slide=function(i,r){var e=this.$element.find(".item.active"),u=r||this.getItemForDirection(i,e),l=this.interval,f="next"==i?"left":"right",a=this,o,s,h,c;return u.hasClass("active")?this.sliding=!1:(o=u[0],s=n.Event("slide.bs.carousel",{relatedTarget:o,direction:f}),(this.$element.trigger(s),!s.isDefaultPrevented())?((this.sliding=!0,l&&this.pause(),this.$indicators.length)&&(this.$indicators.find(".active").removeClass("active"),h=n(this.$indicators.children()[this.getItemIndex(u)]),h&&h.addClass("active")),c=n.Event("slid.bs.carousel",{relatedTarget:o,direction:f}),n.support.transition&&this.$element.hasClass("slide")?(u.addClass(i),"object"==typeof u&&u.length&&u[0].offsetWidth,e.addClass(f),u.addClass(f),e.one("bsTransitionEnd",function(){u.removeClass([i,f].join(" ")).addClass("active");e.removeClass(["active",f].join(" "));a.sliding=!1;setTimeout(function(){a.$element.trigger(c)},0)}).emulateTransitionEnd(t.TRANSITION_DURATION)):(e.removeClass("active"),u.addClass("active"),this.sliding=!1,this.$element.trigger(c)),l&&this.cycle(),this):void 0)};u=n.fn.carousel;n.fn.carousel=i;n.fn.carousel.Constructor=t;n.fn.carousel.noConflict=function(){return n.fn.carousel=u,this};r=function(t){var u=n(this),f=u.attr("href"),s,r,o,e;f&&(f=f.replace(/.*(?=#[^\s]+$)/,""));s=u.attr("data-target")||f;r=n(document).find(s);r.hasClass("carousel")&&(o=n.extend({},r.data(),u.data()),e=u.attr("data-slide-to"),e&&(o.interval=!1),i.call(r,o),e&&r.data("bs.carousel").to(e),t.preventDefault())};n(document).on("click.bs.carousel.data-api","[data-slide]",r).on("click.bs.carousel.data-api","[data-slide-to]",r);n(window).on("load",function(){n('[data-ride="carousel"]').each(function(){var t=n(this);i.call(t,t.data())})})}(jQuery),function(n){"use strict";function r(t){var i,r=t.attr("data-target")||(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"");return n(document).find(r)}function i(i){return this.each(function(){var u=n(this),r=u.data("bs.collapse"),f=n.extend({},t.DEFAULTS,u.data(),"object"==typeof i&&i);!r&&f.toggle&&/show|hide/.test(i)&&(f.toggle=!1);r||u.data("bs.collapse",r=new t(this,f));"string"==typeof i&&r[i]()})}var t=function(i,r){this.$element=n(i);this.options=n.extend({},t.DEFAULTS,r);this.$trigger=n('[data-toggle="collapse"][href="#'+i.id+'"],[data-toggle="collapse"][data-target="#'+i.id+'"]');this.transitioning=null;this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger);this.options.toggle&&this.toggle()},u;t.VERSION="3.4.0";t.TRANSITION_DURATION=350;t.DEFAULTS={toggle:!0};t.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"};t.prototype.show=function(){var f,r,e,u,o,s;if(!this.transitioning&&!this.$element.hasClass("in")&&(r=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing"),!(r&&r.length&&(f=r.data("bs.collapse"))&&f.transitioning)&&(e=n.Event("show.bs.collapse"),this.$element.trigger(e),!e.isDefaultPrevented()))){if(r&&r.length&&(i.call(r,"hide"),f||r.data("bs.collapse",null)),u=this.dimension(),this.$element.removeClass("collapse").addClass("collapsing")[u](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1,o=function(){this.$element.removeClass("collapsing").addClass("collapse in")[u]("");this.transitioning=0;this.$element.trigger("shown.bs.collapse")},!n.support.transition)return o.call(this);s=n.camelCase(["scroll",u].join("-"));this.$element.one("bsTransitionEnd",n.proxy(o,this)).emulateTransitionEnd(t.TRANSITION_DURATION)[u](this.$element[0][s])}};t.prototype.hide=function(){var r,i,u;if(!this.transitioning&&this.$element.hasClass("in")&&(r=n.Event("hide.bs.collapse"),this.$element.trigger(r),!r.isDefaultPrevented())){if(i=this.dimension(),this.$element[i](this.$element[i]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1,u=function(){this.transitioning=0;this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")},!n.support.transition)return u.call(this);this.$element[i](0).one("bsTransitionEnd",n.proxy(u,this)).emulateTransitionEnd(t.TRANSITION_DURATION)}};t.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};t.prototype.getParent=function(){return n(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(n.proxy(function(t,i){var u=n(i);this.addAriaAndCollapsedClass(r(u),u)},this)).end()};t.prototype.addAriaAndCollapsedClass=function(n,t){var i=n.hasClass("in");n.attr("aria-expanded",i);t.toggleClass("collapsed",!i).attr("aria-expanded",i)};u=n.fn.collapse;n.fn.collapse=i;n.fn.collapse.Constructor=t;n.fn.collapse.noConflict=function(){return n.fn.collapse=u,this};n(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var u=n(this),f,e;u.attr("data-target")||t.preventDefault();f=r(u);e=f.data("bs.collapse")?"toggle":u.data();i.call(f,e)})}(jQuery),function(n){"use strict";function r(t){var i=t.attr("data-target"),r;return i||(i=(i=t.attr("href"))&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,"")),r=i&&n(document).find(i),r&&r.length?r:t.parent()}function u(t){t&&3===t.which||(n(".dropdown-backdrop").remove(),n(i).each(function(){var u=n(this),i=r(u),f={relatedTarget:this};i.hasClass("open")&&(t&&"click"==t.type&&/input|textarea/i.test(t.target.tagName)&&n.contains(i[0],t.target)||(i.trigger(t=n.Event("hide.bs.dropdown",f)),t.isDefaultPrevented()||(u.attr("aria-expanded","false"),i.removeClass("open").trigger(n.Event("hidden.bs.dropdown",f)))))}))}var i='[data-toggle="dropdown"]',t=function(t){n(t).on("click.bs.dropdown",this.toggle)},f;t.VERSION="3.4.0";t.prototype.toggle=function(t){var f=n(this),i,o,e;if(!f.is(".disabled, :disabled")){if(i=r(f),o=i.hasClass("open"),u(),!o){if("ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&n(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(n(this)).on("click",u),e={relatedTarget:this},i.trigger(t=n.Event("show.bs.dropdown",e)),t.isDefaultPrevented())return;f.trigger("focus").attr("aria-expanded","true");i.toggleClass("open").trigger(n.Event("shown.bs.dropdown",e))}return!1}};t.prototype.keydown=function(t){var e,o,s,f,u;if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)&&(e=n(this),t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled"))){if(o=r(e),s=o.hasClass("open"),!s&&27!=t.which||s&&27==t.which)return 27==t.which&&o.find(i).trigger("focus"),e.trigger("click");f=o.find(".dropdown-menu li:not(.disabled):visible a");f.length&&(u=f.index(t.target),38==t.which&&0<u&&u--,40==t.which&&u<f.length-1&&u++,~u||(u=0),f.eq(u).trigger("focus"))}};f=n.fn.dropdown;n.fn.dropdown=function(i){return this.each(function(){var r=n(this),u=r.data("bs.dropdown");u||r.data("bs.dropdown",u=new t(this));"string"==typeof i&&u[i].call(r)})};n.fn.dropdown.Constructor=t;n.fn.dropdown.noConflict=function(){return n.fn.dropdown=f,this};n(document).on("click.bs.dropdown.data-api",u).on("click.bs.dropdown.data-api",".dropdown form",function(n){n.stopPropagation()}).on("click.bs.dropdown.data-api",i,t.prototype.toggle).on("keydown.bs.dropdown.data-api",i,t.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",t.prototype.keydown)}(jQuery),function(n){"use strict";function i(i,r){return this.each(function(){var f=n(this),u=f.data("bs.modal"),e=n.extend({},t.DEFAULTS,f.data(),"object"==typeof i&&i);u||f.data("bs.modal",u=new t(this,e));"string"==typeof i?u[i](r):e.show&&u.show(r)})}var t=function(t,i){this.options=i;this.$body=n(document.body);this.$element=n(t);this.$dialog=this.$element.find(".modal-dialog");this.$backdrop=null;this.isShown=null;this.originalBodyPad=null;this.scrollbarWidth=0;this.ignoreBackdropClick=!1;this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom";this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,n.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))},r;t.VERSION="3.4.0";t.TRANSITION_DURATION=300;t.BACKDROP_TRANSITION_DURATION=150;t.DEFAULTS={backdrop:!0,keyboard:!0,show:!0};t.prototype.toggle=function(n){return this.isShown?this.hide():this.show(n)};t.prototype.show=function(i){var r=this,u=n.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(u);this.isShown||u.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',n.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){r.$element.one("mouseup.dismiss.bs.modal",function(t){n(t.target).is(r.$element)&&(r.ignoreBackdropClick=!0)})}),this.backdrop(function(){var f=n.support.transition&&r.$element.hasClass("fade"),u;r.$element.parent().length||r.$element.appendTo(r.$body);r.$element.show().scrollTop(0);r.adjustDialog();f&&r.$element[0].offsetWidth;r.$element.addClass("in");r.enforceFocus();u=n.Event("shown.bs.modal",{relatedTarget:i});f?r.$dialog.one("bsTransitionEnd",function(){r.$element.trigger("focus").trigger(u)}).emulateTransitionEnd(t.TRANSITION_DURATION):r.$element.trigger("focus").trigger(u)}))};t.prototype.hide=function(i){i&&i.preventDefault();i=n.Event("hide.bs.modal");this.$element.trigger(i);this.isShown&&!i.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),n(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),n.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",n.proxy(this.hideModal,this)).emulateTransitionEnd(t.TRANSITION_DURATION):this.hideModal())};t.prototype.enforceFocus=function(){n(document).off("focusin.bs.modal").on("focusin.bs.modal",n.proxy(function(n){document===n.target||this.$element[0]===n.target||this.$element.has(n.target).length||this.$element.trigger("focus")},this))};t.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",n.proxy(function(n){27==n.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")};t.prototype.resize=function(){this.isShown?n(window).on("resize.bs.modal",n.proxy(this.handleUpdate,this)):n(window).off("resize.bs.modal")};t.prototype.hideModal=function(){var n=this;this.$element.hide();this.backdrop(function(){n.$body.removeClass("modal-open");n.resetAdjustments();n.resetScrollbar();n.$element.trigger("hidden.bs.modal")})};t.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove();this.$backdrop=null};t.prototype.backdrop=function(i){var e=this,f=this.$element.hasClass("fade")?"fade":"",r,u;if(this.isShown&&this.options.backdrop){if(r=n.support.transition&&f,this.$backdrop=n(document.createElement("div")).addClass("modal-backdrop "+f).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",n.proxy(function(n){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:n.target===n.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!i)return;r?this.$backdrop.one("bsTransitionEnd",i).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):i()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),u=function(){e.removeBackdrop();i&&i()},n.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",u).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):u()):i&&i()};t.prototype.handleUpdate=function(){this.adjustDialog()};t.prototype.adjustDialog=function(){var n=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&n?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!n?this.scrollbarWidth:""})};t.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})};t.prototype.checkScrollbar=function(){var n=window.innerWidth,t;n||(t=document.documentElement.getBoundingClientRect(),n=t.right-Math.abs(t.left));this.bodyIsOverflowing=document.body.clientWidth<n;this.scrollbarWidth=this.measureScrollbar()};t.prototype.setScrollbar=function(){var i=parseInt(this.$body.css("padding-right")||0,10),t;this.originalBodyPad=document.body.style.paddingRight||"";t=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",i+t),n(this.fixedContent).each(function(i,r){var u=r.style.paddingRight,f=n(r).css("padding-right");n(r).data("padding-right",u).css("padding-right",parseFloat(f)+t+"px")}))};t.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad);n(this.fixedContent).each(function(t,i){var r=n(i).data("padding-right");n(i).removeData("padding-right");i.style.paddingRight=r||""})};t.prototype.measureScrollbar=function(){var n=document.createElement("div"),t;return n.className="modal-scrollbar-measure",this.$body.append(n),t=n.offsetWidth-n.clientWidth,this.$body[0].removeChild(n),t};r=n.fn.modal;n.fn.modal=i;n.fn.modal.Constructor=t;n.fn.modal.noConflict=function(){return n.fn.modal=r,this};n(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var r=n(this),f=r.attr("href"),e=r.attr("data-target")||f&&f.replace(/.*(?=#[^\s]+$)/,""),u=n(document).find(e),o=u.data("bs.modal")?"toggle":n.extend({remote:!/#/.test(f)&&f},u.data(),r.data());r.is("a")&&t.preventDefault();u.one("show.bs.modal",function(n){n.isDefaultPrevented()||u.one("hidden.bs.modal",function(){r.is(":visible")&&r.trigger("focus")})});i.call(u,o,this)})}(jQuery),function(n){"use strict";var t=function(n,t){this.type=null;this.options=null;this.enabled=null;this.timeout=null;this.hoverState=null;this.$element=null;this.inState=null;this.init("tooltip",n,t)},i;t.VERSION="3.4.0";t.TRANSITION_DURATION=150;t.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"><\/div><div class="tooltip-inner"><\/div><\/div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}};t.prototype.init=function(t,i,r){var f,e,u,o,s;if(this.enabled=!0,this.type=t,this.$element=n(i),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&n(document).find(n.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(f=this.options.trigger.split(" "),e=f.length;e--;)if(u=f[e],"click"==u)this.$element.on("click."+this.type,this.options.selector,n.proxy(this.toggle,this));else"manual"!=u&&(o="hover"==u?"mouseenter":"focusin",s="hover"==u?"mouseleave":"focusout",this.$element.on(o+"."+this.type,this.options.selector,n.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,n.proxy(this.leave,this)));this.options.selector?this._options=n.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()};t.prototype.getDefaults=function(){return t.DEFAULTS};t.prototype.getOptions=function(t){return(t=n.extend({},this.getDefaults(),this.$element.data(),t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t};t.prototype.getDelegateOptions=function(){var t={},i=this.getDefaults();return this._options&&n.each(this._options,function(n,r){i[n]!=r&&(t[n]=r)}),t};t.prototype.enter=function(t){var i=t instanceof this.constructor?t:n(t.currentTarget).data("bs."+this.type);if(i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)),t instanceof n.Event&&(i.inState["focusin"==t.type?"focus":"hover"]=!0),i.tip().hasClass("in")||"in"==i.hoverState)i.hoverState="in";else{if(clearTimeout(i.timeout),i.hoverState="in",!i.options.delay||!i.options.delay.show)return i.show();i.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show)}};t.prototype.isInStateTrue=function(){for(var n in this.inState)if(this.inState[n])return!0;return!1};t.prototype.leave=function(t){var i=t instanceof this.constructor?t:n(t.currentTarget).data("bs."+this.type);if(i||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)),t instanceof n.Event&&(i.inState["focusout"==t.type?"focus":"hover"]=!1),!i.isInStateTrue()){if(clearTimeout(i.timeout),i.hoverState="out",!i.options.delay||!i.options.delay.hide)return i.hide();i.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide)}};t.prototype.show=function(){var c=n.Event("show.bs."+this.type),l,p,e,w,h;if(this.hasContent()&&this.enabled){if(this.$element.trigger(c),l=n.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]),c.isDefaultPrevented()||!l)return;var u=this,r=this.tip(),a=this.getUID(this.type);this.setContent();r.attr("id",a);this.$element.attr("aria-describedby",a);this.options.animation&&r.addClass("fade");var i="function"==typeof this.options.placement?this.options.placement.call(this,r[0],this.$element[0]):this.options.placement,v=/\s?auto?\s?/i,y=v.test(i);y&&(i=i.replace(v,"")||"top");r.detach().css({top:0,left:0,display:"block"}).addClass(i).data("bs."+this.type,this);this.options.container?r.appendTo(n(document).find(this.options.container)):r.insertAfter(this.$element);this.$element.trigger("inserted.bs."+this.type);var f=this.getPosition(),o=r[0].offsetWidth,s=r[0].offsetHeight;y&&(p=i,e=this.getPosition(this.$viewport),i="bottom"==i&&f.bottom+s>e.bottom?"top":"top"==i&&f.top-s<e.top?"bottom":"right"==i&&f.right+o>e.width?"left":"left"==i&&f.left-o<e.left?"right":i,r.removeClass(p).addClass(i));w=this.getCalculatedOffset(i,f,o,s);this.applyPlacement(w,i);h=function(){var n=u.hoverState;u.$element.trigger("shown.bs."+u.type);u.hoverState=null;"out"==n&&u.leave(u)};n.support.transition&&this.$tip.hasClass("fade")?r.one("bsTransitionEnd",h).emulateTransitionEnd(t.TRANSITION_DURATION):h()}};t.prototype.applyPlacement=function(t,i){var r=this.tip(),l=r[0].offsetWidth,e=r[0].offsetHeight,o=parseInt(r.css("margin-top"),10),s=parseInt(r.css("margin-left"),10),h,f,u;isNaN(o)&&(o=0);isNaN(s)&&(s=0);t.top+=o;t.left+=s;n.offset.setOffset(r[0],n.extend({using:function(n){r.css({top:Math.round(n.top),left:Math.round(n.left)})}},t),0);r.addClass("in");h=r[0].offsetWidth;f=r[0].offsetHeight;"top"==i&&f!=e&&(t.top=t.top+e-f);u=this.getViewportAdjustedDelta(i,t,h,f);u.left?t.left+=u.left:t.top+=u.top;var c=/top|bottom/.test(i),a=c?2*u.left-l+h:2*u.top-e+f,v=c?"offsetWidth":"offsetHeight";r.offset(t);this.replaceArrow(a,r[0][v],c)};t.prototype.replaceArrow=function(n,t,i){this.arrow().css(i?"left":"top",50*(1-n/t)+"%").css(i?"top":"left","")};t.prototype.setContent=function(){var n=this.tip(),t=this.getTitle();n.find(".tooltip-inner")[this.options.html?"html":"text"](t);n.removeClass("fade in top bottom left right")};t.prototype.hide=function(i){function e(){"in"!=r.hoverState&&u.detach();r.$element&&r.$element.removeAttr("aria-describedby").trigger("hidden.bs."+r.type);i&&i()}var r=this,u=n(this.$tip),f=n.Event("hide.bs."+this.type);if(this.$element.trigger(f),!f.isDefaultPrevented())return u.removeClass("in"),n.support.transition&&u.hasClass("fade")?u.one("bsTransitionEnd",e).emulateTransitionEnd(t.TRANSITION_DURATION):e(),this.hoverState=null,this};t.prototype.fixTitle=function(){var n=this.$element;(n.attr("title")||"string"!=typeof n.attr("data-original-title"))&&n.attr("data-original-title",n.attr("title")||"").attr("title","")};t.prototype.hasContent=function(){return this.getTitle()};t.prototype.getPosition=function(t){var r=(t=t||this.$element)[0],u="BODY"==r.tagName,i=r.getBoundingClientRect();null==i.width&&(i=n.extend({},i,{width:i.right-i.left,height:i.bottom-i.top}));var f=window.SVGElement&&r instanceof window.SVGElement,e=u?{top:0,left:0}:f?null:t.offset(),o={scroll:u?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},s=u?{width:n(window).width(),height:n(window).height()}:null;return n.extend({},i,o,s,e)};t.prototype.getCalculatedOffset=function(n,t,i,r){return"bottom"==n?{top:t.top+t.height,left:t.left+t.width/2-i/2}:"top"==n?{top:t.top-r,left:t.left+t.width/2-i/2}:"left"==n?{top:t.top+t.height/2-r/2,left:t.left-i}:{top:t.top+t.height/2-r/2,left:t.left+t.width}};t.prototype.getViewportAdjustedDelta=function(n,t,i,r){var f={top:0,left:0},e,u,o,s,h,c;return this.$viewport?(e=this.options.viewport&&this.options.viewport.padding||0,u=this.getPosition(this.$viewport),/right|left/.test(n)?(o=t.top-e-u.scroll,s=t.top+e-u.scroll+r,o<u.top?f.top=u.top-o:s>u.top+u.height&&(f.top=u.top+u.height-s)):(h=t.left-e,c=t.left+e+i,h<u.left?f.left=u.left-h:c>u.right&&(f.left=u.left+u.width-c)),f):f};t.prototype.getTitle=function(){var t=this.$element,n=this.options;return t.attr("data-original-title")||("function"==typeof n.title?n.title.call(t[0]):n.title)};t.prototype.getUID=function(n){for(;n+=~~(1e6*Math.random()),document.getElementById(n););return n};t.prototype.tip=function(){if(!this.$tip&&(this.$tip=n(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip};t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")};t.prototype.enable=function(){this.enabled=!0};t.prototype.disable=function(){this.enabled=!1};t.prototype.toggleEnabled=function(){this.enabled=!this.enabled};t.prototype.toggle=function(t){var i=this;t&&((i=n(t.currentTarget).data("bs."+this.type))||(i=new this.constructor(t.currentTarget,this.getDelegateOptions()),n(t.currentTarget).data("bs."+this.type,i)));t?(i.inState.click=!i.inState.click,i.isInStateTrue()?i.enter(i):i.leave(i)):i.tip().hasClass("in")?i.leave(i):i.enter(i)};t.prototype.destroy=function(){var n=this;clearTimeout(this.timeout);this.hide(function(){n.$element.off("."+n.type).removeData("bs."+n.type);n.$tip&&n.$tip.detach();n.$tip=null;n.$arrow=null;n.$viewport=null;n.$element=null})};i=n.fn.tooltip;n.fn.tooltip=function(i){return this.each(function(){var u=n(this),r=u.data("bs.tooltip"),f="object"==typeof i&&i;!r&&/destroy|hide/.test(i)||(r||u.data("bs.tooltip",r=new t(this,f)),"string"==typeof i&&r[i]())})};n.fn.tooltip.Constructor=t;n.fn.tooltip.noConflict=function(){return n.fn.tooltip=i,this}}(jQuery),function(n){"use strict";var t=function(n,t){this.init("popover",n,t)},i;if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");t.VERSION="3.4.0";t.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"><\/div><h3 class="popover-title"><\/h3><div class="popover-content"><\/div><\/div>'});((t.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=t).prototype.getDefaults=function(){return t.DEFAULTS};t.prototype.setContent=function(){var n=this.tip(),i=this.getTitle(),t=this.getContent();n.find(".popover-title")[this.options.html?"html":"text"](i);n.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof t?"html":"append":"text"](t);n.removeClass("fade top bottom left right in");n.find(".popover-title").html()||n.find(".popover-title").hide()};t.prototype.hasContent=function(){return this.getTitle()||this.getContent()};t.prototype.getContent=function(){var t=this.$element,n=this.options;return t.attr("data-content")||("function"==typeof n.content?n.content.call(t[0]):n.content)};t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};i=n.fn.popover;n.fn.popover=function(i){return this.each(function(){var u=n(this),r=u.data("bs.popover"),f="object"==typeof i&&i;!r&&/destroy|hide/.test(i)||(r||u.data("bs.popover",r=new t(this,f)),"string"==typeof i&&r[i]())})};n.fn.popover.Constructor=t;n.fn.popover.noConflict=function(){return n.fn.popover=i,this}}(jQuery),function(n){"use strict";function t(i,r){this.$body=n(document.body);this.$scrollElement=n(i).is(document.body)?n(window):n(i);this.options=n.extend({},t.DEFAULTS,r);this.selector=(this.options.target||"")+" .nav li > a";this.offsets=[];this.targets=[];this.activeTarget=null;this.scrollHeight=0;this.$scrollElement.on("scroll.bs.scrollspy",n.proxy(this.process,this));this.refresh();this.process()}function i(i){return this.each(function(){var u=n(this),r=u.data("bs.scrollspy"),f="object"==typeof i&&i;r||u.data("bs.scrollspy",r=new t(this,f));"string"==typeof i&&r[i]()})}t.VERSION="3.4.0";t.DEFAULTS={offset:10};t.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)};t.prototype.refresh=function(){var t=this,i="offset",r=0;this.offsets=[];this.targets=[];this.scrollHeight=this.getScrollHeight();n.isWindow(this.$scrollElement[0])||(i="position",r=this.$scrollElement.scrollTop());this.$body.find(this.selector).map(function(){var f=n(this),u=f.data("target")||f.attr("href"),t=/^#./.test(u)&&n(u);return t&&t.length&&t.is(":visible")&&[[t[i]().top+r,u]]||null}).sort(function(n,t){return n[0]-t[0]}).each(function(){t.offsets.push(this[0]);t.targets.push(this[1])})};t.prototype.process=function(){var n,i=this.$scrollElement.scrollTop()+this.options.offset,f=this.getScrollHeight(),e=this.options.offset+f-this.$scrollElement.height(),t=this.offsets,r=this.targets,u=this.activeTarget;if(this.scrollHeight!=f&&this.refresh(),e<=i)return u!=(n=r[r.length-1])&&this.activate(n);if(u&&i<t[0])return this.activeTarget=null,this.clear();for(n=t.length;n--;)u!=r[n]&&i>=t[n]&&(t[n+1]===undefined||i<t[n+1])&&this.activate(r[n])};t.prototype.activate=function(t){this.activeTarget=t;this.clear();var r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=n(r).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active"));i.trigger("activate.bs.scrollspy")};t.prototype.clear=function(){n(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var r=n.fn.scrollspy;n.fn.scrollspy=i;n.fn.scrollspy.Constructor=t;n.fn.scrollspy.noConflict=function(){return n.fn.scrollspy=r,this};n(window).on("load.bs.scrollspy.data-api",function(){n('[data-spy="scroll"]').each(function(){var t=n(this);i.call(t,t.data())})})}(jQuery),function(n){"use strict";function r(i){return this.each(function(){var u=n(this),r=u.data("bs.tab");r||u.data("bs.tab",r=new t(this));"string"==typeof i&&r[i]()})}var t=function(t){this.element=n(t)},u,i;t.VERSION="3.4.0";t.TRANSITION_DURATION=150;t.prototype.show=function(){var t=this.element,f=t.closest("ul:not(.dropdown-menu)"),i=t.data("target"),u;if(i||(i=(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var r=f.find(".active:last a"),e=n.Event("hide.bs.tab",{relatedTarget:t[0]}),o=n.Event("show.bs.tab",{relatedTarget:r[0]});(r.trigger(e),t.trigger(o),o.isDefaultPrevented()||e.isDefaultPrevented())||(u=n(document).find(i),this.activate(t.closest("li"),f),this.activate(u,u.parent(),function(){r.trigger({type:"hidden.bs.tab",relatedTarget:t[0]});t.trigger({type:"shown.bs.tab",relatedTarget:r[0]})}))}};t.prototype.activate=function(i,r,u){function o(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1);i.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0);e?(i[0].offsetWidth,i.addClass("in")):i.removeClass("fade");i.parent(".dropdown-menu").length&&i.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0);u&&u()}var f=r.find("> .active"),e=u&&n.support.transition&&(f.length&&f.hasClass("fade")||!!r.find("> .fade").length);f.length&&e?f.one("bsTransitionEnd",o).emulateTransitionEnd(t.TRANSITION_DURATION):o();f.removeClass("in")};u=n.fn.tab;n.fn.tab=r;n.fn.tab.Constructor=t;n.fn.tab.noConflict=function(){return n.fn.tab=u,this};i=function(t){t.preventDefault();r.call(n(this),"show")};n(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(n){"use strict";function i(i){return this.each(function(){var u=n(this),r=u.data("bs.affix"),f="object"==typeof i&&i;r||u.data("bs.affix",r=new t(this,f));"string"==typeof i&&r[i]()})}var t=function(i,r){this.options=n.extend({},t.DEFAULTS,r);var u=this.options.target===t.DEFAULTS.target?n(this.options.target):n(document).find(this.options.target);this.$target=u.on("scroll.bs.affix.data-api",n.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",n.proxy(this.checkPositionWithEventLoop,this));this.$element=n(i);this.affixed=null;this.unpin=null;this.pinnedOffset=null;this.checkPosition()},r;t.VERSION="3.4.0";t.RESET="affix affix-top affix-bottom";t.DEFAULTS={offset:0,target:window};t.prototype.getState=function(n,t,i,r){var u=this.$target.scrollTop(),e=this.$element.offset(),o=this.$target.height(),f,s;return null!=i&&"top"==this.affixed?u<i&&"top":"bottom"==this.affixed?null!=i?!(u+this.unpin<=e.top)&&"bottom":!(u+o<=n-r)&&"bottom":(f=null==this.affixed,s=f?u:e.top,null!=i&&u<=i?"top":null!=r&&n-r<=s+(f?o:t)&&"bottom")};t.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(t.RESET).addClass("affix");var n=this.$target.scrollTop(),i=this.$element.offset();return this.pinnedOffset=i.top-n};t.prototype.checkPositionWithEventLoop=function(){setTimeout(n.proxy(this.checkPosition,this),1)};t.prototype.checkPosition=function(){var i,e,o;if(this.$element.is(":visible")){var s=this.$element.height(),r=this.options.offset,f=r.top,u=r.bottom,h=Math.max(n(document).height(),n(document.body).height());if("object"!=typeof r&&(u=f=r),"function"==typeof f&&(f=r.top(this.$element)),"function"==typeof u&&(u=r.bottom(this.$element)),i=this.getState(h,s,f,u),this.affixed!=i){if(null!=this.unpin&&this.$element.css("top",""),e="affix"+(i?"-"+i:""),o=n.Event(e+".bs.affix"),this.$element.trigger(o),o.isDefaultPrevented())return;this.affixed=i;this.unpin="bottom"==i?this.getPinnedOffset():null;this.$element.removeClass(t.RESET).addClass(e).trigger(e.replace("affix","affixed")+".bs.affix")}"bottom"==i&&this.$element.offset({top:h-s-u})}};r=n.fn.affix;n.fn.affix=i;n.fn.affix.Constructor=t;n.fn.affix.noConflict=function(){return n.fn.affix=r,this};n(window).on("load",function(){n('[data-spy="affix"]').each(function(){var r=n(this),t=r.data();t.offset=t.offset||{};null!=t.offsetBottom&&(t.offset.bottom=t.offsetBottom);null!=t.offsetTop&&(t.offset.top=t.offsetTop);i.call(r,t)})})}(jQuery);!function(n){"use strict";if("function"==typeof bootstrap)bootstrap("promise",n);else if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define(n);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=n}else{if("undefined"==typeof window&&"undefined"==typeof self)throw new Error("This environment was not anticipated by Q. Please file a bug.");var t="undefined"!=typeof window?window:self,i=t.Q;t.Q=n();t.Q.noConflict=function(){return t.Q=i,this}}}(function(){"use strict";function s(n){return function(){return bi.apply(n,arguments)}}function wt(n){return n===Object(n)}function bt(n){return"[object StopIteration]"===gi(n)||n instanceof k}function rt(n,t){var r,i,u;if(y&&t.stack&&"object"==typeof n&&null!==n&&n.stack&&-1===n.stack.indexOf(tt)){for(r=[],i=t;i;i=i.source)i.stack&&r.unshift(i.stack);r.unshift(n.stack);u=r.join("\n"+tt+"\n");n.stack=kt(u)}}function kt(n){for(var t,r=n.split("\n"),u=[],i=0;i<r.length;++i)t=r[i],gt(t)||dt(t)||!t||u.push(t);return u.join("\n")}function dt(n){return-1!==n.indexOf("(module.js:")||-1!==n.indexOf("(node.js:")}function ut(n){var r=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(n),t,i;return r?[r[1],Number(r[2])]:(t=/at ([^ ]+):(\d+):(?:\d+)$/.exec(n),t)?[t[1],Number(t[2])]:(i=/.*@(.+):(\d+)$/.exec(n),i?[i[1],Number(i[2])]:void 0)}function gt(n){var t=ut(n),r,i;return t?(r=t[0],i=t[1],r===vt&&i>=wi&&pt>=i):!1}function ft(){if(y)try{throw new Error;}catch(i){var n=i.stack.split("\n"),r=n[0].indexOf("@")>0?n[1]:n[2],t=ut(r);return t?(vt=t[0],t[1]):void 0}}function ni(n,t,i){return function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(t+" is deprecated, use "+i+" instead.",new Error("").stack),n.apply(n,arguments)}}function n(n){return n instanceof t?n:st(n)?ei(n):b(n)}function r(){function l(t){f=t;e.source=t;c(h,function(i,r){n.nextTick(function(){t.promiseDispatch.apply(t,r)})},void 0);h=void 0;a=void 0}var f,h=[],a=[],s=nt(r.prototype),e=nt(t.prototype);if(e.promiseDispatch=function(t,r,u){var e=i(arguments);h?(h.push(e),"when"===r&&u[1]&&a.push(u[1])):n.nextTick(function(){f.promiseDispatch.apply(f,e)})},e.valueOf=function(){if(h)return e;var n=ot(f);return o(n)&&(f=n),n},e.inspect=function(){return f?f.inspect():{state:"pending"}},n.longStackSupport&&y)try{throw new Error;}catch(v){e.stack=v.stack.substring(v.stack.indexOf("\n")+1)}return s.promise=e,s.resolve=function(t){f||l(n(t))},s.fulfill=function(n){f||l(b(n))},s.reject=function(n){f||l(u(n))},s.notify=function(t){f||c(a,function(i,r){n.nextTick(function(){r(t)})},void 0)},s}function e(n){if("function"!=typeof n)throw new TypeError("resolver must be a function.");var t=r();try{n(t.resolve,t.reject,t.notify)}catch(i){t.reject(i)}return t.promise}function et(t){return e(function(i,r){for(var u=0,f=t.length;f>u;u++)n(t[u]).then(i,r)})}function t(n,i,r){var f,e;return void 0===i&&(i=function(n){return u(new Error("Promise does not support operation: "+n))}),void 0===r&&(r=function(){return{state:"unknown"}}),f=nt(t.prototype),(f.promiseDispatch=function(t,r,e){var o;try{o=n[r]?n[r].apply(f,e):i.call(f,r,e)}catch(s){o=u(s)}t&&t(o)},f.inspect=r,r)&&(e=r(),"rejected"===e.state&&(f.exception=e.reason),f.valueOf=function(){var n=r();return"pending"===n.state||"rejected"===n.state?f:n.value}),f}function f(t,i,r,u){return n(t).then(i,r,u)}function ot(n){if(o(n)){var t=n.inspect();if("fulfilled"===t.state)return t.value}return n}function o(n){return n instanceof t}function st(n){return wt(n)&&"function"==typeof n.then}function ti(n){return o(n)&&"pending"===n.inspect().state}function ii(n){return!o(n)||"fulfilled"===n.inspect().state}function ri(n){return o(n)&&"rejected"===n.inspect().state}function w(){l.length=0;a.length=0;v||(v=!0)}function ui(t,i){v&&("object"==typeof process&&"function"==typeof process.emit&&n.nextTick.runAfter(function(){-1!==d(a,t)&&(process.emit("unhandledRejection",i,t),it.push(t))}),a.push(t),l.push(i&&"undefined"!=typeof i.stack?i.stack:"(no stack) "+i))}function fi(t){if(v){var i=d(a,t);-1!==i&&("object"==typeof process&&"function"==typeof process.emit&&n.nextTick.runAfter(function(){var n=d(it,t);-1!==n&&(process.emit("rejectionHandled",l[i],t),it.splice(n,1))}),a.splice(i,1),l.splice(i,1))}}function u(n){var i=t({when:function(t){return t&&fi(this),t?t(n):this}},function(){return this},function(){return{state:"rejected",reason:n}});return ui(i,n),i}function b(n){return t({when:function(){return n},get:function(t){return n[t]},set:function(t,i){n[t]=i},"delete":function(t){delete n[t]},post:function(t,i){return null===t||void 0===t?n.apply(void 0,i):n[t].apply(n,i)},apply:function(t,i){return n.apply(t,i)},keys:function(){return di(n)}},void 0,function(){return{state:"fulfilled",value:n}})}function ei(t){var i=r();return n.nextTick(function(){try{t.then(i.resolve,i.reject,i.notify)}catch(n){i.reject(n)}}),i.promise}function oi(i){return t({isDef:function(){}},function(n,t){return ct(i,n,t)},function(){return n(i).inspect()})}function ht(t,i,r){return n(t).spread(i,r)}function si(t){return function(){function i(t,i){var s;if("undefined"==typeof StopIteration){try{s=e[t](i)}catch(h){return u(h)}return s.done?n(s.value):f(s.value,r,o)}try{s=e[t](i)}catch(h){return bt(h)?n(h.value):u(h)}return f(s,r,o)}var e=t.apply(this,arguments),r=i.bind(i,"next"),o=i.bind(i,"throw");return r()}}function hi(t){n.done(n.async(t)())}function ci(n){throw new k(n);}function li(n){return function(){return ht([this,h(arguments)],function(t,i){return n.apply(t,i)})}}function ct(t,i,r){return n(t).dispatch(i,r)}function h(n){return f(n,function(n){var i=0,t=r();return c(n,function(r,u,e){var s;o(u)&&"fulfilled"===(s=u.inspect()).state?n[e]=s.value:(++i,f(u,function(r){n[e]=r;0==--i&&t.resolve(n)},t.reject,function(n){t.notify({index:e,value:n})}))},void 0),0===i&&t.resolve(n),t.promise})}function lt(t){if(0===t.length)return n.resolve();var i=n.defer(),r=0;return c(t,function(n,u,e){function o(n){i.resolve(n)}function s(){r--;0===r&&i.reject(new Error("Can't get fulfillment value from any promise, all promises were rejected."))}function h(n){i.notify({index:e,value:n})}var c=t[e];r++;f(c,o,s,h)},void 0),i.promise}function at(t){return f(t,function(t){return t=g(t,n),f(h(g(t,function(n){return f(n,yt,yt)})),function(){return t})})}function ai(t){return n(t).allSettled()}function vi(t,i){return n(t).then(void 0,void 0,i)}function yi(t,i){return n(t).nodeify(i)}var y=!1,tt,pt;try{throw new Error;}catch(pi){y=!!pi.stack}var vt,k,wi=ft(),yt=function(){},p=function(){function n(){for(var n,i;t.next;)t=t.next,n=t.task,t.task=void 0,i=t.domain,i&&(t.domain=void 0,i.enter()),s(n,i);for(;e.length;)n=e.pop(),s(n);r=!1}function s(t,i){try{t()}catch(r){if(f)throw i&&i.exit(),setTimeout(n,0),i&&i.enter(),r;setTimeout(function(){throw r;},0)}i&&i.exit()}var t={task:void 0,next:null},h=t,r=!1,i=void 0,f=!1,e=[],u,o;return(p=function(n){h=h.next={task:n,domain:f&&process.domain,next:null};r||(r=!0,i())},"object"==typeof process&&"[object process]"===process.toString()&&process.nextTick)?(f=!0,i=function(){process.nextTick(n)}):"function"==typeof setImmediate?i="undefined"!=typeof window?setImmediate.bind(window,n):function(){setImmediate(n)}:"undefined"!=typeof MessageChannel?(u=new MessageChannel,u.port1.onmessage=function(){i=o;u.port1.onmessage=n;n()},o=function(){u.port2.postMessage(0)},i=function(){setTimeout(n,0);o()}):i=function(){setTimeout(n,0)},p.runAfter=function(n){e.push(n);r||(r=!0,i())},p}(),bi=Function.call,i=s(Array.prototype.slice),c=s(Array.prototype.reduce||function(n,t){var i=0,r=this.length;if(1===arguments.length)for(;;){if(i in this){t=this[i++];break}if(++i>=r)throw new TypeError;}for(;r>i;i++)i in this&&(t=n(t,this[i],i));return t}),d=s(Array.prototype.indexOf||function(n){for(var t=0;t<this.length;t++)if(this[t]===n)return t;return-1}),g=s(Array.prototype.map||function(n,t){var i=this,r=[];return c(i,function(u,f,e){r.push(n.call(t,f,e,i))},void 0),r}),nt=Object.create||function(n){function t(){}return t.prototype=n,new t},ki=s(Object.prototype.hasOwnProperty),di=Object.keys||function(n){var t=[];for(var i in n)ki(n,i)&&t.push(i);return t},gi=s(Object.prototype.toString);k="undefined"!=typeof ReturnValue?ReturnValue:function(n){this.value=n};tt="From previous event:";n.resolve=n;n.nextTick=p;n.longStackSupport=!1;"object"==typeof process&&process&&process.env&&process.env.Q_DEBUG&&(n.longStackSupport=!0);n.defer=r;r.prototype.makeNodeResolver=function(){var n=this;return function(t,r){t?n.reject(t):n.resolve(arguments.length>2?i(arguments,1):r)}};n.Promise=e;n.promise=e;e.race=et;e.all=h;e.reject=u;e.resolve=n;n.passByCopy=function(n){return n};t.prototype.passByCopy=function(){return this};n.join=function(t,i){return n(t).join(i)};t.prototype.join=function(t){return n([this,t]).spread(function(n,t){if(n===t)return n;throw new Error("Can't join: not the same: "+n+" "+t);})};n.race=et;t.prototype.race=function(){return this.then(n.race)};n.makePromise=t;t.prototype.toString=function(){return"[object Promise]"};t.prototype.then=function(t,i,f){function h(n){try{return"function"==typeof t?t(n):n}catch(i){return u(i)}}function c(n){if("function"==typeof i){rt(n,s);try{return i(n)}catch(t){return u(t)}}return u(n)}function l(n){return"function"==typeof f?f(n):n}var s=this,e=r(),o=!1;return n.nextTick(function(){s.promiseDispatch(function(n){o||(o=!0,e.resolve(h(n)))},"when",[function(n){o||(o=!0,e.resolve(c(n)))}])}),s.promiseDispatch(void 0,"when",[void 0,function(t){var i,r=!1;try{i=l(t)}catch(u){if(r=!0,!n.onerror)throw u;n.onerror(u)}r||e.notify(i)}]),e.promise};n.tap=function(t,i){return n(t).tap(i)};t.prototype.tap=function(t){return t=n(t),this.then(function(n){return t.fcall(n).thenResolve(n)})};n.when=f;t.prototype.thenResolve=function(n){return this.then(function(){return n})};n.thenResolve=function(t,i){return n(t).thenResolve(i)};t.prototype.thenReject=function(n){return this.then(function(){throw n;})};n.thenReject=function(t,i){return n(t).thenReject(i)};n.nearer=ot;n.isPromise=o;n.isPromiseAlike=st;n.isPending=ti;t.prototype.isPending=function(){return"pending"===this.inspect().state};n.isFulfilled=ii;t.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state};n.isRejected=ri;t.prototype.isRejected=function(){return"rejected"===this.inspect().state};var l=[],a=[],it=[],v=!0;return n.resetUnhandledRejections=w,n.getUnhandledReasons=function(){return l.slice()},n.stopUnhandledRejectionTracking=function(){w();v=!1},w(),n.reject=u,n.fulfill=b,n.master=oi,n.spread=ht,t.prototype.spread=function(n,t){return this.all().then(function(t){return n.apply(void 0,t)},t)},n.async=si,n.spawn=hi,n["return"]=ci,n.promised=li,n.dispatch=ct,t.prototype.dispatch=function(t,i){var f=this,u=r();return n.nextTick(function(){f.promiseDispatch(u.resolve,t,i)}),u.promise},n.get=function(t,i){return n(t).dispatch("get",[i])},t.prototype.get=function(n){return this.dispatch("get",[n])},n.set=function(t,i,r){return n(t).dispatch("set",[i,r])},t.prototype.set=function(n,t){return this.dispatch("set",[n,t])},n.del=n["delete"]=function(t,i){return n(t).dispatch("delete",[i])},t.prototype.del=t.prototype["delete"]=function(n){return this.dispatch("delete",[n])},n.mapply=n.post=function(t,i,r){return n(t).dispatch("post",[i,r])},t.prototype.mapply=t.prototype.post=function(n,t){return this.dispatch("post",[n,t])},n.send=n.mcall=n.invoke=function(t,r){return n(t).dispatch("post",[r,i(arguments,2)])},t.prototype.send=t.prototype.mcall=t.prototype.invoke=function(n){return this.dispatch("post",[n,i(arguments,1)])},n.fapply=function(t,i){return n(t).dispatch("apply",[void 0,i])},t.prototype.fapply=function(n){return this.dispatch("apply",[void 0,n])},n["try"]=n.fcall=function(t){return n(t).dispatch("apply",[void 0,i(arguments,1)])},t.prototype.fcall=function(){return this.dispatch("apply",[void 0,i(arguments)])},n.fbind=function(t){var r=n(t),u=i(arguments,1);return function(){return r.dispatch("apply",[this,u.concat(i(arguments))])}},t.prototype.fbind=function(){var n=this,t=i(arguments);return function(){return n.dispatch("apply",[this,t.concat(i(arguments))])}},n.keys=function(t){return n(t).dispatch("keys",[])},t.prototype.keys=function(){return this.dispatch("keys",[])},n.all=h,t.prototype.all=function(){return h(this)},n.any=lt,t.prototype.any=function(){return lt(this)},n.allResolved=ni(at,"allResolved","allSettled"),t.prototype.allResolved=function(){return at(this)},n.allSettled=ai,t.prototype.allSettled=function(){return this.then(function(t){return h(g(t,function(t){function i(){return t.inspect()}return t=n(t),t.then(i,i)}))})},n.fail=n["catch"]=function(t,i){return n(t).then(void 0,i)},t.prototype.fail=t.prototype["catch"]=function(n){return this.then(void 0,n)},n.progress=vi,t.prototype.progress=function(n){return this.then(void 0,void 0,n)},n.fin=n["finally"]=function(t,i){return n(t)["finally"](i)},t.prototype.fin=t.prototype["finally"]=function(t){return t=n(t),this.then(function(n){return t.fcall().then(function(){return n})},function(n){return t.fcall().then(function(){throw n;})})},n.done=function(t,i,r,u){return n(t).done(i,r,u)},t.prototype.done=function(t,i,r){var u=function(t){n.nextTick(function(){if(rt(t,f),!n.onerror)throw t;n.onerror(t)})},f=t||i||r?this.then(t,i,r):this;"object"==typeof process&&process&&process.domain&&(u=process.domain.bind(u));f.then(void 0,u)},n.timeout=function(t,i,r){return n(t).timeout(i,r)},t.prototype.timeout=function(n,t){var i=r(),u=setTimeout(function(){t&&"string"!=typeof t||(t=new Error(t||"Timed out after "+n+" ms"),t.code="ETIMEDOUT");i.reject(t)},n);return this.then(function(n){clearTimeout(u);i.resolve(n)},function(n){clearTimeout(u);i.reject(n)},i.notify),i.promise},n.delay=function(t,i){return void 0===i&&(i=t,t=void 0),n(t).delay(i)},t.prototype.delay=function(n){return this.then(function(t){var i=r();return setTimeout(function(){i.resolve(t)},n),i.promise})},n.nfapply=function(t,i){return n(t).nfapply(i)},t.prototype.nfapply=function(n){var t=r(),u=i(n);return u.push(t.makeNodeResolver()),this.fapply(u).fail(t.reject),t.promise},n.nfcall=function(t){var r=i(arguments,1);return n(t).nfapply(r)},t.prototype.nfcall=function(){var t=i(arguments),n=r();return t.push(n.makeNodeResolver()),this.fapply(t).fail(n.reject),n.promise},n.nfbind=n.denodeify=function(t){var u=i(arguments,1);return function(){var e=u.concat(i(arguments)),f=r();return e.push(f.makeNodeResolver()),n(t).fapply(e).fail(f.reject),f.promise}},t.prototype.nfbind=t.prototype.denodeify=function(){var t=i(arguments);return t.unshift(this),n.denodeify.apply(void 0,t)},n.nbind=function(t,u){var f=i(arguments,2);return function(){function s(){return t.apply(u,arguments)}var o=f.concat(i(arguments)),e=r();return o.push(e.makeNodeResolver()),n(s).fapply(o).fail(e.reject),e.promise}},t.prototype.nbind=function(){var t=i(arguments,0);return t.unshift(this),n.nbind.apply(void 0,t)},n.nmapply=n.npost=function(t,i,r){return n(t).npost(i,r)},t.prototype.nmapply=t.prototype.npost=function(n,t){var f=i(t||[]),u=r();return f.push(u.makeNodeResolver()),this.dispatch("post",[n,f]).fail(u.reject),u.promise},n.nsend=n.nmcall=n.ninvoke=function(t,u){var e=i(arguments,2),f=r();return e.push(f.makeNodeResolver()),n(t).dispatch("post",[u,e]).fail(f.reject),f.promise},t.prototype.nsend=t.prototype.nmcall=t.prototype.ninvoke=function(n){var u=i(arguments,1),t=r();return u.push(t.makeNodeResolver()),this.dispatch("post",[n,u]).fail(t.reject),t.promise},n.nodeify=yi,t.prototype.nodeify=function(t){return t?void this.then(function(i){n.nextTick(function(){t(null,i)})},function(i){n.nextTick(function(){t(i)})}):this},n.noConflict=function(){throw new Error("Q.noConflict only works when Q is used as a global");},pt=ft(),n}),function(n){n.fn.slinky=function(t){var i=n.extend({label:"Back",title:!1,speed:300,resize:!0,activeClass:"mmenu-is-active"},t),r=function(n,t,r){var u=Math.round(parseInt(n.get(0).style.left))||0;n.css("left",-Math.abs(t?u-100:u+100)+"%");jQuery("#mmenu-push-right").scrollTop(0);typeof r=="function"&&setTimeout(r,i.speed)},u=function(n,t){n.height(t.outerHeight())};return this.each(function(){var t=n(this),e=t.children().first(),f=t.parent().parent(),o;t.css("transition-duration",i.speed+"ms");e.css("transition-duration",i.speed+"ms");n("a + ul",t).prev().addClass("next");n("li > ul",t).prepend('<li class="header">');i.title===!0&&n("li > ul",t).each(function(){var t=n(this).parent().find("a").first().text(),i=n("<h2>").text(t);n("> .header",this).append(i)});i.title||i.label!==!0?(o=n("<a>").text(i.label).prop("href","#").addClass("back"),n(".header",t).append(o)):n("li > ul",t).each(function(){var t=n(this).parent().find("a").first().text(),i=n("<a>").text(t).prop("href","#").addClass("back");n("> .header",this).append(i)});n("a",t).on("click",function(o){var s=n(this),h;/#/.test(this.href)&&o.preventDefault();s.hasClass("next")?(s.next().show(),r(e,!0),f.hasClass(i.activeClass)||f.addClass(i.activeClass),i.resize&&u(t,s.next())):s.hasClass("back")&&(r(e,!1,function(){s.parent().parent().hide()}),i.resize&&(h=s.parent().parent().parents("ul"),h.length==1&&f.hasClass(i.activeClass)&&f.removeClass(i.activeClass),u(t,h)))})})}}(jQuery),function(n,t){"use strict";if(typeof define=="function"&&define.amd)define(["exports"],t);else if(typeof exports=="object")t(exports);else{var i={};n.PubSub=i;t(i)}}(typeof window=="object"&&window||this,function(n){"use strict";function i(n){for(var t in n)if(n.hasOwnProperty(t))return!0;return!1}function e(n){return function(){throw n;}}function o(n,t,i){try{n(t,i)}catch(r){setTimeout(e(r),0)}}function s(n,t,i){n(t,i)}function r(n,i,r,u){var f=t[i],h=u?s:o,e;if(t.hasOwnProperty(i))for(e in f)f.hasOwnProperty(e)&&h(f[e],n,r)}function h(n,t,i){return function(){var u=String(n),f=u.lastIndexOf(".");for(r(n,n,t,i);f!==-1;)u=u.substr(0,f),f=u.lastIndexOf("."),r(n,u,t,i)}}function c(n){for(var r=String(n),u=Boolean(t.hasOwnProperty(r)&&i(t[r])),f=r.lastIndexOf(".");!u&&f!==-1;)r=r.substr(0,f),f=r.lastIndexOf("."),u=Boolean(t.hasOwnProperty(r)&&i(t[r]));return u}function u(n,t,i,r){var u=h(n,t,r),f=c(n);return f?(i===!0?u():setTimeout(u,0),!0):!1}var t={},f=-1;n.publish=function(t,i){return u(t,i,!1,n.immediateExceptions)};n.publishSync=function(t,i){return u(t,i,!0,n.immediateExceptions)};n.subscribe=function(n,i){if(typeof i!="function")return!1;t.hasOwnProperty(n)||(t[n]={});var r="uid_"+String(++f);return t[n][r]=i,r};n.clearAllSubscriptions=function(){t={}};n.clearSubscriptions=function(n){for(var i in t)t.hasOwnProperty(i)&&i.indexOf(n)===0&&delete t[i]};n.unsubscribe=function(n){var e=typeof n=="string"&&t.hasOwnProperty(n),o=!e&&typeof n=="string",s=typeof n=="function",u=!1,f,i,r;if(e){delete t[n];return}for(f in t)if(t.hasOwnProperty(f)){if(i=t[f],o&&i[n]){delete i[n];u=n;break}if(s)for(r in i)i.hasOwnProperty(r)&&i[r]===n&&(delete i[r],u=!0)}return u}});!function(n,t,i){!function(n){"use strict";"function"==typeof define&&define.amd?define(["jquery"],n):jQuery&&!jQuery.fn.qtip&&n(jQuery)}(function(r){"use strict";function ui(n,t,i,f){this.id=i;this.target=n;this.tooltip=s;this.elements={target:n};this._id=o+"-"+i;this.timers={img:{}};this.options=t;this.plugins={};this.cache={event:{},target:r(),disabled:u,attr:f,onTooltip:u,lastClass:""};this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=u}function ft(n){return n===s||"object"!==r.type(n)}function vi(n){return!(r.isFunction(n)||n&&n.attr||n.length||"object"===r.type(n)&&(n.jquery||n.then))}function wt(n){var t,e,i,o;return ft(n)?u:(ft(n.metadata)&&(n.metadata={type:n.metadata}),"content"in n&&(t=n.content,ft(t)||t.jquery||t.done?t=n.content={text:e=vi(t)?u:t}:e=t.text,"ajax"in t&&(i=t.ajax,o=i&&i.once!==u,delete t.ajax,t.text=function(n,t){var u=e||r(this).attr(t.options.content.attr)||"Loading...",f=r.ajax(r.extend({},i,{context:t})).then(i.success,s,i.error).then(function(n){return n&&o&&t.set("content.text",n),n},function(n,i,r){t.destroyed||0===n.status||t.set("content.text",i+": "+r)});return o?u:(t.set("content.text",u),f)}),"title"in t&&(r.isPlainObject(t.title)&&(t.button=t.title.button,t.title=t.title.text),vi(t.title||u)&&(t.title=u))),"position"in n&&ft(n.position)&&(n.position={my:n.position,at:n.position}),"show"in n&&ft(n.show)&&(n.show=n.show.jquery?{target:n.show}:n.show===f?{ready:f}:{event:n.show}),"hide"in n&&ft(n.hide)&&(n.hide=n.hide.jquery?{target:n.hide}:{event:n.hide}),"style"in n&&ft(n.style)&&(n.style={classes:n.style}),r.each(h,function(){this.sanitize&&this.sanitize(n)}),n)}function yi(n,t){for(var u,f=0,i=n,r=t.split(".");i=i[r[f++]];)f<r.length&&(u=i);return[u||n,r.pop()]}function sr(n,t){var i,r,u;for(i in this.checks)for(r in this.checks[i])(u=new RegExp(r,"i").exec(n))&&(t.push(u),("builtin"===i||this.plugins[i])&&this.checks[i][r].apply(this.plugins[i]||this,t))}function bt(n){return yr.concat("").join(n?"-"+n+" ":" ")}function kt(n,t){return t>0?setTimeout(r.proxy(n,this),t):void n.call(this)}function hr(n){this.tooltip.hasClass(a)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=kt.call(this,function(){this.toggle(f,n)},this.options.show.delay))}function cr(n){if(!this.tooltip.hasClass(a)&&!this.destroyed){var t=r(n.relatedTarget),i=t.closest(rt)[0]===this.tooltip[0],f=t[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==t[0]&&"mouse"===this.options.position.target&&i||this.options.hide.fixed&&/mouse(out|leave|move)/.test(n.type)&&(i||f))try{n.preventDefault();n.stopImmediatePropagation()}catch(e){}else this.timers.hide=kt.call(this,function(){this.toggle(u,n)},this.options.hide.delay,this)}}function fi(n){!this.tooltip.hasClass(a)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=kt.call(this,function(){this.hide(n)},this.options.hide.inactive))}function pi(n){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(n)}function wi(n,i,u){r(t.body).delegate(n,(i.split?i:i.join("."+o+" "))+"."+o,function(){var n=c.api[r.attr(this,ni)];n&&!n.disabled&&u.apply(n,arguments)})}function lr(n,i,e){var y,l,v,h,b,k=r(t.body),p=n[0]===t?k:n,w=n.metadata?n.metadata(e.metadata):s,d="html5"===e.metadata.type&&w?w[e.metadata.name]:s,a=n.data(e.metadata.name||"qtipopts");try{a="string"==typeof a?r.parseJSON(a):a}catch(g){}if(h=r.extend(f,{},c.defaults,e,"object"==typeof a?wt(a):s,wt(d||w)),l=h.position,h.id=i,"boolean"==typeof h.content.text){if(v=n.attr(h.content.attr),h.content.attr===u||!v)return u;h.content.text=v}if(l.container.length||(l.container=k),l.target===u&&(l.target=p),h.show.target===u&&(h.show.target=p),h.show.solo===f&&(h.show.solo=l.container.closest("body")),h.hide.target===u&&(h.hide.target=p),h.position.viewport===f&&(h.position.viewport=l.container),l.container=l.container.eq(0),l.at=new tt(l.at,f),l.my=new tt(l.my),n.data(o))if(h.overwrite)n.qtip("destroy",!0);else if(h.overwrite===u)return u;return n.attr(ei,i),h.suppress&&(b=n.attr("title"))&&n.removeAttr("title").attr(ut,b).attr("title",""),y=new ui(n,h,i,!!v),n.data(o,y),y}function at(n){return n.charAt(0).toUpperCase()+n.slice(1)}function ar(n,t){var r,u,f=t.charAt(0).toUpperCase()+t.slice(1),e=(t+" "+wr.join(f+" ")+f).split(" "),o=0;if(ci[t])return n.css(ci[t]);for(;r=e[o++];)if((u=n.css(r))!==i)return ci[t]=r,u}function ot(n,t){return Math.ceil(parseFloat(ar(n,t)))}function bi(n,t){this._ns="tip";this.options=t;this.offset=t.offset;this.size=[t.width,t.height];this.init(this.qtip=n)}function ki(n,t){this.options=t;this._ns="-modal";this.init(this.qtip=n)}function di(n){this._ns="ie6";this.init(this.qtip=n)}var c,e,tt,dt,gt,f=!0,u=!1,s=null,w="x",y="y",d="width",vt="height",b="top",p="left",it="bottom",k="right",l="center",vr="flipinvert",et="shift",h={},o="qtip",ei="data-hasqtip",ni="data-qtip-id",yr=["ui-widget","ui-tooltip"],rt="."+o,gi="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),nr=o+"-fixed",oi=o+"-default",st=o+"-focus",pr=o+"-hover",a=o+"-disabled",ht="_replacedByqTip",ut="oldtitle",v={ie:function(){for(var n=4,i=t.createElement("div");(i.innerHTML="<!--[if gt IE "+n+"]><i><\/i><![endif]-->")&&i.getElementsByTagName("i")[0];n+=1);return n>4?n:NaN}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||u},tr,ir,yt,li,ai,g,ri,nt,er,or;e=ui.prototype;e._when=function(n){return r.when.apply(r,n)};e.render=function(n){if(this.rendered||this.destroyed)return this;var w,i=this,t=this.options,s=this.cache,y=this.elements,p=t.content.text,l=t.content.title,b=t.content.button,e=t.position,v=("."+this._id+" ",[]);return r.attr(this.target[0],"aria-describedby",this._id),s.posClass=this._createPosClass((this.position={my:e.my,at:e.at}).my),this.tooltip=y.tooltip=w=r("<div/>",{id:this._id,"class":[o,oi,t.style.classes,s.posClass].join(" "),width:t.style.width||"",height:t.style.height||"",tracking:"mouse"===e.target&&e.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":u,"aria-describedby":this._id+"-content","aria-hidden":f}).toggleClass(a,this.disabled).attr(ni,this.id).data(o,this).appendTo(e.container).append(y.content=r("<div />",{"class":o+"-content",id:this._id+"-content","aria-atomic":f})),this.rendered=-1,this.positioning=f,l&&(this._createTitle(),r.isFunction(l)||v.push(this._updateTitle(l,u))),b&&this._createButton(),r.isFunction(p)||v.push(this._updateContent(p,u)),this.rendered=f,this._setWidget(),r.each(h,function(n){var t;"render"===this.initialize&&(t=this(i))&&(i.plugins[n]=t)}),this._unassignEvents(),this._assignEvents(),this._when(v).then(function(){i._trigger("render");i.positioning=u;i.hiddenDuringWait||!t.show.ready&&!n||i.toggle(f,s.event,u);i.hiddenDuringWait=u}),c.api[this.id]=this,this};e.destroy=function(n){function t(){if(!this.destroyed){this.destroyed=f;var t,n=this.target,i=n.attr(ut);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove();r.each(this.plugins,function(){this.destroy&&this.destroy()});for(t in this.timers)clearTimeout(this.timers[t]);n.removeData(o).removeAttr(ni).removeAttr(ei).removeAttr("aria-describedby");this.options.suppress&&i&&n.attr("title",i).removeAttr(ut);this._unassignEvents();this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=s;delete c.api[this.id]}}return this.destroyed?this.target:(n===f&&"hide"!==this.triggering||!this.rendered?t.call(this):(this.tooltip.one("tooltiphidden",r.proxy(t,this)),!this.triggering&&this.hide()),this.target)};dt=e.checks={builtin:{"^id$":function(n,t,i,e){var s=i===f?c.nextid:i,h=o+"-"+s;s!==u&&s.length>0&&!r("#"+h).length?(this._id=h,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):n[t]=e},"^prerender":function(n,t,i){i&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(n,t,i){this._updateContent(i)},"^content.attr$":function(n,t,i,r){this.options.content.text===this.target.attr(r)&&this._updateContent(this.target.attr(i))},"^content.title$":function(n,t,i){return i?(i&&!this.elements.title&&this._createTitle(),void this._updateTitle(i)):this._removeTitle()},"^content.button$":function(n,t,i){this._updateButton(i)},"^content.title.(text|button)$":function(n,t,i){this.set("content."+t,i)},"^position.(my|at)$":function(n,t,i){"string"==typeof i&&(this.position[t]=n[t]=new tt(i,"at"===t))},"^position.container$":function(n,t,i){this.rendered&&this.tooltip.appendTo(i)},"^show.ready$":function(n,t,i){i&&(!this.rendered&&this.render(f)||this.toggle(f))},"^style.classes$":function(n,t,i,r){this.rendered&&this.tooltip.removeClass(r).addClass(i)},"^style.(width|height)":function(n,t,i){this.rendered&&this.tooltip.css(t,i)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(n,t,i){this.rendered&&this.tooltip.toggleClass(oi,!!i)},"^events.(render|show|move|hide|focus|blur)$":function(n,t,i){this.rendered&&this.tooltip[(r.isFunction(i)?"":"un")+"bind"]("tooltip"+t,i)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var n=this.options.position;this.tooltip.attr("tracking","mouse"===n.target&&n.adjust.mouse);this._unassignEvents();this._assignEvents()}}}};e.get=function(n){if(this.destroyed)return this;var i=yi(this.options,n.toLowerCase()),t=i[0][i[1]];return t.precedance?t.string():t};tr=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i;ir=/^prerender|show\.ready/i;e.set=function(n,t){if(this.destroyed)return this;var o,h=this.rendered,i=u,e=this.options;return this.checks,"string"==typeof n?(o=n,n={},n[o]=t):n=r.extend({},n),r.each(n,function(t,u){if(h&&ir.test(t))return void delete n[t];var o,f=yi(e,t.toLowerCase());o=f[0][f[1]];f[0][f[1]]=u&&u.nodeType?r(u):u;i=tr.test(t)||i;n[t]=[f[0],f[1],u,o]}),wt(e),this.positioning=f,r.each(n,r.proxy(sr,this)),this.positioning=u,this.rendered&&this.tooltip[0].offsetWidth>0&&i&&this.reposition("mouse"===e.position.target?s:this.cache.event),this};e._update=function(n,t){var i=this,e=this.cache;return this.rendered&&n?(r.isFunction(n)&&(n=n.call(this.elements.target,e.event,this)||""),r.isFunction(n.then)?(e.waiting=f,n.then(function(n){return e.waiting=u,i._update(n,t)},s,function(n){return i._update(n,t)})):n===u||!n&&""!==n?u:(n.jquery&&n.length>0?t.empty().append(n.css({display:"block",visibility:"visible"})):t.html(n),this._waitForContent(t).then(function(n){i.rendered&&i.tooltip[0].offsetWidth>0&&i.reposition(e.event,!n.length)}))):u};e._waitForContent=function(n){var t=this.cache;return t.waiting=f,(r.fn.imagesLoaded?n.imagesLoaded():r.Deferred().resolve([])).done(function(){t.waiting=u}).promise()};e._updateContent=function(n,t){this._update(n,this.elements.content,t)};e._updateTitle=function(n,t){this._update(n,this.elements.title,t)===u&&this._removeTitle(u)};e._createTitle=function(){var n=this.elements,t=this._id+"-title";n.titlebar&&this._removeTitle();n.titlebar=r("<div />",{"class":o+"-titlebar "+(this.options.style.widget?bt("header"):"")}).append(n.title=r("<div />",{id:t,"class":o+"-title","aria-atomic":f})).insertBefore(n.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(n){r(this).toggleClass("ui-state-active ui-state-focus","down"===n.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(n){r(this).toggleClass("ui-state-hover","mouseover"===n.type)});this.options.content.button&&this._createButton()};e._removeTitle=function(n){var t=this.elements;t.title&&(t.titlebar.remove(),t.titlebar=t.title=t.button=s,n!==u&&this.reposition())};e._createPosClass=function(n){return o+"-pos-"+(n||this.options.position.my).abbrev()};e.reposition=function(i,e){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=f;var a,y,ut,at,c=this.cache,d=this.tooltip,w=this.options.position,o=w.target,et=w.my,g=w.at,ot=w.viewport,ht=w.container,ft=w.adjust,vt=ft.method.split(" "),ct=d.outerWidth(u),lt=d.outerHeight(u),nt=0,tt=0,yt=d.css("position"),s={left:0,top:0},wt=d[0].offsetWidth>0,bt=i&&"scroll"===i.type,st=r(n),pt=ht[0].ownerDocument,rt=this.mouse;if(r.isArray(o)&&2===o.length)g={x:p,y:b},s={left:o[0],top:o[1]};else if("mouse"===o)g={x:p,y:b},(!ft.mouse||this.options.hide.distance)&&c.origin&&c.origin.pageX?i=c.origin:!i||i&&("resize"===i.type||"scroll"===i.type)?i=c.event:rt&&rt.pageX&&(i=rt),"static"!==yt&&(s=ht.offset()),pt.body.offsetWidth!==(n.innerWidth||pt.documentElement.clientWidth)&&(y=r(t.body).offset()),s={left:i.pageX-s.left+(y&&y.left||0),top:i.pageY-s.top+(y&&y.top||0)},ft.mouse&&bt&&rt&&(s.left-=(rt.scrollX||0)-st.scrollLeft(),s.top-=(rt.scrollY||0)-st.scrollTop());else{if("event"===o?i&&i.target&&"scroll"!==i.type&&"resize"!==i.type?c.target=r(i.target):i.target||(c.target=this.elements.target):"event"!==o&&(c.target=r(o.jquery?o:this.elements.target)),o=c.target,o=r(o).eq(0),0===o.length)return this;o[0]===t||o[0]===n?(nt=v.iOS?n.innerWidth:o.width(),tt=v.iOS?n.innerHeight:o.height(),o[0]===n&&(s={top:(ot||o).scrollTop(),left:(ot||o).scrollLeft()})):h.imagemap&&o.is("area")?a=h.imagemap(this,o,g,h.viewport?vt:u):h.svg&&o&&o[0].ownerSVGElement?a=h.svg(this,o,g,h.viewport?vt:u):(nt=o.outerWidth(u),tt=o.outerHeight(u),s=o.offset());a&&(nt=a.width,tt=a.height,y=a.offset,s=a.position);s=this.reposition.offset(o,s,ht);(v.iOS>3.1&&v.iOS<4.1||v.iOS>=4.3&&v.iOS<4.33||!v.iOS&&"fixed"===yt)&&(s.left-=st.scrollLeft(),s.top-=st.scrollTop());(!a||a&&a.adjustable!==u)&&(s.left+=g.x===k?nt:g.x===l?nt/2:0,s.top+=g.y===it?tt:g.y===l?tt/2:0)}return s.left+=ft.x+(et.x===k?-ct:et.x===l?-ct/2:0),s.top+=ft.y+(et.y===it?-lt:et.y===l?-lt/2:0),h.viewport?(ut=s.adjusted=h.viewport(this,s,w,nt,tt,ct,lt),y&&ut.left&&(s.left+=y.left),y&&ut.top&&(s.top+=y.top),ut.my&&(this.position.my=ut.my)):s.adjusted={left:0,top:0},c.posClass!==(at=this._createPosClass(this.position.my))&&d.removeClass(c.posClass).addClass(c.posClass=at),this._trigger("move",[s,ot.elem||ot],i)?(delete s.adjusted,e===u||!wt||isNaN(s.left)||isNaN(s.top)||"mouse"===o||!r.isFunction(w.effect)?d.css(s):r.isFunction(w.effect)&&(w.effect.call(d,this,r.extend({},s)),d.queue(function(n){r(this).css({opacity:"",height:""});v.ie&&this.style.removeAttribute("filter");n()})),this.positioning=u,this):this};e.reposition.offset=function(n,i,u){function s(n,t){i.left+=t*n.scrollLeft();i.top+=t*n.scrollTop()}if(!u[0])return i;var o,h,e,c,l=r(n[0].ownerDocument),a=!!v.ie&&"CSS1Compat"!==t.compatMode,f=u[0];do"static"!==(h=r.css(f,"position"))&&("fixed"===h?(e=f.getBoundingClientRect(),s(l,-1)):(e=r(f).position(),e.left+=parseFloat(r.css(f,"borderLeftWidth"))||0,e.top+=parseFloat(r.css(f,"borderTopWidth"))||0),i.left-=e.left+(parseFloat(r.css(f,"marginLeft"))||0),i.top-=e.top+(parseFloat(r.css(f,"marginTop"))||0),o||"hidden"===(c=r.css(f,"overflow"))||"visible"===c||(o=r(f)));while(f=f.offsetParent);return o&&(o[0]!==l[0]||a)&&s(o,1),i};yt=(tt=e.reposition.Corner=function(n,t){n=(""+n).replace(/([A-Z])/," $1").replace(/middle/gi,l).toLowerCase();this.x=(n.match(/left|right/i)||n.match(/center/)||["inherit"])[0].toLowerCase();this.y=(n.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase();this.forceY=!!t;var i=n.charAt(0);this.precedance="t"===i||"b"===i?y:w}).prototype;yt.invert=function(n,t){this[n]=this[n]===p?k:this[n]===k?p:t||this[n]};yt.string=function(n){var t=this.x,i=this.y,r=t!==i?"center"===t||"center"!==i&&(this.precedance===y||this.forceY)?[i,t]:[t,i]:[t];return n!==!1?r.join(" "):r};yt.abbrev=function(){var n=this.string(!1);return n[0].charAt(0)+(n[1]&&n[1].charAt(0)||"")};yt.clone=function(){return new tt(this.string(),this.forceY)};e.toggle=function(n,i){var c=this.cache,b=this.options,e=this.tooltip;if(i){if(/over|enter/.test(i.type)&&c.event&&/out|leave/.test(c.event.type)&&b.show.target.add(i.target).length===b.show.target.length&&e.has(i.relatedTarget).length)return this;c.event=r.event.fix(i)}if(this.waiting&&!n&&(this.hiddenDuringWait=f),!this.rendered)return n?this.render(1):this;if(this.destroyed||this.disabled)return this;var y,p,l,w=n?"show":"hide",h=this.options[w],k=(this.options[n?"hide":"show"],this.options.position),a=this.options.content,d=this.tooltip.css("width"),g=this.tooltip.is(":visible"),nt=n||1===h.target.length,tt=!i||h.target.length<2||c.target[0]===i.target;return(typeof n).search("boolean|number")&&(n=!g),y=!e.is(":animated")&&g===n&&tt,p=y?s:!!this._trigger(w,[90]),this.destroyed?this:(p!==u&&n&&this.focus(i),!p||y?this:(r.attr(e[0],"aria-hidden",!n),n?(this.mouse&&(c.origin=r.event.fix(this.mouse)),r.isFunction(a.text)&&this._updateContent(a.text,u),r.isFunction(a.title)&&this._updateTitle(a.title,u),!gt&&"mouse"===k.target&&k.adjust.mouse&&(r(t).bind("mousemove."+o,this._storeMouse),gt=f),d||e.css("width",e.outerWidth(u)),this.reposition(i,arguments[2]),d||e.css("width",""),h.solo&&("string"==typeof h.solo?r(h.solo):r(rt,h.solo)).not(e).not(h.target).qtip("hide",r.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete c.origin,gt&&!r(rt+'[tracking="true"]:visible',h.solo).not(e).length&&(r(t).unbind("mousemove."+o),gt=u),this.blur(i)),l=r.proxy(function(){n?(v.ie&&e[0].style.removeAttribute("filter"),e.css("overflow",""),"string"==typeof h.autofocus&&r(this.options.show.autofocus,e).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):e.css({display:"",visibility:"",opacity:"",left:"",top:""});this._trigger(n?"visible":"hidden")},this),h.effect===u||nt===u?(e[w](),l()):r.isFunction(h.effect)?(e.stop(1,1),h.effect.call(e,this),e.queue("fx",function(n){l();n()})):e.fadeTo(90,n?1:0,l),n&&h.target.trigger("qtip-"+this.id+"-inactive"),this))};e.show=function(n){return this.toggle(f,n)};e.hide=function(n){return this.toggle(u,n)};e.focus=function(n){if(!this.rendered||this.destroyed)return this;var t=r(rt),i=this.tooltip,f=parseInt(i[0].style.zIndex,10),u=c.zindex+t.length;return i.hasClass(st)||this._trigger("focus",[u],n)&&(f!==u&&(t.each(function(){this.style.zIndex>f&&(this.style.zIndex=this.style.zIndex-1)}),t.filter("."+st).qtip("blur",n)),i.addClass(st)[0].style.zIndex=u),this};e.blur=function(n){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass(st),this._trigger("blur",[this.tooltip.css("zIndex")],n),this)};e.disable=function(n){return this.destroyed?this:("toggle"===n?n=!(this.rendered?this.tooltip.hasClass(a):this.disabled):"boolean"!=typeof n&&(n=f),this.rendered&&this.tooltip.toggleClass(a,n).attr("aria-disabled",n),this.disabled=!!n,this)};e.enable=function(){return this.disable(u)};e._createButton=function(){var e=this,n=this.elements,i=n.tooltip,t=this.options.content.button,s="string"==typeof t,f=s?t:"Close tooltip";n.button&&n.button.remove();n.button=t.jquery?t:r("<a />",{"class":"qtip-close "+(this.options.style.widget?"":o+"-icon"),title:f,"aria-label":f}).prepend(r("<span />",{"class":"ui-icon ui-icon-close",html:"×"}));n.button.appendTo(n.titlebar||i).attr("role","button").click(function(n){return i.hasClass(a)||e.hide(n),u})};e._updateButton=function(n){if(!this.rendered)return u;var t=this.elements.button;n?this._createButton():t.remove()};e._setWidget=function(){var t=this.options.style.widget,n=this.elements,i=n.tooltip,r=i.hasClass(a);i.removeClass(a);a=t?"ui-state-disabled":"qtip-disabled";i.toggleClass(a,r);i.toggleClass("ui-helper-reset "+bt(),t).toggleClass(oi,this.options.style.def&&!t);n.content&&n.content.toggleClass(bt("content"),t);n.titlebar&&n.titlebar.toggleClass(bt("header"),t);n.button&&n.button.toggleClass(o+"-icon",!t)};e._storeMouse=function(n){return(this.mouse=r.event.fix(n)).type="mousemove",this};e._bind=function(n,t,i,u,f){if(n&&i&&t.length){var e="."+this._id+(u?"-"+u:"");return r(n).bind((t.split?t:t.join(e+" "))+e,r.proxy(i,f||this)),this}};e._unbind=function(n,t){return n&&r(n).unbind("."+this._id+(t?"-"+t:"")),this};e._trigger=function(n,t,i){var f=r.Event("tooltip"+n);return f.originalEvent=i&&r.extend({},i)||this.cache.event||s,this.triggering=n,this.tooltip.trigger(f,[this].concat(t||[])),this.triggering=u,!f.isDefaultPrevented()};e._bindEvents=function(n,t,i,u,f,e){var o=i.filter(u).add(u.filter(i)),s=[];o.length&&(r.each(t,function(t,i){var u=r.inArray(i,n);u>-1&&s.push(n.splice(u,1)[0])}),s.length&&(this._bind(o,s,function(n){var t=this.rendered?this.tooltip[0].offsetWidth>0:!1;(t?e:f).call(this,n)}),i=i.not(o),u=u.not(o)));this._bind(i,n,f);this._bind(u,t,e)};e._assignInitialEvents=function(n){function i(n){return this.disabled||this.destroyed?u:(this.cache.event=n&&r.event.fix(n),this.cache.target=n&&r(n.target),clearTimeout(this.timers.show),void(this.timers.show=kt.call(this,function(){this.render("object"==typeof n||t.show.ready)},t.prerender?0:t.show.delay)))}var t=this.options,e=t.show.target,s=t.hide.target,h=t.show.event?r.trim(""+t.show.event).split(" "):[],o=t.hide.event?r.trim(""+t.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(){this.destroy(!0)},"destroy");/mouse(over|enter)/i.test(t.show.event)&&!/mouse(out|leave)/i.test(t.hide.event)&&o.push("mouseleave");this._bind(e,"mousemove",function(n){this._storeMouse(n);this.cache.onTarget=f});this._bindEvents(h,o,e,s,i,function(){return this.timers?void clearTimeout(this.timers.show):u});(t.show.ready||t.prerender)&&i.call(this,n)};e._assignEvents=function(){var y=this,i=this.options,f=i.position,e=this.tooltip,s=i.show.target,o=i.hide.target,p=f.container,h=f.viewport,l=r(t),v=(r(t.body),r(n)),w=i.show.event?r.trim(""+i.show.event).split(" "):[],b=i.hide.event?r.trim(""+i.hide.event).split(" "):[];r.each(i.events,function(n,t){y._bind(e,"toggle"===n?["tooltipshow","tooltiphide"]:["tooltip"+n],t,null,e)});/mouse(out|leave)/i.test(i.hide.event)&&"window"===i.hide.leave&&this._bind(l,["mouseout","blur"],function(n){/select|option/.test(n.target.nodeName)||n.relatedTarget||this.hide(n)});i.hide.fixed?o=o.add(e.addClass(nr)):/mouse(over|enter)/i.test(i.show.event)&&this._bind(o,"mouseleave",function(){clearTimeout(this.timers.show)});(""+i.hide.event).indexOf("unfocus")>-1&&this._bind(p.closest("html"),["mousedown","touchstart"],function(n){var t=r(n.target),i=this.rendered&&!this.tooltip.hasClass(a)&&this.tooltip[0].offsetWidth>0,u=t.parents(rt).filter(this.tooltip[0]).length>0;t[0]===this.target[0]||t[0]===this.tooltip[0]||u||this.target.has(t[0]).length||!i||this.hide(n)});"number"==typeof i.hide.inactive&&(this._bind(s,"qtip-"+this.id+"-inactive",fi,"inactive"),this._bind(o.add(e),c.inactiveEvents,fi));this._bindEvents(w,b,s,o,hr,cr);this._bind(s.add(e),"mousemove",function(n){if("number"==typeof i.hide.distance){var t=this.cache.origin||{},r=this.options.hide.distance,u=Math.abs;(u(n.pageX-t.pageX)>=r||u(n.pageY-t.pageY)>=r)&&this.hide(n)}this._storeMouse(n)});"mouse"===f.target&&f.adjust.mouse&&(i.hide.event&&this._bind(s,["mouseenter","mouseleave"],function(n){return this.cache?void(this.cache.onTarget="mouseenter"===n.type):u}),this._bind(l,"mousemove",function(n){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(a)&&this.tooltip[0].offsetWidth>0&&this.reposition(n)}));(f.adjust.resize||h.length)&&this._bind(r.event.special.resize?h:v,"resize",pi);f.adjust.scroll&&this._bind(v.add(f.container),"scroll",pi)};e._unassignEvents=function(){var u=this.options,f=u.show.target,e=u.hide.target,i=r.grep([this.elements.target[0],this.rendered&&this.tooltip[0],u.position.container[0],u.position.viewport[0],u.position.container.closest("html")[0],n,t],function(n){return"object"==typeof n});f&&f.toArray&&(i=i.concat(f.toArray()));e&&e.toArray&&(i=i.concat(e.toArray()));this._unbind(i)._unbind(i,"destroy")._unbind(i,"inactive")};r(function(){wi(rt,["mouseenter","mouseleave"],function(n){var u="mouseenter"===n.type,i=r(n.currentTarget),f=r(n.relatedTarget||n.target),t=this.options;u?(this.focus(n),i.hasClass(nr)&&!i.hasClass(a)&&clearTimeout(this.timers.hide)):"mouse"===t.position.target&&t.position.adjust.mouse&&t.hide.event&&t.show.target&&!f.closest(t.show.target[0]).length&&this.hide(n);i.toggleClass(pr,u)});wi("["+ni+"]",gi,fi)});c=r.fn.qtip=function(n,t,e){var a=(""+n).toLowerCase(),y=s,p=r.makeArray(arguments).slice(1),v=p[p.length-1],l=this[0]?r.data(this[0],o):s;return!arguments.length&&l||"api"===a?l:"string"==typeof n?(this.each(function(){var n=r.data(this,o);if(!n)return f;if(v&&v.timeStamp&&(n.cache.event=v),t&&("option"===a||"options"===a)){if(e===i&&!r.isPlainObject(t))return y=n.get(t),u;n.set(t,e)}else n[a]&&n[a].apply(n,p)}),y!==s?y:this):"object"!=typeof n&&arguments.length?void 0:(l=wt(r.extend(f,{},n)),this.each(function(n){var i,t;return t=r.isArray(l.id)?l.id[n]:l.id,t=!t||t===u||t.length<1||c.api[t]?c.nextid++:t,i=lr(r(this),t,l),i===u?f:(c.api[t]=i,r.each(h,function(){"initialize"===this.initialize&&this(i)}),void i._assignInitialEvents(v))}))};r.qtip=ui;c.api={};r.each({attr:function(n,t){if(this.length){var u=this[0],f="title",i=r.data(u,"qtip");if(n===f&&i&&"object"==typeof i&&i.options.suppress)return arguments.length<2?r.attr(u,ut):(i&&i.options.content.attr===f&&i.cache.attr&&i.set("content.text",t),this.attr(ut,t))}return r.fn["attr"+ht].apply(this,arguments)},clone:function(n){var t=(r([]),r.fn["clone"+ht].apply(this,arguments));return n||t.filter("["+ut+"]").attr("title",function(){return r.attr(this,ut)}).removeAttr(ut),t}},function(n,t){if(!t||r.fn[n+ht])return f;var i=r.fn[n+ht]=r.fn[n];r.fn[n]=function(){return t.apply(this,arguments)||i.apply(this,arguments)}});r.ui||(r["cleanData"+ht]=r.cleanData,r.cleanData=function(n){for(var t,i=0;(t=r(n[i])).length;i++)if(t.attr(ei))try{t.triggerHandler("removeqtip")}catch(u){}r["cleanData"+ht].apply(this,arguments)});c.version="2.2.1";c.nextid=0;c.inactiveEvents=gi;c.zindex=15e3;c.defaults={prerender:u,id:u,overwrite:f,suppress:f,content:{text:f,attr:"title",title:u,button:u},position:{my:"top left",at:"bottom right",target:u,container:u,viewport:u,adjust:{x:0,y:0,mouse:f,scroll:f,resize:f,method:"flipinvert flipinvert"},effect:function(n,t){r(this).animate(t,{duration:200,queue:u})}},show:{target:u,event:"mouseenter",effect:f,delay:90,solo:u,ready:u,autofocus:u},hide:{target:u,event:"mouseleave",effect:f,delay:0,fixed:u,inactive:u,leave:"window",distance:u},style:{classes:"",widget:u,width:u,height:u,def:f},events:{render:s,move:s,show:s,hide:s,toggle:s,visible:s,hidden:s,focus:s,blur:s}};var si,hi="margin",ti="border",pt="color",ct="background-color",rr="transparent",ur=" !important",ii=!!t.createElement("canvas").getContext,fr=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,ci={},wr=["Webkit","O","Moz","ms"];if(ii)var br=n.devicePixelRatio||1,kr=function(){var n=t.createElement("canvas").getContext("2d");return n.backingStorePixelRatio||n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||1}(),lt=br/kr;else li=function(n,t,i){return"<qtipvml:"+n+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(t||"")+' style="behavior: url(#default#VML); '+(i||"")+'" />'};r.extend(bi.prototype,{init:function(n){var t,i;i=this.element=n.elements.tip=r("<div />",{"class":o+"-tip"}).prependTo(n.tooltip);ii?(t=r("<canvas />").appendTo(this.element)[0].getContext("2d"),t.lineJoin="miter",t.miterLimit=1e5,t.save()):(t=li("shape",'coordorigin="0,0"',"position:absolute;"),this.element.html(t+t),n._bind(r("*",i).add(i),["click","mousedown"],function(n){n.stopPropagation()},this._ns));n._bind(n.tooltip,"tooltipmove",this.reposition,this._ns,this);this.create()},_swapDimensions:function(){this.size[0]=this.options.height;this.size[1]=this.options.width},_resetDimensions:function(){this.size[0]=this.options.width;this.size[1]=this.options.height},_useTitle:function(n){var t=this.qtip.elements.titlebar;return t&&(n.y===b||n.y===l&&this.element.position().top+this.size[1]/2+this.options.offset<t.outerHeight(f))},_parseCorner:function(n){var t=this.qtip.options.position.my;return n===u||t===u?n=u:n===f?n=new tt(t.string()):n.string||(n=new tt(n),n.fixed=f),n},_parseWidth:function(n,t,i){var r=this.qtip.elements,u=ti+at(t)+"Width";return(i?ot(i,u):ot(r.content,u)||ot(this._useTitle(n)&&r.titlebar||r.content,u)||ot(r.tooltip,u))||0},_parseRadius:function(n){var t=this.qtip.elements,i=ti+at(n.y)+at(n.x)+"Radius";return v.ie<9?0:ot(this._useTitle(n)&&t.titlebar||t.content,i)||ot(t.tooltip,i)||0},_invalidColour:function(n,t,i){var r=n.css(t);return!r||i&&r===n.css(i)||fr.test(r)?u:r},_parseColours:function(n){var i=this.qtip.elements,u=this.element.css("cssText",""),f=ti+at(n[n.precedance])+at(pt),o=this._useTitle(n)&&i.titlebar||i.content,t=this._invalidColour,e=[];return e[0]=t(u,ct)||t(o,ct)||t(i.content,ct)||t(i.tooltip,ct)||u.css(ct),e[1]=t(u,f,pt)||t(o,f,pt)||t(i.content,f,pt)||t(i.tooltip,f,pt)||i.tooltip.css(f),r("*",u).add(u).css("cssText",ct+":"+rr+ur+";"+ti+":0"+ur+";"),e},_calculateSize:function(n){var o,f,e,s=n.precedance===y,h=this.options.width,r=this.options.height,c="c"===n.abbrev(),l=(s?h:r)*(c?.5:1),i=Math.pow,a=Math.round,u=Math.sqrt(i(l,2)+i(r,2)),t=[this.border/l*u,this.border/r*u];return t[2]=Math.sqrt(i(t[0],2)-i(this.border,2)),t[3]=Math.sqrt(i(t[1],2)-i(this.border,2)),o=u+t[2]+t[3]+(c?0:t[0]),f=o/u,e=[a(f*h),a(f*r)],s?e:e.reverse()},_calculateTip:function(n,t,i){i=i||1;t=t||this.size;var r=t[0]*i,u=t[1]*i,e=Math.ceil(r/2),o=Math.ceil(u/2),f={br:[0,0,r,u,r,0],bl:[0,0,r,0,0,u],tr:[0,u,r,0,r,u],tl:[0,0,0,u,r,u],tc:[0,u,e,0,r,u],bc:[0,0,r,0,e,u],rc:[0,0,r,o,0,u],lc:[r,0,r,u,0,o]};return f.lt=f.br,f.rt=f.bl,f.lb=f.tr,f.rb=f.tl,f[n.abbrev()]},_drawCoords:function(n,t){n.beginPath();n.moveTo(t[0],t[1]);n.lineTo(t[2],t[3]);n.lineTo(t[4],t[5]);n.closePath()},create:function(){var n=this.corner=(ii||v.ie)&&this._parseCorner(this.options.corner);return(this.enabled=!!this.corner&&"c"!==this.corner.abbrev())&&(this.qtip.cache.corner=n.clone(),this.update()),this.element.toggle(this.enabled),this.corner},update:function(t,i){if(!this.enabled)return this;var a,et,h,c,ot,g,o,s,ht=this.qtip.elements,st=this.element,rt=st.children(),ut=this.options,nt=this.size,e=ut.mimic,ft=Math.round;t||(t=this.qtip.cache.corner||this.corner);e===u?e=t:(e=new tt(e),e.precedance=t.precedance,"inherit"===e.x?e.x=t.x:"inherit"===e.y?e.y=t.y:e.x===e.y&&(e[t.precedance]=t[t.precedance]));et=e.precedance;t.precedance===w?this._swapDimensions():this._resetDimensions();a=this.color=this._parseColours(t);a[1]!==rr?(s=this.border=this._parseWidth(t,t[t.precedance]),ut.border&&1>s&&!fr.test(a[1])&&(a[0]=a[1]),this.border=s=ut.border!==f?ut.border:s):this.border=s=0;o=this.size=this._calculateSize(t);st.css({width:o[0],height:o[1],lineHeight:o[1]+"px"});g=t.precedance===y?[ft(e.x===p?s:e.x===k?o[0]-nt[0]-s:(o[0]-nt[0])/2),ft(e.y===b?o[1]-nt[1]:0)]:[ft(e.x===p?o[0]-nt[0]:0),ft(e.y===b?s:e.y===it?o[1]-nt[1]-s:(o[1]-nt[1])/2)];ii?(h=rt[0].getContext("2d"),h.restore(),h.save(),h.clearRect(0,0,6e3,6e3),c=this._calculateTip(e,nt,lt),ot=this._calculateTip(e,this.size,lt),rt.attr(d,o[0]*lt).attr(vt,o[1]*lt),rt.css(d,o[0]).css(vt,o[1]),this._drawCoords(h,ot),h.fillStyle=a[1],h.fill(),h.translate(g[0]*lt,g[1]*lt),this._drawCoords(h,c),h.fillStyle=a[0],h.fill()):(c=this._calculateTip(e),c="m"+c[0]+","+c[1]+" l"+c[2]+","+c[3]+" "+c[4]+","+c[5]+" xe",g[2]=s&&/^(r|b)/i.test(t.string())?8===v.ie?2:1:0,rt.css({coordsize:o[0]+s+" "+(o[1]+s),antialias:""+(e.string().indexOf(l)>-1),left:g[0]-g[2]*Number(et===w),top:g[1]-g[2]*Number(et===y),width:o[0]+s,height:o[1]+s}).each(function(n){var t=r(this);t[t.prop?"prop":"attr"]({coordsize:o[0]+s+" "+(o[1]+s),path:c,fillcolor:a[0],filled:!!n,stroked:!n}).toggle(!(!s&&!n));n||t.html(li("stroke",'weight="'+2*s+'px" color="'+a[1]+'" miterlimit="1000" joinstyle="miter"'))}));n.opera&&setTimeout(function(){ht.tip.css({display:"inline-block",visibility:"visible"})},1);i!==u&&this.calculate(t,o)},calculate:function(n,t){if(!this.enabled)return u;var i,o,e=this,s=this.qtip.elements,c=this.element,h=this.options.offset,f=(s.tooltip.hasClass("ui-widget"),{});return n=n||this.corner,i=n.precedance,t=t||this._calculateSize(n),o=[n.x,n.y],i===w&&o.reverse(),r.each(o,function(r,u){var o,a,c;u===l?(o=i===y?p:b,f[o]="50%",f[hi+"-"+o]=-Math.round(t[i===y?0:1]/2)+h):(o=e._parseWidth(n,u,s.tooltip),a=e._parseWidth(n,u,s.content),c=e._parseRadius(n),f[u]=Math.max(-e.border,r?a:h+(c>o?c:-o)))}),f[n[i]]-=t[i===w?0:1],c.css({margin:"",top:"",bottom:"",left:"",right:""}).css(f),f},reposition:function(n,t,r){function tt(n,t,i,r,u){n===et&&s.precedance===t&&h[r]&&s[i]!==l?s.precedance=s.precedance===w?y:w:n!==et&&h[r]&&(s[t]=s[t]===l?h[r]>0?r:u:s[t]===r?u:r)}function rt(n,t,f){s[n]===l?nt[hi+"-"+t]=o[n]=e[hi+"-"+t]-h[t]:(a=e[f]!==i?[h[t],-e[t]]:[-h[t],e[t]],(o[n]=Math.max(a[0],a[1]))>a[0]&&(r[t]-=h[t],o[t]=u),nt[e[f]!==i?f:t]=o[n])}if(this.enabled){var e,a,c=t.cache,s=this.corner.clone(),h=r.adjusted,v=t.options.position.adjust.method.split(" "),d=v[0],g=v[1]||v[0],o={left:u,top:u,x:0,y:0},nt={};this.corner.fixed!==f&&(tt(d,w,y,p,k),tt(g,y,w,b,it),(s.string()!==c.corner.string()||c.cornerTop!==h.top||c.cornerLeft!==h.left)&&this.update(s,u));e=this.calculate(s);e.right!==i&&(e.left=-e.right);e.bottom!==i&&(e.top=-e.bottom);e.user=this.offset;(o.left=d===et&&!!h.left)&&rt(w,p,k);(o.top=g===et&&!!h.top)&&rt(y,b,it);this.element.css(nt).toggle(!(o.x&&o.y||s.x===l&&o.y||s.y===l&&o.x));r.left-=e.left.charAt?e.user:d!==et||o.top||!o.left&&!o.top?e.left+this.border:0;r.top-=e.top.charAt?e.user:g!==et||o.left||!o.left&&!o.top?e.top+this.border:0;c.cornerLeft=h.left;c.cornerTop=h.top;c.corner=s.clone()}},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns);this.qtip.elements.tip&&this.qtip.elements.tip.find("*").remove().end().remove()}});si=h.tip=function(n){return new bi(n,n.options.style.tip)};si.initialize="render";si.sanitize=function(n){if(n.style&&"tip"in n.style){var t=n.style.tip;"object"!=typeof t&&(t=n.style.tip={corner:t});/string|boolean/i.test(typeof t.corner)||(t.corner=f)}};dt.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){this.create();this.qtip.reposition()},"^style.tip.(height|width)$":function(n){this.size=[n.width,n.height];this.update();this.qtip.reposition()},"^content.title|style.(classes|widget)$":function(){this.update()}};r.extend(f,c.defaults,{style:{tip:{corner:f,mimic:u,width:6,height:6,border:f,offset:0}}});ri="qtip-modal";nt="."+ri;g=function(){function l(n){if(r.expr[":"].focusable)return r.expr[":"].focusable;var t,i,u,e=!isNaN(r.attr(n,"tabindex")),f=n.nodeName&&n.nodeName.toLowerCase();return"area"===f?(t=n.parentNode,i=t.name,n.href&&i&&"map"===t.nodeName.toLowerCase()?(u=r("img[usemap=#"+i+"]")[0],!!u&&u.is(":visible")):!1):/input|select|textarea|button|object/.test(f)?!n.disabled:"a"===f?n.href||e:e}function h(n){o.length<1&&n.length?n.not("body").blur():o.first().focus()}function a(t){if(n.is(":visible")){var e,f=r(t.target),s=i.tooltip,c=f.closest(rt);e=c.length<1?u:parseInt(c[0].style.zIndex,10)>parseInt(s[0].style.zIndex,10);e||f.closest(rt)[0]===s[0]||h(f);v=t.target===o[o.length-1]}}var i,v,c,n,e=this,o={};r.extend(e,{init:function(){return n=e.elem=r("<div />",{id:"qtip-overlay",html:"<div><\/div>",mousedown:function(){return u}}).hide(),r(t.body).bind("focusin"+nt,a),r(t).bind("keydown"+nt,function(n){i&&i.options.show.modal.escape&&27===n.keyCode&&i.hide(n)}),n.bind("click"+nt,function(n){i&&i.options.show.modal.blur&&i.hide(n)}),e},update:function(n){i=n;o=n.options.show.modal.stealfocus!==u?n.tooltip.find("*").filter(function(){return l(this)}):[]},toggle:function(o,l,a){var p=(r(t.body),o.tooltip),v=o.options.show.modal,y=v.effect,w=l?"show":"hide",b=n.is(":visible"),k=r(nt).filter(":visible:not(:animated)").not(p);return e.update(o),l&&v.stealfocus!==u&&h(r(":focus")),n.toggleClass("blurs",v.blur),l&&n.appendTo(t.body),n.is(":animated")&&b===l&&c!==u||!l&&k.length?e:(n.stop(f,u),r.isFunction(y)?y.call(n,l):y===u?n[w]():n.fadeTo(parseInt(a,10)||90,l?1:0,function(){l||n.hide()}),l||n.queue(function(t){n.css({left:"",top:""});r(nt).length||n.detach();t()}),c=l,i.destroyed&&(i=s),e)}});e.init()};g=new g;r.extend(ki.prototype,{init:function(n){var t=n.tooltip;return this.options.on?(n.elements.overlay=g.elem,t.addClass(ri).css("z-index",c.modal_zindex+r(nt).length),n._bind(t,["tooltipshow","tooltiphide"],function(n,i,u){var f=n.originalEvent;if(n.target===t[0])if(f&&"tooltiphide"===n.type&&/mouse(leave|enter)/.test(f.type)&&r(f.relatedTarget).closest(g.elem[0]).length)try{n.preventDefault()}catch(e){}else(!f||f&&"tooltipsolo"!==f.type)&&this.toggle(n,"tooltipshow"===n.type,u)},this._ns,this),n._bind(t,"tooltipfocus",function(n,i){if(!n.isDefaultPrevented()&&n.target===t[0]){var u=r(nt),f=c.modal_zindex+u.length,e=parseInt(t[0].style.zIndex,10);g.elem[0].style.zIndex=f-1;u.each(function(){this.style.zIndex>e&&(this.style.zIndex-=1)});u.filter("."+st).qtip("blur",n.originalEvent);t.addClass(st)[0].style.zIndex=f;g.update(i);try{n.preventDefault()}catch(o){}}},this._ns,this),void n._bind(t,"tooltiphide",function(n){n.target===t[0]&&r(nt).filter(":visible").not(t).last().qtip("focus",n)},this._ns,this)):this},toggle:function(n,t,i){return n&&n.isDefaultPrevented()?this:void g.toggle(this.qtip,!!t,i)},destroy:function(){this.qtip.tooltip.removeClass(ri);this.qtip._unbind(this.qtip.tooltip,this._ns);g.toggle(this.qtip,u);delete this.qtip.elements.overlay}});ai=h.modal=function(n){return new ki(n,n.options.show.modal)};ai.sanitize=function(n){n.show&&("object"!=typeof n.show.modal?n.show.modal={on:!!n.show.modal}:"undefined"==typeof n.show.modal.on&&(n.show.modal.on=f))};c.modal_zindex=c.zindex-200;ai.initialize="render";dt.modal={"^show.modal.(on|blur)$":function(){this.destroy();this.init();this.qtip.elems.overlay.toggle(this.qtip.tooltip[0].offsetWidth>0)}};r.extend(f,c.defaults,{show:{modal:{on:u,effect:f,blur:f,stealfocus:f,escape:f}}});h.viewport=function(i,r,f,e,o,s,h){function at(n,t,i,u,f,e,o,s,h){var y=r[f],c=v[n],k=kt[n],rt=i===et,tt=c===f?h:c===e?-h:-h/2,ut=k===f?s:k===e?-s:-s/2,it=st[f]+nt[f]-(yt?0:g[f]),b=it-y,w=y+h-(o===d?ft:ot)-it,p=tt-(v.precedance===n||c===v[t]?ut:0)-(k===l?s/2:0);return rt?(p=(c===f?1:-1)*tt,r[f]+=b>0?b:w>0?-w:0,r[f]=Math.max(-g[f]+nt[f],y-p,Math.min(Math.max(-g[f]+nt[f]+(o===d?ft:ot),y+p),r[f],"center"===c?y-tt:1e9))):(u*=i===vr?2:0,b>0&&(c!==f||w>0)?(r[f]-=p+u,a.invert(n,f)):w>0&&(c!==e||b>0)&&(r[f]-=(c===l?-p:p)+u,a.invert(n,e)),r[f]<st&&-r[f]>w&&(r[f]=y,a=v.clone())),r[f]-y}var ut,a,g,yt,ft,ot,st,nt,pt=f.target,bt=i.elements.tooltip,v=f.my,kt=f.at,tt=f.adjust,ht=tt.method.split(" "),ct=ht[0],lt=ht[1]||ht[0],c=f.viewport,wt=f.container,rt=(i.cache,{left:0,top:0});return c.jquery&&pt[0]!==n&&pt[0]!==t.body&&"none"!==tt.method?(g=wt.offset()||rt,yt="static"===wt.css("position"),ut="fixed"===bt.css("position"),ft=c[0]===n?c.width():c.outerWidth(u),ot=c[0]===n?c.height():c.outerHeight(u),st={left:ut?0:c.scrollLeft(),top:ut?0:c.scrollTop()},nt=c.offset()||rt,("shift"!==ct||"shift"!==lt)&&(a=v.clone()),rt={left:"none"!==ct?at(w,y,ct,tt.x,p,k,d,e,s):0,top:"none"!==lt?at(y,w,lt,tt.y,b,it,vt,o,h):0,my:a}):rt};h.polys={polygon:function(n,t){for(var r,h,c,i={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10},adjustable:u},f=0,e=[],o=1,s=1,a=0,v=0,f=n.length;f--;)r=[parseInt(n[--f],10),parseInt(n[f+1],10)],r[0]>i.position.right&&(i.position.right=r[0]),r[0]<i.position.left&&(i.position.left=r[0]),r[1]>i.position.bottom&&(i.position.bottom=r[1]),r[1]<i.position.top&&(i.position.top=r[1]),e.push(r);if(h=i.width=Math.abs(i.position.right-i.position.left),c=i.height=Math.abs(i.position.bottom-i.position.top),"c"===t.abbrev())i.position={left:i.position.left+i.width/2,top:i.position.top+i.height/2};else{for(;h>0&&c>0&&o>0&&s>0;)for(h=Math.floor(h/2),c=Math.floor(c/2),t.x===p?o=h:t.x===k?o=i.width-h:o+=Math.floor(h/2),t.y===b?s=c:t.y===it?s=i.height-c:s+=Math.floor(c/2),f=e.length;f--&&!(e.length<2);)a=e[f][0]-i.position.left,v=e[f][1]-i.position.top,(t.x===p&&a>=o||t.x===k&&o>=a||t.x===l&&(o>a||a>i.width-o)||t.y===b&&v>=s||t.y===it&&s>=v||t.y===l&&(s>v||v>i.height-s))&&e.splice(f,1);i.position={left:e[0][0],top:e[0][1]}}return i},rect:function(n,t,i,r){return{width:Math.abs(i-n),height:Math.abs(r-t),position:{left:Math.min(n,i),top:Math.min(t,r)}}},_angles:{tc:1.5,tr:7/4,tl:5/4,bc:.5,br:.25,bl:.75,rc:2,lc:1,c:0},ellipse:function(n,t,i,r,f){var e=h.polys._angles[f.abbrev()],o=0===e?0:i*Math.cos(e*Math.PI),s=r*Math.sin(e*Math.PI);return{width:2*i-Math.abs(o),height:2*r-Math.abs(s),position:{left:n+o,top:t+s},adjustable:u}},circle:function(n,t,i,r){return h.polys.ellipse(n,t,i,i,r)}};h.svg=function(n,i,f){for(var a,b,p,k,w,v,s,o,c,e=(r(t),i[0]),y=r(e.ownerSVGElement),l=e.ownerDocument,d=(parseInt(i.css("stroke-width"),10)||0)/2;!e.getBBox;)e=e.parentNode;if(!e.getBBox||!e.parentNode)return u;switch(e.nodeName){case"ellipse":case"circle":o=h.polys.ellipse(e.cx.baseVal.value,e.cy.baseVal.value,(e.rx||e.r).baseVal.value+d,(e.ry||e.r).baseVal.value+d,f);break;case"line":case"polygon":case"polyline":for(s=e.points||[{x:e.x1.baseVal.value,y:e.y1.baseVal.value},{x:e.x2.baseVal.value,y:e.y2.baseVal.value}],o=[],v=-1,k=s.numberOfItems||s.length;++v<k;)w=s.getItem?s.getItem(v):s[v],o.push.apply(o,[w.x,w.y]);o=h.polys.polygon(o,f);break;default:o=e.getBBox();o={width:o.width,height:o.height,position:{left:o.x,top:o.y}}}return c=o.position,y=y[0],y.createSVGPoint&&(b=e.getScreenCTM(),s=y.createSVGPoint(),s.x=c.left,s.y=c.top,p=s.matrixTransform(b),c.left=p.x,c.top=p.y),l!==t&&"mouse"!==n.position.target&&(a=r((l.defaultView||l.parentWindow).frameElement).offset(),a&&(c.left+=a.left,c.top+=a.top)),l=r(l),c.left+=l.scrollLeft(),c.top+=l.scrollTop(),o};h.imagemap=function(n,t,i){t.jquery||(t=r(t));var e,s,c,o,v,l=(t.attr("shape")||"rect").toLowerCase().replace("poly","polygon"),f=r('img[usemap="#'+t.parent("map").attr("name")+'"]'),y=r.trim(t.attr("coords")),a=y.replace(/,$/,"").split(",");if(!f.length)return u;if("polygon"===l)o=h.polys.polygon(a,i);else{if(!h.polys[l])return u;for(c=-1,v=a.length,s=[];++c<v;)s.push(parseInt(a[c],10));o=h.polys[l].apply(this,s.concat(i))}return e=f.offset(),e.left+=Math.ceil((f.outerWidth(u)-f.width())/2),e.top+=Math.ceil((f.outerHeight(u)-f.height())/2),o.position.left+=e.left,o.position.top+=e.top,o};or='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';"  style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"><\/iframe>';r.extend(di.prototype,{_scroll:function(){var t=this.qtip.elements.overlay;t&&(t[0].style.top=r(n).scrollTop()+"px")},init:function(i){var u=i.tooltip;r("select, object").length<1&&(this.bgiframe=i.elements.bgiframe=r(or).appendTo(u),i._bind(u,"tooltipmove",this.adjustBGIFrame,this._ns,this));this.redrawContainer=r("<div/>",{id:o+"-rcontainer"}).appendTo(t.body);i.elements.overlay&&i.elements.overlay.addClass("qtipmodal-ie6fix")&&(i._bind(n,["scroll","resize"],this._scroll,this._ns,this),i._bind(u,["tooltipshow"],this._scroll,this._ns,this));this.redraw()},adjustBGIFrame:function(){var t,n,i=this.qtip.tooltip,e={height:i.outerHeight(u),width:i.outerWidth(u)},r=this.qtip.plugins.tip,f=this.qtip.elements.tip;n=parseInt(i.css("borderLeftWidth"),10)||0;n={left:-n,top:-n};r&&f&&(t="x"===r.corner.precedance?[d,p]:[vt,b],n[t[1]]-=f[t[0]]());this.bgiframe.css(n).css(e)},redraw:function(){if(this.qtip.rendered<1||this.drawing)return this;var f,n,t,i,r=this.qtip.tooltip,u=this.qtip.options.style,e=this.qtip.options.position.container;return this.qtip.drawing=1,u.height&&r.css(vt,u.height),u.width?r.css(d,u.width):(r.css(d,"").appendTo(this.redrawContainer),n=r.width(),1>n%2&&(n+=1),t=r.css("maxWidth")||"",i=r.css("minWidth")||"",f=(t+i).indexOf("%")>-1?e.width()/100:0,t=(t.indexOf("%")>-1?f:1)*parseInt(t,10)||n,i=(i.indexOf("%")>-1?f:1)*parseInt(i,10)||0,n=t+i?Math.min(Math.max(n,i),t):n,r.css(d,Math.round(n)).appendTo(e)),this.drawing=0,this},destroy:function(){this.bgiframe&&this.bgiframe.remove();this.qtip._unbind([n,this.qtip.tooltip],this._ns)}});er=h.ie6=function(n){return 6===v.ie?new di(n):u};er.initialize="render";dt.ie6={"^content|style$":function(){this.redraw()}}})}(window,document),function(n){function t(t,i){var u,r=this,e=window.navigator,l=e.userAgent.toLowerCase(),s,o,a,y;r.uid=n.rsModules.uid++;r.ns=".rs"+r.uid;var h=document.createElement("div").style,f=["webkit","Moz","ms","O"],o="",v=0,c;for(u=0;u<f.length;u++)c=f[u],!o&&c+"Transform"in h&&(o=c),c=c.toLowerCase(),window.requestAnimationFrame||(window.requestAnimationFrame=window[c+"RequestAnimationFrame"],window.cancelAnimationFrame=window[c+"CancelAnimationFrame"]||window[c+"CancelRequestAnimationFrame"]);for(window.requestAnimationFrame||(window.requestAnimationFrame=function(n){var t=(new Date).getTime(),i=Math.max(0,16-(t-v)),r=window.setTimeout(function(){n(t+i)},i);return v=t+i,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(n){clearTimeout(n)}),r.isIPAD=l.match(/(ipad)/),r.isIOS=r.isIPAD||l.match(/(iphone|ipod)/),u=function(n){return n=/(chrome)[ \/]([\w.]+)/.exec(n)||/(webkit)[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(n)||/(msie) ([\w.]+)/.exec(n)||0>n.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(n)||[],{browser:n[1]||"",version:n[2]||"0"}}(l),f={},u.browser&&(f[u.browser]=!0,f.version=u.version),f.chrome&&(f.webkit=!0),r._a=f,r.isAndroid=-1<l.indexOf("android"),r.slider=n(t),r.ev=n(r),r._b=n(document),r.st=n.extend({},n.fn.royalSlider.defaults,i),r._c=r.st.transitionSpeed,r._d=0,r.st.allowCSS3&&(!f.webkit||r.st.allowCSS3OnWebkit)&&(u=o+(o?"T":"t"),r._e=(u+"ransform"in h)&&(u+"ransition"in h),r._e&&(r._f=(o+(o?"P":"p")+"erspective"in h))),o=o.toLowerCase(),r._g="-"+o+"-",r._h="vertical"===r.st.slidesOrientation?!1:!0,r._i=r._h?"left":"top",r._j=r._h?"width":"height",r._k=-1,r._l="fade"===r.st.transitionType?!1:!0,r._l||(r.st.sliderDrag=!1,r._m=10),r._n="z-index:0; display:none; opacity:0;",r._o=0,r._p=0,r._q=0,n.each(n.rsModules,function(n,t){"uid"!==n&&t.call(r)}),r.slides=[],r._r=0,(r.st.slides?n(r.st.slides):r.slider.children().detach()).each(function(){r._s(this,!0)}),r.st.randomizeSlides&&r.slides.sort(function(){return.5-Math.random()}),r.numSlides=r.slides.length,r._t(),r.st.startSlideId?r.st.startSlideId>r.numSlides-1&&(r.st.startSlideId=r.numSlides-1):r.st.startSlideId=0,r._o=r.staticSlideId=r.currSlideId=r._u=r.st.startSlideId,r.currSlide=r.slides[r.currSlideId],r._v=0,r.pointerMultitouch=!1,r.slider.addClass((r._h?"rsHor":"rsVer")+(r._l?"":" rsFade")),h='<div class="rsOverflow"><div class="rsContainer">',r.slidesSpacing=r.st.slidesSpacing,r._w=(r._h?r.slider.width():r.slider.height())+r.st.slidesSpacing,r._x=Boolean(0<r._y),1>=r.numSlides&&(r._z=!1),r._a1=r._z&&r._l?2===r.numSlides?1:2:0,r._b1=6>r.numSlides?r.numSlides:6,r._c1=0,r._d1=0,r.slidesJQ=[],u=0;u<r.numSlides;u++)r.slidesJQ.push(n('<div style="'+(r._l?"":u!==r.currSlideId?r._n:"z-index:0;")+'" class="rsSlide "><\/div>'));r._e1=h=n(h+"<\/div><\/div>");s=r.ns;o=function(n,t,i,u,f){r._j1=n+t+s;r._k1=n+i+s;r._l1=n+u+s;f&&(r._m1=n+f+s)};u=e.pointerEnabled;r.pointerEnabled=u||e.msPointerEnabled;r.pointerEnabled?(r.hasTouch=!1,r._n1=.2,r.pointerMultitouch=Boolean(1<e[(u?"m":"msM")+"axTouchPoints"]),u?o("pointer","down","move","up","cancel"):o("MSPointer","Down","Move","Up","Cancel")):(r.isIOS?r._j1=r._k1=r._l1=r._m1="":o("mouse","down","move","up"),"ontouchstart"in window||"createTouch"in document?(r.hasTouch=!0,r._j1+=" touchstart"+s,r._k1+=" touchmove"+s,r._l1+=" touchend"+s,r._m1+=" touchcancel"+s,r._n1=.5,r.st.sliderTouch&&(r._f1=!0)):(r.hasTouch=!1,r._n1=.2));r.st.sliderDrag&&(r._f1=!0,f.msie||f.opera?r._g1=r._h1="move":f.mozilla?(r._g1="-moz-grab",r._h1="-moz-grabbing"):f.webkit&&-1!=e.platform.indexOf("Mac")&&(r._g1="-webkit-grab",r._h1="-webkit-grabbing"),r._i1());r.slider.html(h);r._o1=r.st.controlsInside?r._e1:r.slider;r._p1=r._e1.children(".rsContainer");r.pointerEnabled&&r._p1.css((u?"":"-ms-")+"touch-action",r._h?"pan-y":"pan-x");r._q1=n('<div class="rsPreloader"><\/div>');e=r._p1.children(".rsSlide");r._r1=r.slidesJQ[r.currSlideId];r._s1=0;r._e?(r._t1="transition-property",r._u1="transition-duration",r._v1="transition-timing-function",r._w1=r._x1=r._g+"transform",r._f?(f.webkit&&!f.chrome&&r.slider.addClass("rsWebkit3d"),r._y1="translate3d(",r._z1="px, ",r._a2="px, 0px)"):(r._y1="translate(",r._z1="px, ",r._a2="px)"),r._l?r._p1[r._g+r._t1]=r._g+"transform":(f={},f[r._g+r._t1]="opacity",f[r._g+r._u1]=r.st.transitionSpeed+"ms",f[r._g+r._v1]=r.st.css3easeInOut,e.css(f))):(r._x1="left",r._w1="top");n(window).on("resize"+r.ns,function(){a&&clearTimeout(a);a=setTimeout(function(){r.updateSliderSize()},50)});if(r.ev.trigger("rsAfterPropsSetup"),r.updateSliderSize(),r.st.keyboardNavEnabled&&r._b2(),r.st.arrowsNavHideOnTouch&&(r.hasTouch||r.pointerMultitouch)&&(r.st.arrowsNav=!1),r.st.arrowsNav&&(e=r._o1,n('<div class="rsArrow rsArrowLeft"><div class="rsArrowIcn"><\/div><\/div><div class="rsArrow rsArrowRight"><div class="rsArrowIcn"><\/div><\/div>').appendTo(e),r._c2=e.children(".rsArrowLeft").click(function(n){n.preventDefault();r.prev()}),r._d2=e.children(".rsArrowRight").click(function(n){n.preventDefault();r.next()}),r.st.arrowsNavAutoHide&&!r.hasTouch&&(r._c2.addClass("rsHidden"),r._d2.addClass("rsHidden"),e.one("mousemove.arrowshover",function(){r._c2.removeClass("rsHidden");r._d2.removeClass("rsHidden")}),e.hover(function(){r._e2||(r._c2.removeClass("rsHidden"),r._d2.removeClass("rsHidden"))},function(){r._e2||(r._c2.addClass("rsHidden"),r._d2.addClass("rsHidden"))})),r.ev.on("rsOnUpdateNav",function(){r._f2()}),r._f2()),r.hasTouch&&r.st.sliderTouch||!r.hasTouch&&r.st.sliderDrag)r._p1.on(r._j1,function(n){r._g2(n)});else r.dragSuccess=!1;y=["rsPlayBtnIcon","rsPlayBtn","rsCloseVideoBtn","rsCloseVideoIcn"];r._p1.click(function(t){if(!r.dragSuccess){var i=n(t.target).attr("class");if(-1!==n.inArray(i,y)&&r.toggleVideo())return!1;if(r.st.navigateByClick&&!r._h2){if(n(t.target).closest(".rsNoDrag",r._r1).length)return!0;r._i2(t)}r.ev.trigger("rsSlideClick",t)}}).on("click.rs","a",function(){if(r.dragSuccess)return!1;r._h2=!0;setTimeout(function(){r._h2=!1},3)});r.ev.trigger("rsAfterInit")}n.rsModules||(n.rsModules={uid:0});t.prototype={constructor:t,_i2:function(n){n=n[this._h?"pageX":"pageY"]-this._j2;n>=this._q?this.next():0>n&&this.prev()},_t:function(){var n;n=this.st.numImagesToPreload;(this._z=this.st.loop)&&(2===this.numSlides?(this._z=!1,this.st.loopRewind=!0):2>this.numSlides&&(this.st.loopRewind=this._z=!1));this._z&&0<n&&(4>=this.numSlides?n=1:this.st.numImagesToPreload>(this.numSlides-1)/2&&(n=Math.floor((this.numSlides-1)/2)));this._y=n},_s:function(t,i){function e(n,t){if(t?r.images.push(n.attr(t)):r.images.push(n.text()),s){s=!1;r.caption="src"===t?n.attr("alt"):n.contents();r.image=r.images[0];r.videoURL=n.attr("data-rsVideo");var i=n.attr("data-rsw"),f=n.attr("data-rsh");"undefined"!=typeof i&&!1!==i&&"undefined"!=typeof f&&!1!==f?(r.iW=parseInt(i,10),r.iH=parseInt(f,10)):u.st.imgWidth&&u.st.imgHeight&&(r.iW=u.st.imgWidth,r.iH=u.st.imgHeight)}}var u=this,o,r={},f,s=!0;return t=n(t),u._k2=t,u.ev.trigger("rsBeforeParseNode",[t,r]),r.stopParsing?void 0:(t=u._k2,r.id=u._r,r.contentAdded=!1,u._r++,r.images=[],r.isBig=!1,r.hasCover||(t.hasClass("rsImg")?(f=t,o=!0):(f=t.find(".rsImg"),f.length&&(o=!0)),o?(r.bigImage=f.eq(0).attr("data-rsBigImg"),f.each(function(){var t=n(this);t.is("a")?e(t,"href"):t.is("img")?e(t,"src"):e(t)})):t.is("img")&&(t.addClass("rsImg rsMainSlideImage"),e(t,"src"))),f=t.find(".rsCaption"),f.length&&(r.caption=f.remove()),r.content=t,u.ev.trigger("rsAfterParseNode",[t,r]),i&&u.slides.push(r),0===r.images.length&&(r.isLoaded=!0,r.isRendered=!1,r.isLoading=!1,r.images=null),r)},_b2:function(){var n=this,t,i,r=function(t){37===t?n.prev():39===t&&n.next()};n._b.on("keydown"+n.ns,function(u){if(!n.st.keyboardNavEnabled)return!0;if(!(n._l2||(i=u.keyCode,37!==i&&39!==i||t))){if(document.activeElement&&/(INPUT|SELECT|TEXTAREA)/i.test(document.activeElement.tagName))return!0;n.isFullscreen&&u.preventDefault();r(i);t=setInterval(function(){r(i)},700)}}).on("keyup"+n.ns,function(){t&&(clearInterval(t),t=null)})},goTo:function(n,t){n!==this.currSlideId&&this._m2(n,this.st.transitionSpeed,!0,!t)},destroy:function(t){this.ev.trigger("rsBeforeDestroy");this._b.off("keydown"+this.ns+" keyup"+this.ns+" "+this._k1+" "+this._l1);this._p1.off(this._j1+" click");this.slider.data("royalSlider",null);n.removeData(this.slider,"royalSlider");n(window).off("resize"+this.ns);this.loadingTimeout&&clearTimeout(this.loadingTimeout);t&&this.slider.remove();this.ev=this.slider=this.slides=null},_n2:function(t,i){function v(i,u,f){i.isAdded?(y(u,i),p(u,i)):(f||(f=r.slidesJQ[u]),i.holder?f=i.holder:(f=r.slidesJQ[u]=n(f),i.holder=f),i.appendOnLoaded=!1,p(u,i,f),y(u,i),r._p2(i,f,t),i.isAdded=!0)}function y(n,i){i.contentAdded||(r.setItemHtml(i,t),t||(i.contentAdded=!0))}function p(n,t,i){r._l&&(i||(i=r.slidesJQ[n]),i.css(r._i,(n+r._d1+a)*r._w))}function s(n){if(k){if(n>l-1)return s(n-l);if(0>n)return s(l+n)}return n}var r=this,e,u,k=r._z,l=r.numSlides;if(!isNaN(i))return s(i);var f=r.currSlideId,a,h=t?Math.abs(r._o2-r.currSlideId)>=r.numSlides-1?0:1:r._y,c=Math.min(2,h),w=!1,b=!1,o;for(u=f;u<f+1+c;u++)if(o=s(u),(e=r.slides[o])&&(!e.isAdded||!e.positionSet)){w=!0;break}for(u=f-1;u>f-1-c;u--)if(o=s(u),(e=r.slides[o])&&(!e.isAdded||!e.positionSet)){b=!0;break}if(w)for(u=f;u<f+h+1;u++)o=s(u),a=Math.floor((r._u-(f-u))/r.numSlides)*r.numSlides,(e=r.slides[o])&&v(e,o);if(b)for(u=f-1;u>f-1-h;u--)o=s(u),a=Math.floor((r._u-(f-u))/l)*l,(e=r.slides[o])&&v(e,o);if(!t)for(c=s(f-h),f=s(f+h),h=c>f?0:c,u=0;u<l;u++)c>f&&u>c-1||!(u<h||u>f)||(e=r.slides[u])&&e.holder&&(e.holder.detach(),e.isAdded=!1)},setItemHtml:function(t,i){var r=this,e=function(){var i,e,u,s;if(t.images){if(!t.isLoading)if(t.content.hasClass("rsImg")?(i=t.content,e=!0):i=t.content.find(".rsImg:not(img)"),i&&!i.is("img")&&i.each(function(){var i=n(this),r='<img class="rsImg" src="'+(i.is("a")?i.attr("href"):i.text())+'" />';e?t.content=n(r):i.replaceWith(r)}),i=e?t.content:t.content.find("img.rsImg"),h(),i.eq(0).addClass("rsMainSlideImage"),t.iW&&t.iH&&(t.isLoaded||r._q2(t),f()),t.isLoading=!0,t.isBig)n("<img />").on("load.rs error.rs",function(){n(this).off("load.rs error.rs");o([this],!0)}).attr("src",t.image);else for(t.loaded=[],t.numStartedLoad=0,i=function(){n(this).off("load.rs error.rs");t.loaded.push(this);t.loaded.length===t.numStartedLoad&&o(t.loaded,!1)},u=0;u<t.images.length;u++)s=n("<img />"),t.numStartedLoad++,s.on("load.rs error.rs",i).attr("src",t.images[u])}else t.isRendered=!0,t.isLoaded=!0,t.isLoading=!1,f(!0)},o=function(n,i){var f,r;n.length?(f=n[0],i!==t.isBig?(f=t.holder.children())&&1<f.length&&c():t.iW&&t.iH?u():(t.iW=f.width,t.iH=f.height,t.iW&&t.iH)?u():(r=new Image,r.onload=function(){r.width?(t.iW=r.width,t.iH=r.height,u()):setTimeout(function(){r.width&&(t.iW=r.width,t.iH=r.height);u()},1e3)},r.src=f.src)):u()},u=function(){t.isLoaded=!0;t.isLoading=!1;f();c();s()},f=function(){if(!t.isAppended&&r.ev){var n=r.st.visibleNearby,u=t.id-r._o;!i&&!t.appendOnLoaded&&r.st.fadeinLoadedSlide&&(0===u||(n||r._r2||r._l2)&&(-1===u||1===u))&&(n={visibility:"visible",opacity:0},n[r._g+"transition"]="opacity 400ms ease-in-out",t.content.css(n),setTimeout(function(){t.content.css("opacity",1)},16));t.holder.find(".rsPreloader").length?t.holder.append(t.content):t.holder.html(t.content);t.isAppended=!0;t.isLoaded&&(r._q2(t),s());t.sizeReady||(t.sizeReady=!0,setTimeout(function(){r.ev.trigger("rsMaybeSizeReady",t)},100))}},s=function(){!t.loadedTriggered&&r.ev&&(t.isLoaded=t.loadedTriggered=!0,t.holder.trigger("rsAfterContentSet"),r.ev.trigger("rsAfterContentSet",t))},h=function(){r.st.usePreloader&&t.holder.html(r._q1.clone())},c=function(n){r.st.usePreloader&&(n=t.holder.find(".rsPreloader"),n.length&&n.remove())};t.isLoaded?f():i?!r._l&&t.images&&t.iW&&t.iH?e():(t.holder.isWaiting=!0,h(),t.holder.slideId=-99):e()},_p2:function(n){this._p1.append(n.holder);n.appendOnLoaded=!1},_g2:function(t,i){var r=this,u,f="touchstart"===t.type,e;if(r._s2=f,r.ev.trigger("rsDragStart"),n(t.target).closest(".rsNoDrag",r._r1).length)return r.dragSuccess=!1,!0;if(!i&&r._r2&&(r._t2=!0,r._u2()),r.dragSuccess=!1,r._l2)f&&(r._v2=!0);else{if(f&&(r._v2=!1),r._w2(),f)if(e=t.originalEvent.touches,e&&0<e.length)u=e[0],1<e.length&&(r._v2=!0);else return;else t.preventDefault(),u=t,r.pointerEnabled&&(u=u.originalEvent);r._l2=!0;r._b.on(r._k1,function(n){r._x2(n,i)}).on(r._l1,function(n){r._y2(n,i)});if(r._z2="",r._a3=!1,r._b3=u.pageX,r._c3=u.pageY,r._d3=r._v=(i?r._e3:r._h)?u.pageX:u.pageY,r._f3=0,r._g3=0,r._h3=i?r._i3:r._p,r._j3=(new Date).getTime(),f)r._e1.on(r._m1,function(n){r._y2(n,i)})}},_k3:function(n,t){if(this._l3){var o=this._m3,i=n.pageX-this._b3,f=n.pageY-this._c3,r=this._h3+i,u=this._h3+f,e=t?this._e3:this._h,r=e?r:u,u=this._z2;this._a3=!0;this._b3=n.pageX;this._c3=n.pageY;"x"===u&&0!==i?this._f3=0<i?1:-1:"y"===u&&0!==f&&(this._g3=0<f?1:-1);u=e?this._b3:this._c3;i=e?i:f;t?r>this._n3?r=this._h3+i*this._n1:r<this._o3&&(r=this._h3+i*this._n1):this._z||(0>=this.currSlideId&&0<u-this._d3&&(r=this._h3+i*this._n1),this.currSlideId>=this.numSlides-1&&0>u-this._d3&&(r=this._h3+i*this._n1));this._h3=r;200<o-this._j3&&(this._j3=o,this._v=u);t?this._q3(this._h3):this._l&&this._p3(this._h3)}},_x2:function(n,t){var i=this,r,f="touchmove"===n.type,u;if(!i._s2||f){if(f){if(i._r3)return;if(u=n.originalEvent.touches,u){if(1<u.length)return;r=u[0]}else return}else r=n,i.pointerEnabled&&(r=r.originalEvent);if(i._a3||(i._e&&(t?i._s3:i._p1).css(i._g+i._u1,"0s"),function e(){i._l2&&(i._t3=requestAnimationFrame(e),i._u3&&i._k3(i._u3,t))}()),i._l3)n.preventDefault(),i._m3=(new Date).getTime(),i._u3=r;else if(u=t?i._e3:i._h,r=Math.abs(r.pageX-i._b3)-Math.abs(r.pageY-i._c3)-(u?-7:7),7<r){if(u)n.preventDefault(),i._z2="x";else if(f){i._v3(n);return}i._l3=!0}else if(-7>r){if(u){if(f){i._v3(n);return}}else n.preventDefault(),i._z2="y";i._l3=!0}}},_v3:function(n){this._r3=!0;this._a3=this._l2=!1;this._y2(n)},_y2:function(t,i){function v(n){return 100>n?100:500<n?500:n}function c(n,t){(r._l||i)&&(s=(-r._u-r._d1)*r._w,y=Math.abs(r._p-s),r._c=y/t,n&&(r._c+=250),r._c=v(r._c),r._x3(s,!1))}var r=this,o,u,s,y,f,a,e,h;if(o=-1<t.type.indexOf("touch"),!r._s2||o)if(r._s2=!1,r.ev.trigger("rsDragRelease"),r._u3=null,r._l2=!1,r._r3=!1,r._l3=!1,r._m3=0,cancelAnimationFrame(r._t3),r._a3&&(i?r._q3(r._h3):r._l&&r._p3(r._h3)),r._b.off(r._k1).off(r._l1),o&&r._e1.off(r._m1),r._i1(),!r._a3&&!r._v2&&i&&r._w3)f=n(t.target).closest(".rsNavItem"),f.length&&r.goTo(f.index());else{if(u=i?r._e3:r._h,r._a3&&("y"!==r._z2||!u)&&("x"!==r._z2||u))r.dragSuccess=!0;else if(!i&&r._t2){if(r._t2=!1,r.st.navigateByClick){r._i2(r.pointerEnabled?t.originalEvent:t);r.dragSuccess=!0;return}r.dragSuccess=!0}else{r._t2=!1;r.dragSuccess=!1;return}r._t2=!1;r._z2="";a=r.st.minSlideOffset;o=o?t.originalEvent.changedTouches[0]:r.pointerEnabled?t.originalEvent:t;e=u?o.pageX:o.pageY;h=r._d3;o=r._v;var p=r.currSlideId,w=r.numSlides,l=u?r._f3:r._g3,b=r._z;if(Math.abs(e-h),o=e-o,u=(new Date).getTime()-r._j3,u=Math.abs(o)/u,0===l||1>=w)c(!0,u);else{if(!b&&!i)if(0>=p){if(0<l){c(!0,u);return}}else if(p>=w-1&&0>l){c(!0,u);return}if(i){if(s=r._i3,s>r._n3)s=r._n3;else if(s<r._o3)s=r._o3;else{if(e=u*u/.006,f=-r._i3,h=r._y3-r._z3+r._i3,0<o&&e>f?(f+=r._z3/(15/(e/u*.003)),u=u*f/e,e=f):0>o&&e>h&&(h+=r._z3/(15/(e/u*.003)),u=u*h/e,e=h),f=Math.max(Math.round(u/.003),50),s+=e*(0>o?-1:1),s>r._n3){r._a4(s,f,!0,r._n3,200);return}if(s<r._o3){r._a4(s,f,!0,r._o3,200);return}}r._a4(s,f,!0)}else f=function(n){var t=Math.floor(n/r._w);return n-t*r._w>a&&t++,t},h+a<e?0>l?c(!1,u):(f=f(e-h),r._m2(r.currSlideId-f,v(Math.abs(r._p-(-r._u-r._d1+f)*r._w)/u),!1,!0,!0)):h-a>e?0<l?c(!1,u):(f=f(h-e),r._m2(r.currSlideId+f,v(Math.abs(r._p-(-r._u-r._d1-f)*r._w)/u),!1,!0,!0)):c(!1,u)}}},_p3:function(n){n=this._p=n;this._e?this._p1.css(this._x1,this._y1+(this._h?n+this._z1+0:0+this._z1+n)+this._a2):this._p1.css(this._h?this._x1:this._w1,n)},updateSliderSize:function(n){var t,i,r,u;if(this.slider){if(this.st.autoScaleSlider?(r=this.st.autoScaleSliderWidth,u=this.st.autoScaleSliderHeight,this.st.autoScaleHeight?(t=this.slider.width(),t!=this.width&&(this.slider.css("height",u/r*t),t=this.slider.width()),i=this.slider.height()):(i=this.slider.height(),i!=this.height&&(this.slider.css("width",r/u*i),i=this.slider.height()),t=this.slider.width())):(t=this.slider.width(),i=this.slider.height()),n||t!=this.width||i!=this.height){for(this.width=t,this.height=i,this._b4=t,this._c4=i,this.ev.trigger("rsBeforeSizeSet"),this.ev.trigger("rsAfterSizePropSet"),this._e1.css({width:this._b4,height:this._c4}),this._w=(this._h?this._b4:this._c4)+this.st.slidesSpacing,this._d4=this.st.imageScalePadding,t=0;t<this.slides.length;t++)n=this.slides[t],n.positionSet=!1,n&&n.images&&n.isLoaded&&(n.isRendered=!1,this._q2(n));if(this._e4)for(t=0;t<this._e4.length;t++)n=this._e4[t],n.holder.css(this._i,(n.id+this._d1)*this._w);this._n2();this._l&&(this._e&&this._p1.css(this._g+"transition-duration","0s"),this._p3((-this._u-this._d1)*this._w));this.ev.trigger("rsOnUpdateNav")}this._j2=this._e1.offset();this._j2=this._j2[this._i]}},appendSlide:function(t,i){var r=this._s(t);(isNaN(i)||i>this.numSlides)&&(i=this.numSlides);this.slides.splice(i,0,r);this.slidesJQ.splice(i,0,n('<div style="'+(this._l?"position:absolute;":this._n)+'" class="rsSlide"><\/div>'));i<=this.currSlideId&&this.currSlideId++;this.ev.trigger("rsOnAppendSlide",[r,i]);this._f4(i);i===this.currSlideId&&this.ev.trigger("rsAfterSlideChange")},removeSlide:function(n){var t=this.slides[n];t&&(t.holder&&t.holder.remove(),n<this.currSlideId&&this.currSlideId--,this.slides.splice(n,1),this.slidesJQ.splice(n,1),this.ev.trigger("rsOnRemoveSlide",[n]),this._f4(n),n===this.currSlideId&&this.ev.trigger("rsAfterSlideChange"))},_f4:function(n){var t=this;for(n=t.numSlides,n=0>=t._u?0:Math.floor(t._u/n),t.numSlides=t.slides.length,0===t.numSlides?(t.currSlideId=t._d1=t._u=0,t.currSlide=t._g4=null):t._u=n*t.numSlides+t.currSlideId,n=0;n<t.numSlides;n++)t.slides[n].id=n;t.currSlide=t.slides[t.currSlideId];t._r1=t.slidesJQ[t.currSlideId];t.currSlideId>=t.numSlides?t.goTo(t.numSlides-1):0>t.currSlideId&&t.goTo(0);t._t();t._l&&t._p1.css(t._g+t._u1,"0ms");t._h4&&clearTimeout(t._h4);t._h4=setTimeout(function(){t._l&&t._p3((-t._u-t._d1)*t._w);t._n2();t._l||t._r1.css({display:"block",opacity:1})},14);t.ev.trigger("rsOnUpdateNav")},_i1:function(){this._f1&&this._l&&(this._g1?this._e1.css("cursor",this._g1):(this._e1.removeClass("grabbing-cursor"),this._e1.addClass("grab-cursor")))},_w2:function(){this._f1&&this._l&&(this._h1?this._e1.css("cursor",this._h1):(this._e1.removeClass("grab-cursor"),this._e1.addClass("grabbing-cursor")))},next:function(n){this._m2("next",this.st.transitionSpeed,!0,!n)},prev:function(n){this._m2("prev",this.st.transitionSpeed,!0,!n)},_m2:function(n,t,i,r,u){var f=this,l,s,e,a,o,c;if(f.ev.trigger("rsBeforeMove",[n,r]),e="next"===n?f.currSlideId+1:"prev"===n?f.currSlideId-1:n=parseInt(n,10),!f._z){if(0>e){f._i4("left",!r);return}if(e>=f.numSlides){f._i4("right",!r);return}}f._r2&&(f._u2(!0),i=!1);s=e-f.currSlideId;e=f._o2=f.currSlideId;o=f.currSlideId+s;r=f._u;f._z?(o=f._n2(!1,o),r+=s):r=o;f._o=o;f._g4=f.slidesJQ[f.currSlideId];f._u=r;f.currSlideId=f._o;f.currSlide=f.slides[f.currSlideId];f._r1=f.slidesJQ[f.currSlideId];o=f.st.slidesDiff;c=Boolean(0<s);s=Math.abs(s);var h=Math.floor(e/f._y),v=Math.floor((e+(c?o:-o))/f._y),h=(c?Math.max(h,v):Math.min(h,v))*f._y+(c?f._y-1:0);if(h>f.numSlides-1?h=f.numSlides-1:0>h&&(h=0),e=c?h-e:e-h,e>f._y&&(e=f._y),s>e+o)for(f._d1+=(s-(e+o))*(c?-1:1),t*=1.4,e=0;e<f.numSlides;e++)f.slides[e].positionSet=!1;f._c=t;f._n2(!0);u||(a=!0);l=(-r-f._d1)*f._w;a?setTimeout(function(){f._j4=!1;f._x3(l,n,!1,i);f.ev.trigger("rsOnUpdateNav")},0):(f._x3(l,n,!1,i),f.ev.trigger("rsOnUpdateNav"))},_f2:function(){this.st.arrowsNav&&(1>=this.numSlides?(this._c2.css("display","none"),this._d2.css("display","none")):(this._c2.css("display","block"),this._d2.css("display","block"),this._z||this.st.loopRewind||(0===this.currSlideId?this._c2.addClass("rsArrowDisabled"):this._c2.removeClass("rsArrowDisabled"),this.currSlideId===this.numSlides-1?this._d2.addClass("rsArrowDisabled"):this._d2.removeClass("rsArrowDisabled"))))},_x3:function(t,i,r,u,f){function c(){var n;o&&(n=o.data("rsTimeout"))&&(o!==s&&o.css({opacity:0,display:"none",zIndex:0}),clearTimeout(n),o.data("rsTimeout",""));(n=s.data("rsTimeout"))&&(clearTimeout(n),s.data("rsTimeout",""))}var e=this,o,s,h={};isNaN(e._c)&&(e._c=400);e._p=e._h3=t;e.ev.trigger("rsBeforeAnimStart");e._e?e._l?(e._c=parseInt(e._c,10),r=e._g+e._v1,h[e._g+e._u1]=e._c+"ms",h[r]=u?n.rsCSS3Easing[e.st.easeInOut]:n.rsCSS3Easing[e.st.easeOut],e._p1.css(h),u||!e.hasTouch?setTimeout(function(){e._p3(t)},5):e._p3(t)):(e._c=e.st.transitionSpeed,o=e._g4,s=e._r1,s.data("rsTimeout")&&s.css("opacity",0),c(),o&&o.data("rsTimeout",setTimeout(function(){h[e._g+e._u1]="0ms";h.zIndex=0;h.display="none";o.data("rsTimeout","");o.css(h);setTimeout(function(){o.css("opacity",0)},16)},e._c+60)),h.display="block",h.zIndex=e._m,h.opacity=0,h[e._g+e._u1]="0ms",h[e._g+e._v1]=n.rsCSS3Easing[e.st.easeInOut],s.css(h),s.data("rsTimeout",setTimeout(function(){s.css(e._g+e._u1,e._c+"ms");s.data("rsTimeout",setTimeout(function(){s.css("opacity",1);s.data("rsTimeout","")},20))},20))):e._l?(h[e._h?e._x1:e._w1]=t+"px",e._p1.animate(h,e._c,u?e.st.easeInOut:e.st.easeOut)):(o=e._g4,s=e._r1,s.stop(!0,!0).css({opacity:0,display:"block",zIndex:e._m}),e._c=e.st.transitionSpeed,s.animate({opacity:1},e._c,e.st.easeInOut),c(),o&&o.data("rsTimeout",setTimeout(function(){o.stop(!0,!0).css({opacity:0,display:"none",zIndex:0})},e._c+60)));e._r2=!0;e.loadingTimeout&&clearTimeout(e.loadingTimeout);e.loadingTimeout=f?setTimeout(function(){e.loadingTimeout=null;f.call()},e._c+60):setTimeout(function(){e.loadingTimeout=null;e._k4(i)},e._c+60)},_u2:function(n){if(this._r2=!1,clearTimeout(this.loadingTimeout),this._l)if(this._e){if(!n){n=this._p;var t=this._h3=this._l4();this._p1.css(this._g+this._u1,"0ms");n!==t&&this._p3(t)}}else this._p1.stop(!0),this._p=parseInt(this._p1.css(this._h?this._x1:this._w1),10);else 20<this._m?this._m=10:this._m++},_l4:function(){var n=window.getComputedStyle(this._p1.get(0),null).getPropertyValue(this._g+"transform").replace(/^matrix\(/i,"").split(/, |\)$/g),t=0===n[0].indexOf("matrix3d");return parseInt(n[this._h?t?12:4:t?13:5],10)},_m4:function(n,t){return this._e?this._y1+(t?n+this._z1+0:0+this._z1+n)+this._a2:n},_k4:function(){this._l||(this._r1.css("z-index",0),this._m=10);this._r2=!1;this.staticSlideId=this.currSlideId;this._n2();this._n4=!1;this.ev.trigger("rsAfterSlideChange")},_i4:function(n,t){var i=this,r=(-i._u-i._d1)*i._w,u;0===i.numSlides||i._r2||(i.st.loopRewind?i.goTo("left"===n?i.numSlides-1:0,t):i._l&&(i._c=200,u=function(){i._r2=!1},i._x3(r+("left"===n?30:-30),"",!1,!0,function(){i._r2=!1;i._x3(r,"",!1,!0,u)})))},_q2:function(t){var o,s,l,f,c,h;if(!t.isRendered){var e=t.content,i="rsMainSlideImage",a,v=n.isFunction(this.st.imageAlignCenter)?this.st.imageAlignCenter(t):this.st.imageAlignCenter,r=n.isFunction(this.st.imageScaleMode)?this.st.imageScaleMode(t):this.st.imageScaleMode,u;t.videoURL&&(i="rsVideoContainer","fill"!==r?a=!0:(u=e,u.hasClass(i)||(u=u.find("."+i)),u.css({width:"100%",height:"100%"}),i="rsMainSlideImage"));e.hasClass(i)||(e=e.find("."+i));e&&(o=t.iW,s=t.iH,t.isRendered=!0,("none"!==r||v)&&(i="fill"!==r?this._d4:0,u=this._b4-2*i,l=this._c4-2*i,h={},"fit-if-smaller"===r&&(o>u||s>l)&&(r="fit"),("fill"===r||"fit"===r)&&(f=u/o,c=l/s,f="fill"==r?f>c?f:c:"fit"==r?f<c?f:c:1,o=Math.ceil(o*f,10),s=Math.ceil(s*f,10)),"none"!==r&&(h.width=o,h.height=s,a&&e.find(".rsImg").css({width:"100%",height:"100%"})),v&&(h.marginLeft=Math.floor((u-o)/2)+i,h.marginTop=Math.floor((l-s)/2)+i),e.css(h)))}}};n.rsProto=t.prototype;n.fn.royalSlider=function(i){var r=arguments;return this.each(function(){var u=n(this);if("object"!=typeof i&&i){if((u=u.data("royalSlider"))&&u[i])return u[i].apply(u,Array.prototype.slice.call(r,1))}else u.data("royalSlider")||u.data("royalSlider",new t(u,i))})};n.fn.royalSlider.defaults={slidesSpacing:8,startSlideId:0,loop:!1,loopRewind:!1,numImagesToPreload:4,fadeinLoadedSlide:!0,slidesOrientation:"horizontal",transitionType:"move",transitionSpeed:600,controlNavigation:"bullets",controlsInside:!0,arrowsNav:!0,arrowsNavAutoHide:!0,navigateByClick:!0,randomizeSlides:!1,sliderDrag:!0,sliderTouch:!0,keyboardNavEnabled:!1,fadeInAfterLoaded:!0,allowCSS3:!0,allowCSS3OnWebkit:!0,addActiveClass:!1,autoHeight:!1,easeOut:"easeOutSine",easeInOut:"easeInOutSine",minSlideOffset:10,imageScaleMode:"fit-if-smaller",imageAlignCenter:!0,imageScalePadding:4,usePreloader:!0,autoScaleSlider:!1,autoScaleSliderWidth:800,autoScaleSliderHeight:400,autoScaleHeight:!0,arrowsNavHideOnTouch:!1,globalCaption:!1,slidesDiff:2};n.rsCSS3Easing={easeOutSine:"cubic-bezier(0.390, 0.575, 0.565, 1.000)",easeInOutSine:"cubic-bezier(0.445, 0.050, 0.550, 0.950)"};n.extend(jQuery.easing,{easeInOutSine:function(n,t,i,r,u){return-r/2*(Math.cos(Math.PI*t/u)-1)+i},easeOutSine:function(n,t,i,r,u){return r*Math.sin(t/u*(Math.PI/2))+i},easeOutCubic:function(n,t,i,r,u){return r*((t=t/u-1)*t*t+1)+i}})}(jQuery,window),function(n){n.extend(n.rsProto,{_i5:function(){var t=this;"bullets"===t.st.controlNavigation&&(t.ev.one("rsAfterPropsSetup",function(){t._j5=!0;t.slider.addClass("rsWithBullets");for(var i='<div class="rsNav rsBullets">',r=0;r<t.numSlides;r++)i+='<div class="rsNavItem rsBullet"><span><\/span><\/div>';t._k5=i=n(i+"<\/div>");t._l5=i.appendTo(t.slider).children();t._k5.on("click.rs",".rsNavItem",function(){t._m5||t.goTo(n(this).index())})}),t.ev.on("rsOnAppendSlide",function(n,i,r){r>=t.numSlides?t._k5.append('<div class="rsNavItem rsBullet"><span><\/span><\/div>'):t._l5.eq(r).before('<div class="rsNavItem rsBullet"><span><\/span><\/div>');t._l5=t._k5.children()}),t.ev.on("rsOnRemoveSlide",function(n,i){var r=t._l5.eq(i);r&&r.length&&(r.remove(),t._l5=t._k5.children())}),t.ev.on("rsOnUpdateNav",function(){var n=t.currSlideId;t._n5&&t._n5.removeClass("rsNavSelected");n=t._l5.eq(n);n.addClass("rsNavSelected");t._n5=n}))}});n.rsModules.bullets=n.rsProto._i5}(jQuery),function(n){n.extend(n.rsProto,{_h6:function(){var t=this;"thumbnails"===t.st.controlNavigation&&(t._i6={drag:!0,touch:!0,orientation:"horizontal",navigation:!0,arrows:!0,arrowLeft:null,arrowRight:null,spacing:4,arrowsAutoHide:!1,appendSpan:!1,transitionSpeed:600,autoCenter:!0,fitInViewport:!0,firstMargin:!0,paddingTop:0,paddingBottom:0},t.st.thumbs=n.extend({},t._i6,t.st.thumbs),t._j6=!0,!1===t.st.thumbs.firstMargin?t.st.thumbs.firstMargin=0:!0===t.st.thumbs.firstMargin&&(t.st.thumbs.firstMargin=t.st.thumbs.spacing),t.ev.on("rsBeforeParseNode",function(t,i,r){i=n(i);r.thumbnail=i.find(".rsTmb").remove();r.thumbnail.length?r.thumbnail=n(document.createElement("div")).append(r.thumbnail).html():(r.thumbnail=i.attr("data-rsTmb"),r.thumbnail||(r.thumbnail=i.find(".rsImg").attr("data-rsTmb")),r.thumbnail=r.thumbnail?'<img src="'+r.thumbnail+'"/>':"")}),t.ev.one("rsAfterPropsSetup",function(){t._k6()}),t._n5=null,t.ev.on("rsOnUpdateNav",function(){var i=n(t._l5[t.currSlideId]);i!==t._n5&&(t._n5&&(t._n5.removeClass("rsNavSelected"),t._n5=null),t._l6&&t._m6(t.currSlideId),t._n5=i.addClass("rsNavSelected"))}),t.ev.on("rsOnAppendSlide",function(n,i,r){n="<div"+t._n6+' class="rsNavItem rsThumb">'+t._o6+i.thumbnail+"<\/div>";t._e&&t._s3.css(t._g+"transition-duration","0ms");r>=t.numSlides?t._s3.append(n):t._l5.eq(r).before(n);t._l5=t._s3.children();t.updateThumbsSize(!0)}),t.ev.on("rsOnRemoveSlide",function(n,i){var r=t._l5.eq(i);r&&(t._e&&t._s3.css(t._g+"transition-duration","0ms"),r.remove(),t._l5=t._s3.children(),t.updateThumbsSize(!0))}))},_k6:function(){var t=this,u="rsThumbs",i=t.st.thumbs,r="",f,e,s=i.spacing,o;for(t._j5=!0,t._e3="vertical"===i.orientation?!1:!0,t._n6=f=s?' style="margin-'+(t._e3?"right":"bottom")+":"+s+'px;"':"",t._i3=0,t._p6=!1,t._m5=!1,t._l6=!1,t._q6=i.arrows&&i.navigation,e=t._e3?"Hor":"Ver",t.slider.addClass("rsWithThumbs rsWithThumbs"+e),r+='<div class="rsNav rsThumbs rsThumbs'+e+'"><div class="'+u+'Container">',t._o6=i.appendSpan?'<span class="thumbIco"><\/span>':"",o=0;o<t.numSlides;o++)e=t.slides[o],r+="<div"+f+' class="rsNavItem rsThumb">'+e.thumbnail+t._o6+"<\/div>";r=n(r+"<\/div><\/div>");f={};i.paddingTop&&(f[t._e3?"paddingTop":"paddingLeft"]=i.paddingTop);i.paddingBottom&&(f[t._e3?"paddingBottom":"paddingRight"]=i.paddingBottom);r.css(f);t._s3=n(r).find("."+u+"Container");t._q6&&(u+="Arrow",i.arrowLeft?t._r6=i.arrowLeft:(t._r6=n('<div class="'+u+" "+u+'Left"><div class="'+u+'Icn"><\/div><\/div>'),r.append(t._r6)),i.arrowRight?t._s6=i.arrowRight:(t._s6=n('<div class="'+u+" "+u+'Right"><div class="'+u+'Icn"><\/div><\/div>'),r.append(t._s6)),t._r6.click(function(){var n=(Math.floor(t._i3/t._t6)+t._u6)*t._t6+t.st.thumbs.firstMargin;t._a4(n>t._n3?t._n3:n)}),t._s6.click(function(){var n=(Math.floor(t._i3/t._t6)-t._u6)*t._t6+t.st.thumbs.firstMargin;t._a4(n<t._o3?t._o3:n)}),i.arrowsAutoHide&&!t.hasTouch&&(t._r6.css("opacity",0),t._s6.css("opacity",0),r.one("mousemove.rsarrowshover",function(){t._l6&&(t._r6.css("opacity",1),t._s6.css("opacity",1))}),r.hover(function(){t._l6&&(t._r6.css("opacity",1),t._s6.css("opacity",1))},function(){t._l6&&(t._r6.css("opacity",0),t._s6.css("opacity",0))})));t._k5=r;t._l5=t._s3.children();t.msEnabled&&t.st.thumbs.navigation&&t._s3.css("-ms-touch-action",t._e3?"pan-y":"pan-x");t.slider.append(r);t._w3=!0;t._v6=s;i.navigation&&t._e&&t._s3.css(t._g+"transition-property",t._g+"transform");t._k5.on("click.rs",".rsNavItem",function(){t._m5||t.goTo(n(this).index())});t.ev.off("rsBeforeSizeSet.thumbs").on("rsBeforeSizeSet.thumbs",function(){t._w6=t._e3?t._c4:t._b4;t.updateThumbsSize(!0)});t.ev.off("rsAutoHeightChange.thumbs").on("rsAutoHeightChange.thumbs",function(n,i){t.updateThumbsSize(!0,i)})},updateThumbsSize:function(n,t){var i=this,r=i._l5.first(),u={},f=i._l5.length;i._t6=(i._e3?r.outerWidth():r.outerHeight())+i._v6;i._y3=f*i._t6-i._v6;u[i._e3?"width":"height"]=i._y3+i._v6;i._z3=i._e3?i._k5.width():void 0!==t?t:i._k5.height();i._w3&&(i.isFullscreen||i.st.thumbs.fitInViewport)&&(i._e3?i._c4=i._w6-i._k5.outerHeight():i._b4=i._w6-i._k5.outerWidth());i._z3&&(i._o3=-(i._y3-i._z3)-i.st.thumbs.firstMargin,i._n3=i.st.thumbs.firstMargin,i._u6=Math.floor(i._z3/i._t6),i._y3<i._z3?(i.st.thumbs.autoCenter?i._q3((i._z3-i._y3)/2):i._q3(i._n3),i.st.thumbs.arrows&&i._r6&&(i._r6.addClass("rsThumbsArrowDisabled"),i._s6.addClass("rsThumbsArrowDisabled")),i._l6=!1,i._m5=!1,i._k5.off(i._j1)):i.st.thumbs.navigation&&!i._l6&&(i._l6=!0,!i.hasTouch&&i.st.thumbs.drag||i.hasTouch&&i.st.thumbs.touch)&&(i._m5=!0,i._k5.on(i._j1,function(n){i._g2(n,!0)})),i._s3.css(u),n&&t&&i._m6(i.currSlideId,!0))},setThumbsOrientation:function(n,t){this._w3&&(this.st.thumbs.orientation=n,this._k5.remove(),this.slider.removeClass("rsWithThumbsHor rsWithThumbsVer"),this._k6(),this._k5.off(this._j1),t||this.updateSliderSize(!0))},_q3:function(n){this._i3=n;this._e?this._s3.css(this._x1,this._y1+(this._e3?n+this._z1+0:0+this._z1+n)+this._a2):this._s3.css(this._e3?this._x1:this._w1,n)},_a4:function(t,i,r,u,f){var e=this,o;e._l6&&(i||(i=e.st.thumbs.transitionSpeed),e._i3=t,e._x6&&clearTimeout(e._x6),e._p6&&(e._e||e._s3.stop(),r=!0),o={},e._p6=!0,e._e?(o[e._g+"transition-duration"]=i+"ms",o[e._g+"transition-timing-function"]=r?n.rsCSS3Easing[e.st.easeOut]:n.rsCSS3Easing[e.st.easeInOut],e._s3.css(o),e._q3(t)):(o[e._e3?e._x1:e._w1]=t+"px",e._s3.animate(o,i,r?"easeOutCubic":e.st.easeInOut)),u&&(e._i3=u),e._y6(),e._x6=setTimeout(function(){e._p6=!1;f&&(e._a4(u,f,!0),f=null)},i))},_y6:function(){this._q6&&(this._i3===this._n3?this._r6.addClass("rsThumbsArrowDisabled"):this._r6.removeClass("rsThumbsArrowDisabled"),this._i3===this._o3?this._s6.addClass("rsThumbsArrowDisabled"):this._s6.removeClass("rsThumbsArrowDisabled"))},_m6:function(n,t){var r=0,i,f=n*this._t6+2*this._t6-this._v6+this._n3,u=Math.floor(this._i3/this._t6);this._l6&&(this._j6&&(t=!0,this._j6=!1),f+this._i3>this._z3?(n===this.numSlides-1&&(r=1),u=-n+this._u6-2+r,i=u*this._t6+this._z3%this._t6+this._v6-this._n3):0!==n?(n-1)*this._t6<=-this._i3+this._n3&&n-1<=this.numSlides-this._u6&&(i=(-n+1)*this._t6+this._n3):i=this._n3,i!==this._i3&&(r=void 0===i?this._i3:i,r>this._n3?this._q3(this._n3):r<this._o3?this._q3(this._o3):void 0!==i&&(t?this._q3(i):this._a4(i))),this._y6())}});n.rsModules.thumbnails=n.rsProto._h6}(jQuery),function(n){n.extend(n.rsProto,{_f6:function(){var t=this;"tabs"===t.st.controlNavigation&&(t.ev.on("rsBeforeParseNode",function(t,i,r){i=n(i);r.thumbnail=i.find(".rsTmb").remove();r.thumbnail.length?r.thumbnail=n(document.createElement("div")).append(r.thumbnail).html():(r.thumbnail=i.attr("data-rsTmb"),r.thumbnail||(r.thumbnail=i.find(".rsImg").attr("data-rsTmb")),r.thumbnail=r.thumbnail?'<img src="'+r.thumbnail+'"/>':"")}),t.ev.one("rsAfterPropsSetup",function(){t._g6()}),t.ev.on("rsOnAppendSlide",function(n,i,r){r>=t.numSlides?t._k5.append('<div class="rsNavItem rsTab">'+i.thumbnail+"<\/div>"):t._l5.eq(r).before('<div class="rsNavItem rsTab">'+item.thumbnail+"<\/div>");t._l5=t._k5.children()}),t.ev.on("rsOnRemoveSlide",function(n,i){var r=t._l5.eq(i);r&&(r.remove(),t._l5=t._k5.children())}),t.ev.on("rsOnUpdateNav",function(){var n=t.currSlideId;t._n5&&t._n5.removeClass("rsNavSelected");n=t._l5.eq(n);n.addClass("rsNavSelected");t._n5=n}))},_g6:function(){var t=this,i,r;for(t._j5=!0,i='<div class="rsNav rsTabs">',r=0;r<t.numSlides;r++)i+='<div class="rsNavItem rsTab">'+t.slides[r].thumbnail+"<\/div>";i=n(i+"<\/div>");t._k5=i;t._l5=i.children(".rsNavItem");t.slider.append(i);t._k5.click(function(i){i=n(i.target).closest(".rsNavItem");i.length&&t.goTo(i.index())})}});n.rsModules.tabs=n.rsProto._f6}(jQuery),function(n){n.extend(n.rsProto,{_q5:function(){var t=this;if(t._r5={enabled:!1,keyboardNav:!0,buttonFS:!0,nativeFS:!1,doubleTap:!0},t.st.fullscreen=n.extend({},t._r5,t.st.fullscreen),t.st.fullscreen.enabled)t.ev.one("rsBeforeSizeSet",function(){t._s5()})},_s5:function(){var t=this,i,u,r,f;if(t._t5=!t.st.keyboardNavEnabled&&t.st.fullscreen.keyboardNav,t.st.fullscreen.nativeFS){if(i={supportsFullScreen:!1,isFullScreen:function(){return!1},requestFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",prefix:""},u=["webkit","moz","o","ms","khtml"],"undefined"!=typeof document.cancelFullScreen)i.supportsFullScreen=!0;else for(r=0,f=u.length;r<f;r++)if(i.prefix=u[r],"undefined"!=typeof document[i.prefix+"CancelFullScreen"]){i.supportsFullScreen=!0;break}i.supportsFullScreen?(t.nativeFS=!0,i.fullScreenEventName=i.prefix+"fullscreenchange"+t.ns,i.isFullScreen=function(){switch(this.prefix){case"":return document.fullScreen;case"webkit":return document.webkitIsFullScreen;default:return document[this.prefix+"FullScreen"]}},i.requestFullScreen=function(n){return""===this.prefix?n.requestFullScreen():n[this.prefix+"RequestFullScreen"]()},i.cancelFullScreen=function(){return""===this.prefix?document.cancelFullScreen():document[this.prefix+"CancelFullScreen"]()},t._u5=i):t._u5=!1}t.st.fullscreen.buttonFS&&(t._v5=n('<div class="rsFullscreenBtn"><div class="rsFullscreenIcn"><\/div><\/div>').appendTo(t._o1).on("click.rs",function(){t.isFullscreen?t.exitFullscreen():t.enterFullscreen()}))},enterFullscreen:function(t){var i=this,r;if(i._u5)if(t)i._u5.requestFullScreen(n("html")[0]);else{i._b.on(i._u5.fullScreenEventName,function(){i._u5.isFullScreen()?i.enterFullscreen(!0):i.exitFullscreen(!0)});i._u5.requestFullScreen(n("html")[0]);return}if(!i._w5){i._w5=!0;i._b.on("keyup"+i.ns+"fullscreen",function(n){27===n.keyCode&&i.exitFullscreen()});for(i._t5&&i._b2(),t=n(window),i._x5=t.scrollTop(),i._y5=t.scrollLeft(),i._z5=n("html").attr("style"),i._a6=n("body").attr("style"),i._b6=i.slider.attr("style"),n("body, html").css({overflow:"hidden",height:"100%",width:"100%",margin:"0",padding:"0"}),i.slider.addClass("rsFullscreen"),r=0;r<i.numSlides;r++)t=i.slides[r],t.isRendered=!1,t.bigImage&&(t.isBig=!0,t.isMedLoaded=t.isLoaded,t.isMedLoading=t.isLoading,t.medImage=t.image,t.medIW=t.iW,t.medIH=t.iH,t.slideId=-99,t.bigImage!==t.medImage&&(t.sizeType="big"),t.isLoaded=t.isBigLoaded,t.isLoading=!1,t.image=t.bigImage,t.images[0]=t.bigImage,t.iW=t.bigIW,t.iH=t.bigIH,t.isAppended=t.contentAdded=!1,i._c6(t));i.isFullscreen=!0;i._w5=!1;i.updateSliderSize();i.ev.trigger("rsEnterFullscreen")}},exitFullscreen:function(t){var i=this,r;if(i._u5){if(!t){i._u5.cancelFullScreen(n("html")[0]);return}i._b.off(i._u5.fullScreenEventName)}if(!i._w5){for(i._w5=!0,i._b.off("keyup"+i.ns+"fullscreen"),i._t5&&i._b.off("keydown"+i.ns),n("html").attr("style",i._z5||""),n("body").attr("style",i._a6||""),r=0;r<i.numSlides;r++)t=i.slides[r],t.isRendered=!1,t.bigImage&&(t.isBig=!1,t.slideId=-99,t.isBigLoaded=t.isLoaded,t.isBigLoading=t.isLoading,t.bigImage=t.image,t.bigIW=t.iW,t.bigIH=t.iH,t.isLoaded=t.isMedLoaded,t.isLoading=!1,t.image=t.medImage,t.images[0]=t.medImage,t.iW=t.medIW,t.iH=t.medIH,t.isAppended=t.contentAdded=!1,i._c6(t,!0),t.bigImage!==t.medImage&&(t.sizeType="med"));i.isFullscreen=!1;t=n(window);t.scrollTop(i._x5);t.scrollLeft(i._y5);i._w5=!1;i.slider.removeClass("rsFullscreen");i.updateSliderSize();setTimeout(function(){i.updateSliderSize()},1);i.ev.trigger("rsExitFullscreen")}},_c6:function(t){var i=t.isLoaded||t.isLoading?'<img class="rsImg rsMainSlideImage" src="'+t.image+'"/>':'<a class="rsImg rsMainSlideImage" href="'+t.image+'"><\/a>';t.content.hasClass("rsImg")?t.content=n(i):t.content.find(".rsImg").eq(0).replaceWith(i);t.isLoaded||t.isLoading||!t.holder||t.holder.html(t.content)}});n.rsModules.fullscreen=n.rsProto._q5}(jQuery),function(n){n.extend(n.rsProto,{_x4:function(){var t=this,i;t._y4={enabled:!1,stopAtAction:!0,pauseOnHover:!0,delay:2e3};!t.st.autoPlay&&t.st.autoplay&&(t.st.autoPlay=t.st.autoplay);t.st.autoPlay=n.extend({},t._y4,t.st.autoPlay);t.st.autoPlay.enabled&&(t.ev.on("rsBeforeParseNode",function(t,r,u){r=n(r);(i=r.attr("data-rsDelay"))&&(u.customDelay=parseInt(i,10))}),t.ev.one("rsAfterInit",function(){t._z4()}),t.ev.on("rsBeforeDestroy",function(){t.stopAutoPlay();t.slider.off("mouseenter mouseleave");n(window).off("blur"+t.ns+" focus"+t.ns)}))},_z4:function(){var t=this;t.startAutoPlay();t.ev.on("rsAfterContentSet",function(n,i){t._l2||t._r2||!t._a5||i!==t.currSlide||t._b5()});t.ev.on("rsDragRelease",function(){t._a5&&t._c5&&(t._c5=!1,t._b5())});t.ev.on("rsAfterSlideChange",function(){t._a5&&t._c5&&(t._c5=!1,t.currSlide.isLoaded&&t._b5())});t.ev.on("rsDragStart",function(){t._a5&&(t.st.autoPlay.stopAtAction?t.stopAutoPlay():(t._c5=!0,t._d5()))});t.ev.on("rsBeforeMove",function(n,i,r){t._a5&&(r&&t.st.autoPlay.stopAtAction?t.stopAutoPlay():(t._c5=!0,t._d5()))});t._e5=!1;t.ev.on("rsVideoStop",function(){t._a5&&(t._e5=!1,t._b5())});t.ev.on("rsVideoPlay",function(){t._a5&&(t._c5=!1,t._d5(),t._e5=!0)});n(window).on("blur"+t.ns,function(){t._a5&&(t._c5=!0,t._d5())}).on("focus"+t.ns,function(){t._a5&&t._c5&&(t._c5=!1,t._b5())});t.st.autoPlay.pauseOnHover&&(t._f5=!1,t.slider.hover(function(){t._a5&&(t._c5=!1,t._d5(),t._f5=!0)},function(){t._a5&&(t._f5=!1,t._b5())}))},toggleAutoPlay:function(){this._a5?this.stopAutoPlay():this.startAutoPlay()},startAutoPlay:function(){this._a5=!0;this.currSlide.isLoaded&&this._b5()},stopAutoPlay:function(){this._e5=this._f5=this._c5=this._a5=!1;this._d5()},_b5:function(){var n=this;n._f5||n._e5||(n._g5=!0,n._h5&&clearTimeout(n._h5),n._h5=setTimeout(function(){var t;n._z||n.st.loopRewind||(t=!0,n.st.loopRewind=!0);n.next(!0);t&&(n.st.loopRewind=!1)},n.currSlide.customDelay?n.currSlide.customDelay:n.st.autoPlay.delay))},_d5:function(){this._f5||this._e5||(this._g5=!1,this._h5&&(clearTimeout(this._h5),this._h5=null))}});n.rsModules.autoplay=n.rsProto._x4}(jQuery),function(n){n.extend(n.rsProto,{_z6:function(){var t=this,i;t._a7={autoHideArrows:!0,autoHideControlNav:!1,autoHideBlocks:!1,autoHideCaption:!1,disableCSS3inFF:!0,youTubeCode:'<iframe src="https://www.youtube.com/embed/%id%?rel=1&showinfo=0&autoplay=1&wmode=transparent" frameborder="no"><\/iframe>',vimeoCode:'<iframe src="https://player.vimeo.com/video/%id%?byline=0&portrait=0&autoplay=1" frameborder="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen><\/iframe>'};t.st.video=n.extend({},t._a7,t.st.video);t.ev.on("rsBeforeSizeSet",function(){t._b7&&setTimeout(function(){var n=t._r1,n=n.hasClass("rsVideoContainer")?n:n.find(".rsVideoContainer");t._c7&&t._c7.css({width:n.width(),height:n.height()})},32)});i=t._a.mozilla;t.ev.on("rsAfterParseNode",function(r,u,f){if(r=n(u),f.videoURL){t.st.video.disableCSS3inFF&&i&&(t._e=t._f=!1);u=n('<div class="rsVideoContainer"><\/div>');var e=n('<div class="rsBtnCenterer"><div class="rsPlayBtn"><div class="rsPlayBtnIcon"><\/div><\/div><\/div>');r.hasClass("rsImg")?f.content=u.append(r).append(e):f.content.find(".rsImg").wrap(u).after(e)}});t.ev.on("rsAfterSlideChange",function(){t.stopVideo()})},toggleVideo:function(){return this._b7?this.stopVideo():this.playVideo()},playVideo:function(){var t=this,r,i,f,u;return t._b7?!1:(i=t.currSlide,!i.videoURL)?!1:(t._d7=i,r=t._e7=i.content,i=i.videoURL,i.match(/youtu\.be/i)||i.match(/youtube\.com/i)?(u=/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,(u=i.match(u))&&11==u[2].length&&(f=u[2]),void 0!==f&&(t._c7=t.st.video.youTubeCode.replace("%id%",f))):i.match(/vimeo\.com/i)&&(u=/(www\.)?vimeo.com\/(\d+)($|\/)/,(u=i.match(u))&&(f=u[2]),void 0!==f&&(t._c7=t.st.video.vimeoCode.replace("%id%",f))),t.videoObj=n(t._c7),t.ev.trigger("rsOnCreateVideoElement",[i]),t.videoObj.length&&(t._c7=n('<div class="rsVideoFrameHolder"><div class="rsPreloader"><\/div><div class="rsCloseVideoBtn"><div class="rsCloseVideoIcn"><\/div><\/div><\/div>'),t._c7.find(".rsPreloader").after(t.videoObj),r=r.hasClass("rsVideoContainer")?r:r.find(".rsVideoContainer"),t._c7.css({width:r.width(),height:r.height()}).find(".rsCloseVideoBtn").off("click.rsv").on("click.rsv",function(n){return t.stopVideo(),n.preventDefault(),n.stopPropagation(),!1}),r.append(t._c7),t.isIPAD&&r.addClass("rsIOSVideo"),t._f7(!1),setTimeout(function(){t._c7.addClass("rsVideoActive")},10),t.ev.trigger("rsVideoPlay"),t._b7=!0),!0)},stopVideo:function(){var n=this;return n._b7?(n.isIPAD&&n.slider.find(".rsCloseVideoBtn").remove(),n._f7(!0),setTimeout(function(){n.ev.trigger("rsOnDestroyVideoElement",[n.videoObj]);var t=n._c7.find("iframe");if(t.length)try{t.attr("src","")}catch(i){}n._c7.remove();n._c7=null},16),n.ev.trigger("rsVideoStop"),n._b7=!1,!0):!1},_f7:function(n){var t=[],i=this.st.video;if(i.autoHideArrows&&(this._c2&&(t.push(this._c2,this._d2),this._e2=!n),this._v5&&t.push(this._v5)),i.autoHideControlNav&&this._k5&&t.push(this._k5),i.autoHideBlocks&&this._d7.animBlocks&&t.push(this._d7.animBlocks),i.autoHideCaption&&this.globalCaption&&t.push(this.globalCaption),this.slider[n?"removeClass":"addClass"]("rsVideoPlaying"),t.length)for(i=0;i<t.length;i++)n?t[i].removeClass("rsHidden"):t[i].addClass("rsHidden")}});n.rsModules.video=n.rsProto._z6}(jQuery),function(n){n.extend(n.rsProto,{_p4:function(){function r(){var n=t.currSlide,r;if(t.currSlide&&t.currSlide.isLoaded&&t._t4!==n){if(0<t._s4.length){for(i=0;i<t._s4.length;i++)clearTimeout(t._s4[i]);t._s4=[]}if(0<t._r4.length){for(i=0;i<t._r4.length;i++)(r=t._r4[i])&&(t._e?(r.block.css(t._g+t._u1,"0s"),r.block.css(r.css)):r.block.stop(!0).css(r.css),t._t4=null,n.animBlocksDisplayed=!1);t._r4=[]}n.animBlocks&&(n.animBlocksDisplayed=!0,t._t4=n,t._u4(n.animBlocks))}}var t=this,i;t._q4={fadeEffect:!0,moveEffect:"top",moveOffset:20,speed:400,easing:"easeOutSine",delay:200};t.st.block=n.extend({},t._q4,t.st.block);t._r4=[];t._s4=[];t.ev.on("rsAfterInit",function(){r()});t.ev.on("rsBeforeParseNode",function(t,i,r){i=n(i);r.animBlocks=i.find(".rsABlock").css("display","none");r.animBlocks.length||(r.animBlocks=i.hasClass("rsABlock")?i.css("display","none"):!1)});t.ev.on("rsAfterContentSet",function(n,i){i.id===t.slides[t.currSlideId].id&&setTimeout(function(){r()},t.st.fadeinLoadedSlide?300:0)});t.ev.on("rsAfterSlideChange",function(){r()})},_v4:function(n,t){setTimeout(function(){n.css(t)},6)},_u4:function(t){var i=this,f,o,s,u,e,r,h;i._s4=[];t.each(function(t){var c,a,l;f=n(this);o={};s={};u=null;c=f.attr("data-move-offset");c=c?parseInt(c,10):i.st.block.moveOffset;0<c&&((r=f.data("move-effect"))?(r=r.toLowerCase(),"none"===r?r=!1:"left"!==r&&"top"!==r&&"bottom"!==r&&"right"!==r&&(r=i.st.block.moveEffect,"none"===r&&(r=!1))):r=i.st.block.moveEffect,r&&"none"!==r)&&(a="right"===r||"left"===r?!0:!1,h=!1,i._e?(l=0,e=i._x1):(a?isNaN(parseInt(f.css("right"),10))?e="left":(e="right",h=!0):isNaN(parseInt(f.css("bottom"),10))?e="top":(e="bottom",h=!0),e="margin-"+e,h&&(c=-c),i._e?l=parseInt(f.css(e),10):(l=f.data("rs-start-move-prop"),void 0===l&&(l=parseInt(f.css(e),10),isNaN(l)&&(l=0),f.data("rs-start-move-prop",l)))),s[e]=i._m4("top"===r||"left"===r?l-c:l+c,a),o[e]=i._m4(l,a));c=f.attr("data-fade-effect");c?("none"===c.toLowerCase()||"false"===c.toLowerCase())&&(c=!1):c=i.st.block.fadeEffect;c&&(s.opacity=0,o.opacity=1);(c||r)&&(u={},u.hasFade=Boolean(c),Boolean(r)&&(u.moveProp=e,u.hasMove=!0),u.speed=f.data("speed"),isNaN(u.speed)&&(u.speed=i.st.block.speed),u.easing=f.data("easing"),u.easing||(u.easing=i.st.block.easing),u.css3Easing=n.rsCSS3Easing[u.easing],u.delay=f.data("delay"),isNaN(u.delay)&&(u.delay=i.st.block.delay*t));c={};i._e&&(c[i._g+i._u1]="0ms");c.moveProp=o.moveProp;c.opacity=o.opacity;c.display="none";i._r4.push({block:f,css:c});i._v4(f,s);i._s4.push(setTimeout(function(n,t,r,u){return function(){var f,e;n.css("display","block");r&&(f={},i._e?(e="",r.hasMove&&(e+=r.moveProp),r.hasFade&&(r.hasMove&&(e+=", "),e+="opacity"),f[i._g+i._t1]=e,f[i._g+i._u1]=r.speed+"ms",f[i._g+i._v1]=r.css3Easing,n.css(f),setTimeout(function(){n.css(t)},24)):setTimeout(function(){n.animate(t,r.speed,r.easing)},16));delete i._s4[u]}}(f,o,u,t),6>=u.delay?12:u.delay))})}});n.rsModules.animatedBlocks=n.rsProto._p4}(jQuery),function(n){n.extend(n.rsProto,{_w4:function(){var n=this,f,t,r,u,i;if(n.st.autoHeight){u=!0;i=function(i){r=n.slides[n.currSlideId];(f=r.holder)&&(t=f.height())&&void 0!==t&&t>(n.st.minAutoHeight||30)&&(n._c4=t,n._e||!i?n._e1.css("height",t):n._e1.stop(!0,!0).animate({height:t},n.st.transitionSpeed),n.ev.trigger("rsAutoHeightChange",t),u&&(n._e&&setTimeout(function(){n._e1.css(n._g+"transition","height "+n.st.transitionSpeed+"ms ease-in-out")},16),u=!1))};n.ev.on("rsMaybeSizeReady.rsAutoHeight",function(n,t){r===t&&i()});n.ev.on("rsAfterContentSet.rsAutoHeight",function(n,t){r===t&&i()});n.slider.addClass("rsAutoHeight");n.ev.one("rsAfterInit",function(){setTimeout(function(){i(!1);setTimeout(function(){n.slider.append('<div style="clear:both; float: none;"><\/div>')},16)},16)});n.ev.on("rsBeforeAnimStart",function(){i(!0)});n.ev.on("rsBeforeSizeSet",function(){setTimeout(function(){i(!1)},16)})}}});n.rsModules.autoHeight=n.rsProto._w4}(jQuery),function(n){n.extend(n.rsProto,{_d6:function(){var t=this;t.st.globalCaption&&(t.ev.on("rsAfterInit",function(){t.globalCaption=n('<div class="rsGCaption"><\/div>').appendTo(t.st.globalCaptionInside?t._e1:t.slider);t.globalCaption.html(t.currSlide.caption||"")}),t.ev.on("rsBeforeAnimStart",function(){t.globalCaption.html(t.currSlide.caption||"")}))}});n.rsModules.globalCaption=n.rsProto._d6}(jQuery),function(n){n.rsProto._o4=function(){var t,n=this;if(n.st.addActiveClass)n.ev.on("rsOnUpdateNav",function(){t&&clearTimeout(t);t=setTimeout(function(){n._g4&&n._g4.removeClass("rsActiveSlide");n._r1&&n._r1.addClass("rsActiveSlide");t=null},50)})};n.rsModules.activeClass=n.rsProto._o4}(jQuery),function(n){n.extend(n.rsProto,{_o5:function(){var t=this,u,i,r;if(t._p5={enabled:!1,change:!1,prefix:""},t.st.deeplinking=n.extend({},t._p5,t.st.deeplinking),t.st.deeplinking.enabled){var f=t.st.deeplinking.change,e=t.st.deeplinking.prefix,o="#"+e,s=function(){var n=window.location.hash;return n&&0<n.indexOf(e)&&(n=parseInt(n.substring(o.length),10),0<=n)?n-1:-1},h=s();-1!==h&&(t.st.startSlideId=h);f&&(n(window).on("hashchange"+t.ns,function(n){u||(n=s(),0>n||(n>t.numSlides-1&&(n=t.numSlides-1),t.goTo(n)))}),t.ev.on("rsBeforeAnimStart",function(){i&&clearTimeout(i);r&&clearTimeout(r)}),t.ev.on("rsAfterSlideChange",function(){i&&clearTimeout(i);r&&clearTimeout(r);r=setTimeout(function(){u=!0;window.location.replace((""+window.location).split("#")[0]+o+(t.currSlideId+1));i=setTimeout(function(){u=!1;i=null},60)},400)}));t.ev.on("rsBeforeDestroy",function(){i=r=null;f&&n(window).off("hashchange"+t.ns)})}}});n.rsModules.deeplinking=n.rsProto._o5}(jQuery),function(n,t,i){function r(n){return n=n||location.href,"#"+n.replace(/^[^#]*#?(.*)$/,"$1")}var u=document,f,o=n.event.special,s=u.documentMode,e="onhashchange"in t&&(s===i||7<s);n.fn.hashchange=function(n){return n?this.bind("hashchange",n):this.trigger("hashchange")};n.fn.hashchange.delay=50;o.hashchange=n.extend(o.hashchange,{setup:function(){if(e)return!1;n(f.start)},teardown:function(){if(e)return!1;n(f.stop)}});f=function(){function h(){var u=r(),i=a(s);u!==s?(l(s=u,i),n(t).trigger("hashchange")):i!==s&&(location.href=location.href.replace(/#.*/,"")+i);o=setTimeout(h,n.fn.hashchange.delay)}var f={},o,s=r(),c=function(n){return n},l=c,a=c;return f.start=function(){o||h()},f.stop=function(){o&&clearTimeout(o);o=i},!t.attachEvent||t.addEventListener||e||function(){var t,i;f.start=function(){t||(i=(i=n.fn.hashchange.src)&&i+r(),t=n('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){i||l(r());h()}).attr("src",i||"javascript:0").insertAfter("body")[0].contentWindow,u.onpropertychange=function(){try{"title"===event.propertyName&&(t.document.title=u.title)}catch(n){}})};f.stop=c;a=function(){return r(t.location.href)};l=function(i,r){var f=t.document,e=n.fn.hashchange.domain;i!==r&&(f.title=u.title,f.open(),e&&f.write('<script>document.domain="'+e+'"<\/script>'),f.close(),t.location.hash=i)}}(),f}()}(jQuery,this),function(n){n.rsProto._g7=function(){var t=this;t.st.visibleNearby&&t.st.visibleNearby.enabled&&(t._h7={enabled:!0,centerArea:.6,center:!0,breakpoint:0,breakpointCenterArea:.8,hiddenOverflow:!0,navigateByCenterClick:!1},t.st.visibleNearby=n.extend({},t._h7,t.st.visibleNearby),t.ev.one("rsAfterPropsSetup",function(){t._i7=t._e1.css("overflow","visible").wrap('<div class="rsVisibleNearbyWrap"><\/div>').parent();t.st.visibleNearby.hiddenOverflow||t._i7.css("overflow","visible");t._o1=t.st.controlsInside?t._i7:t.slider}),t.ev.on("rsAfterSizePropSet",function(){var n,i=t.st.visibleNearby;n=i.breakpoint&&t.width<i.breakpoint?i.breakpointCenterArea:i.centerArea;t._h?(t._b4*=n,t._i7.css({height:t._c4,width:t._b4/n}),t._d=t._b4*(1-n)/2/n):(t._c4*=n,t._i7.css({height:t._c4/n,width:t._b4}),t._d=t._c4*(1-n)/2/n);i.navigateByCenterClick||(t._q=t._h?t._b4:t._c4);i.center&&t._e1.css("margin-"+(t._h?"left":"top"),t._d)}))};n.rsModules.visibleNearby=n.rsProto._g7}(jQuery),function(n){typeof define=="function"&&define.amd?define(["jquery"],n):typeof exports=="object"?n(require("jquery")):n(jQuery)}(function(n){var t=navigator.userAgent,u=/iphone/i.test(t),f=/chrome/i.test(t),i=/android/i.test(t),r;n.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"};n.fn.extend({caret:function(n,t){var i;if(this.length!==0&&!this.is(":hidden")&&this.get(0)===document.activeElement)return typeof n=="number"?(t=typeof t=="number"?t:n,this.each(function(){this.setSelectionRange?this.setSelectionRange(n,t):this.createTextRange&&(i=this.createTextRange(),i.collapse(!0),i.moveEnd("character",t),i.moveStart("character",n),i.select())})):(this[0].setSelectionRange?(n=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(i=document.selection.createRange(),n=0-i.duplicate().moveStart("character",-1e5),t=n+i.text.length),{begin:n,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,e){var p,l,o,c,h,v,s,a,y;return!t&&this.length>0?(p=n(this[0]),y=p.data(n.mask.dataName),y?y():undefined):(e=n.extend({autoclear:n.mask.autoclear,placeholder:n.mask.placeholder,completed:null},e),l=n.mask.definitions,o=[],c=s=t.length,h=null,t=String(t),n.each(t.split(""),function(n,t){t=="?"?(s--,c=n):l[t]?(o.push(new RegExp(l[t])),h===null&&(h=o.length-1),n<c&&(v=o.length-1)):o.push(null)}),this.trigger("unmask").each(function(){function tt(){if(e.completed){for(var n=h;n<=v;n++)if(o[n]&&p[n]===w(n))return;e.completed.call(y)}}function w(n){return n<e.placeholder.length?e.placeholder.charAt(n):e.placeholder.charAt(0)}function b(n){while(++n<s&&!o[n]);return n}function ft(n){while(--n>=0&&!o[n]);return n}function it(n,t){var r,i;if(!(n<0)){for(r=n,i=b(t);r<s;r++)if(o[r]){if(i<s&&o[r].test(p[i]))p[r]=p[i],p[i]=w(i);else break;i=b(i)}d();y.caret(Math.max(h,n))}}function et(n){for(var r,u,t=n,i=w(n);t<s;t++)if(o[t])if(r=b(t),u=p[t],p[t]=i,r<s&&o[r].test(u))i=u;else break}function ot(){var i=y.val(),n=y.caret(),r,t;if(a&&a.length&&a.length>i.length){for(k(!0);n.begin>0&&!o[n.begin-1];)n.begin--;if(n.begin===0)while(n.begin<h&&!o[n.begin])n.begin++;y.caret(n.begin,n.begin)}else r=k(!0),t=i.charAt(n.begin),n.begin<s&&(o[n.begin]?o[n.begin].test(t)&&n.begin++:(n.begin++,o[n.begin].test(t)&&n.begin++)),y.caret(n.begin,n.begin);tt()}function rt(){k();y.val()!=nt&&y.change()}function st(n){if(!y.prop("readonly")){var i=n.which||n.keyCode,f,r,t;a=y.val();i===8||i===46||u&&i===127?(f=y.caret(),r=f.begin,t=f.end,t-r==0&&(r=i!==46?ft(r):t=b(r-1),t=i===46?b(t):t),g(r,t),it(r,t-1),n.preventDefault()):i===13?rt.call(this,n):i===27&&(y.val(nt),y.caret(0,k()),n.preventDefault())}}function ht(t){var f,r,u,e,h,c;y.prop("readonly")||(f=t.which||t.keyCode,r=y.caret(),t.ctrlKey||t.altKey||t.metaKey||f<32)||f&&f!==13&&(r.end-r.begin!=0&&(g(r.begin,r.end),it(r.begin,r.end-1)),u=b(r.begin-1),u<s&&(e=String.fromCharCode(f),o[u].test(e)&&(et(u),p[u]=e,d(),h=b(u),i?(c=function(){n.proxy(n.fn.caret,y,h)()},setTimeout(c,0)):y.caret(h),r.begin<=v&&tt())),t.preventDefault())}function g(n,t){for(var i=n;i<t&&i<s;i++)o[i]&&(p[i]=w(i))}function d(){y.val(p.join(""))}function k(n){for(var r=y.val(),u=-1,f,t=0,i=0;t<s;t++)if(o[t]){for(p[t]=w(t);i++<r.length;)if(f=r.charAt(i-1),o[t].test(f)){p[t]=f;u=t;break}if(i>r.length){g(t+1,s);break}}else p[t]===r.charAt(i)&&i++,t<c&&(u=t);return n?d():u+1<c?e.autoclear||p.join("")===ut?(y.val()&&y.val(""),g(0,s)):d():(d(),y.val(y.val().substring(0,u+1))),c?t:h}var y=n(this),p=n.map(t.split(""),function(n,t){if(n!="?")return l[n]?w(t):n}),ut=p.join(""),nt=y.val();y.data(n.mask.dataName,function(){return n.map(p,function(n,t){return o[t]&&n!=w(t)?n:null}).join("")});y.one("unmask",function(){y.off(".mask").removeData(n.mask.dataName)}).on("focus.mask",function(){if(!y.prop("readonly")){clearTimeout(r);var n;nt=y.val();n=k();r=setTimeout(function(){y.get(0)===document.activeElement&&(d(),n==t.replace("?","").length?y.caret(0,n):y.caret(n))},10)}}).on("blur.mask",rt).on("keydown.mask",st).on("keypress.mask",ht).on("input.mask paste.mask",function(){y.prop("readonly")||setTimeout(function(){var n=k(!0);y.caret(n);tt()},0)});if(f&&i)y.off("input.mask").on("input.mask",ot);k()}))}})}),function(n,t){"use strict";var i;i=function(i,r){var h,c,u,s,f,o,e;return o=0,e=0,u=0,s={},f=[],c=0,h=function(t,i){this.options={speed:1,boost:0};for(u in i)this.options[u]=i[u];if((this.options.speed<0||this.options.speed>1)&&(this.options.speed=1),t||(t="paraxify"),n.getElementsByClassName(t.replace(".","")))this.photos=n.getElementsByClassName(t.replace(".",""));else if(n.querySelector(t)!==!1)this.photos=querySelector(t);else throw new Error("The elements you're trying to select don't exist.");s=this.options;f=this.photos;this._init(this)},h.prototype={update:function(){for(e=t.innerHeight,u=0;u<f.length;)f[u].style.backgroundPosition="center center",f[u].url=t.getComputedStyle(f[u],!1).backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2").split(",")[0],f[u].img||(f[u].img=new Image),f[u].url!==f[u].img.src&&(this._check(u),f[u].img.src=f[u].url),u++;this._animate()},_init:function(){this.update();t.onscroll=function(){this._animate()}.bind(this);t.onresize=function(){this.update()}.bind(this)},_check:function(n){var r,i;(i=f[n],i.ok=!0,i.bgSize=t.getComputedStyle(i,!1).backgroundSize,r=e,f[n].img!=undefined&&f[n].img!=null)&&(f[n].img.onload=function(){if(i.bgSize===""||i.bgSize==="auto")if(this.height<i.offsetHeight){i.ok=!1;throw new Error("The image "+i.url+" ("+this.height+"px) is too short for that container ("+i.offsetHeight+"px).");}else r=this.height,this.height<e&&(r=r+(e-i.offsetHeight)*s.speed);else if(i.bgSize==="cover"){if(e<i.offsetHeight){i.ok=!1;throw new Error("The container ("+i.offsetHeight+"px) can't be bigger than the image ("+e+"px).");}}else t.getComputedStyle(i,!1).backgroundSize==="cover",this._check(n);i.diff=-(r-i.offsetHeight)*s.speed;i.diff=i.diff-i.offsetHeight*s.boost})},_visible:function(n){return o+e>this._offsetTop(f[n])&&o<this._offsetTop(f[n])+f[n].offsetHeight?!0:!1},_animate:function(){var r,i;for(o=t.pageYOffset!==void 0?t.pageYOffset:(n.documentElement||n.body.parentNode||n.body).scrollTop,u=0;u<f.length;)this._check(u),f[u].ok&&t.getComputedStyle(f[u],!1).backgroundAttachment==="fixed"&&this._visible(u)?(r=(o-this._offsetTop(f[u])+e)/(f[u].offsetHeight+e),i=f[u].diff*(r-.5),f[u].bgSize!=="cover"&&(i=i+(e-f[u].img.height)/2),i=Math.round(i*100)/100):i="center",f[u].style.backgroundPosition="center "+i+"px",u++},_offsetTop:function(n){return jQuery(n).offset().top}},new h(i,r)};t.paraxify=i}(document,window,0),function(n){var r=function(){this.localStorage=this.isSupported("localStorage")?window.localStorage:new t;this.sessionStorage=this.isSupported("sessionStorage")?window.sessionStorage:new t(!0)},i,t;r.prototype.isSupported=function(n){var t="__isSupported",i=window[n];try{return i.setItem(t,"1"),i.removeItem(t),!0}catch(r){return!1}};i=function(){this.store={}};i.prototype.getItem=function(n){var t=this.store[n]||null;return t===null||t.trim().length<=0||t.trim().toLowerCase()==="null"?null:t};i.prototype.setItem=function(n,t){this.store[n]=t};i.prototype.removeItem=function(n){delete this.store[n]};t=function(n){this.objectStore={};this.expireDate=n?"; path=/":"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/";this.updateObject()};t.prototype.getItem=function(n){var t=this.objectStore[n]||null;return t===null||t.trim().length<=0||t.trim().toLowerCase()==="null"?null:t};t.prototype.setItem=function(n,t){n&&(document.cookie=escape(n)+"="+escape(t)+this.expireDate,this.updateObject())};t.prototype.removeItem=function(n){n&&(document.cookie=escape(n)+this.expireDate,delete this.objectStore[n])};t.prototype.updateObject=function(){for(var n,r,t=0,i=document.cookie.split(/\s*;\s*/);t<i.length;t++)n=i[t].split(/\s*=\s*/),n.length>1&&(this.objectStore[r=unescape(n[0])]=unescape(n[1]))};n.StorageService=new r}(window),function(n){typeof require=="function"&&typeof exports=="object"&&typeof module=="object"?n(require("knockout")):typeof define=="function"&&define.amd?define(["knockout"],n):n(ko)}(function(n){n.bindingHandlers.files={init:function(t,i,r){var p=r(),e,s,f,h,v,c,o,l,u=p.files;if(typeof n.unwrap(u)=="function"?e=n.unwrap(u):(e=n.unwrap(u.onLoaded),s=n.unwrap(u.onProgress),f=n.unwrap(u.onError),v=n.unwrap(u.allowDrop),h=n.unwrap(u.hoverClass),c=n.unwrap(u.fileFilter),l=n.unwrap(u.maxFileSize),o=n.unwrap(u.readAs)),typeof e=="function"){var w=function(n){var t=new FileReader;t.onload=function(t){e(n,t.target.result)};typeof s=="function"&&(t.onprogress=function(t){s(n,t.loaded,t.total)});typeof f=="function"&&(t.onerror=function(t){f(n,t.target.error)});o=="text"?t.readAsText(n):o=="array"?t.readAsArrayBuffer(n):o=="binary"?t.readAsBinaryString(n):t.readAsDataURL(n)},a=function(n){n.stopPropagation();n.preventDefault();n.type=="dragover"?n.target.classList.add(h):n.target.classList.remove(h)},b=function(n){a(n);y(n)},y=function(n){for(var r=n.target.files||n.dataTransfer.files,i=0,t;t=r[i];i++){if(typeof c!="undefined"&&!t.type.match(c)){typeof f=="function"&&f(t,"File type does not match filter");continue}if(typeof l!="undefined"&&t.size>=l){typeof f=="function"&&f(t,"File exceeds file size limit");continue}w(t)}};document.addEventListener&&(t.addEventListener("change",y,!1),v&&(t.addEventListener("dragover",a,!1),t.addEventListener("dragleave",a,!1),t.addEventListener("drop",b,!1)))}}}});WebApiService=function(n){var i=jQuery,t=this;this.webApiPrefix="/api";this.controller=n;i(document).ready(function(){t.isCheckoutPage=i("#checkout").length>0?!0:!1});this.SetControler=function(n){t.controller=n};this.GetActionKo=function(n,i,r){return Q(jQuery.ajaxQueue({url:t.webApiPrefix+"/"+t.controller+"/"+n,data:i,type:"GET",dataType:"json",cache:!1})).then(function(n){r(n)}).fail(function(t){console.error("Error in WebApiService, Action: "+n+", message: "+t)})};this.GetAction=function(n,i){return Q(jQuery.ajaxQueue({url:t.webApiPrefix+"/"+t.controller+"/"+n,data:i,type:"GET",dataType:"json",cache:!1})).then(function(i){return t.publishEvents(t.webApiPrefix+"/"+t.controller+"/"+n),i}).fail(function(t){console.error("Error in WebApiService, Action: "+n,t);throw t;})};this.GetHTML=function(n,i){return Q(jQuery.ajaxQueue({url:t.webApiPrefix+"/"+t.controller+"/"+n,data:i,type:"GET",dataType:"html",cache:!1})).then(function(i){return t.publishEvents(t.webApiPrefix+"/"+t.controller+"/"+n),i}).fail(function(t){console.error("Error in WebApiService, Action: "+n,t);throw t;})};this.PostAction=function(n,i){return(i==null||i.length<1)&&(i={}),Q(jQuery.ajaxQueue({beforeSend:function(n){n.setRequestHeader("Content-Type","application/x-www-form-urlencoded")},url:t.webApiPrefix+"/"+t.controller+"/"+n,type:"POST",dataType:"json",contentType:"application/json",cache:!1,data:i})).then(function(i){return t.publishEvents(t.webApiPrefix+"/"+t.controller+"/"+n),i}).fail(function(t){console.error("Error in POST WebApiService, Action: "+n+", message: "+t)})};this.PutAction=function(n,i){return i==null||i.length<1?null:Q(jQuery.ajaxQueue({beforeSend:function(n){n.setRequestHeader("Content-Type","application/x-www-form-urlencoded")},url:t.webApiPrefix+"/"+t.controller+"/"+n,type:"PUT",dataType:"json",contentType:"application/json",cache:!1,data:i})).then(function(i){return t.publishEvents(t.webApiPrefix+"/"+t.controller+"/"+n),i}).fail(function(t){console.error("Error in PUT WebApiService, Action: "+n+", message: "+t)})};this.DeleteAction=function(n,i){return i==null||i.length<1?null:Q(jQuery.ajaxQueue({beforeSend:function(n){n.setRequestHeader("Content-Type","application/x-www-form-urlencoded")},url:t.webApiPrefix+"/"+t.controller+"/"+n,type:"PUT",dataType:"json",contentType:"application/json",cache:!1,data:i})).then(function(i){return t.publishEvents(t.webApiPrefix+"/"+t.controller+"/"+n),i}).fail(function(t){console.error("Error in DELETE WebApiService, Action: "+n+", message: "+t)})};t.publishEvents=function(n){t.isCheckoutPage===!0&&PubSub.publish(mcWeb.cart.events.onRequestSendt,n)}},function(n){var t=n({});n.ajaxQueue=function(i){function e(t){f=n.ajax(i).done(r.resolve).fail(r.reject).then(t,t)}var f,r=n.Deferred(),u=r.promise();return t.queue(e),u.abort=function(o){if(f)return f.abort(o);var s=t.queue(),h=n.inArray(e,s);return h>-1&&s.splice(h,1),r.rejectWith(i.context||i,[u,o,""]),u},u}}(jQuery);mcWeb=mcWeb||{};mcWeb.responsive=function(n){"use strict";function i(){return f()?"lg":u()?"md":r()?"sm":"xs"}function a(){return h()?3840:s()?2560:o()?1920:e()?1440:f()?1200:u()?992:r()?768:"640"}function v(n){var t=i(),r=!1;return n=="lg"?r=t=="lg"||t=="md"||t=="sm"||t=="xs":n=="md"?r=t=="md"||t=="sm"||t=="xs":n=="sm"?r=t=="sm"||t=="xs":n=="xs"&&(r=t=="xs"),r}function y(){return!r()&&!u()&&!f()&&!e()&&!o()&&!s()&&!h()}function r(){try{return window.matchMedia("(min-width: 768px)").matches}catch(n){}return!1}function u(){try{return window.matchMedia("(min-width: 992px)").matches}catch(n){}return!1}function f(){try{return window.matchMedia("(min-width: 1200px)").matches}catch(n){}return!1}function e(){try{return window.matchMedia("(min-width: 1400px)").matches}catch(n){}return!1}function o(){try{return window.matchMedia("(min-width: 1880px)").matches}catch(n){}return!1}function s(){try{return window.matchMedia("(min-width: 2520px)").matches}catch(n){}return!1}function h(){try{return window.matchMedia("(min-width: 3800px)").matches}catch(n){}return!1}function c(t){var e=new WebApiService("Responsive"),i={size:t},r="SetResponsiveScreenSize",u=n("#d-size"),f;u!==undefined&&u.data("fully-responsive")!=="True"&&(f=w(),i={size:t,originUrl:window.location.href,zoom:f},r="SetScreenSize");e.GetAction(r,i).done(function(n){n&&n.length?n!=="[NO-RELOAD]"&&(n==="[RELOAD]"?window.location.reload(!0):window.location=n):window.location.reload(!0)})}function p(t){var i=new WebApiService("Responsive"),r={matched:t};i.GetAction("SetScreenSizeMatched",r).done(function(t){if(t&&t.length&&t==="true"){var i=n("#d-size");i!==undefined&&i.data("size-set",!0)}})}function w(){var n=window.outerWidth/window.innerWidth;return screen.deviceXDPI!=undefined?n=screen.deviceXDPI/screen.logicalXDPI:window.devicePixelRatio!=undefined&&(n=window.devicePixelRatio),n}function b(){var n=i();n!==t&&(t=n,c(n))}function l(){n(function(){var r,u,f;t=i();r=n("#d-size");r!==undefined&&(u=r.data("size"),u!=undefined&&u.length>0&&(u!=t?c(t):(f=r.data("size-set"),f==="False"&&p(!0))))});var r;n(window).on("resize",function(n,t){r&&clearTimeout(r);r=setTimeout(function(){b(n,t);r=null},200)})}var t=null;return l(),{setupResponsiveDesign:l,getScreenSize:i,getScreenSizePixels:a,isExtraSmall:y,isSmall:r,isMedium:u,isLarge:f,useMobileMenu:v}}(jQuery);mcSlide=new function(){var t=!1;this.isSwipeTouched=function(){return t};this.removeInnerSlide=function(n){var i=n.find(".royalSlider"),e,r,u,t,o;if(i.length>0){for(n.append('<div class="slide-tmp"> <\/div>'),e=n.children(".slide-tmp"),r=0;r<i.length;r++)i.children().appendTo(e);for(u=n.children(),t=0;t<u.length;t++){var f=jQuery(u[t]),s=f.hasClass("slide-tmp"),h=f.hasClass("rsNav rsBullets");s==!1&&h==!1&&f.remove()}o=n.children(".slide-tmp").children();o.unwrap()}};this.InitSlideshow=function(n,t,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d){var st=w==!0&&a=="vertical"?!1:!0,it,g,ut,ft,tt,ot;if(c=c=="slide"?"move":c,it=jQuery("#"+n),g=it.find(".royalSlider").first(),!(g.length<1)){if(ut=g.children().length>1&&e?"bullets":"none",this.removeInnerSlide(g),w==!1&&b==800&&k==400)ft=g,tt=ft.find(".WebPubFieldRow").first(),tt.length>0&&(k=tt.height(),b=tt.width());else if(w==!0){var nt=0,rt=0,et=g.find(".WebPubElement");et.each(function(){rt=$(this).height();nt<rt&&(nt=rt)});et.each(function(){$(this).height(nt)});nt>0&&(k=nt,ot=g.find(".sm-jqm"),ot.length>0&&(k+=20),b=Math.abs(window.orientation)===90?$(window).height():$(window).width())}return i(g,it,st,t,r,u,f,ut,o,s,h,c,l,a,v,y,p,w,b,k,d)}};this.InitKnockoutSlideshow=function(n,t){var a=n.IsMobileDomain==!0&&n.Orientation=="vertical"?!1:!0,v=n.Effect=="slide"?"move":n.Effect,r=jQuery(t),h,o,l;if(!(r.length<1)){var e=n.Width,u=n.Height,y=r.children().length>1&&n.GeneratePagination?"bullets":"none";if(this.removeInnerSlide(r),n.IsMobileDomain==!1&&e==800&&u==400)h=r,o=h.find(".row-container").first(),o.length>0&&(u=o.height()+5,e=r.width());else if(n.IsMobileDomain==!0){var f=0,s=0,c=r.find(".element-ko");c.each(function(){s=$(this).height();f<s&&(f=s)});c.each(function(){$(this).height(f)});f>0&&(u=f,l=r.find(".sm-jqm"),l.length>0&&(u+=20),e=Math.abs(window.orientation)===90?$(window).height():$(window).width())}return i(r,r,a,n.Play,n.Pause,n.HoverPause,n.GenerateNextPrev,y,n.ArrowsNavAutoHide,n.FadeSpeed,n.SlideSpeed,v,n.Crrossfade,n.Orientation,n.ScaleType,n.Randomize,n.Css,n.IsMobileDomain,e,u,!0)}};var n=function(n){if(n!==undefined&&n!==null&&n.content!==undefined){var t=jQuery(n.content).find("img.lazy-slideshow");jQuery(t).each(function(n,t){jQuery(t).trigger("appear");jQuery(t).removeClass("lazy-slideshow")});t=jQuery(n.content).find("img.lazy");jQuery(t).each(function(n,t){jQuery(t).trigger("appear");jQuery(t).removeClass("lazy")})}},i=function(i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt){k.length>0&&i.addClass(k);var it=i.royalSlider({sliderTouch:u,sliderDrag:u,autoScaleSlider:!0,autoScaleSliderWidth:g,autoScaleSliderHeight:nt,controlNavigation:h,arrowsNav:s,arrowsNavAutoHide:c,controlNavigationSpacing:0,loop:!0,numImagesToPreload:10,usePreloader:!1,keyboardNavEnabled:!1,navigateByClick:!1,transitionType:v,transitionSpeed:a,slidesOrientation:p,randomizeSlides:b,imageScalePadding:5,autoPlay:{enabled:tt,pauseOnHover:o,stopAtAction:!1,delay:f}}).data("royalSlider");n(it.slides[it.currSlideId]);setTimeout(function(){var n=i.find(".WebPubFieldRow").first();n.length>0&&(it.width=0,it.st.autoScaleSliderHeight=n.height(),it.st.autoScaleSliderWidth=n.width());it.updateSliderSize(!0)},1e3);it.ev.on("rsDragStart",function(){t=!0});it.ev.on("rsDragRelease",function(){setTimeout(function(){t=!1},100)});r.addClass("Show");d==!1&&i.parent().append(i.find(".rsNav"));it.ev.on("rsBeforeMove",function(t,i){i==="next"?this.currSlideId+1<this.numSlides&&(n(this.slides[this.currSlideId+1]),this.currSlideId+2<this.numSlides&&n(this.slides[this.currSlideId+2])):i==="prev"?this.currSlideId-1>=0&&n(this.slides[this.currSlideId-1]):i>=0?i<this.numSlides?(n(this.slides[i]),i+1<this.numSlides&&n(this.slides[i+1])):n(this.slides[0]):(n(this.slides[this.numSlides+i]),this.numSlides+i-1>0&&n(this.slides[this.numSlides+i-1]))});return it},r=jQuery(".rsContent.zindex-off");r!=null&&setTimeout(function(){r.removeClass("zindex-off")},1e3)};mcWeb.hash=new function(){var t=jQuery,n=this,i;n.isLightboxReady=!1;n.init=function(){t(document).on("lightboxReady",function(){if(!n.isLightboxReady){n.isLightboxReady=!0;t(window).on("hashchange",function(){i()});i()}});setTimeout(function(){n.isLightboxReady||t(document).trigger("lightboxReady")},400)};i=function(){switch(window.location.hash.toLowerCase()){case"#login":mcWeb.login.load();break;case"#closedlogin":mcWeb.login.loadClosedLogin();break;case"#logout":mcWeb.login.logout();break;case"#password":mcWeb.loginPassword.load();break;case"#logincontact":mcWeb.loginContacts.load();break;case"#loginagent":mcWeb.loginAgent.load();break;case"#productvariantmatrix":mcWeb.productVariantMatrix.load();break;case"#customerregistration":mcWeb.customerRegistration.LoadView();break;case"#skiassembly":mcWeb.SkiAssembly.load();break;case"#skiattributeassembly":mcWeb.SkiAttributeAssembly.load();break;case"#tagger":mcWeb.attributeTagger.load()}}};mc=mc||{};mc.format=new function(){"use strict";var t=this;t.asNumber=function(t,i,r){return Number(n(t,i,r))};t.asCulture=function(t,i){try{return t=n(t,i).toLocaleString(),r()==="."?t.replace(",","."):t.replace(".",",")}catch(u){return"1"}};t.roundToNearest=function(t,i,r){var f=Number(n(t,r)),e=Number(n(i,r)),o=Number(n(r,0));return u(f,e,o)};var n=function(r,u,f){try{r!=null&&(r=r.toString().replace(",","."));u=Number(u);isNaN(u)&&(u=0);(isNaN(r)||r.length<1)&&(r=f!=null?n(f,u,1):n(1,u));var o=i(r,u),e=parseFloat(Math.round(o*100)/100).toFixed(u);return isNaN(e)?t.asNumber(1,u):e}catch(s){return 1}},r=function(){if(_MCDECIMAL_SEP!==undefined)return _MCDECIMAL_SEP;return 1.1.toLocaleString().substring(1,2)},i=function(n,t){var i=Math.round(n*Math.pow(10,t))/Math.pow(10,t);return n-i>0?i+Math.floor(Math.round((n-i)*Math.pow(10,t+1))/5)/Math.pow(10,t):i},u=function(t,r,u){var e=t*100,f=r*100,o=1;return(e=i(e,u),f=i(f,u),e==0)?0:(o=e%f==0?parseFloat(Math.floor(e/f))*f:parseFloat(Math.floor(e/f))*f+f,n(o/100,u))}}(jQuery);mcWeb.flabels=new function(n){var t=this;t.events={reload:"mcWeb.flabels.reload"};n(document).ready(function(){t.load()});t.load=function(){var t=navigator.userAgent.indexOf("MSIE")!==-1||navigator.appVersion.indexOf("Trident/")>0;n('[data-toggle="f-label"]').each(function(i,r){var u=n(r);if(!(u.length<1)){u.attr("placeholder",u.next("label").text());u.focusin(function(){var i=n(this),r=i.parent();r.addClass("f-label-active");t&&i.attr("data-value"," ")});u.focusout(function(){var i=n(this),r=i.parent();r.removeClass("f-label-active");t&&i.attr("data-value","")});u.attr("data-value",n(this).val()).on("keyup change",function(){var t=n(this);t.attr("data-value",t.val())})}})};PubSub.subscribe(t.events.reload,function(){t.load()})}(jQuery);mcWeb.lightbox=new function(){var n=jQuery,t=this,i;t.events={onShowSpinicon:"mcWeb.lightbox.onShowSpinicon",onHideSpinicon:"mcWeb.lightbox.onHideSpinicon",onShowLightbox:"mcWeb.lightbox.onShowLightbox",onHideLightbox:"mcWeb.lightbox.onHideLightbox",modifyOptions:"mcWeb.lightbox.modifyOptions",contentChanged:"mcWeb.lightbox.contentChanged"};i=!1;t.init=function(){function u(){if(i===!0)return!0;var t=n(".body-checkout #lightboxCustomerRegistration");return t==null||t.length<1?!1:!0}function f(){var t=n(".customer-registration-confirm");t.length>0&&location.reload(!0)}function e(){n(".qtip").remove();window.location.hash=""}var r=null;PubSub.subscribe(mcWeb.lightbox.events.onShowLightbox,function(i,u){var f=n("#center-popup"),e=!!u,s=f.find(".lightbox-close"),o;e&&u.keyboard===!1?s.hide():s.show();e&&u.css!=null&&(r=u.css,f.addClass(r));f.is(":visible")?e?u!=undefined&&u!=null&&u.variantData!=undefined?t.publishUpdateOfPublishedFieldEvent(u):u!=undefined&&u!=null&&u.callback!=undefined&&u.callback!=null&&u.callback():(o=f.data("bs.modal"),o.options.backdrop=!0,o.options.keyboard=!0,t.publishUpdateOfPublishedFieldEvent(u)):setTimeout(function(){f.modal(e?u:"show");f.show();PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);t.publishUpdateOfPublishedFieldEvent(u)},300)});PubSub.subscribe(mcWeb.lightbox.events.onHideLightbox,function(){var i=n("#center-popup");r!=null&&(i.removeClass(r),r=null);i.is(":visible")&&(i.modal("hide"),i.hide(),PubSub.publish(mcWeb.lightbox.events.onHideSpinicon));u()&&location.reload(!0);t.movePopupFieldsToOriginalPlaceholder(i)});PubSub.subscribe(mcWeb.lightbox.events.onShowSpinicon,function(){n(".center-placeholder").addClass("refresh-data");n("#refresh-center").show()});PubSub.subscribe(mcWeb.lightbox.events.onHideSpinicon,function(){n(".center-placeholder").removeClass("refresh-data");n("#refresh-center").hide()});PubSub.subscribe(mcWeb.lightbox.events.contentChanged,function(){n(".modal:visible").each(t.centerLighBox)});PubSub.subscribe(mcWeb.lightbox.events.modifyOptions,function(t,i){var u=n("#center-popup"),r;(u.data("bs.modal")||{}).isShown&&(r=u.data("bs.modal"),i.backdrop&&(i.backdrop==="static"&&(r.options.backdrop="static"),i.backdrop===!0&&(r.options.backdrop=!0),i.backdrop===!1&&(r.options.backdrop=!1)),i.keyboard&&(i.keyboard===!0&&(r.options.keyboard=!0),i.keyboard===!1&&(r.options.keyboard=!1)))});n("#center-popup").on("show.bs.modal",function(){n("#center-popup").each(t.centerLighBox)});n("#center-popup").on("hide.bs.modal",function(){r!=null&&(n(this).removeClass(r),r=null);u()&&location.reload(!0);e();f()});n(window).on("resize",function(){n(".modal:visible").each(t.centerLighBox)})};t.movePopupFieldsToOriginalPlaceholder=function(t){var i=t.find(".web-pub-field").each(function(t,i){var o=i.id,r=n(i),u=n("div[data-placeholder-id='"+o+"']"),f=r.find(".ajax-field"),e;f.length>0&&f.empty();e=r.detach();u.after(e);u.detach()})};t.publishUpdateOfPublishedFieldEvent=function(n){var t={variantMatrix:null};n!=undefined&&n!=null&&(n.variantData!=null&&n.variantData!=undefined&&(t.variantMatrix=n.variantData,PubSub.publish(mcWeb.ajaxRenderEngine.events.onNewAreasShown,t)),n.callback!=undefined&&n.callback!=null&&n.callback())};t.cancelRegistration=function(){i=!0;mcWeb.login.load()};t.centerLighBox=function(){var i=n(this),t=i.find(".modal-dialog");i.css("display","block");t.css({position:"absolute",top:"50%",left:"50%",transform:"translate(-"+Math.round(t.width()/2)+"px, -"+Math.round(Math.min(n(window).height(),t.height())/2)+"px)","margin-top":""})};n(function(){t.init();setTimeout(function(){n(document).trigger("lightboxReady")},1e3)})};LanguageService=function(){var n=this;this.service=new WebApiService("Language");this.getValueKo=function(t,i,r){return n.service.GetActionKo("GetValue",{obj:t,name:i},r)};this.getValue=function(t,i){return n.service.GetAction("GetValue",{obj:t,name:i})}};mcWeb.tooltip={show:function(n,t){n.qtip({content:{text:t},hide:{event:"unfocus",fixed:!0,effect:function(){$(this).slideUp()}},position:{my:"bottom center",at:"top center"},style:{classes:"qtip-bootstrap"},show:{ready:!0,event:"contextmenu"}})}};jQuery.support.placeholder=function(){var n=document.createElement("input");return"placeholder"in n}();mcWeb.validation=new function(){var t=this,n=jQuery;t.service=new WebApiService("Language");t.registrationService=new WebApiService("CustomerRegistration");ko.bindingHandlers.validation={init:function(n,i,r,u,f){f.$data.validationRules.push({element:n,rules:i()});var e=r().value();t.moveLabel(e,n)},update:function(n,i,r){var u=r().value();t.moveLabel(u,n)}};ko.bindingHandlers.smartlabel={init:function(n,i,r){var u=r().value();t.moveLabel(u,n,!0)},update:function(n,i,r){var u=r().value();t.moveLabel(u,n,!0)}};this.moveLabel=function(t,i,r){var u=ko.unwrap(t);u!==undefined&&u.length>0?(n(i).parent().removeClass("inactive").addClass("active"),n(i).next().fadeIn()):(r&&n(i).attr("placeholder",n(i).next().text()),n.support.placeholder?(n(i).parent().removeClass("inactive").addClass("inactive"),n(i).next().fadeOut()):n(i).parent().removeClass("inactive").addClass("inactive-old"))};this.isNotEmpty=function(n){return n.value!==null&&n.value!==""&&n.value!==undefined&&!t.isAllUnderscore(n.value)};t.isAllUnderscore=function(n){var t,i,r;if(n===null||n===""||n===undefined)return!1;for(t=0,i=!0,t=0;t<n.length;t++)if(r=n.substring(t,t+1),r!=="_"){i=!1;break}return i};this.isEmail=function(n){return/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.test(n.value)};this.isDigitsOnly=function(n){return/^\s*\d[\d\s]*$/.test(n.value)};this.isDigitsAndScrableOnly=function(n){return/^\s*\d[\d\s*?]*$/.test(n.value)};this.isLettersDigitsOnly=function(n){return/^[A-Za-z0-9 _]*[A-Za-z0-9][A-Za-z0-9]*$/.test(n.value)};this.isValidDate=function(n){return/^\d{6}$/.test(n.value)};this.isMinLenght=function(n,t){return n.value.length>=t};this.isUsernameNew=function(n){n.val!==undefined&&n.length>0;var i={userName:n.value};return t.registrationService.PostAction("IsUsernameNew",i)};this.isOrgnrNew=function(n){n.val!==undefined&&n.length>0;var i={orgnr:n.value};return t.registrationService.GetAction("IsOrgnrNew",i)};this.isMaxLenght=function(n,t){return n.value.length<=t};this.isLength=function(n,t){return n.value.length===t};this.addErrorClass=function(t){n(t).addClass("validation_error")};this.qTipActionShowClickHide=function(t,i){n(t).qtip({content:{text:i},position:{my:"bottom center",at:"top center"},style:{classes:"qtip-bootstrap qtip-cust-condition"},show:!0,hide:{event:"click"},prerender:!0})};this.qTipActionShow=function(t,i,r){r?n(t).qtip({content:{text:i},position:{my:"bottom center",at:"top center"},show:!0,hide:!1,prerender:!0}):n(t).qtip({content:{text:i},position:{my:"bottom center",at:"top center"},style:{classes:"qtip-bootstrap qtip-cust"},show:!0,hide:!1,prerender:!0})};this.qTipActionShowAndHide=function(t,i,r,u){r?n(t).qtip({content:{text:i},position:{my:"bottom center",at:"top center"},show:!0,hide:{delay:u},prerender:!0}):n(t).qtip({content:{text:i},position:{my:"bottom center",at:"top center"},style:{classes:"qtip-bootstrap qtip-cust"},show:!0,hide:{event:"unfocus",inactive:u},prerender:!0})};this.elementIsValid=function(n){return n.valid==!0};this.validateElement=function(t,i){var r=this.validateModel(t);return r.then(function(t){for(var f=!0,u="",r=0;r<t.length;r++)t[r].elem!==i||t[r].valid||(f=!1,u=t[r].rule);return f?(n(".qtip").remove(),{valid:!0,rule:u}):{valid:!1,rule:u}})};this.setValidCss=function(t){n(t).parent().addClass("ok");n(t).removeClass("validation_error");n(t).prev().addClass("icon-star icon-ok green")};this.removeValidCss=function(t){n(t).parent().removeClass("ok");n(t).removeClass("validation_error");n(t).prev().removeClass("icon-ok green")};this.getErrorMessage=function(n){var i=n.split(","),r={obj:i[0],name:i[1]};return t.service.GetAction("GetValue",r)};this.getErrorMessages=function(n){for(var f=[],r,u,e,i=0;i<n.length;i++)for(r=0;r<n[i].rules.length;r++)u=n[i].rules[r].resource.split(","),f.push({Object:u[0],Name:u[1],Value:""});return e={"":f},t.service.PostAction("PostValues",e)};this.validateModel=function(t){for(var c=[],o,r=[],i,u,f,s,l,a,h,e=0;e<t.length;e++)if(i=t[e].element,n(i).is(":visible"))for(o=0;o<t[e].rules.length;o++){u=t[e].rules[o];f=u.rule;switch(f){case"required":!this.isNotEmpty(i)&&(ko.isComputed(u.active)||ko.isObservable(u.active)?u.active():u.active)?r.push({elem:i,rule:f,valid:!1}):r.push({elem:i,rule:f,valid:!0});break;case"email":i.value!==""&&!this.isEmail(i)&&(ko.isComputed(u.active)||ko.isObservable(u.active)?u.active():u.active)?r.push({elem:i,rule:f,valid:!1}):r.push({elem:i,rule:f,valid:!0});break;case"digits":this.isDigitsOnly(i)||!u.active?r.push({elem:i,valid:!0}):r.push({elem:i,rule:f,valid:!1});break;case"digitsorscramble":this.isDigitsAndScrableOnly(i)||!u.active?r.push({elem:i,valid:!0}):r.push({elem:i,rule:f,valid:!1});break;case"minlenght":this.isNotEmpty(i)||!u.active?r.push({elem:i,valid:!0}):r.push({elem:i,rule:f,valid:!1});break;case"maxlenght":this.isNotEmpty(i)||!u.active?r.push({elem:i,valid:!0}):r.push({elem:i,rule:f,valid:!1});break;case"lenght":this.isLength(i,u.len)||!u.active?r.push({elem:i,valid:!0}):r.push({elem:i,rule:f,valid:!1});break;case"usernameUnique":s={elem:i,rule:"usernameUnique",valid:!1};l=u;r.push(s);a=this.isUsernameNew(i).then(function(n){s.valid=n!=!0&&l.active()?!1:!0});c.push(a);break;case"orgNrUnique":h={elem:i,rule:"orgNrUnique",valid:!1};r.push(h);var p=i,v=u,y=this.isOrgnrNew(i).then(function(n){h.valid=n!=!0&&v.active?!1:!0});c.push(y);break;case"date":this.isLength(i,0)||this.isValidDate(i)||!u.active?r.push({elem:i,valid:!0}):r.push({elem:i,rule:f,valid:!1});break;case"custom":u.func()||!u.active?r.push({elem:i,valid:!0}):r.push({elem:i,rule:f,valid:!1})}}return Q.allSettled(c).then(function(){return r})}},function(n){"use strict";function i(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);return n}function t(n){this.options=i({},this.options);i(this.options,n);this._init()}t.prototype.events={onClose:"Menu.events.onClose",onOpen:"Menu.events.onOpen",onAddNewFilterButton:"Menu.events.onAddNewFilterButton"};t.prototype.options={wrapper:"#o-wrapper",type:"slide-left",menuOpenerClass:".c-button",maskId:"#c-mask",menuStartId:"#c-menu--",closeClass:".c-menu__close"};t.prototype._init=function(){this.isOpen=!1;this.body=document.body;this.wrapper=document.querySelector(this.options.wrapper);this.mask=document.querySelector(this.options.maskId);this.menu=document.querySelector(this.options.menuStartId+this.options.type);this.closeBtn=this.menu.querySelector(this.options.closeClass);this.menuOpeners=document.querySelector(this.options.menuOpenerClass);this._initEvents()};t.prototype._initEvents=function(){this.closeBtn.addEventListener("click",function(n){n.preventDefault();this.close()}.bind(this));this.mask.addEventListener("click",function(n){n.preventDefault();this.close()}.bind(this));this.menuOpeners.addEventListener("click",function(n){n.preventDefault();this.isOpen?this.close():this.open()}.bind(this))};t.prototype.notransition=function(){this.menu.classList.add("notransition");this.mask.classList.add("notransition")};t.prototype.transition=function(){this.menu.classList.remove("notransition");this.mask.classList.remove("notransition")};t.prototype.open=function(){this.menuOpeners.classList.add("change");this.body.classList.add("has-active-menu");this.wrapper.classList.add("has-"+this.options.type);this.menu.classList.add("is-active");this.mask.classList.add("is-active");this.isOpen=!0;PubSub.publish(t.prototype.events.onOpen,this.menu.id)};t.prototype.close=function(){this.menuOpeners.classList.remove("change");this.body.classList.remove("has-active-menu");this.wrapper.classList.remove("has-"+this.options.type);this.menu.classList.remove("is-active");this.mask.classList.remove("is-active");this.isOpen=!1;PubSub.publish(t.prototype.events.onClose,this.menu.id)};n.Menu=t}(window);!function(n,t){"use strict";"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():n.Headroom=t()}(this,function(){"use strict";function i(n){this.callback=n;this.ticking=!1}function u(n){return n&&"undefined"!=typeof window&&(n===window||n.nodeType)}function r(n){var t,f,i,e;if(arguments.length<=0)throw new Error("Missing arguments in extend function");for(i=n||{},f=1;f<arguments.length;f++){e=arguments[f]||{};for(t in e)i[t]="object"!=typeof i[t]||u(i[t])?i[t]||e[t]:r(i[t],e[t])}return i}function f(n){return n===Object(n)?n:{down:n,up:n}}function n(t,i){i=r(i,n.options);this.lastKnownScrollY=0;this.elem=t;this.tolerance=f(i.tolerance);this.classes=i.classes;this.offset=i.offset;this.scroller=i.scroller;this.initialised=!1;this.onPin=i.onPin;this.onUnpin=i.onUnpin;this.onTop=i.onTop;this.onNotTop=i.onNotTop;this.onBottom=i.onBottom;this.onNotBottom=i.onNotBottom}var t={bind:!!function(){}.bind,classList:"classList"in document.documentElement,rAF:!!(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame)};return window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,i.prototype={constructor:i,update:function(){this.callback&&this.callback();this.ticking=!1},requestTick:function(){this.ticking||(requestAnimationFrame(this.rafCallback||(this.rafCallback=this.update.bind(this))),this.ticking=!0)},handleEvent:function(){this.requestTick()}},n.prototype={constructor:n,init:function(){if(n.cutsTheMustard)return(this.debouncer=new i(this.update.bind(this)),this.elem.classList.add(this.classes.initial),setTimeout(this.attachEvent.bind(this),100),this)},destroy:function(){var n=this.classes;this.initialised=!1;this.elem.classList.remove(n.unpinned,n.pinned,n.top,n.notTop,n.initial);this.scroller.removeEventListener("scroll",this.debouncer,!1)},attachEvent:function(){this.initialised||(this.lastKnownScrollY=this.getScrollY(),this.initialised=!0,this.scroller.addEventListener("scroll",this.debouncer,!1),this.debouncer.handleEvent())},unpin:function(){var n=this.elem.classList,t=this.classes;!n.contains(t.pinned)&&n.contains(t.unpinned)||(n.add(t.unpinned),n.remove(t.pinned),this.onUnpin&&this.onUnpin.call(this))},pin:function(){var n=this.elem.classList,t=this.classes;n.contains(t.unpinned)&&(n.remove(t.unpinned),n.add(t.pinned),this.onPin&&this.onPin.call(this))},top:function(){var n=this.elem.classList,t=this.classes;n.contains(t.top)||(n.add(t.top),n.remove(t.notTop),this.onTop&&this.onTop.call(this))},notTop:function(){var n=this.elem.classList,t=this.classes;n.contains(t.notTop)||(n.add(t.notTop),n.remove(t.top),this.onNotTop&&this.onNotTop.call(this))},bottom:function(){var n=this.elem.classList,t=this.classes;n.contains(t.bottom)||(n.add(t.bottom),n.remove(t.notBottom),this.onBottom&&this.onBottom.call(this))},notBottom:function(){var n=this.elem.classList,t=this.classes;n.contains(t.notBottom)||(n.add(t.notBottom),n.remove(t.bottom),this.onNotBottom&&this.onNotBottom.call(this))},getScrollY:function(){return void 0!==this.scroller.pageYOffset?this.scroller.pageYOffset:void 0!==this.scroller.scrollTop?this.scroller.scrollTop:(document.documentElement||document.body.parentNode||document.body).scrollTop},getViewportHeight:function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},getElementPhysicalHeight:function(n){return Math.max(n.offsetHeight,n.clientHeight)},getScrollerPhysicalHeight:function(){return this.scroller===window||this.scroller===document.body?this.getViewportHeight():this.getElementPhysicalHeight(this.scroller)},getDocumentHeight:function(){var n=document.body,t=document.documentElement;return Math.max(n.scrollHeight,t.scrollHeight,n.offsetHeight,t.offsetHeight,n.clientHeight,t.clientHeight)},getElementHeight:function(n){return Math.max(n.scrollHeight,n.offsetHeight,n.clientHeight)},getScrollerHeight:function(){return this.scroller===window||this.scroller===document.body?this.getDocumentHeight():this.getElementHeight(this.scroller)},isOutOfBounds:function(n){var t=0>n,i=n+this.getScrollerPhysicalHeight()>this.getScrollerHeight();return t||i},toleranceExceeded:function(n,t){return Math.abs(n-this.lastKnownScrollY)>=this.tolerance[t]},shouldUnpin:function(n,t){var i=n>this.lastKnownScrollY,r=n>=this.offset;return i&&r&&t},shouldPin:function(n,t){var i=n<this.lastKnownScrollY,r=n<=this.offset;return i&&t||r},update:function(){var n=this.getScrollY(),i=n>this.lastKnownScrollY?"down":"up",t=this.toleranceExceeded(n,i);this.isOutOfBounds(n)||(n<=this.offset?this.top():this.notTop(),n+this.getViewportHeight()>=this.getScrollerHeight()?this.bottom():this.notBottom(),this.shouldUnpin(n,t)?this.unpin():this.shouldPin(n,t)&&this.pin(),this.lastKnownScrollY=n)}},n.options={tolerance:{up:0,down:0},offset:0,scroller:window,classes:{pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",bottom:"headroom--bottom",notBottom:"headroom--not-bottom",initial:"headroom"}},n.cutsTheMustard="undefined"!=typeof t&&t.rAF&&t.bind&&t.classList,n});mcWeb=mcWeb||{};mcWeb.variantImage=new function(){"use strict";var n=jQuery,t=this;t.selectImage=function(t,i,r){var f=n("#"+t),u=f.find("img.lazy"),e;f.length>0&&u!==undefined&&(u[0].src=r[i].ImageUrl,u[0].title=r[i].Title,u[0].alt=r[i].AltTag,e=f.find("a[href]"),e.length>0&&n(e[0]).attr("href",r[i].Href))}};ko.components.register("discount-code",{viewModel:function(){var t=jQuery,n=this;this.service=new WebApiService("Cart");this.languageService=new LanguageService;this.discountCode=ko.observable("");this.discountPending=ko.observable(!1);this.discountCodeError=ko.observable(!1);this.isCheckout=ko.observable(t(".body-checkout").length>0?!0:!1);this.buttonText=ko.observable();this.onClickDiscount=function(){n.discountCode().length!==0&&(n.discountCodeError(!1),n.discountPending(!0),n.service.GetAction("AddDiscountCode",{discountCode:n.discountCode(),isCheckout:n.isCheckout()}).then(function(t){t===0?(n.updateCart(),n.discountCode(""),n.showLanguageTextInTooltip("CUSTOMERCENTER_MYPAGE","RabattkodeRegistrert"),setTimeout(PubSub.publish(mcWeb.payments.events.reloadPayments,null),750)):(n.discountCodeError(!0),t===3?n.showLanguageTextInTooltip("CUSTOMERCENTER_MYPAGE","RabattkodeFinnesIkke"):t===2?n.showLanguageTextInTooltip("CUSTOMERCENTER_MYPAGE","RabattkodeFinnes"):n.showLanguageTextInTooltip("CUSTOMERCENTER_MYPAGE","RabattkodeFeil"))}).fail(function(t){console.log(t);n.discountCodeError(!0);n.showLanguageTextInTooltip("CUSTOMERCENTER_MYPAGE","RabattkodeFeil")}).finally(function(){n.discountPending(!1)}))};this.updateCart=function(){n.service.GetAction("LoadCart",{cartName:null,useVat:null,discountCode:null,vatChange:!1,isCheckout:n.isCheckout()}).done(function(n){n!=null&&PubSub.publish(mcWeb.cart.events.onChangedCart,n)})};this.showLanguageTextInTooltip=function(t,i){n.languageService.getValue(t,i).done(function(n){mcWeb.tooltip.show(jQuery("#discount-code-input"),n)})};this.getButtonText=function(){n.languageService.getValue("COMMANDS","Add").done(function(t){n.buttonText(t)})};n.getButtonText()},template:'<div class="form-group" data-bind="css: { \'has-feedback has-error\': discountCodeError}">\t\t\t<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true" data-bind="visible: discountCodeError"><\/span>\t\t\t<input type="text" id="discount-code-input" class="form-control" onclick="return false;" data-bind="value: discountCode, valueUpdate: \'input\', ">\t\t<\/div>\t\t<div class="form-group">\t\t\t<button type="button" id="discount-button" class="btn btn-default" data-bind="click: onClickDiscount, disable: discountCode().length == 0 || discountPending()">\t\t\t\t<span class="spinner" data-bind="visible: discountPending"><i class="icon-spinner animate-spin"><\/i><\/span>\t\t\t\t<span data-bind="text: buttonText"><\/span>\t\t\t<\/button>\t\t<\/div>'});mcWeb.freeShippingTxt=new function(n){"use strict";this.events={onUpdateFreeShipping:"mcWeb.freeShipping.onUpdateFreeShipping"};this.load=function(){var t=this;t.service=new WebApiService("Cart");t.updateFreeShippingTxt=function(){var i={isCheckout:n(".body-checkout").length>0?!0:!1};t.service.GetAction("UpdateFreeShipmentCountDown",i).done(function(t){t.length>0&&n(".free-shipping-counter").html(t)})};PubSub.subscribe(mcWeb.freeShippingTxt.events.onUpdateFreeShipping,function(){t.updateFreeShippingTxt()})}}(jQuery);document.addEventListener("DOMContentLoaded",function(){mcWeb.freeShippingTxt.load()});mcWeb.paymentTools=new function(){var t=jQuery,n=this;n.sveaService=new WebApiService("PaymentTools");n.getSveaMinimumMonthCost=function(i,r){n.sveaService.GetAction("GetSveaMinimumMonthCost",{plid:i}).done(function(n){var u,f;n!=null&&n.length>0&&(u=t("#svea-web-pay-"+i),r!=null?(f=u.html(),f=f.replace("¤amount¤",n),u.html(f)):u.find("span").text(n),u.show())})}};mcWeb.instantSearch=new function(){var n,i;this.request=null;this.searchTextBox=null;this.instantSearch=!1;this.publishMode=!1;n=this;n.searchHasFocus=!1;n.clearEntryOnClick=!1;n.vm=new function(){var i=this;i.products=ko.observableArray();i.brands=ko.observableArray();i.brandnames=ko.observableArray();i.categories=ko.observableArray();i.articles=ko.observableArray();i.TotalHits=ko.observable(0);i.TotalArticleHits=ko.observable(0);i.ShowBrands=ko.observable(!1);i.ShowBrandNames=ko.observable(!1);i.ShowCategories=ko.observable(!1);i.ShowPreview=ko.observable(!1);i.ShowAccessories=ko.observable(!1);i.ShowAlternatives=ko.observable(!1);i.ShowArticles=ko.observable(!1);i.CurrentProduct=ko.observable();i.CurrentPlid=ko.observable(0);jQuery("body.mode-publisher").length>0&&(n.instantSearch=!0,n.publishMode=!0);i.setResult=function(n){var r;if(i.TotalArticleHits(n.TotalArticleHits),i.ShowBrands(n.ShowBrands),i.ShowBrandNames(n.ShowBrandNames),i.ShowCategories(n.ShowCategories),i.ShowPreview(n.ShowPreview),i.ShowAccessories(n.ShowAccessories),i.ShowAlternatives(n.ShowAlternatives),i.ShowArticles(n.ShowArticles),i.TotalHits(n.TotalHits),n.Products!=null&&n.Products.length>0){for(i.CurrentProduct(n.Products[0]),r=0;r<n.Products.length;r++)n.Products[r].ProduktDesc1=t(n.SearchWord,n.Products[r].ProduktDesc1),n.Products[r].ProduktDesc2=t(n.SearchWord,n.Products[r].ProduktDesc2);i.products(n.Products)}else i.products.removeAll();if(n.Categories!=null&&n.Categories.length>0?i.categories(n.Categories):i.categories.removeAll(),n.BrandList!=null&&n.BrandList.length>0){for(r=0;r<n.BrandList.length;r++)n.BrandList[r].BrandName=t(n.SearchWord,n.BrandList[r].BrandName);i.brandnames(n.BrandList)}else i.brandnames.removeAll();n.Brands!=null&&n.Brands.length>0?i.brands(n.Brands):i.brands.removeAll();n.Articles!=null&&n.Articles.length>0?i.articles(n.Articles):i.articles.removeAll()};i.CurrentProduct.subscribe(function(n){var t=n.ProduktLagerID;i.ShowAccessories(n.ShowAccessories);i.ShowAlternatives(n.ShowAlternatives);!mcWeb.ajaxRenderEngine||mcWeb.ajaxRenderEngine.reloadInstantSearchPreview(t)});i.PreviewCurrentProduct=function(n){var t=n.ProduktLagerID;t!=i.CurrentPlid()&&(i.ShowAccessories(n.ShowAccessories),i.ShowAlternatives(n.ShowAlternatives),!mcWeb.ajaxRenderEngine||mcWeb.ajaxRenderEngine.reloadInstantSearchPreview(t));i.CurrentPlid(n.ProduktLagerID)}};n.load=function(){var t=document.getElementById("InstSearchDiv");t&&ko.applyBindings(n.vm,t)};this.get=function(n){var t=jQuery(".jqm-nosearch");t.hide();i(n)==!0&&r(n)};i=function(n){var t=jQuery(".content-search");if(t!=null&&t.length>0){if(n==null||n.length<1)return t.css({display:"none"}),!1;t.css({display:""})}return!0};this.loadPreview=function(n,t){var i=n,r=t};this.search=function(t,i){n.instantSearch=i;jQuery(document).ready(function(){n.searchTextBox=document.getElementById(t);jQuery("#"+t).on("keypress",function(n){n.keyCode==13&&(mcWeb.instantSearch.doSearch(),n.preventDefault())});if(i)jQuery("#"+t).on("keyup",function(t){if(n.searchTextBox.value!=null&&t.keyCode!=13){var i=encodeURIComponent(n.searchTextBox.value.replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"));mcWeb.instantSearch.get(i)}});jQuery("#BSrch").on("click",function(){mcWeb.instantSearch.doSearch()})})};this.clearAndFocus=function(n,t){t.preventDefault();jQuery("#InstSearchDiv").slideUp(400);var i=document.getElementById(n);i.className="TextBoxSearchEnable";i.value="";jQuery("#CloseSearchButton").hide();i.focus()};this.doSearch=function(){if(jQuery("#InstSearchDiv").hide(),jQuery(n.searchTextBox).val().length!=0){var i=encodeURIComponent(jQuery(n.searchTextBox).val()),r="/search?q="+i,t=jQuery("[ID*='DDLSearchType']");t.length==0?(t=jQuery("#s-type"),t&&t.val()==2&&(r="/WebPages/Produkt/ProduktListMobileGrouped.aspx?q="+i)):t&&t.val()==0&&(r="/WebPages/Produkt/ProduktListCellsGrouped.aspx?q="+i);n.request&&n.request.abort();document.location=r}};this.onFocusOut=function(){n.searchHasFocus=!1;n.clearEntryOnClick=!0};this.focusOnSearch=function(t,i){try{n.clearEntryOnClick&&i.selectionStart>=i.value.length&&(i.className="TextBoxSearchEnable",i.value="",n.clearEntryOnClick=!1,jQuery("#InstSearchDiv").slideUp(400))}catch(r){}};this.setSearchBoxCoord=function(t,i){var r,o,s,f,c,u,e,h;(n.searchHasFocus||(n.clearEntryOnClick=!0),n.searchHasFocus=!0,n.instantSearch)&&(r=jQuery("#InstSearchDiv"),r)&&(o=jQuery("#search-result"),(o==null||o.length<1)&&(s=i,f=i,jQuery("body.layoutver4").length>0&&(f="#SubMenuArea"),r.clonePosition(s),r.css("left",jQuery(f).offset().left+"px"),r.css("position","absolute"),r.css("z-index","121"),c=jQuery(s).outerHeight(),r.offset({top:r.offset().top+c,left:r.offset().left}),u=r.width(),e=jQuery(f).outerWidth(),u<e&&(r.css("width",e+"px"),u=e),u<300&&r.css("width","300px"),h=jQuery(".InstantSearch table").outerWidth(),u<h&&r.css("width",h+"px")))};this.setSearchBoxCoordFixed=function(n,t){var i=jQuery("#InstSearchDiv"),f,e,r,u;i!=null&&(f=jQuery("#search-result"),(f==null||f.length<1)&&(i.clonePosition(t),i.css("left",jQuery(t).offset().left+"px"),e=jQuery(t).outerHeight(),i.offset({top:i.offset().top+e,left:i.offset().left}),r=i.width(),u=jQuery(t).outerWidth(),r<u&&(i.css("width",u+"px"),r=u),r<300&&i.css("width","300px"),i.css("top","92px"),i.css("position","fixed"),i.css("z-index","121")))};var r=function(t){var i={search:t};n.request&&n.request.abort();n.request=McAjaxGetRequestToUserControl("InstantSearchKnockout","GetInstantSearchResult",i,u)},u=function(t){var i,u,r,f,e,o,s;n.request=null;try{return i=document.getElementById("InstSearchDiv"),u=jQuery(i).css("display"),n.vm.setResult(t),t!=null&&(t.Products!=null&&t.Products.length>0||t.TotalArticleHits>0)?(r=1,t.Products!=null&&t.Products.length>0&&(r=t.Products.length),u!="block"?(t.IsMobileDomain||jQuery(i).height(52*r),jQuery("#CloseSearchButton").show(),jQuery(i).slideDown(100)):t.IsMobileDomain||(f=52*r,e=jQuery("#InstSearchDiv > div.InstantSearch").height(),e>f?jQuery(i).height(e):jQuery(i).height(f))):(u=="block"&&(jQuery("#CloseSearchButton").hide(),jQuery(i).slideUp(400)),t.IsMobileDomain&&(o=jQuery(".jqm-nosearch"),s=jQuery(".jqm-search-word"),s.text(t.SearchWord),o.show())),!0}catch(h){return alert("InstantSearch getCallback Error : InstantSearch.js : "+h),!0}},t=function(n,t){var f,e;try{var i=0,r=0,u=n.length;for(n=n.toLowerCase(),f='<span class="search-key">',e="<\/span>";i>-1;)if(i=t.substring(r).toLowerCase().indexOf(n),i>-1){i+=r;var o=t.substring(0,i)+f,s=t.substring(i,i+u)+e,h=t.substring(i+u,t.length);if(t=o+s+h,r=o.length+s.length,r>=t.length)return t}}catch(c){}return t}},function(n){n.fn.clonePosition=function(t,i){var i=n.extend({cloneWidth:!0,cloneHeight:!0,offsetLeft:0,offsetTop:0},i||{}),r=n(t).offset();return n(this).css({position:"absolute",top:r.top+i.offsetTop+"px",left:r.left+i.offsetLeft+"px"}),i.cloneWidth&&n(this).width(n(t).width()),i.cloneHeight&&n(this).height(n(t).height()),this}}(jQuery);jQuery(document).mouseup(function(n){var t=jQuery("#InstSearchDiv");t.is(n.target)||t.has(n.target).length!==0||t.hide()});mcWeb.KontaktOssArticle=new function(){var u,t,r;this.setPath=function(n){u=n};this.IdMailTo=function(n){t="#"+n};var n=function(n,t,i,r){var u=jQuery(n),f=jQuery(t),e=u.val().length<1,o;return(r==!0&&(o=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,e=!o.test(u.val())),e)?(f.show(),!1):(f.hide(),i)},f=function(){var r=!0,u;return n("#inputName","#ReqName",!0)||(r=!1),n("#inputMail","#emailMustBeFilledIn",r)||(r=!1),n("#inputMail",".emailIsInvalid",r,!0)||(r=!1),n("#inputPhone","#ReqPhone",r)||(r=!1),jQuery("#idRefReq").attr("value")=="True"&&(n("#inputReferanse","#ReqInvRef",r)||(r=!1)),u=i(),u!=null&&u.length>3&&(n(t+" option:selected","#ReqMarket",r,!0)||(r=!1)),n("#inputSubject","#ReqSubject",r)||(r=!1),n("#message","#ReqMessage",r)||(r=!1),r},i=function(){return jQuery(t+" option:selected").val()};this.Send=function(){if(f()!=!1){var n=jQuery("#inputName").val(),t=jQuery("#inputMail").val(),u=jQuery("#inputPhone").val(),e=jQuery("#inputReferanse").val(),o=jQuery("#inputSubject").val(),s=jQuery("#message").val(),h=i(),c={Name:n,Mail:t,Phone:u,Referanse:e,Subject:o,Message:s,MailTo:h};McAjaxRequestToUserControl("Publisher_Templates_KontaktOssArticle","Send",c,r,null,!0)}};r=function(n){try{var t=jQuery("#mailSendt"),i=jQuery("#mailNotSendt");n!=null&&n.success==!0?(i.hide(),t.show(),jQuery("#inputName").val(""),jQuery("#inputMail").val(""),jQuery("#inputPhone").val(""),jQuery("#inputReferanse").val(""),jQuery("#inputSubject").val(""),jQuery("#message").val("")):(i.show(),t.hide())}catch(r){alert("Error : KontaktOssArticle.js - getCallBack : "+r)}}};mcWeb.warehousestock=new function(){this.get=function(n,t,u){i(n);r(t,u)};var i=function(n){var r=this,t,i;t=document.documentElement.scrollLeft>=document.body.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;i=document.documentElement.scrollTop>=document.body.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;t=t+n.clientX-30;i=i+n.clientY+20;r.posLeft=t;r.posTop=i},t=function(){var n="LagerstatusKnockoutContainer";document.getElementById(n).style.left=self.posLeft+"px";document.getElementById(n).style.top=self.posTop+"px"},r=function(n,t){var i={plid:t};McAjaxRequest(n,"GetWarehouseStockList",i,u)},n=null,u=function(i){var r,u;try{return r=document.getElementById("LagerstatusKnockoutContainer"),i!=null&&i.length>0?(u=jQuery(r).css("display"),u=="block"&&jQuery(r).hide(500),n!=null&&ko.cleanNode(r),n=new e(i),ko.applyBindings(n,r),u=="block"?setTimeout(f,250):(t(),jQuery(r).show(250))):jQuery(r).hide(250),!0}catch(o){return alert("WarehouseStock getCallback Error : Lagerstatus.js : "+o),!0}},f=function(){var n=document.getElementById("LagerstatusKnockoutContainer");t();jQuery(n).show(250)},e=function(n){var t=this;t.warehouses=ko.observableArray(n)},o=function(){var n=document.getElementById("UpdateIcon");n.style.display="block"},s=function(){var n=document.getElementById("UpdateIcon");n.style.display="none"}};mcWeb.conditions=new function(n){var t=this;this.events={onAcceptChange:"mcWeb.conditions.events.onAcceptChange",onConditionsBound:"mcWeb.conditions.events.onConditionsBound"};this.conditionGetLanguageText=function(t){if(n("."+t).length>0)return n("."+t)[0].innerText};this.vm=function(i){var r=this;r.settings=null;r.userEditMode=ko.observable(!1);this.refConditionsStatus={isFunctionalConditionAccepted:ko.observable(!1),acceptDocuments:ko.observableArray([]),usageArea:null};r.setSettings=function(n){n&&(r.settings={usageArea:0,usageFunction:"",forUnknownUser:!0,isInLightbox:!1,accordionstyleCollapse:!0,emailAddress:null,useSessionDocumentAcceptance:!1},r.settings.usageArea=n.usageArea?n.usageArea:0,r.settings.usageFunction=n.functionName?n.functionName:"",r.settings.forUnknownUser=n.forUnknownUser===null?!0:n.forUnknownUser,r.settings.isInLightbox=n.isInLightbox===null?!1:n.isInLightbox,r.settings.accordionstyleCollapse=n.accordionstyleCollapse===null?!0:n.accordionstyleCollapse,r.settings.emailAddress=n.emailAddress,r.settings.useSessionDocumentAcceptance=n.useSessionDocumentAcceptance!=null?n.useSessionDocumentAcceptance:!1,r.settings.usageArea==4?(r.isRegisterForEDM=ko.observable(!0),r.isVisible(!1),PubSub.subscribe(mcWeb.EdmRegistration.events.onInOutChange,function(n,t){r.isRegisterForEDM(t);r.isVisible(t);t||r.resetResponses()}),PubSub.subscribe(mcWeb.EdmRegistration.events.onEdmRegistrationSuccess,function(n,t){r.isVisible(!t);t&&r.resetResponses()}),PubSub.subscribe(mcWeb.EdmRegistration.events.onEdmRegistrationTBFocus,function(n,t){t.hasFocus;r.isRegisterForEDM(t.isIn);!r.isVisible()&&r.isRegisterForEDM()&&(r.isVisible(!0),r.resetResponses())})):r.settings.usageArea==2?r.isVisible(!1):r.isVisible(!0))};r.conditions=ko.observableArray([]);r.AcceptDoc=function(n,t){var i=this;this.Term=ko.observable(n);this.userEditMode=ko.observable(!1);this.Accepted=ko.observable(n.Accepted===null?!1:n.Accepted?n.RepeatMode==1?t?!0:!1:!0:!1);this.Accepted.subscribe(function(){r.acceptanceChanged.notifySubscribers()});this.storedAcceptanceStatus=ko.observable(n.Accepted===null?"0":n.Accepted?n.RepeatMode=="1"?"1":"1":"-1");this.newAcceptanceStatus=ko.observable(this.storedAcceptanceStatus());this.newAcceptanceStatus.subscribe(function(){r.acceptanceChanged.notifySubscribers()});this.isFullview=ko.observable(!1);this.isExpanded=ko.observable(!1);this.cancelEdit=function(){return i.userEditMode(!1),i.newAcceptanceStatus(i.storedAcceptanceStatus()),!1};this.goEditMode=function(){return i.Term().CurrRev>i.Term().AcceptedRevision&&i.newAcceptanceStatus(0),i.userEditMode(!0),!1};this.save=function(n){return r.saveCondition(n),!0}};r.id=i?i[0]=="#"?i.substring(1):i:null;r.service=new WebApiService("Conditions");r.highlightRequired=function(i){var u;return u=i===undefined||i==null?n("#"+r.id+" .isRequired label:not(.active)"):n("#"+i+" .isRequired label:not(.active)"),u.length>0&&mcWeb.validation.qTipActionShowClickHide(u[0],t.conditionGetLanguageText("langtext-conditions-required")),u.length>0};r.isLoggedIn=ko.observable();r.selectedDocument=ko.observable(null);r.isVisible=ko.observable(!1);r.usageArea=0;r.usageFunction=0;r.acceptanceChanged=ko.computed(function(){return!1},this);r.acceptanceChanged.extend({notify:"always",rateLimit:50});r.acceptanceChanged.subscribe(function(){var n={functionalConditionIsAccepted:null,acceptDocuments:[],usageArea:r.settings.usageArea,instanceId:r.id},t=!1,i=!0;ko.utils.arrayForEach(r.conditions(),function(u){u.Term().Accepted=r.settings.usageArea==0?u.newAcceptanceStatus()>0?!0:u.newAcceptanceStatus()==0?null:!1:u.Accepted();n.acceptDocuments.push(u.Term());u.Term().TermRequiredForFunction&&(t=!0,u.Accepted()||(i=!1))});r.acceptDocuments=n.acceptDocuments;n.functionalConditionIsAccepted=t?i:null;n.vm=r;PubSub.publish(mcWeb.conditions.events.onAcceptChange,n)});r.expandDoc=function(n){r.collapseAllBut(n);n.isExpanded(!n.isExpanded())};r.goFullViewDoc=function(t){n(".qtip").remove();r.collapseAllBut(t);t.isFullview(!0);r.selectedDocument(t);r.moveDocToLightbox()};r.removeFullViewDoc=function(n){r.collapseAllBut(n);n.isFullview(!1);r.selectedDocument(null);r.settings.isInLightbox?r.moveDocBackToPlaceholder():PubSub.publish(mcWeb.lightbox.events.onHideLightbox)};r.moveDocToLightbox=function(){if(n("#lightbox-placeholder").children().hide(),n("#lightbox-placeholder > .FullAcceptDocument-UsageArea"+r.settings.usageArea).length==0){var t=n(".FullAcceptDocument-UsageArea"+r.settings.usageArea).detach();n("#lightbox-placeholder").append(t)}n("#lightbox-placeholder .FullAcceptDocument-UsageArea"+r.settings.usageArea).show();r.settings.isInLightbox||PubSub.publish(mcWeb.lightbox.events.onShowLightbox)};r.moveDocBackToPlaceholder=function(){if(n("#lightbox-placeholder").children().show(),n("#lightbox-placeholder .conditionDocumentFull").hide(),n("#lightbox-placeholder > .FullAcceptDocument-UsageArea"+r.settings.usageArea).length==1){var t=n(".FullAcceptDocument-UsageArea"+r.settings.usageArea).detach();n(".FullDocPlaceholder-UsageArea"+r.settings.usageArea).append(t)}};r.collapseAllBut=function(n){r.settings.accordionstyleCollapse&&ko.utils.arrayForEach(r.conditions(),function(t){n!=t&&(t.isFullview(!1),t.isExpanded(!1))})};r.expandAll=function(){r.settings.accordionstyleCollapse||ko.utils.arrayForEach(r.conditions(),function(n){n.isFullview(!1);n.isExpanded(!0)})};r.resetResponses=function(){ko.utils.arrayForEach(r.conditions(),function(n){n.Accepted(!1);n.isFullview(!1);n.isExpanded(!1);n.newAcceptanceStatus(n.storedAcceptanceStatus())})};r.load=function(t,i){if(n(".conditionDocumentFull").hide(),!r.settings){var u;i&&(u=i);r.setSettings(u);u.status&&(r.refConditionsStatus=u.status,PubSub.subscribe(mcWeb.conditions.events.onAcceptChange,function(t,i){r.id==i.instanceId&&(i.functionalConditionIsAccepted===null?r.refConditionsStatus.isFunctionalConditionAccepted(!0):r.refConditionsStatus.isFunctionalConditionAccepted(i.functionalConditionIsAccepted),r.refConditionsStatus.acceptDocuments(i.acceptDocuments),n(".qtip").remove(),r.settings.useSessionDocumentAcceptance&&r.updateSessionCondition())}));PubSub.subscribe(mcWeb.lightbox.events.onHideLightbox,function(){r.moveDocBackToPlaceholder()})}if(t==null){r.fetchConditions();return}r.bindConditions(t)};r.fetchConditions=function(){var i=this,t=r.settings.emailAddress==null?mcWeb.currentUser.getUser():null,n;!!r.settings&&r.settings.emailAddress!=null&&r.settings.emailAddress.length>0&&(t=r.settings.emailAddress);n={UsageArea:r.settings.usageArea==0?null:r.settings.usageArea,SpraakId:null,AvsAdresseId:null,KndKontaktId:null,DomainId:null,FunctionName:r.settings.usageFunction,ForUnknownUser:r.settings.forUnknownUser};r.service.PostAction(n.UsageArea!=null?"ListAcceptDocumentsNotAcceptedOrIsRepeatable":"ListAcceptDocuments",n).done(function(t){var i,u;t!=null?r.settings.usageArea===3||r.settings.usageArea===1?(i=n,i.UsageArea=2,i.FunctionName="CUSTOMERREGISTRATION",u=t,r.service.PostAction("ListAcceptDocumentsNotAcceptedOrIsRepeatable",i).done(function(n){for(var i,e,o,t=[],f=0;f<u.length;f++)i=u[f],i.storedAcceptanceStatus=i.Accepted,t.push(i);for(f=0;f<n.length;f++)i=n[f],i.storedAcceptanceStatus=i.Accepted,r.settings.usageArea!==1?t.push(i):i.TermRequiredForFunction&&t.push(i);if(u.length!=0&&n.length!=0){var c=function(n){return n.DocumentID},h={},s=t.filter(function(n){var t=c(n);return h.hasOwnProperty(t)?!1:h[t]=!0});for(e=0;e<t.length;e++)for(o=0;o<s.length;o++)s[o].DocumentID==t[e].DocumentID&&s[o].TermRequiredForFunction==null&&t[e].TermRequiredForFunction!=null&&(s[o].TermRequiredForFunction=t[e].TermRequiredForFunction);t=s.sort(function(n,t){return n.TermRequiredForFunction<t.TermRequiredForFunction})}r.bindConditions(t)})):r.bindConditions(t):r.bindConditions(null)})};r.bindConditions=function(n){var f,o,i,u,s,t,e;if(n!=null)if(n.length>0)if(f=!1,r.settings&&r.settings.usageArea==0&&(f=!0),r.conditions().length==0)for(t=0;t<n.length;++t)r.conditions.push(new r.AcceptDoc(n[t],f));else{for(t=0;t<n.length;++t)o=!1,ko.utils.arrayForEach(r.conditions(),function(i){i.Term().DocumentID==n[t].DocumentID&&(o=!0)}),o||r.conditions.push(new r.AcceptDoc(n[t],f));for(i=[],u=0;u<r.conditions().length;++u){for(s=!1,t=0;t<n.length;++t)r.conditions()[u].Term().DocumentID==n[t].DocumentID&&(s=!0);s||i.push(u)}if(console.log("conditions().length before ="+r.conditions().length),console.log("to be removed:"+i.length),i.length>0)for(e=i.length-1;e>=0;e--)r.conditions.splice(i[e],1);console.log("conditions().length after ="+r.conditions().length)}else r.conditions([]);else r.conditions([]);r.acceptanceChanged.notifySubscribers();PubSub.publish(mcWeb.conditions.events.onConditionsBound,r.settings.usageArea)};r.saveCondition=function(n){var u=mcWeb.currentUser.getUser(),i=n.Term(),f=n.Accepted(),t={Accept:f,DocUsageId:i.DocUsageID,RevDataId:i.RevDataID,AvsAdresseID:null,DomainId:null,EmailAddress:u,ReferenceString:i.FunctionReferenceString};t.Accept!=null&&r.service.PostAction("RegisterTermAcceptance",t).done(function(i){i&&(i.RetCode===0?(n.storedAcceptanceStatus(t.Accept===null?"0":t.Accept?"1":"0"),n.newAcceptanceStatus(n.storedAcceptanceStatus())):console.log("RetCode:"+i.RetCode))})};r.updateSessionCondition=function(){var n=[];ko.utils.arrayForEach(r.conditions(),function(t){n.push({Accepted:t.Accepted(),DocUsageID:t.Term().DocUsageID,DocumentID:t.Term().DocumentID,RevDataID:t.Term().RevDataID})});n.length>0&&r.service.PostAction("UpdateCurrentSessionAcceptDocuments",{"":n}).done(function(){console.log("Sesssion updated")})}}}(jQuery);mcWeb.postlogin=new function(){this.events={};this.vm=function(n){var t=this;this.id="#"+n;this.conditionVM=new mcWeb.conditions.vm(t.id);this.conditionsStatus={isFunctionalConditionAccepted:ko.observable(!1),acceptDocuments:ko.observableArray([]),usageArea:1};this.successLoginResult=null;this.lightboxCloseSubToken=null;this.isStoring=ko.observable(!1);this.responseCounter=0;this.expectedResponses=0;this.initialAcceptChange=!0;this.conditionsStored=ko.observable(!1);this.conditionsStoringSuccessfull=ko.observable(!1);this.reminderText=ko.observable("");this.checkReminder=ko.observable(!1);this.reminderNextTime=null;this.EDMAcceptDoc=null;t.conditionsService=new WebApiService("Conditions");this.load=function(n,i){i&&i.successLoginResult&&(t.successLoginResult=i.successLoginResult);null!==t.successLoginResult&&(t.reminderText(t.successLoginResult.Reminder.ReminderText),t.reminderNextTime=t.successLoginResult.Reminder.NextReminderDate,this.checkReminder.subscribe(function(n){n?window.StorageService.localStorage.setItem("nextPostLoginConditionReminder",t.successLoginResult.Reminder.NextReminderDate):window.StorageService.localStorage.setItem("nextPostLoginConditionReminder",null)}));t.conditionVM.id="#postloginConditions";PubSub.publish(mcWeb.lightbox.events.modifyOptions,{backdrop:"static"});t.lightboxCloseSubToken=PubSub.subscribe(mcWeb.lightbox.events.onHideLightbox,function(){t.isStoring()||(PubSub.unsubscribe(t.lightboxCloseSubToken),t.goPostLogin())});t.conditionVM.load(n,{usageArea:t.conditionsStatus.usageArea,forUnknownUser:!1,isInLightbox:!0,status:t.conditionsStatus,accordionstyleCollapse:!1});PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);PubSub.subscribe(mcWeb.conditions.events.onAcceptChange,function(n,i){t.conditionsStatus.usageArea==i.usageArea&&(t.conditionsStoringSuccessfull(!1),t.initialAcceptChange?(t.conditionsStored(!0),t.initialAcceptChange=!1,t.conditionVM.expandAll()):(t.isStoring(!0),t.conditionsStored(!1),t.storeAcceptDocs()))})};this.storeAcceptDocs=function(){var u,n,r,f;if(t.conditionsStatus.acceptDocuments!==undefined&&t.conditionsStatus.acceptDocuments!=null&&t.conditionsStatus.acceptDocuments().length>0)for(t.responseCounter=0,t.expectedResponses=t.conditionsStatus.acceptDocuments().length,u=mcWeb.currentUser.getUser(),i=0;i<t.conditionsStatus.acceptDocuments().length;i++)if(n=t.conditionsStatus.acceptDocuments()[i],n!==null){if(r=n.Accepted,!r&&n.storedAcceptanceStatus==r){t.responseCounter++;continue}f={Accept:r,DocUsageId:n.DocUsageID,RevDataId:n.RevDataID,AvsAdresseID:null,DomainId:null,EmailAddress:u,ReferenceString:n.FunctionReferenceString};t.conditionsService.PostAction("RegisterTermAcceptance",f).done(function(n){if(t.isStoring(!1),n){if(n.RetCode==0)for(t.responseCounter++,i=0;i<t.conditionsStatus.acceptDocuments().length;i++){var r=t.conditionsStatus.acceptDocuments()[i];n.DocumentRevisionDataId==r.RevDataID&&(r.storedAcceptanceStatus=r.Accepted)}}else console.log("Something went wrong when registering acceptance. "+n);console.log("expectedResponses:"+t.expectedResponses+", responseCounter:"+t.responseCounter);t.expectedResponses===t.responseCounter&&(t.conditionsStored(!0),t.conditionsStoringSuccessfull(!0))})}};this.closeDialog=function(){(t.conditionsStored()==!0||confirm("Endringene er ikke lagret. Fortsette uten å lagre?"))&&t.goPostLogin()};this.goPostLogin=function(){mcWeb.login.postViewingConditions(t.successLoginResult)}}};mcWeb.userConditions=new function(){this.events={};this.vm=function(n){var t=this;this.id="#"+n;this.conditionVM=new mcWeb.conditions.vm(t.id);this.conditionsStatus={isFunctionalConditionAccepted:ko.observable(!1),acceptDocuments:ko.observableArray([]),usageArea:null};this.isLoading=ko.observable(!0);this.initialAcceptChange=!0;this.conditionsStored=ko.observable(!0);this.conditionsStoringSuccessfull=ko.observable(!1);this.responseCounter=0;this.expectedResponses=0;this.conditions=ko.observableArray([]);t.doBind=function(){PubSub.subscribe(mcWeb.conditions.events.onAcceptChange,function(n,i){t.conditionsStatus.usageArea==i.usageArea&&(t.initialAcceptChange?(t.conditionsStored(!0),t.initialAcceptChange=!1):t.conditionsStored(!1),t.conditionsStoringSuccessfull(!1))});t.conditionVM.load(ko.toJS(t.conditions),{usageArea:t.conditionsStatus.usageArea,forUnknownUser:!1,isInLightbox:!1,status:t.conditionsStatus});t.conditionVM.isVisible(!0);t.isLoading(!1)};t.service=new WebApiService("Conditions");this.load=function(){var n,i;t.isLoading(!0);n=mcWeb.currentUser.getUser();t.conditions([]);i={UsageArea:this.conditionsStatus.usageArea,SpraakId:null,AvsAdresseId:null,KndKontaktId:null,EmailAddress:n,DomainId:null,FunctionName:null,ForUnknownUser:!1};t.service.PostAction("ListAcceptDocuments",i).done(function(n){if(n!=null)for(index=0;index<n.length;++index)t.conditions.push(n[index]);t.doBind()})}}};mcWeb.deleteuser=new function(){this.events={onDeleteUserOK:"mcWeb.deleteuser.events.onDeleteUserOK"};this.vm=function(n){var t=this;this.id="#"+n;this.conditionVM=new mcWeb.conditions.vm(t.id);this.conditionsStatus={isFunctionalConditionAccepted:ko.observable(!1),acceptDocuments:ko.observableArray([]),usageArea:5};this.lightboxCloseSubToken=null;t.conditionsService=new WebApiService("Conditions");this.load=function(n){t.conditionVM.load(n,{usageArea:t.conditionsStatus.usageArea,functionName:"DELETE-CUSTOMER",forUnknownUser:!1,isInLightbox:!0,status:t.conditionsStatus,accordionstyleCollapse:!1});PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);PubSub.publish(mcWeb.lightbox.events.modifyOptions,{backdrop:"static"})};this.tryDeleteuser=function(){t.conditionsStatus.isFunctionalConditionAccepted()?t.storeAcceptDocs():t.conditionVM.highlightRequired()};this.cancelDeleteuser=function(){PubSub.publish(mcWeb.lightbox.events.onHideLightbox);PubSub.publish(mcWeb.deleteuser.events.onDeleteUserOK,!1)};this.storeAcceptDocs=function(){var i,n,r,u;t.conditionsStatus.acceptDocuments!==undefined&&t.conditionsStatus.acceptDocuments!=null&&t.conditionsStatus.acceptDocuments().length>0&&(t.responseCounter=0,t.expectedResponses=t.conditionsStatus.acceptDocuments().length,i=mcWeb.currentUser.getUser(),t.conditionsStatus.acceptDocuments().length>0&&(n=t.conditionsStatus.acceptDocuments()[0],n!==null&&(r=n.Accepted,u={Accept:r,DocUsageId:n.DocUsageID,RevDataId:n.RevDataID,AvsAdresseID:null,DomainId:null,EmailAddress:i,ReferenceString:n.FunctionReferenceString},t.conditionsService.PostAction("RegisterTermAcceptance",u).done(function(n){n?n.RetCode==0?(PubSub.publish(mcWeb.lightbox.events.onHideLightbox),PubSub.publish(mcWeb.deleteuser.events.onDeleteUserOK,!0)):console.log("Something went wrong when registering acceptance. "+n):console.log("Something went wrong when registering acceptance. ")}))))}}};mcWeb.checkoutconditions=new function(){this.events={};this.vm=function(){var n=this;this.id="checkout-conditions";this.conditionVM=new mcWeb.conditions.vm(n.id+"-conditions");this.conditionsStatus={isFunctionalConditionAccepted:ko.observable(!1),acceptDocuments:ko.observableArray([]),usageArea:3};this.hasCartItems=ko.observable(!1);this.showConditions=ko.computed(function(){return n.conditionsStatus.acceptDocuments().length>0&&n.hasCartItems()},this);this.IsKlarnaCheckoutActive=ko.observable(!1);this.isLoggedIn=ko.observable(!1);n.conditionsService=new WebApiService("Conditions");this.load=function(t,i){n.IsKlarnaCheckoutActive(i.IsKlarnaCheckoutActive!=null&&i.IsKlarnaCheckoutActive!=undefined?i.IsKlarnaCheckoutActive:!1);n.isLoggedIn(!i.UnknownUser);n.conditionVM.load(t,{useSessionDocumentAcceptance:n.IsKlarnaCheckoutActive(),usageArea:n.conditionsStatus.usageArea,forUnknownUser:!n.isLoggedIn(),functionName:"CHECKOUT",status:n.conditionsStatus,accordionstyleCollapse:!1});PubSub.subscribe(mcWeb.conditions.events.onAcceptChange,function(t,i){n.conditionsStatus.usageArea==i.usageArea&&n.conditionVM.isVisible(!0)});PubSub.subscribe(mcWeb.login.events.onIsloggedIn,function(t,i){i!=n.isLoggedIn()&&(n.isLoggedIn(i),n.conditionVM.setSettings({useSessionDocumentAcceptance:n.IsKlarnaCheckoutActive(),usageArea:n.conditionsStatus.usageArea,functionName:"CHECKOUT",status:n.conditionsStatus,accordionstyleCollapse:!1}),n.conditionVM.fetchConditions())});PubSub.subscribe(mcWeb.customerRegistration.onRememberedUserNotMe,function(){window.StorageService.localStorage.removeItem("authenticatedGuid");n.conditionVM.fetchConditions()});PubSub.subscribe(mcWeb.cart.events.hasCartItems,function(t,i){n.hasCartItems(i)})}}};mcWeb.loginAgent=new function(n){"use strict";var t=this,i,r,u;t.service=new WebApiService("Login");t.isClosedShop=!1;i=function(i,r,u){window.location.pathname.toLowerCase().indexOf("loginlukketshop")!==-1&&(t.isClosedShop=!0);PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);n(r).load("/Webpages/Kunde/LoginAgentView.aspx",function(){if(n("#login-agent").length<1){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);return}mcWeb.loginAgent.activateView(i,u);PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0)})};r=function(){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);t.service.GetAction("LoadAgentLastSearch").done(function(n){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);n!==null?i(n,"#lightbox-placeholder","login-agent"):mcWeb.login.load()})};t.load=function(n){if(n==null){r();return}i(n,"#lightbox-placeholder","login-agent")};t.activateView=function(t,i){var r=i==="login-agent"?!0:!1;ko.applyBindings(new u(t,r),document.getElementById(i));r&&(PubSub.publish(mcWeb.lightbox.events.onShowLightbox,{show:!0,css:"login-agent-dialog"}),setTimeout(function(){n("#agent-search-input").focus()},1e3))};u=function(n){var i=this;i.searchKey="";i.showSearch=ko.observable(!0);i.contactName=ko.observable(n.ContactName);n.SearchKey!=null?(i.query=ko.observable(n.SearchKey),i.Customers=ko.observableArray(n.SearchResults)):(i.query=ko.observable(""),i.Customers=ko.observableArray(),i.Customers(null));i.loginContact=function(n){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);var i={loginAsMe:n.CustomerNo==null&&n.ContactId==null?!0:!1,customerNo:n.CustomerNo==null?null:n.CustomerNo,contactId:n.ContactId==null?null:n.ContactId,loginType:4};t.service.PostAction("LoginContact",i).done(function(n){n!=null&&n.Success===!0?window.location.href=t.isClosedShop?"/":document.location.href.replace(location.hash,""):(PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),mcWeb.login.load())})};i.search=function(n){if(n!=null&&n.length<2){i.Customers(null);return}i.searchKey=n;setTimeout(function(){i.searchKey===n&&(PubSub.publish(mcWeb.lightbox.events.onShowSpinicon),t.service.PostAction("AgentSearch",{Search:n}).done(function(n){i.Customers(n!=null&&n.length?n:null);PubSub.publish(mcWeb.lightbox.events.onHideSpinicon)}))},1e3)};i.query.subscribe(i.search)};this.logout=function(){try{window.StorageService.localStorage.removeItem("id");window.StorageService.localStorage.removeItem("user");window.StorageService.localStorage.removeItem("remember");window.StorageService.localStorage.removeItem("authenticatedGuid");window.StorageService.localStorage.removeItem("remember")}catch(n){console.error("LoginAgentView.logout - ex: "+n)}mcWeb.login.logout()}}(jQuery);mcWeb.loginAvsAdresse=new function(){var t=jQuery,n=this,i,r;n.service=new WebApiService("Login");n.isClosedShop=!1;n.data={};i=function(i,r,u){window.location.pathname.toLowerCase().indexOf("loginlukketshop")!==-1&&(n.isClosedShop=!0);PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);t(r).load("/Webpages/Kunde/LoginAvsAdresseView.aspx",function(){if(t("#login-avs-adresse").length<1){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);return}mcWeb.loginAvsAdresse.activateView(i,u);PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);mcWeb.inlineEditor!==undefined&&mcWeb.inlineEditor.init(!0)})};n.load=function(t,r){t!==null&&r!==null&&(n.data=t,i(r,"#lightbox-placeholder","login-avs-adresse"))};r=function(t){var i=this;i.avsenders=ko.observableArray(t);i.loginSender=function(t){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);n.data.avsAdresseId=t.AvsAdresseId;n.service.PostAction("Login",n.data).done(function(n){n!=null&&n.Success===!0?mcWeb.login.loginResult(n):(PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),mcWeb.login.load())})}};n.activateView=function(n,t){ko.applyBindings(new r(n),document.getElementById(t));PubSub.publish(mcWeb.lightbox.events.onShowLightbox)};this.logout=function(){try{window.StorageService.localStorage.removeItem("id");window.StorageService.localStorage.removeItem("user");window.StorageService.localStorage.removeItem("remember");window.StorageService.localStorage.removeItem("authenticatedGuid");window.StorageService.localStorage.removeItem("remember")}catch(n){console.error("LoginAvsAdresseView.logout - ex: "+n)}mcWeb.login.logout()}};mcWeb.loginContacts=new function(){var i=jQuery,n=this,t,r,u;n.service=new WebApiService("Login");n.isClosedShop=!1;n.load=function(n){if(n==null){r();return}t(n,"#lightbox-placeholder","login-club")};n.loadInfo=function(n){n!=null&&t(n,"#placeholder-club","club-bindings")};t=function(t,r,u){window.location.pathname.toLowerCase().indexOf("loginlukketshop")!==-1&&(n.isClosedShop=!0);PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);i(r).load("/Webpages/Kunde/LoginContactView.aspx",function(){if(i("#login-club").length<1){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);return}mcWeb.loginContacts.activateView(t,u);PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0)})};r=function(){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);n.service.GetAction("LoadContacts").done(function(n){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);n!==null?mcWeb.loginContacts.load(n):mcWeb.login.load()})};n.activateView=function(n,t){var i=t==="login-club"?!0:!1;ko.applyBindings(new u(n,i),document.getElementById(t));i&&PubSub.publish(mcWeb.lightbox.events.onShowLightbox)};u=function(t,i){var r=this;r.contactName=ko.observable(t.ContactName);r.Contacts=ko.observableArray(t.Contacts);r.loginContact=function(t){if(i===!1)return!1;PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);var r={loginAsMe:t.CustomerNo==null?!0:!1,customerNo:t.CustomerNo==null?null:t.CustomerNo,loginType:3};n.service.PostAction("LoginContact",r).done(function(t){t!=null&&t.Success==!0?window.location.href=n.isClosedShop?"/":document.location.href.replace(location.hash,""):(PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),mcWeb.login.load())})}};this.logout=function(){try{window.StorageService.localStorage.removeItem("id");window.StorageService.localStorage.removeItem("user");window.StorageService.localStorage.removeItem("remember");window.StorageService.localStorage.removeItem("authenticatedGuid");window.StorageService.localStorage.removeItem("remember")}catch(n){console.error("LoginContactsView.logout - ex: "+n)}mcWeb.login.logout()}};mcWeb.loginPassword=new function(){var n=jQuery,t=this;t.service=new WebApiService("Login");t.closeOnCancel=!1;t.load=function(i,r){t.closeOnCancel=i;var u=n("#lightbox-placeholder");u.length<1||u.load("/Webpages/Kunde/LoginForgottenPasswordView.aspx",function(){var t=n("#forgotten-password");if(!(t.length<1)){t.on("keyup",function(){event.keyCode===13&&mcWeb.loginPassword.sendPasswordToken()});n("#forgottenPassordEmail").focus();n("#send-password").on("click",function(){mcWeb.loginPassword.sendPassword()});n("#send-password-token").on("click",function(){mcWeb.loginPassword.sendPasswordToken()});r?PubSub.publish(mcWeb.lightbox.events.onShowLightbox,r):PubSub.publish(mcWeb.lightbox.events.onShowLightbox);mcWeb.inlineEditor!=null&&mcWeb.inlineEditor.init(!0)}})};t.close=function(){return t.closeOnCancel!==null&&t.closeOnCancel===!0?(PubSub.publish(mcWeb.lightbox.events.onHideLightbox),!1):(mcWeb.login.load(),!0)};t.setTabIndex=function(t){t?(n("#avs-select").attr("tabindex",1),n("#password").attr("tabindex",2),n("#password2").attr("tabindex",3),n("#change-psw").attr("tabindex",4)):(n("#avs-select").removeAttr("tabindex"),n("#password").attr("tabindex",1),n("#password2").attr("tabindex",2),n("#change-psw").attr("tabindex",3))};t.loadAvsenders=function(i){var r=n("#avs-form"),u=i.value,f,e;if(u==null||u.trim().length<3){r.hasClass("hidden")||r.AddClass("hidden");mcWeb.loginPassword.setTabIndex(!1);return}f=t.getPasswordTokenFromURI("ptk");e={username:u,passwordToken:f};PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);try{t.service.PostAction("PasswordTokenSenders",e).done(function(t){var f,i,u;if(PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),t!=null&&(f=document.getElementById("avs-select"),f!=null&&t.length>0)){for(i=0;i<t.length;i++)u=document.createElement("option"),u.setAttribute("value",t[i].AvsAdresseId),u.appendChild(document.createTextNode(t[i].DisplayName)),f.appendChild(u);n("#avs-select").attr("tabindex",1);r.removeClass("hidden");mcWeb.loginPassword.setTabIndex(!0);return}r.addClass("hidden");mcWeb.loginPassword.setTabIndex(!1)})}catch(o){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon)}};t.sendPassword=function(){var i={username:encodeURIComponent(n("#forgottenPassordEmail").val())};n("#send-password").attr("disabled","disabled");PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);try{t.service.PostAction("SendPassword",i).done(function(t){var i,r;if(PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),i=n("#error-msg-password"),t!==null&&t!==undefined){if(t.Success===!0){r=n("#psw-sendt");r.html(t.Message);n("#fp-primary").hide();n("#fp-secondary").show();return}i.html(t.Message);n("#forgottenPassordEmail").focus()}i.show();n("#send-password").removeAttr("disabled")})}catch(r){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon)}};t.sendPasswordToken=function(){var i={username:n("#forgottenPassordEmail").val()};n("#send-password-token").attr("disabled","disabled");PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);try{t.service.PostAction("SendPasswordToken",i).done(function(t){var i,r;if(PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),i=n("#error-msg-password"),t!==null&&t!==undefined){if(t.Success===!0){r=n("#psw-sendt");r.html(t.Message);n("#fp-primary").hide();n("#fp-secondary").show();return}i.html(t.Message);n("#forgottenPassordEmail").focus()}i.show();n("#send-password-token").removeAttr("disabled")})}catch(r){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon)}};t.getPasswordTokenFromURI=function(n){return decodeURIComponent((new RegExp("[?|&]"+n+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null};t.validateResetPasswordInput=function(){n("#password2").on("keypress",function(n){var t=n.keyCode||n.which;if(t===13)return n.preventDefault(),!1});return n("#password").val()===n("#password2").val()&&n("#password").val().length>=6};t.setNewUserPassword=function(){var i,r,o,u,f,e;try{if(i=n("#password").val(),r=n("#psw_save_btn"),r.hasClass("disabled"))return!1;if(i.trim().length<1)return PubSub.publish(mcWeb.lightbox.events.onHideLightbox),!1;if(i=i.trim(),r.addClass("disabled"),o={password:i},n("#passWordSaveError1").hide(),n("#passWordSaveError2").hide(),u=n("#password2").length>0,f=!1,f=u?t.validateResetPasswordInput():i.length>=6,f){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);try{t.service.PostAction("ChangeCurrentUserPassword",o).done(function(t){var i,u;PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);t?(i=n("#passWordSaveOk").text(),PubSub.publish(mcWeb.cartsmall.events.onShowNewItemInCartText,{status:!0,msg:i,css:"popup-new-psw",popupTime:3e3}),r.text(i),setTimeout(function(){PubSub.publish(mcWeb.lightbox.events.onHideLightbox,{})},3500)):(u=n("#passWordSaveError1"),PubSub.publish(mcWeb.cartsmall.events.onShowNewItemInCartText,{status:!1,msg:u.text(),popupTime:4e3}),u.show(),r.removeClass("disabled"))})}catch(s){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon)}}else e=u?n("#passWordSaveError2"):n("#passWordSaveError3"),PubSub.publish(mcWeb.cartsmall.events.onShowNewItemInCartText,{status:!1,msg:e.text(),popupTime:4e3}),e.show(),r.removeClass("disabled")}catch(s){console.log("LoginForgottenPasswordView - Error: "+s)}return!1};t.sendPasswordResetRequest=function(){var r=t.getPasswordTokenFromURI("ptk"),i,u,f;if(n("#reset-result-success").hide(),n("#reset-result-error").hide(),n("#reset-result-validation-error").hide(),n("#reset-result-avs-not-selected").hide(),n("#avs-select").removeClass("reset-error"),r==null&&(r="_missing_"),i=-1,u=n("#avs-form"),u.length>0&&!u.hasClass("hidden")&&(i=parseFloat(jQuery("#avs-select").find(":selected").val()),isNaN(i)&&(i=-1),i<0)){n("#reset-result-avs-not-selected").show();n("#avs-select").addClass("reset-error");return}if(f={username:n("#username").val(),passwordToken:r,password:n("#password").val(),avsender:i},t.validateResetPasswordInput()){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);try{t.service.PostAction("SendPasswordResetRequest",f).done(function(t){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);t&&t.Success?(n("#reset-result-success").show(),mcWeb.login.loginAfterPasswordReset()):n("#reset-result-error").show()})}catch(e){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon)}}else n("#reset-result-validation-error").show()};n("#forgottenPassordEmail").keyup(function(n){n.keyCode===13&&mcWeb.login.sendPassword()})};mcWeb.login=new function(){function o(){var n=t(".qtip");n.length>0&&n.remove()}function u(){t("#password").on("keypress",function(n){n.keyCode==13&&(mcWeb.login.login(),n.preventDefault())});t("#username").on("keypress",function(n){n.keyCode==13&&(mcWeb.login.login(),n.preventDefault())});t("#username").on("blur",function(){f()});t("#remember_me").on("click",function(){var n=t(this).is(":checked");n&&window.StorageService.localStorage.setItem("remember",n)})}function f(){var n=t(".login-mode"),i;n!=null&&n.length>0&&(i=t("#username").val(),i!=null&&i.indexOf("@multicase.no")>0?n.show():n.hide())}function e(){var r=window.StorageService.localStorage.getItem("remember"),n=mcWeb.currentUser.getUser();r!==null&&r==="true"&&n!==null&&n.indexOf("@")>0?(t("#remember_me").prop("checked",!0),t("#username").val(n),t("#password").val(i),f()):(t("#remember_me").removeAttr("checked"),t("#login_mode").removeAttr("checked"),window.StorageService.localStorage.removeItem("user"),window.StorageService.localStorage.removeItem("id"),window.StorageService.localStorage.removeItem("remember"))}function s(n,i){var u=i.parent();return(u.hasClass("has-error")&&u.removeClass("has-error"),n==null||n.trim().toLowerCase()==="null"||n.trim().length<4)?(t("#remember_me").removeAttr("checked"),r(),u.addClass("has-error"),i.val(""),i.focus(),!1):!0}function r(){window.StorageService.localStorage.removeItem("user");window.StorageService.localStorage.removeItem("id");window.StorageService.localStorage.removeItem("remember");window.StorageService.localStorage.removeItem("authenticatedGuid")}var t=jQuery,n=this,i;n.events={onSetLogin:"mcWeb.login.onSetLogin",onIsloggedIn:"mcWeb.login.onIsloggedIn"};n.service=new WebApiService("Login");n.isMobile=!1;n.isLoggedIn=!1;n.isClosedShop=!1;n.lightboxOptions=null;n.loadClosedLogin=function(){n.lightboxOptions={backdrop:"static",keyboard:!1,show:!0,variantData:{},deferred:!1};n.load()};n.conditionVM=new mcWeb.conditions.vm("login");n.conditionsStatus={isFunctionalConditionAccepted:ko.observable(!1),acceptDocuments:ko.observableArray([]),usageArea:1};n.acceptChangesubscriptionToken=null;n.load=function(){n.isMobile||t("#UpdateIcon").show();window.location.pathname.toLowerCase().indexOf("loginlukketshop")!==-1&&(n.isClosedShop=!0);t("#lightbox-placeholder").load("/Webpages/Kunde/LoginView.aspx",function(){(n.isMobile||t("#UpdateIcon").hide(),t("#login").length<1)||(o(),u(),e(),t("body.layoutver4").length>0&&n.lightboxOptions===null&&(n.lightboxOptions={keyboard:!0,show:!0,variantData:{},deferred:!1}),n.isMobile||(n.lightboxOptions===null?PubSub.publish(mcWeb.lightbox.events.onShowLightbox):PubSub.publish(mcWeb.lightbox.events.onShowLightbox,n.lightboxOptions)),!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0),setTimeout(function(){t("#username").focus()},1e3))})};t(document).ready(function(){PubSub.subscribe(mcWeb.login.events.onSetLogin,function(t,i){n.isLoggedIn=i;PubSub.publish(mcWeb.login.events.onIsloggedIn,n.isLoggedIn)})});n.loadMobile=function(){n.isMobile=!0;u();e()};i="********************";n.data={username:"",password:"",localstorge:!1,allowasynclogin:!1,avsAdresseId:null,isNormalMode:!0};n.login=function(){try{var u=t("#password"),e=u.val(),o=e===i,h=window.StorageService.localStorage.getItem("id"),f=h!==null&&o?h:e;if(s(f,u)===!1)return;n.isMobile==!1&&PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);n.data.username=t("#username").val();n.data.password=f;n.data.localstorge=o;n.data.allowasynclogin=!0;n.data.avsAdresseId=null;n.data.isNormalMode=t("#login_mode").is(":checked");n.service.PostAction("Login",n.data).done(function(e){var o,s;if(n.isMobile==!1&&PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),e.Success===!0)if(r(),e.User!==mcWeb.currentUser.getUser()&&mcWeb.currentUser.setUser(e.User),n.successLoginResult=e,e.IsAgent===!0||e.IsClub===!0||e.Token!=null)n.postViewingConditions();else{if(o=window.StorageService.localStorage.getItem("nextPostLoginConditionReminder"),o!==null&&(s=Date.parse(o),!isNaN(s)&&Date.now()<=s)){n.postViewingConditions();return}n.conditionVM.load(null,{usageArea:n.conditionsStatus.usageArea,forUnknownUser:!1,isInLightbox:!0,status:n.conditionsStatus});n.acceptChangesubscriptionToken=PubSub.subscribe(mcWeb.conditions.events.onAcceptChange,function(t,i){n.conditionsStatus.usageArea==i.usageArea&&(i.acceptDocuments.length>0?n.postLoginShowConditions(i.acceptDocuments):n.postViewingConditions())})}else{if(r(),f===i)return t("#remember_me").removeAttr("checked"),u.parent().addClass("has-error"),u.val(""),u.focus(),!1;e.PreOrderClosed?(t("#error-msg-login").hide(),t("#error-preorder-login").show()):(t("#error-msg-login").show(),t("#error-preorder-login").hide())}return!1})}catch(c){n.isMobile==!0&&t.mobile.loading("hide")}};n.successLoginResult=null;n.postLoginShowConditions=function(){PubSub.unsubscribe(n.acceptChangesubscriptionToken);PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);var i={successLoginResult:n.successLoginResult};t("#lightbox-placeholder").load("/Webpages/ViewProvider.aspx?view=postlogin",function(){loadModule(mcWeb.postlogin,"PostloginCondtions","postloginConditions",n.conditionsStatus.acceptDocuments(),i)})};n.postViewingConditions=function(t){var i=t?t:n.successLoginResult;i||(console.log("No successfull login. Starting over."),n.load());n.loginResult(i)};n.loginResult=function(i){var r,u,f,e;if(i.Token!=null)mcWeb.customerRegistration.LoadView(i.Token);else if(i.Avsenders!=null)mcWeb.loginAvsAdresse.load(n.data,i.Avsenders);else if(i.IsAgent==!0)mcWeb.loginAgent.load(i);else if(i.Club!=null)mcWeb.loginContacts.load(i.Club);else{if(r=window.location.href,n.isMobile?r=t("#url-ref").text():n.isClosedShop?r=i.RefUrlLukketShop&&i.RefUrlLukketShop.length>0?i.RefUrlLukketShop:"/":location.hash==null||location.hash.length<1?u=!0:r=document.location.href.replace(location.hash,""),i.RedirectDomain)return f=r.split("/"),e=f[0]+"//"+i.RedirectDomain,window.location.href=e,!0;u?location.reload(!0):window.location.href=r}return!1};n.loginAfterPasswordReset=function(){try{var r=t("#password").val(),u=r===i,f=window.StorageService.localStorage.getItem("id"),e=f!==null&&u?f:r,o={username:t("#username").val(),password:e,localstorge:u,allowasynclogin:!0};n.service.PostAction("Login",o).done(function(n){return n.Success===!0&&(window.location.href=location.protocol==="https:"?"https://"+location.hostname:"http://"+location.hostname),!1})}catch(s){n.isMobile==!0&&t.mobile.loading("hide")}};this.logout=function(t){var i="";t!=undefined&&(i=t);n.service.GetAction("Logout",i).done(function(n){var t=window.StorageService.localStorage.getItem("remember");(t==null||t!=="true")&&(window.StorageService.localStorage.removeItem("user"),window.StorageService.localStorage.removeItem("id"),window.StorageService.localStorage.removeItem("remember"),window.StorageService.localStorage.removeItem("authenticatedGuid"));n==null||n==="true"?window.location.href=location.protocol==="https:"?"https://"+location.hostname:"http://"+location.hostname:n==="false"?alert("Error logg ut"):n.length>0&&(window.location.href=n)})};this.getLoginStatus=function(){n.service.GetAction("GetLoginStatus","").done(function(n){var r,i;n!=null&&(r=t("#loginout"),r.text(n.LoginText),i=t("#loginout-content"),n.IsLogedin===!0?(r.attr("href",n.ShowClubLogin?"#logincontact":"#logout"),i.removeClass("LogInButtonContainer"),i.addClass("LogUtButtonContainer")):(r.attr("href",n.ShowClubLogin?"#logincontact":"#login"),i.removeClass("LogUtButtonContainer"),i.addClass("LogInButtonContainer")),t("#loginuser").text(n.LoginUser))})};this.showForgottenPassword=function(){n.lightboxOptions===null?mcWeb.loginPassword.load():mcWeb.loginPassword.load(!1,n.lightboxOptions)};this.LoadRegistrationLightbox=function(t,i){if(t)try{n.service.GetAction("Logout",{forceReloadPage:!1}).done(function(n){window.StorageService.localStorage.removeItem("authenticatedGuid");window.StorageService.localStorage.removeItem("user");window.StorageService.localStorage.removeItem("id");window.StorageService.localStorage.removeItem("remember");n==="false"?alert("Error logg ut"):(i.ReadOnly=!1,mcWeb.customerRegistration.lightbox.load(i))})}catch(r){console.log("LoginView.LoadRegistrationLightbox - ex: "+r)}else mcWeb.customerRegistration.lightbox.load(i)};this.ThatsNotMe=function(){window.StorageService.localStorage.removeItem("user");window.StorageService.localStorage.removeItem("id");window.StorageService.localStorage.removeItem("remember");window.StorageService.localStorage.removeItem("authenticatedGuid");this.logout(!1)}};mcWeb.customerReview=new function(n){"use strict";var t=this;this.vm=function(i){var r=this;t.productinfo=i;r.service=t.productinfo.service;r.customerName=ko.observable();r.rating=ko.observable(0);r.setRating=function(n){r.rating(n)};r.star=ko.pureComputed(function(){return r.rating()},r);r.review=ko.observable();r.kundeId=ko.observable();r.kndKontaktId=ko.observable();r.plid=ko.observable();r.loggedIn=ko.observable();r.reviewReply=ko.observable();r.webPubElementId=0;r.replyMode=ko.observable(!1);this.login=function(){mcWeb.login.load()};this.openReviewWindow=function(){n("#customerReviewModal").modal("show")};this.closeReviewWindow=function(){n("#customerReviewModal").modal("hide");window.location=window.location.pathname+window.location.hash};this.openReviewReplyWindow=function(t){r.webPubElementId=t;r.replyMode(!0);r.loadReply(t);n("#customerReviewModal").modal("show")};this.openReviewReplyWindow2=function(t){var i=n(t).data("elementid");r.webPubElementId=i;r.replyMode(!0);r.loadReply(i);n("#customerReviewModal").modal("show")};this.closeReviewReplyRemoveWindow=function(){n("#customerReviewReplyRemove").modal("hide");window.location=window.location.pathname+window.location.hash};r.submitReview=function(){var t=n("#nickname"),i;t.val()!==""&&r.rating()>0?(i={CustomerName:r.customerName(),Rating:r.rating(),Review:r.review(),KndKontaktId:r.kndKontaktId(),KundeId:r.kundeId(),plid:r.plid()},r.service.PostAction("PostReview",i).done(function(){r.closeReviewWindow()})):(t.val()===""&&t.addClass("rev-error"),r.rating()===0&&n("#scoreFieldset").addClass("rev-error"))};r.submitReviewReply=function(){if(r.reviewReply()!==""){var t={ReviewReply:r.reviewReply(),plid:r.plid(),WebPubElementId:r.webPubElementId};r.service.PostAction("PostReviewReply",t).done(function(){r.closeReviewWindow()})}else n(".review-reply").addClass("rev-error")};var u=n("div[id*='revqsdiv']").html(),f=n("div[id*='revpliddiv']").html(),e=n("div[id*='revpliddiv']").data("loggedin");r.loggedIn(e==="True");r.plid(f);u&&(u=JSON.parse(u),r.kundeId(u.KundeId),r.kndKontaktId(u.KndKontaktId),r.rating(parseInt(u.Score)),r.customerName(u.Kundenavn),r.rating()!==0&&r.openReviewWindow());n("#nickname").on("keypress",function(n){var t=n.keyCode||n.which;return t===13?(n.preventDefault(),!1):!0});r.loadReply=function(n){r.service.GetAction("GetReviewReply",{webPubElementId:n}).done(function(n){n!=null&&(r.reviewReply(n.ReviewReply),r.plid(n.plid),r.rating(parseInt(n.Score.toString())),r.review(n.Review),r.customerName(n.CustomerName))})};r.editReviewReply=function(t){r.webPubElementId=t;r.loadReply(t);n("#customerReviewReplyModal").modal("show")};r.openReviewReplyRemove=function(t){r.webPubElementId=t;n("#customerReviewReplyRemove").modal("show")};r.openReviewReplyRemove2=function(t){var i=n(t).data("elementid");r.webPubElementId=i;n("#customerReviewReplyRemove").modal("show")};r.submitRemoveReviewReply=function(){var n={ReviewReply:"",plid:r.plid(),WebPubElementId:r.webPubElementId};r.service.PostAction("PostReviewReply",n).done(function(){r.closeReviewWindow()})}}}(jQuery);mcWeb.productlistbuy=new function(n){"use strict";var t=this;t.productlist;this.vm=function(i){var r,u;t.productlist=i;r=this;r.service=t.productlist.service;r.buyAll=function(t,i,r){for(var f,e,l,o=[],h=[],c=n(i),s=0;s<c.length;s++)f=c[s],e=parseFloat(f.value),e!=isNaN&&e>0&&(o.push(n(f).data("plid")),h.push(e),n(f).val(0));o.length<1||(l={Plids:o,Amount:h,isCheckout:!1,sender:"productlist-buy2016.js - buyAll"},u(l,r))};r.disableBuyButton=!1;r.buy=function(n,t,i){try{if(r.disableBuyButton)return;if(r.disableBuyButton=!0,setTimeout(function(){r.disableBuyButton=!1},480),i=String(i).replace(",","."),i=i==null?1:parseFloat(i),i=isNaN(i)||i<0?1:i,i<=0)return;var f={plid:t,isConfig:!1,quantity:i,isCheckout:!1,sender:"productlist-buy2016.js - buy"};u(f)}catch(e){alert("Exception: "+e)}};u=function(t,i){try{PubSub.publish(mcWeb.cartsmall.events.onShowNewItemInCart);r.service.GetAction("AddToCart",t).done(function(t){t!=null&&t.Success==!0?(PubSub.publish(mcWeb.cartsmall.events.onShowNewItemInCartText,{status:!0,msg:t.PopupText}),PubSub.publish(mcWeb.cartsmall.events.onUpdateCart),PubSub.publish(mcWeb.freeShippingTxt.events.onUpdateFreeShipping),t.Redirect!=null&&(t.Redirect=="mcWeb.SkiAssembly"?setTimeout(function(){mcWeb.SkiAssembly.load()},500):t.Redirect=="mcWeb.SkiAttributeAssembly"?setTimeout(function(){mcWeb.SkiAttributeAssembly.load()},500):i===!0&&t.Redirect.length>0&&(document.location.href=t.Redirect),t.Redirect==="[REFRESH]"&&n(".WebCartSmall").length>0&&location.reload(!0))):t.ShowNewOrderbookPopup?(mcWeb.orderbookManager.showAddNewOrderbookDate(),PubSub.publish(mcWeb.cartsmall.events.onHideNewItemInCart)):PubSub.publish(mcWeb.cartsmall.events.onShowNewItemInCartText,{status:!1,msg:t==null?"":t.PopupText})})}catch(u){PubSub.publish(mcWeb.cartsmall.events.onShowNewItemInCartText,{status:!1,msg:"Error: "+u});alert("Exception: "+u)}}}}(jQuery);mcWeb.productlistfavorites=new function(n){"use strict";var t=this;t.productlist;this.vm=function(i){t.productlist=i;var r=this;r.service=t.productlist.service;r.add=function(t,i,u,f,e){try{f=f===undefined?!1:f;u=u==null?1:parseFloat(u);u=isNaN(u)||u<0?1:u;var s={plid:i,isConfig:!1,quantity:u,sender:"productlist-favorites2016.js",favCartId:-1};e!=!0&&PubSub.publish(f?mcWeb.cart.events.onShowNewItemInCart:mcWeb.cartsmall.events.onShowNewItemInCart);r.service.GetAction("AddToFavoriteCart",s).done(function(i){i!=null&&i.Success==!0?(u==0&&t!=null&&n(t).closest(".WebPubElement").remove(),e!=!0&&PubSub.publish(f?mcWeb.cart.events.onShowNewItemInCartText:mcWeb.cartsmall.events.onShowNewItemInCartText,{status:!0,msg:i.PopupText}),f||PubSub.publish(mcWeb.cartsmall.events.onUpdateCart,null)):e!=!0&&PubSub.publish(f?mcWeb.cart.events.onShowNewItemInCartText:mcWeb.cartsmall.events.onShowNewItemInCartText,{status:!1,msg:i==null?"":i.PopupText})})}catch(o){PubSub.publish(f?mcWeb.cart.events.onShowNewItemInCartText:mcWeb.cartsmall.events.onShowNewItemInCartText,{status:!1,msg:"Error: "+o});alert("Exception: "+o)}};r.remove=function(n,t,i,u){r.add(n,t,0,i,u)}}}(jQuery);mcWeb.productlistfilter=new function(){"use strict";var n=this;n.productlist;this.vm=function(t){n.productlist=t;var i=this;i.service=n.productlist.service;i.ToggleStockMode=function(n){i.ToggleStockModeValue(n.checked)};i.ToggleStockModeValue=function(n){try{var t={show:n},i=new WebApiService("AttributeFilter");i.GetAction("ToggleShowOnlyStock",t).done(function(){location.reload()})}catch(r){alert("Exception: "+r)}};i.ToggleGroupVariants=function(n){try{var t={group:n.checked},i=new WebApiService("AttributeFilter");i.GetAction("ToggleGroupVariants",t).done(function(){location.reload()})}catch(r){alert("Exception: "+r)}}}}(jQuery);mcWeb.productlistprice=new function(n){"use strict";var t=this;t.productlist;this.vm=function(i){t.productlist=i;var r=this;r.service=t.productlist.service;r.updatePrice=function(t,i,u){var f={plid:t,quantity:i};r.service.GetAction("GetProductPrice",f).done(function(i){try{i!=null&&(u?i.PriceIncVat!=null&&i.PriceIncVat.length>0&&n("#pr"+t).html(i.PriceIncVat):i.PriceExVat!=null&&i.PriceExVat.length>0&&n("#pr"+t).html(i.PriceExVat),i.PriceRetail!=null&&i.PriceRetail.length>0&&n("#prre"+t).html(i.PriceRetail),i.YouSavePercent!=null&&i.YouSavePercent.trim().length>0?(n("#list-yousave-"+t).html(i.YouSavePercent),n("#list-yousave-"+t).show()):n("#list-yousave-"+t).hide())}catch(r){alert("Error - Ex: "+r)}})}}}(jQuery);mcWeb.productlistquantity=new function(n){"use strict";var t=this;t.productlist;this.vm=function(i){var r,u;t.productlist=i;r=this;r.service=t.productlist.service;r.updatePrice=!0;r.change=function(i,r,f,e,o,s){var p=n(i),c=mc.format.asNumber(i.value,s),l=mc.format.asNumber(f,s),e=mc.format.asNumber(e,s),a=mc.format.asNumber(o,s),v,h,y;if(c>a&&(u(i,a,c),c=a),l<-.0001&&(l=Number(0)),e<.0001&&(e=Number(1)),v=c,h=mc.format.roundToNearest(c,e,s),h<l){i.value=mc.format.asCulture(l,s);return}h!=v&&u(i,h,v,s);i.value=mc.format.asCulture(h,s);t.productlist.price!=null&&p.data("updateprice")==!0&&(y=n("#price-inc-ex-vat").is(":checked")?1:0,t.productlist.price.updatePrice(r,h,y))};u=function(t,i,u,f){var o=mc.format.asNumber(i-u,f),e=mc.format.asCulture(o,f),s=" "+(e>0?"+":"")+e;r.quantityQtip(n(t),"",s)};this.quantityQtip=function(t,i,r){var u=r?'<span class="bold">'+r+"<\/span>":"";t.qtip({content:{text:i+u},hide:{inactive:5e3,event:"click mouseleave mouseover",effect:function(){n(this).slideUp()}},position:{my:"bottom center",at:"top center"},style:{classes:"qtip-bootstrap qtip-cart"},show:{ready:!0}})};r.keyPressed=function(t,i){if(i===38||i===107||i===40||i===109){var h=i===38||i===107?!0:!1,u=n(t),r=u.data("des"),o=mc.format.asNumber(u.data("min"),r),f=mc.format.asNumber(u.data("inc"),r),s=mc.format.asNumber(u.data("max"),r),e=mc.format.asNumber(t.value,r);if(isNaN(e))return t.value=mc.format.asCulture(o,r),!0;if(h==!0){if(e+f>s)return t.value=mc.format.asCulture(s,r),!1;t.value=mc.format.asCulture(mc.format.asNumber(e+f,r),r)}else{if(e-f<o)return t.value=mc.format.asCulture(o,r),!1;t.value=mc.format.asCulture(mc.format.asNumber(e-f,r),r)}return mcWeb.productlist.qt.change(t,u.data("plid"),o,f,s,r),!1}if(i===13)return document.activeElement.blur(),!0}}}(jQuery);mcWeb.productlist=new function(){"use strict";this.vm=function(n){var t=this;t.id="#"+n;t.service=new WebApiService("ProductInfo");t.qt=new mcWeb.productlistquantity.vm(t);t.buy=new mcWeb.productlistbuy.vm(t);t.price=new mcWeb.productlistprice.vm(t);t.fav=new mcWeb.productlistfavorites.vm(t);t.filter=new mcWeb.productlistfilter.vm(t)}}(jQuery);mcWeb.productlist.vm();mcWeb.productVariant=new function(){var n=this;n.showQtipWarning=function(n){var t=jQuery("#variant-visual-warning").html(),i=jQuery("#variant-visual-warning-title").html();jQuery("#"+n).qtip({content:{text:t,title:i},position:{my:"right center",at:"center left"},style:{classes:"qtip-dark"},show:{ready:!0,event:"contextmenu"},hide:{event:!1,inactive:4e3,fixed:!0}})}};mcWeb.SkiAssembly=new function(){var n=this,t=jQuery;n.id="skiassembly";n.VM=null;n.service=new WebApiService("SkiAssembly");n.vm=function(){var i=this;i.mount=ko.observable(!1);i.bootsize=ko.observable();i.assemblyspot=ko.observable(0);i.freetext=ko.observable();i.isBootsizeSelected=ko.observable(!0);i.showExtraInfo=ko.observable(!1);i.onCheckedMountToBoots=ko.observable(!1);i.stockId=ko.observable("");i.produktDesc1=ko.observable("");i.onClickMount=function(){i.mount(!0)};i.onClickUnMount=function(){i.mount(!1)};i.onClickRecommendedMidpoint=function(){i.assemblyspot(0)};i.onClickTrueCenter=function(){i.assemblyspot(1)};i.onClickCustDefine=function(){i.assemblyspot(2)};i.onClickShowExtraInfo=function(){i.showExtraInfo(!0)};i.onClickHideExtraInfo=function(){i.showExtraInfo(!1)};i.onClickConfirm=function(){var r=t("#checkout").length>0?!0:!1,u={mount:i.mount,bootsize:i.bootsize,assemblyspot:i.assemblyspot,freetext:i.freetext,mountToBoots:i.onCheckedMountToBoots,isCheckoutPage:r};n.service.GetAction("SaveSkiAssembly",u).done(function(n){try{n!=null?PubSub.publish(mcWeb.lightbox.events.onHideLightbox):alert("Endringen ble dessverre ikke lagret, pr�v igjen.")}catch(t){alert("Error : SkiAssembly.js - Error: "+t)}})};t("#toolTipEmailSearchIcon").qtip({content:{title:t("#bootsize-info").html(),text:t("#toolTipEmailSearch").html()},position:{my:"bottom center",at:"top center"},style:{classes:"qtip-bootstrap"}})};n.GetSkiAssembly=function(){n.service.GetAction("GetSkiAssembly",{plid:null}).done(function(t){try{t!=null&&n.loadData(t)}catch(i){alert("Error : SkiAssembly.js - Error - GetSkiAssembly: "+i)}})};n.load=function(){t("#lightbox-placeholder").load("/WebPages/Produkt/SkiAssemblyPopup.aspx",function(){if(!(t("#"+n.id).length<1)){var i=document.getElementById(n.id);n.VM!=null&&ko.cleanNode(i);n.VM=new n.vm;ko.applyBindings(n.VM,i);n.GetSkiAssembly();PubSub.publish(mcWeb.lightbox.events.onShowLightbox,{backdrop:"static",keyboard:!1,show:!0});!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0);PubSub.publish(mcWeb.cartsmall.events.onUpdateCart,"")}})};n.loadData=function(t,i){if(t==null){n.VM.mount(!1);return}if(n.VM.mount(t.Mount),n.VM.bootsize(t.Bootsize!=null?t.Bootsize:"350"),t.StockId!=null&&n.VM.stockId(t.StockId),t.ProduktDesc1!=null&&n.VM.produktDesc1(t.ProduktDesc1),t.Assemblyspot!=null&&n.VM.assemblyspot(t.Assemblyspot),t.Freetext!=null&&n.VM.freetext(t.Freetext),t.MountToBoots!=null)n.VM.onCheckedMountToBoots(t.MountToBoots);i}};mcWeb.SkiAttributeAssembly=new function(){var n=this,t=jQuery;n.id="skiattrassembly";n.VM=null;n.service=new WebApiService("SkiAttrAssembly");n.vm=function(){var i=this;i.height=ko.observable("");i.height.subscribe(function(){i.height()!==null&&i.height().length>3&&i.height(i.height().substr(0,3))});i.age=ko.observable("");i.age.subscribe(function(){i.age()!==null&&i.age().length>2&&i.age(i.age().substr(0,2))});i.weight=ko.observable("");i.weight.subscribe(function(){i.weight()!==null&&i.weight().length>3&&i.weight(i.weight().substr(0,3))});i.selectedDropdown1=ko.observable("");i.selectedDropdown2=ko.observable("");i.selectedDropdown3=ko.observable("");i.selectedDropdown4=ko.observable("");i.selectedDropdown5=ko.observable("");i.dropdownList1=ko.observableArray();i.dropdownList2=ko.observableArray();i.dropdownList3=ko.observableArray();i.dropdownList4=ko.observableArray();i.dropdownList5=ko.observableArray();i.textHeader=ko.observable("");i.textSubTitle=ko.observable("");i.textFooter=ko.observable("");i.textConfirm=ko.observable("");i.textCancel=ko.observable("");i.textAge=ko.observable("");i.textHeight=ko.observable("");i.textWeight=ko.observable("");i.stockId=ko.observable("");i.produktDesc1=ko.observable("");i.focusAge=ko.observable(!1);i.focusHeight=ko.observable(!1);i.focusWeight=ko.observable(!1);i.focusDropdown1=ko.observable(!1);i.focusDropdown2=ko.observable(!1);i.focusDropdown3=ko.observable(!1);i.focusDropdown4=ko.observable(!1);i.focusDropdown5=ko.observable(!1);i.focusConfirm=ko.observable(!1);i.dataObject=null;i.isDropDownSeleced=function(n,t,i){var u=n(),r=t(),f=i();return r===null||r.length<1?"":u==r[0].Name&&f==!0};i.isValid=function(){return n.VM.height()===null||n.VM.height().length<1?(n.VM.focusHeight(!0),!1):n.VM.weight()===null||n.VM.weight().length<1?(n.VM.focusWeight(!0),!1):!0};i.onClickConfirm=function(){if(n.VM.dataObject==null&&(alert("Error - Feilet ved lagring av data"),PubSub.publish(mcWeb.lightbox.events.onHideLightbox)),n.VM.isValid()){var i=t("#checkout").length>0?!0:!1,r={height:n.VM.height()==null?"-":n.VM.height(),age:n.VM.age()==null?"-":n.VM.age(),weight:n.VM.weight()==null?"-":n.VM.weight(),selectedDropdown1:n.VM.selectedDropdown1()==null||n.VM.selectedDropdown1()==n.VM.dropdownList1()[0].Name?"-":n.VM.selectedDropdown1(),selectedDropdown2:n.VM.selectedDropdown2()==null||n.VM.selectedDropdown2()==n.VM.dropdownList2()[0].Name?"-":n.VM.selectedDropdown2(),selectedDropdown3:n.VM.selectedDropdown3()==null||n.VM.selectedDropdown3()==n.VM.dropdownList3()[0].Name?"-":n.VM.selectedDropdown3(),selectedDropdown4:n.VM.selectedDropdown4()==null||n.VM.selectedDropdown4()==n.VM.dropdownList4()[0].Name?"-":n.VM.selectedDropdown4(),selectedDropdown5:n.VM.selectedDropdown5()==null||n.VM.selectedDropdown5()==n.VM.dropdownList5()[0].Name?"-":n.VM.selectedDropdown5(),isCheckoutPage:i};n.service.GetAction("SaveSkiAssembly",r).done(function(n){try{n!=null?PubSub.publish(mcWeb.lightbox.events.onHideLightbox):alert("Endringen ble dessverre ikke lagret, pr�v igjen.")}catch(t){alert("Error : SkiAssembly.js - Error: "+t)}})}};i.onClickCancel=function(){PubSub.publish(mcWeb.lightbox.events.onHideLightbox)};i.onSelectDropDown1=function(n){i.dropdown1(n)};i.onSelectDropDown2=function(n){i.dropdown2(n)};i.onSelectDropDown3=function(n){i.dropdown3(n)};i.onSelectDropDown4=function(n){i.dropdown4(n)};i.onSelectDropDown5=function(n){i.dropdown5(n)}};n.GetSkiAttributeAssembly=function(){n.service.GetAction("GetSkiAssembly",{plid:null}).done(function(t){try{t!==null&&n.loadData(t)}catch(i){alert("Error : SkiAssembly.js - Error - GetSkiAssembly: "+i)}})};n.load=function(){t("#lightbox-placeholder").load("/WebPages/Produkt/SkiAttributeAssemblyPopup.aspx",function(){if(!(t("#"+n.id).length<1)){var i=document.getElementById(n.id);n.VM!=null&&ko.cleanNode(i);n.VM=new n.vm;ko.applyBindings(n.VM,i);n.GetSkiAttributeAssembly();PubSub.publish(mcWeb.lightbox.events.onShowLightbox,{backdrop:"static",keyboard:!1,show:!0});!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0);PubSub.publish(mcWeb.cartsmall.events.onUpdateCart,"")}})};n.loadData=function(i,r){(n.VM.dataObject=i,i!=null)&&(n.VM.height(i.Height==null?"":i.Height),n.VM.age(i.Age==null?"":i.Age),n.VM.weight(i.Weight==null?"":i.Weight),n.VM.dropdownList1(i.DropdownList1),n.VM.dropdownList2(i.DropdownList2),n.VM.dropdownList3(i.DropdownList3),n.VM.dropdownList4(i.DropdownList4),n.VM.dropdownList5(i.DropdownList5),n.VM.selectedDropdown1(i.SelectedDropdown1),n.VM.selectedDropdown2(i.SelectedDropdown2),n.VM.selectedDropdown3(i.SelectedDropdown3),n.VM.selectedDropdown4(i.SelectedDropdown4),n.VM.selectedDropdown5(i.SelectedDropdown5),n.VM.textHeader(i.TextHeader),n.VM.textSubTitle(i.TextSubTitle),n.VM.textFooter(i.TextFooter),n.VM.textConfirm(i.TextConfirm),n.VM.textCancel(i.TextCancel),n.VM.textHeight(i.TextHeight),n.VM.textAge(i.TextAge),n.VM.textWeight(i.TextWeight),n.VM.stockId(i.StockId),n.VM.produktDesc1(i.ProduktDesc1),setTimeout(function(){n.VM.focusHeight(!0);t("#height").focus()},1e3),!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0),r)}};mcWeb.productVariantMatrix=new function(){var n=jQuery,t=this,i;t.service=new WebApiService("ProductVariant");t.loadExplicit=function(i){n("#UpdateIcon").show();n("#lightbox-placeholder").load("/WebPages/Produkt/ProductVariantMatrixView.aspx",function(){if(n("#product-variant-matrix").length<1){n("#UpdateIcon").hide();return}t.activateViewExplicit(i)})};t.load=function(){n("#UpdateIcon").show();n("#lightbox-placeholder").load("/WebPages/Produkt/ProductVariantMatrixView.aspx",function(){if(n("#product-variant-matrix").length<1){n("#UpdateIcon").hide();return}t.activateView()})};t.loadFromList=function(i){n("#UpdateIcon").show();t.currentPlid=i;n("#lightbox-placeholder").load("/WebPages/Produkt/ProductVariantMatrixView.aspx",function(){if(n("#product-variant-matrix").length<1){n("#UpdateIcon").hide();return}t.activateView()})};t.activateViewExplicit=function(r){var u={motherProduktLagerId:r};t.service.GetAction("GetProductVariantChildList",u).done(function(t){t!=null?ko.applyBindings(new i(t),document.getElementById("product-variant-matrix")):(n("#product-variant-matrix > fieldset").hide(),n("#product-variant-matrix-notfound").show());PubSub.publish(mcWeb.lightbox.events.onShowLightbox,{css:"matrix-popup"})})};t.activateView=function(){var r=n("#variant-matrix-button").data("plid"),u;t.plid!=undefined&&t.plid>0&&(r=t.plid);u={motherProduktLagerId:r};t.service.GetAction("GetProductVariantChildList",u).done(function(t){t!=null?ko.applyBindings(new i(t),document.getElementById("product-variant-matrix")):(n("#product-variant-matrix > fieldset").hide(),n("#product-variant-matrix-notfound").show());PubSub.publish(mcWeb.lightbox.events.onShowLightbox,{css:"matrix-popup"})})};t.validateValue=function(n){(isNaN(n.value)||n.value=="")&&(n.value=0)};t.focusTextbox=function(t){n(t).data("element-value",t.value);t.value=""};t.blureTextbox=function(t){t.value==0&&(t.value=n(t).data("element-value"))};i=function(i){var r=this;r.ShowRetailPrice=ko.observable(i.ShowRetailPrice);r.ShowCustomerPrice=ko.observable(i.ShowCustomerPrice);r.Attributt1Txt=ko.observable(i.Attributt1Txt);r.Attributt2Txt=ko.observable(i.Attributt2Txt);r.VariantChilds=ko.observableArray(i.VariantChilds);r.addToCart=function(){var u,i,f;n("#UpdateIcon").show();PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);u=ko.toJS(r.VariantChilds);i="";n(u).each(function(){this.Amount>0&&(i+=this.ProduktLagerId+"|"+this.Amount+";")});i!=""?(i=encodeURI(i),f={variants:i},t.service.GetAction("AddToCartVariants",f).done(function(t){if(n("#UpdateIcon").hide(),PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),t!=null&&t.Success==!0){var i=document.location.href.replace(location.hash,"");i=i.replace("#","");window.location=i}else r.showError(t)})):(n("#UpdateIcon").hide(),PubSub.publish(mcWeb.lightbox.events.onHideSpinicon))};r.showError=function(t){n("#UpdateIcon").hide();n("#product-variant-matrix > fieldset").hide();n("#product-variant-matrix-error").show();t!=null&&n("#product-variant-matrix-error-message").html(t.Message)};r.postProcessing=function(){n("#UpdateIcon").hide()};r.cancelAndCloseWindow=function(){PubSub.publish(mcWeb.lightbox.events.onHideLightbox)};r.retryAddToCart=function(){n("#product-variant-matrix > fieldset").show();n("#product-variant-matrix-error").hide()}}};mcWeb.attributeDDLFilter=new function(){var n=this,t;n.service=new WebApiService("AttributeFilter");n.load=function(){jQuery("#UpdateIcon").show();jQuery("#attributefilter-placeholder").load("/WebPages/Attribute/Filter/DropDownFilter.aspx",function(){jQuery("#productlist-filter").length<1||(mcWeb.attributeDDLFilter.activateView(!1,!0),jQuery("#UpdateIcon").hide(),n.model=new t,ko.applyBindings(n.model,document.getElementById("productlist-filter")))})};n.activateView=function(t,i){var r,u;n.initialiseSlider=i;n.webSiteMapNodeID=jQuery.getUrlVar("WebSiteMapNodeID");n.webSiteMapNodeID==undefined&&(r=jQuery("#hidden-nodeid").text(),r!=null&&r!=""&&(n.webSiteMapNodeID=parseInt(r)),n.webSiteMapNodeID==NaN&&(n.webSiteMapNodeID=-1));n.loadCurrentPage=t;n.minPrice=parseInt(jQuery.getUrlVar("minPrice"));n.maxPrice=parseInt(jQuery.getUrlVar("maxPrice"));(isNaN(n.minPrice)||isNaN(n.maxPrice))&&(n.minPrice=0,n.maxPrice=0);n.filter=jQuery.getUrlVar("Filter");n.filter=="undefined"&&(n.filter="");n.SearchString=jQuery.getUrlVar("q");n.SearchString=="undefined"&&(n.SearchString="");u={NodeId:n.webSiteMapNodeID,Url:document.location.pathname,Filter:n.filter,MinPrice:n.minPrice,MaxPrice:n.maxPrice,SearchString:n.SearchString,FieldId:0};n.service.GetAction("ListAttributeFilter",u).done(function(t){if(t!=null&&(n.loadCurrentPage&&mcWeb.productList.loadFirstPage("CenterContentDynamicProdList"),n.model.Attributes(t.Attributes),n.model.ShowOnlyInStock(t.ShowOnlyInStock),n.model.VariantsGrouped(t.VariantsGrouped),n.minPrice==n.maxPrice&&n.minPrice==0&&(n.maxPrice=t.MaxPrice),n.initialiseSlider)){var i=jQuery("#slider-range");i.slider({range:!0,min:t.MinPrice,max:t.MaxPrice,values:[n.minPrice,n.maxPrice],slide:function(t,i){var r=i.values;n.changePriceFilter2(r[0],r[1])}});jQuery("#slider-range-min").val(jQuery("#slider-range").slider("values",0));jQuery("#slider-range-max").val(jQuery("#slider-range").slider("values",1));jQuery("#slider-range-min").on("change",function(){n.priceSliderOnChange()});jQuery("#slider-range-max").on("change",function(){n.priceSliderOnChange()});jQuery("#slider-range").on("slidechange",function(){n.sliderChange()})}})};n.changePriceFilter2=function(n,t){var r=jQuery("#slider-range-min"),i;r!=null&&r.val(n);i=jQuery("#slider-range-max");i!=null&&i.val(t)};n.ToggleVariantMode=function(t){var i={show:t};n.service.GetAction("ToggleVariantMode",i).done(function(){mcWeb.attributeDDLFilter.activateView(!0)})};n.ToggleStockMode=function(t){var i={show:t};n.service.GetAction("ToggleShowOnlyStock",i).done(function(){mcWeb.attributeDDLFilter.activateView(!0)})};n.ToggleValues=function(n){var i=jQuery(n.parentNode),r=i.find(".attribute-values:nth-child(n+9)"),t;r.toggleClass("show-attribute-values");t=jQuery(n);t.toggleClass("hidden")};n.updatePageUrl=function(n){window.history.replaceState({},"modified page",n)};t=function(){var t=this;t.Attributes=ko.observableArray();t.VariantsGrouped=ko.observable();t.ShowOnlyInStock=ko.observable();t.GetQuantityToShow=function(n){return n.Count>0?"("+n.Count+")":n.Change>0?"(+"+n.Change+")":""};t.AddToFilterUrl=function(t,i){var u,f,r,e;t.AttributeValues!=null&&(u=decodeURIComponent(document.location.search),f=i.currentTarget.selectedIndex!=undefined?t.AttributeValues[i.currentTarget.selectedIndex-1].Id:t.SelectedId,r="",u.indexOf(t.Id)>0?r=n.RemoveAttributeValueFromLink(t.Id,f):(e=t.Id+":"+f,r=CreateUrl(u,e)),n.updatePageUrl(encodeURI(r)),n.activateView(!0))};n.validateValue=function(n){(isNaN(n.value)||n.value=="")&&(n.value=0)};n.changePriceFilter=function(n,t){var r=jQuery("#slider-range-min"),i;r!=null&&r.val(n);i=jQuery("#slider-range-max");i!=null&&i.val(t)};n.priceSliderOnChange=function(){var n=jQuery("#slider-range-min"),t=jQuery("#slider-range-max");n.length>0&&t.length>0&&jQuery("#slider-range").slider("option","values",[n[0].value,t[0].value])};n.sliderChange=function(){var n=jQuery("#slider-range").slider("option","values"),t;n.length>1&&(t=mcWeb.productList.getPageQuery(1,1,n[0],n[1]),window.history.replaceState({},"modified page",t),mcWeb.attributeDDLFilter.activateView(!0,!1))};n.RemoveAttributeValue=function(t){var i=t.Id,r=t.SelectedId;n.RemoveAttributeValueFromLink(i,r)};n.RemoveAttributeValueFromLink=function(t,i){for(var r=new String(document.location.href),u,e,o,r=decodeURIComponent(r),f=new RegExp(i,"ig");m=f.exec(r);)if(u=m.index,e=m.index+i.length,e>=r.length)break;else if(r.substr(u+i.length,1).match(/(^|~)/i))break;return o="",r.substr(u-1,1)=="^"||r.substr(u+i.length,1)=="^"?r.substr(u-1,1)==":"?r.replace(i+"^",""):r.replace("^"+i,""):n.RemoveAttribute(r,t+":"+i)};n.RemoveAttribute=function(n,t){var u=decodeURIComponent(n),i=u.replace(t,""),r;return i.substring(i.length-1)=="|"&&(i=i.substring(0,i.length-1)),r=i.indexOf("Filter=|"),r>1&&(i=i.replace("|","")),i.substring(i.length-7)=="Filter="&&(i=i.substring(0,i.length-7)),i.substring(i.length-1)=="&"&&(i=i.substring(0,i.length-1)),i.substring(i.length-1)=="?"&&(i=i.substring(0,i.length-1)),i.replace("||","|")}};n.SetUpShowMoreButton=function(){var t=jQuery("[ID*='LinkButtonShowAllAttributes']");t.on("click",function(){n.DoToggleShowMore(200)});n.DoToggleShowMore=function(n){var i=jQuery(".attribute-box.advanced");i.is(":visible")?t.text(showMoreText):t.text(hideMoreText);i.slideToggle(n)}}};mcWeb.attributeFilter=new function(){var n=this,t;n.service=new WebApiService("AttributeFilter");n.Expanded=!1;n.load=function(){jQuery("#UpdateIcon").show();jQuery("#attributefilter-placeholder").load("/WebPages/Attribute/Filter/TextFilter.aspx",function(){jQuery("#productlist-filter").length<1||(mcWeb.attributeFilter.activateView(!1,!0),jQuery("#UpdateIcon").hide(),n.model=new t,ko.applyBindings(n.model,document.getElementById("productlist-filter")))})};n.activateView=function(t,i){var r,u;n.initialiseSlider=i;n.webSiteMapNodeID=jQuery.getUrlVar("WebSiteMapNodeID");n.webSiteMapNodeID==undefined&&(r=jQuery("#hidden-nodeid").text(),r!=null&&r!=""&&(n.webSiteMapNodeID=parseInt(r)),n.webSiteMapNodeID==NaN&&(n.webSiteMapNodeID=-1));n.loadCurrentPage=t;n.minPrice=parseInt(jQuery.getUrlVar("minPrice"));n.maxPrice=parseInt(jQuery.getUrlVar("maxPrice"));(isNaN(n.minPrice)||isNaN(n.maxPrice))&&(n.minPrice=0,n.maxPrice=0);n.filter=jQuery.getUrlVar("Filter");n.filter=="undefined"&&(n.filter="");n.SearchString=jQuery.getUrlVar("q");n.SearchString=="undefined"&&(n.SearchString="");u={NodeId:n.webSiteMapNodeID,Url:document.location.pathname,Filter:n.filter,MinPrice:n.minPrice,MaxPrice:n.maxPrice,SearchString:n.SearchString,FieldId:0};n.service.GetAction("ListAttributeFilter",u).done(function(t){if(t!=null){if(n.loadCurrentPage&&mcWeb.productList.loadFirstPage("CenterContentDynamicProdList"),n.model.Attributes(t.Attributes),n.model.ShowOnlyInStock(t.ShowOnlyInStock),n.model.VariantsGrouped(t.VariantsGrouped),n.minPrice==n.maxPrice&&n.minPrice==0&&(n.maxPrice=t.MaxPrice),n.initialiseSlider){var i=jQuery("#slider-range");i.slider({range:!0,min:t.MinPrice,max:t.MaxPrice,values:[n.minPrice,n.maxPrice],slide:function(t,i){var r=i.values;n.changePriceFilter2(r[0],r[1])}});jQuery("#slider-range-min").val(jQuery("#slider-range").slider("values",0));jQuery("#slider-range-max").val(jQuery("#slider-range").slider("values",1));jQuery("#slider-range-min").on("change",function(){n.priceSliderOnChange()});jQuery("#slider-range-max").on("change",function(){n.priceSliderOnChange()});jQuery("#slider-range").on("slidechange",function(){n.sliderChange()})}n.Expanded&&n.DoToggleShowMore(0)}})};n.changePriceFilter2=function(n,t){var r=jQuery("#slider-range-min"),i;r!=null&&r.val(n);i=jQuery("#slider-range-max");i!=null&&i.val(t)};n.ToggleVariantMode=function(t){var i={show:t};n.service.GetAction("ToggleVariantMode",i).done(function(){mcWeb.attributeFilter.activateView(!0)})};n.ToggleStockMode=function(t){var i={show:t};n.service.GetAction("ToggleShowOnlyStock",i).done(function(){mcWeb.attributeFilter.activateView(!0)})};n.ToggleValues=function(n){var i=jQuery(n.parentNode),r=i.find(".attribute-values:nth-child(n+9)"),t;r.toggleClass("show-attribute-values");t=jQuery(n);t.toggleClass("hidden")};n.GetIsExpanded=function(){var n=jQuery(".attribute-box.advanced");return n.is(":visible")};n.updatePageUrl=function(n){window.history.replaceState({},"modified page",n)};t=function(){var t=this;t.Attributes=ko.observableArray();t.VariantsGrouped=ko.observable();t.ShowOnlyInStock=ko.observable();t.GetQuantityToShow=function(n){return n.Count>0?"("+n.Count+")":n.Change>0?"(+"+n.Change+")":""};t.AddToFilterUrl=function(t,i){var e;if(n.Expanded=n.GetIsExpanded(),!(t.Change<0)||!(t.Count<=0)){var u=decodeURIComponent(document.location.search),f=jQuery(i.target).data("attributeid"),r="";u.indexOf(t.Id)>0?r=n.RemoveAttributeValueFromLink(f,t.Id):(e=f+":"+t.Id,r=CreateUrl(u,e));n.updatePageUrl(encodeURI(r));n.activateView(!0)}};n.validateValue=function(n){(isNaN(n.value)||n.value=="")&&(n.value=0)};n.changePriceFilter=function(n,t){var r=jQuery("#slider-range-min"),i;r!=null&&r.val(n);i=jQuery("#slider-range-max");i!=null&&i.val(t)};n.priceSliderOnChange=function(){var n=jQuery("#slider-range-min"),t=jQuery("#slider-range-max");n.length>0&&t.length>0&&jQuery("#slider-range").slider("option","values",[n[0].value,t[0].value])};n.sliderChange=function(){var n=jQuery("#slider-range").slider("option","values"),t;n.length>1&&(t=mcWeb.productList.getPageQuery(1,1,n[0],n[1]),window.history.replaceState({},"modified page",t),mcWeb.attributeFilter.activateView(!0,!1))};n.RemoveAttributeValueFromLink=function(t,i){for(var r=new String(document.location.href),u,e,o,r=decodeURIComponent(r),f=new RegExp(i,"ig");m=f.exec(r);)if(u=m.index,e=m.index+i.length,e>=r.length)break;else if(r.substr(u+i.length,1).match(/(^|~)/i))break;return o="",r.substr(u-1,1)=="^"||r.substr(u+i.length,1)=="^"?r.substr(u-1,1)==":"?r.replace(i+"^",""):r.replace("^"+i,""):n.RemoveAttribute(r,t+":"+i)};n.RemoveAttribute=function(n,t){var u=decodeURIComponent(n),i=u.replace(t,""),r;return i.substring(i.length-1)=="|"&&(i=i.substring(0,i.length-1)),r=i.indexOf("Filter=|"),r>1&&(i=i.replace("|","")),i.substring(i.length-7)=="Filter="&&(i=i.substring(0,i.length-7)),i.substring(i.length-1)=="&"&&(i=i.substring(0,i.length-1)),i.substring(i.length-1)=="?"&&(i=i.substring(0,i.length-1)),i.replace("||","|")}};n.SetUpShowMoreButton=function(){var t=jQuery("[ID*='LinkButtonShowAllAttributes']");t.on("click",function(){n.DoToggleShowMore(200)});n.DoToggleShowMore=function(n){var i=jQuery(".attribute-box.advanced");i.is(":visible")?t.text(showMoreText):t.text(hideMoreText);i.slideToggle(n)}}};mcWeb.cart=new function(){};mcWeb.cart.events={hasCartItems:"mcWeb.cart.events.hasCartItems",onChangedCart:"mcWeb.cart.events.onChangedCart",onChangedQuantityCart:"mcWeb.cart.events.onChangedQuantityCart",focusDiscoutCode:"mcWeb.cart.events.focusDiscoutCode",cartGuid:"mcWeb.cart.events.cartGuid",onChangeCollectedDelivery:"mcWeb.cart.events.onChangeCollectedDelivery",onShowNewItemInCart:"mcWeb.cart.events.onShowNewItemInCart",onShowNewItemInCartText:"mcWeb.cart.events.onShowNewItemInCartText",onHideNewItemInCart:"mcWeb.cart.events.onHideNewItemInCart",onRequestSendt:"mcWeb.cart.events.onRequestSendt"};mcWeb.cartsmall=new function(){};mcWeb.cartsmall.events={onChangedQuantityCartSmall:"mcWeb.cartsmall.onChangedQuantityCartSmall",onUpdateCart:"mcWeb.cartsmall.events.onUpdateCart",onChangeVat:"mcWeb.cartsmall.events.onChangeVat",onShowNewItemInCart:"mcWeb.cartsmall.events.onShowNewItemInCart",onShowNewItemInCartText:"mcWeb.cartsmall.events.onShowNewItemInCartText",onHideNewItemInCart:"mcWeb.cartsmall.events.onHideNewItemInCart",onChangeFav:"mcWeb.cartsmall.events.onChangeFav",onCartItemRemoved:"mcWeb.cartsmall.events.onCartItemRemoved",onGotoSelectedCart:"mcWeb.cartsmall.events.onGotoSelectedCart"};mcWeb.cartsmall=jQuery.extend(!0,mcWeb.cartsmall,new function(){this.vm=function(n){var i=jQuery,t=this,u,r;if(i(".body-checkout").length>0){t.load=function(){};return}t.id="#"+n;t.service=new WebApiService("Cart");t.popoverNode=null;t.popoverOpen=ko.observable(!1);t.priceTotal=ko.observable();t.priceTotalInkVat=ko.observable();t.priceTotalProducts=ko.observable();t.priceTotalProductsInkVat=ko.observable();t.priceTotalInkVatExShipping=ko.observable();t.priceTotalExVatExShipping=ko.observable();t.priceTotalInkCarrier=ko.observable();t.priceTotalInkCarrierInkVat=ko.observable();t.vatTotal=ko.observable(0);t.vatTotalInkCarrier=ko.observable();t.hasCart=ko.observable();t.cartName=ko.observable();t.itemCount=ko.observable();t.favoriteCount=ko.observable(0);t.cartItems=ko.observableArray();t.orderbooks=ko.observableArray();t.showPriceDisplayControls=!1;t.chkPriceIncExVat=ko.observable();t.chkShowVeilPris=!1;t.chkHideCustomerPice=!1;t.isLoggedIn=ko.observable();t.showPriceIncExVat=!1;t.showRemoveButton=!1;t.showCart=ko.observable(!0);t.showRemoveCart=ko.observable(!1);t.OrderbookDate=ko.observable("");t.OrderbookActive=ko.observable(!1);t.showGoToCart=!1;t.showGoToCheckout=!1;t.addToCartNotifier=ko.observable(!1);t.addToCartNotifierText=ko.observable("");t.addToCartNotifierIsActive=ko.observable(!1);t.isVisible=ko.observable(!1);t.isCartItemsSet=ko.observable(!1);t.favoriteCartUrl="";t.offerCartUrl="";t.isSoftLog=null;t.decimalsQuantity=0;t.popupTime=2500;t.showOrderbookSummary=ko.observable(!1);t.smallCartContentId=ko.observable("small-cart-content");t.invoiceFee=ko.observable();t.invoiceFeeInkVat=ko.observable();t.invoiceFeeAndShipping=ko.observable();t.invoiceFeeAndShippingInkVat=ko.observable();t.offerCount=ko.observable(0);i(document).ready(function(){t.popupMsg=i("#NewItemInCartNotifier");t.popupMsgWait=t.popupMsg.find(".pop-wait");t.popupMsgSuccess=t.popupMsg.find(".pop-success");t.popupMsgError=t.popupMsg.find(".pop-error");t.popupMsgText=t.popupMsg.find(".cart-popup-text")});t.numberOfItemsToShow=ko.observable(0);t.cartItemsToShow=ko.computed(function(){var i=[],r=t.cartItems().length,n;for(t.numberOfItemsToShow()>0&&(r=Math.min(t.cartItems().length,t.numberOfItemsToShow())),n=0;n<r;n++)i.push(t.cartItems()[n]);return i});PubSub.subscribe(mcWeb.cart.events.onChangedCart,function(n,i){t.load(i)});PubSub.subscribe(mcWeb.cart.events.onChangedQuantityCart,function(n,i){for(var u=null,r=0;r<t.cartItems().length;r++)if(t.cartItems()[r].ProductId===i.ProductId){u=t.cartItems()[r];break}u!==null?t.resultQuantity(i.result,u,i.newQuantity):t.load()});PubSub.subscribe(mcWeb.cartsmall.events.onUpdateCart,function(n,i){t.load(i)});PubSub.subscribe(mcWeb.cartsmall.events.onChangeVat,function(n,i){try{if(i===null)return;if(t.chkPriceIncExVat()===i)return;t.chkPriceIncExVat(i);t.setVat(i)}catch(r){console.log("CartSmallView - Ex: "+r)}});t.doShowActiveCart=function(){t.smallCartContentId("small-cart-content");t.showOrderbookSummary(!1);window.StorageService.localStorage.setItem("orderbook.cartivew","active-cart")};t.doShowOrderbookSummary=function(){t.showOrderbookSummary(!0);t.smallCartContentId("small-cart-orderbook-content");window.StorageService.localStorage.setItem("orderbook.cartivew","summary");mcWeb.orderbookManager.showOrderbookSummaryInline(".popover #small-cart-orderbook-summary")};t.load=function(n,i){var r,f;if(t.showSmallCartAmount(),i&&(t.showGoToCart=i.ShowGoToCart,t.showGoToCheckout=i.ShowGoToCheckout,t.showPriceIncExVat=i.ShowPriceIncExVat,t.showRemoveButton=i.ShowRemoveButton,t.showPriceDisplayControls=i.ShowPriceDisplayControls,t.chkShowVeilPris=i.ShowVeilPrisValue,t.chkHideCustomerPice=i.HideCustomerPriceValue,t.favoriteCartUrl=i.FavoriteCartUrl,t.offerCartUrl=i.OfferCartUrl,t.isLoggedIn(i.IsLoggedIn),t.numberOfItemsToShow(i.SmallCartItemsToShow),t.decimalsQuantity=i.DecimalsQuantity,t.popupTime=i.PopupTime),!n){t.isVisible(!1);r={cartName:null,useVat:t.chkPriceIncExVat(),hasCarrier:!1,guid:u(),favGuid:mcWeb.cartsmall.getFavoriteGuid()};t.service.GetAction("LoadCart",r).done(function(n){n!==null&&t.load(n)});return}n.CartName!==null&&t.cartName(n.CartName);n.Orderbooks!==null&&(t.orderbooks(n.Orderbooks),f=window.StorageService.localStorage.getItem("orderbook.cartivew"),f==="summary"?t.doShowOrderbookSummary():t.doShowActiveCart());(n.Orderbooks===null||n.Orderbooks.length===0)&&n.OrderbookActive&&(t.doShowOrderbookSummary(),window.StorageService.localStorage.setItem("orderbook.cartivew","summary"));t.OrderbookActive(n.OrderbookActive);t.OrderbookIncludesDefaultCart=n.OrderbookIncludesDefaultCart;t.hasCart(n.HasCart);t.itemCount(mc.format.asCulture(n.ItemCount,t.decimalsQuantity));t.favoriteCount(n.FavoriteCount);PubSub.publish(mcWeb.cartsmall.events.onChangeFav,t.favoriteCount());t.priceTotal(n.PriceTotal);t.priceTotalInkVat(n.PriceTotalInkVat);t.priceTotalProducts(n.PriceTotalProducts);t.priceTotalProductsInkVat(n.PriceTotalProductsInkVat);t.priceTotalInkVatExShipping(n.PriceTotalInkVatExShipping);t.priceTotalExVatExShipping(n.PriceTotalExVatExShipping);t.priceTotalInkCarrier(n.PriceTotalInkCarrier);t.priceTotalInkCarrierInkVat(n.PriceTotalInkCarrierInkVat);t.vatTotal(n.VatTotal);t.vatTotalInkCarrier(n.VatTotalInkCarrier);t.invoiceFee(n.InvoiceFee);t.invoiceFeeInkVat(n.InvoiceFeeInkVat);t.invoiceFeeAndShipping(n.InvoiceFeeAndShipping);t.invoiceFeeAndShippingInkVat(n.InvoiceFeeAndShippingInkVat);t.offerCount(n.OfferCount);t.addToCartNotifier(n.AddToCartNotifier);t.addToCartNotifierText(n.AddToCartNotifierText!==null?n.AddToCartNotifierText:"");t.chkPriceIncExVat(n.IncVat);t.isLoggedIn(n.IsLoggedIn);n.OrderbookDate==null?t.OrderbookDate(""):t.OrderbookDate(n.OrderbookDate);mcWeb.cartsmall.setFavoriteGuid(n.FavoriteGuid,t.isLoggedIn());t.hasCart()&&ko.utils.arrayForEach(n.CartItems,function(n){ko.isObservable(n.Quantity)||(n.Quantity=ko.observable(mc.format.asCulture(n.Quantity,t.decimalsQuantity)));ko.isObservable(n.QuantityMinimum)||(n.QuantityMinimum=ko.observable(n.QuantityMinimum));ko.isObservable(n.Price1)||(n.Price1=ko.observable(n.Price1));ko.isObservable(n.Price2)||(n.Price2=ko.observable(n.Price2))});t.isVisible(!0);t.cartItems(n.CartItems);t.isCartItemsSet(!0);t.addToCartNotifier()&&t.ShowNewItemInCartNotifier()};u=function(){try{var n=window.StorageService.sessionStorage.getItem("sCartId");return n===null||n.length<30?null:(window.StorageService.sessionStorage.removeItem("sCartId"),n)}catch(t){return null}};t.setVat=function(n){var i={cartName:null,useVat:n,vatChange:!0,hasCarrier:!1};t.service.GetAction("LoadCart",i).done(function(n){t.isCheckoutPage()||t.isCartPage()?PubSub.publish(mcWeb.cart.events.onChangedCart,n):location.reload(!0)})};t.setVeil=function(n){var i={showVeilPris:n};t.service.GetAction("ShowVeilPris",i).done(function(){location.reload(!0)})};t.setHideCustomerPrice=function(n){var i={hideCustomerPrice:n};t.service.GetAction("HideCustomerPrice",i).done(function(){location.reload(!0)})};this.onClose=function(){t.popoverNode!==null&&(t.popoverNode.popover("hide"),t.popoverOpen(!1))};this.onClickRemove=function(n){t.updateQuantity(n,0)};this.updateQuantity=function(n,i){var r={plid:n.ProductId,quantity:i,cartName:null};t.service.GetAction("UpdateCartItem",r).done(function(r){if(r===null){PubSub.publish(mcWeb.cartsmall.events.onCartItemRemoved);return}PubSub.publish(mcWeb.freeShippingTxt.events.onUpdateFreeShipping);var u={};u.result=r;u.newQuantity=i;u.ProductId=n.ProductId;t.resultQuantity(r,n,i);PubSub.publish(mcWeb.cartsmall.events.onChangedQuantityCartSmall,u)})};this.resultQuantity=function(n,i){t.hasCart(n.HasCart);t.itemCount(mc.format.asCulture(n.ItemCount,t.decimalsQuantity));t.favoriteCount(n.FavoriteCount);PubSub.publish(mcWeb.cartsmall.events.onChangeFav,t.favoriteCount());n.PriceTotal&&(t.priceTotal(n.PriceTotal),t.priceTotalInkVat(n.PriceTotalInkVat),t.priceTotalProducts(n.PriceTotalProducts),t.priceTotalProductsInkVat(n.PriceTotalProductsInkVat),t.priceTotalInkCarrier(n.PriceTotalInkCarrier),t.priceTotalInkCarrierInkVat(n.PriceTotalInkCarrierInkVat),t.priceTotalInkVatExShipping(n.PriceTotalInkVatExShipping),t.priceTotalExVatExShipping(n.PriceTotalExVatExShipping));n.VatTotal&&(t.vatTotal(n.VatTotal),t.vatTotalInkCarrier(n.VatTotalInkCarrier));t.hasCart()?n.CartItems===null||n.CartItems.length<1?t.cartItems.remove(i):n.CartItems!==null&&(i.Quantity(n.CartItems[0].Quantity),i.Price1(n.CartItems[0].Price1),i.Price2(n.CartItems[0].Price2)):(t.popoverNode!==null&&(t.popoverNode.popover("hide"),t.popoverOpen(!1)),t.cartItems.removeAll(),PubSub.publish(mcWeb.cart.events.hasCartItems,t.hasCart()));document.activeElement&&document.activeElement.blur()};this.onClickVat=function(){return t.setVat(t.chkPriceIncExVat()),!0};this.onClickVeil=function(){return t.setVeil(t.chkShowVeilPris),!0};this.onClickHideCustomerPrice=function(){return t.setHideCustomerPrice(t.chkHideCustomerPice),!0};this.onClickProductLink=function(n){window.location.href=n.ProductLink};this.onClickGoToCart=function(){try{t.updateIcon(!0);t.service.GetAction("GoToCart","").done(function(n){(t.updateIcon(!1),n!==null)&&(window.location.href=n)})}catch(n){t.updateIcon(!1)}};this.onSelectCart=function(n){t.onSelectCartByName(n.Name)};this.onSelectCartByName=function(n){var i={ActiveCartName:n};t.service.PostAction("SetActiveCartName",i).done(function(){PubSub.publish(mcWeb.cart.events.onChangedCart,null)})};this.onGoToCart=function(){try{var n={cartName:t.cartName()};t.updateIcon(!0);t.service.GetAction("GoToCart",n).done(function(n){(t.updateIcon(!1),n!==null)&&window.location.pathname!==n&&(window.location.href=n)})}catch(i){t.updateIcon(!1)}};this.onClickGoToCheckout=function(){var n,i;try{n={cartName:t.cartName};t.updateIcon(!0);i="GoToCheckOut";t.service.GetAction(i,n).done(function(n){(t.updateIcon(!1),n!==null)&&(window.location.href=n)})}catch(r){t.updateIcon(!1)}};t.getContent=function(){return"<div id='"+t.conId+t.kn+"'>"+i("#"+t.conId).html()+"<\/div>"};ko.bindingHandlers.popover={init:function(n,r,u,f){var e=i(n),v,a,c;t.popoverNode=e;var s=ko.utils.unwrapObservable(r()),h=s.contentid,l=s.titleid,o="-kn";t.conId=h;t.kn=o;v="<div id='"+h+o+"'>"+i("#"+h).html()+"<\/div>";a="<div id='"+l+o+"'>"+i("#"+l).html()+"<\/div>";this.togglePopover=function(){e.popover("toggle");mcWeb.MegaMenuResponsive!==undefined&&mcWeb.MegaMenuResponsive.setOverlay(!1);var n=document.getElementById(h+o),t=document.getElementById(l+o);n!==undefined&&n!==null&&ko.cleanNode(n);ko.cleanNode(t);ko.applyBindings(f,n);ko.applyBindings(f,t)};c=e.popover({title:a,content:t.getContent,html:s.html,trigger:"manual",sanitize:!1,placement:function(n){var r=jQuery(n),u;if(r.addClass(s.contentClass),u=i("body.mc-inline-editor"),u.length>0)return"bottom";r.on("mouseleave",function(){return e.popover("hide"),t.popoverOpen(!1),!0});return"bottom"}});t.mouseleaveCartSmall=function(n){return!i(n.target).closest(".cart-small-popover").length&&c.is(":visible")?(e.popover("hide"),t.popoverOpen(!1),n.stopPropagation(),!1):!0};c.on("shown.bs.popover",function(){i(document).bind("click touchstart",t.mouseleaveCartSmall)});c.on("hide.bs.popover",function(){i(document).unbind("click touchstart",t.mouseleaveCartSmall)});e.click(function(){if(mcWeb.responsive.getScreenSize()==="xs"){t.onClickGoToCheckout();return}t.showOrderbookSummary()&&t.doShowOrderbookSummary();togglePopover();t.popoverOpen(!t.popoverOpen());mcWeb.inlineEditor&&mcWeb.inlineEditor.init(!0)})}};this.updateIcon=function(n){var t=i("#UpdateIcon");t.length<1||(n?t.show():t.hide())};this.showSmallCartAmount=function(){!t.isCheckoutPage()&&mcWeb.responsive.isMedium()&&i(".cart-small-product-txt").show()};this.isCheckoutPage=function(){return i(".body-checkout").length>0?!0:!1};this.isCartPage=function(){return i(".body-cart").length>0?!0:!1};this.ShowNewItemInCartNotifier=function(){var n=i(".cart-popup-panel");n.length>0&&!t.addToCartNotifierIsActive()&&(i("body").append(n),t.addToCartNotifierIsActive(!0),n.fadeIn(500),n.delay(1500),n.fadeOut(1e3),t.service.GetAction("HasShownAddToCartNotifier").done(function(){t.addToCartNotifierIsActive(!1)}))};PubSub.subscribe(mcWeb.login.events.onIsloggedIn,function(n,i){t.isLoggedIn(i)});PubSub.subscribe(mcWeb.cartsmall.events.onShowNewItemInCartText,function(n,i){t.popupMsgWait.hide();t.popupMsgText.show();i.status===!0?t.popupMsgSuccess.show():(t.popupMsg.addClass("notifier-error"),t.popupMsgError.show());t.popupMsgText.html(i.msg);t.popupMsg.fadeIn();i.popupTime!==undefined&&i.popupTime!==null&&(t.popupTime=i.popupTime);setTimeout(function(){PubSub.publish(mcWeb.cartsmall.events.onHideNewItemInCart)},t.popupTime)});r=!1;PubSub.subscribe(mcWeb.cartsmall.events.onShowNewItemInCart,function(){r!==!0&&(r=!0,t.popupMsgText.hide(),t.popupMsgWait.show(),t.popupMsg.fadeIn())});PubSub.subscribe(mcWeb.cartsmall.events.onHideNewItemInCart,function(){var n=mc.format.asNumber(t.popupTime,1,1e3),i=mc.format.asNumber(.3,2,.3),u=n*i,f=mc.format.asNumber(u,1,1e3);t.popupMsg.fadeOut(f,function(){t.popupMsgSuccess.hide();t.popupMsgError.hide();t.popupMsg.removeClass("notifier-error")});r=!1});PubSub.subscribe(mcWeb.cartsmall.events.onGotoSelectedCart,function(n,i){t.onSelectCartByName(i);t.onGoToCart()})};this.setFavoriteGuid=function(n,t){try{if(n===null||n.length<30)window.StorageService.localStorage.removeItem("sFavCartId");else{var i=t?n+";l":n;window.StorageService.localStorage.setItem("sFavCartId",i)}}catch(r){console.log("CartSmallView.setFavoriteGuid - ex: "+r)}};this.getFavoriteGuid=function(){try{var n=window.StorageService.localStorage.getItem("sFavCartId");return n===null||n.length<30?null:(window.StorageService.localStorage.removeItem("sFavCartId"),n)}catch(t){console.log("CartSmallView.getFavoriteGuid - ex: "+t)}return null}});mcWeb.cart=jQuery.extend(!0,mcWeb.cart,new function(){this.vm=function(n){function s(){t.load(null)}var i=jQuery,t=this,e,h,c,u,o,r,l,f;t.id="#"+n;t.service=new WebApiService("Cart");t.isMobile=ko.observable();t.priceCarrier=ko.observable();t.priceCarrierInkVat=ko.observable();t.priceTotal=ko.observable();t.priceTotalInkVat=ko.observable();t.priceTotalProducts=ko.observable();t.priceTotalProductsInkVat=ko.observable();t.giftVoucherReduction=ko.observable();t.giftVoucherValue=ko.observable();t.priceTotalInkCarrier=ko.observable();t.priceTotalInkCarrierInkVat=ko.observable();t.vatTotal=ko.observable();t.vatTotalInkCarrier=ko.observable();t.hasCart=ko.observable();t.cartTitle=ko.observable();t.cartName=ko.observable();t.guId=ko.observable("");t.itemCount=ko.observable();t.cartItems=ko.observableArray();t.orderbooks=ko.observableArray();t.inlineEditor=ko.observable(!1);t.chkPriceIncExVatPrev=ko.observable(!1);t.chkPriceIncExVat=ko.observable(!1);t.salesMessageVisible=ko.observable(!1);t.discountVisible=ko.observable(!1);t.isLoggedIn=ko.observable();t.zipCodePrev=ko.observable();t.zipCode=ko.observable("");t.shippingPrice=ko.observable();t.shippingPriceInkVat=ko.observable();t.invoiceFee=ko.observable();t.invoiceFeeInkVat=ko.observable();t.invoiceFeeAndShipping=ko.observable();t.invoiceFeeAndShippingInkVat=ko.observable();t.carrierTypes=ko.observableArray();t.selectedCarrierName=ko.observable();t.selectedCarrierId=ko.observable();t.selectedCarrierPrice=ko.observable();t.previousCarrierId=ko.observable(-1);t.CampaignCodeTxt=ko.observable("");t.CampaignUncombinableTxt=ko.observable("");t.CampaignTxt=ko.observable("");t.CampaignFreeFreightRequirementTxt=ko.observable("");t.messageToSalesDep=ko.observable("");t.messageToSalesDepDelayed=ko.computed(function(){return t.messageToSalesDep()}).extend({throttle:300});t.messageBookingRef=ko.observable("");t.messageBookingRefDelayed=ko.computed(function(){return t.messageBookingRef()}).extend({throttle:300});t.showLinkTop=ko.observable(!0);t.showAmountsBottom=ko.observable(!1);t.showCartAlteration=ko.observable(!1);t.showMessageToSalesDep=ko.observable(!1);t.showMessageBookingRef=ko.observable(!1);t.showDiscountCode=ko.observable(!1);t.showPriceIncExVat=ko.observable(!1);t.showRemoveButton=ko.observable(!1);t.showCart=ko.observable(!0);t.isLoadingCart=ko.observable(!0);t.showContinueShoping=ko.observable(!1);t.isCartCollapsed=ko.observable(!0);t.showCartCollapsed=ko.observable(!0);t.showRemoveCart=ko.observable(!1);t.showGoToCheckout=ko.observable(!1);t.showInvoiceFee=ko.observable(!1);t.showTotalInkCarrier=ko.observable(!1);t.showEmptyCart=ko.observable(!1);t.showShipments=ko.observable(!1);t.pricePcs=i("#price-pcs").html();t.showRefreshSpin=ko.observable(!1);t.showRefreshSpinMargin=ko.observable(0);t.hrefLogin=ko.observable("#Login");t.notFixAmount=ko.observable(!0);t.isCheckout=ko.observable(!1);t.showCartItemInfo=ko.observable(!1);t.showSeparateFraktFakturaCost=ko.observable();t.nbrOfDecimals=ko.observable(0);t.quantityMaxlength=ko.observable(3);t.showAddToFavorite=ko.observable(!1);t.isBedrift=ko.observable();t.quantityStepValue=ko.observable();t.minimumSessionTimeoutUponLoginOrPurchase=-1;t.maximumSessionTimeoutWhenNotLoggedInAndEmptyCart=-1;t.sessionEndTime=-1;t.sessionEndPopupTime=-1;t.showCountdownPopup=!1;t.countdownInterval=null;t.sessionTemplateHtml=null;t.OrderbookDate=ko.observable("");t.OrderbookEditVisible=ko.computed(function(){return t.OrderbookDate()==null?!1:t.OrderbookDate()==""?!1:!0});t.isSoftLog=null;t.popupTime=1e3;i(document).ready(function(){t.popupMsg=i("#NewItemInCartNotifier");t.popupMsgWait=t.popupMsg.find(".pop-wait");t.popupMsgSuccess=t.popupMsg.find(".pop-success");t.popupMsgError=t.popupMsg.find(".pop-error");t.popupMsgText=t.popupMsg.find(".cart-popup-text");t.cartItemCommentPlaceholder=i("#CartItemCommentPlaceholder").html();t.sessionTemplateHtml=i("#session-timout").html();t.stepValue=i("#CartItemRemove").attr("step-value")});i("#collapse-cartitems").on("shown.bs.collapse",function(){t.isCartCollapsed(!1)});i("#collapse-cartitems").on("hidden.bs.collapse",function(){t.isCartCollapsed(!0)});t.onSelectCart=function(n){var i={ActiveCartName:n.Name};t.service.PostAction("SetActiveCartName",i).done(function(){PubSub.publish(mcWeb.cart.events.onChangedCart,null)})};this.showRefreshSpin.subscribe(function(){var n=parseFloat(i("#cart.panel").height());n!==NaN&&n>1&&t.showRefreshSpinMargin(n/2-30+"px")});t.showEditOrderbookDate=function(){mcWeb.orderbookManager.showEditOrderbookDate(t.OrderbookDate(),t.guId(),t.cartName())};t.deleteOrderbook=function(){PubSub.publish(mcWeb.orderbookManager.events.onDoDeleteOrderbook,{Guid:t.guId()})};t.deleteFavouriteCart=function(){PubSub.publish(mcWeb.orderbookManager.events.onDoDeleteOrderbook,{Guid:t.guId()})};this.priceTotalInkVat.subscribe(function(){t.priceTotalInkVat()==null||t.priceTotalInkVat().length<1||t.showTotalPrice()});PubSub.subscribe(mcWeb.customerRegistration.events.onChangedCustomerData,function(n,i){i!=null&&i.postnrDelivery!=null&&i.postnrDelivery!=t.zipCode();t.showCart(!0)});PubSub.subscribe(mcWeb.cart.events.onChangedCart,function(n,i){t.load(i);PubSub.publish(mcWeb.shipment.events.reloadShipment,"")});PubSub.subscribe(mcWeb.customerRegistration.events.onChangedZipCode,function(n,i){i!=null&&t.zipCode()&&i.trim()!==t.zipCode().trim()&&t.LoadZipCode(i)});PubSub.subscribe(mcWeb.cartsmall.events.onChangedQuantityCartSmall,function(){t.load()});PubSub.subscribe(mcWeb.shipment.events.onChangedShipment,function(n,i){i&&t.loadCarrier(i)});PubSub.subscribe(mcWeb.shipment.events.onSelectedShipment,function(n,i){i&&(t.selectedCarrierName(i.Name),t.selectedCarrierPrice(i.PrintPrice))});e=function(n){return n<10&&(n="0"+n),n};t.startSessionCountdown=function(){var n,r,u;t.sessionEndPopupTime<1||(t.showCountdownPopup===!0&&(t.showCountdownPopup=!1,PubSub.publish(mcWeb.lightbox.events.onHideLightbox)),t.countdownInterval!=null&&clearInterval(t.countdownInterval),n=new Date,r=new Date(n),t.sessionEndTime=t.isLoggedIn()===!0&&t.itemCount()>0?t.minimumSessionTimeoutUponLoginOrPurchase:t.maximumSessionTimeoutWhenNotLoggedInAndEmptyCart,u=r.setMinutes(n.getMinutes()+t.sessionEndTime),t.countdownInterval=setInterval(function(){var h=(new Date).getTime(),n=u-h,c=Math.floor(n/864e5),l=Math.floor(n%864e5/36e5),f=Math.floor(n%36e5/6e4),o=Math.floor(n%6e4/1e3),r;c===0&&l===0&&f<t.sessionEndPopupTime&&(t.showCountdownPopup===!1&&(t.showCountdownPopup=!0,t.showTemplate(t.sessionTemplateHtml),PubSub.publish(mcWeb.lightbox.events.onShowLightbox,{backdrop:"static",keyboard:!1,show:!0}),document.getElementById("session-btn").addEventListener("click",s)),f=e(f),o=e(o),document.getElementById("session-time").innerHTML=f+":"+o);n<0&&(r=document.getElementById("session-btn"),r!=null&&r.length>0&&(r.removeEventListener("click",s),r.addEventListener("click",function(){window.location.href="/"})),clearInterval(t.countdownInterval),i("#session-info").addClass("hidden"),i("#session-update").addClass("hidden"),i("#session-time").addClass("hidden"),i("#session-info-end").removeClass("hidden"),i("#session-end").removeClass("hidden"),i("#session-time-end").removeClass("hidden"))},1e3))};this.load=function(n,r,u){var f,e,o;if(r&&(PubSub.publish(mcWeb.login.events.onIsloggedIn,r.IsLoggedIn),t.isCartCollapsed(r.ShowCartCollapsed),t.showCartCollapsed=r.ShowCartCollapsed,t.showRemoveCart(r.ShowRemoveCart),t.showGoToCheckout(r.ShowGoToCheckout),t.showContinueShoping(r.ShowContinueShoping),t.showLinkTop(r.ShowLinkTop),t.showAmountsBottom(r.ShowAmountsBottom),t.showCartAlteration(r.ShowCartAlteration),t.showMessageToSalesDep(r.ShowMessageToSalesDep),t.showMessageBookingRef(r.ShowMessageBookingRef),t.showDiscountCode(r.ShowDiscountCode),t.showPriceIncExVat(r.ShowPriceIncExVat),t.showRemoveButton(r.ShowRemoveButton),t.showCart(r.ShowCart),t.showInvoiceFee(r.ShowInvoiceFee),t.showTotalInkCarrier(r.ShowTotalInkCarrier),t.showShipments(r.ShowShipment),t.hrefLogin(r.HrefLogin),t.isCheckout(i(".body-checkout").length>0?!0:!1),t.inlineEditor(r.InlineEditor),t.showCartItemInfo(r.ShowCartItemInfo),t.showSeparateFraktFakturaCost(r.ShowSeparateFraktFakturaCost),t.nbrOfDecimals(r.NbrOfDecimals),t.quantityMaxlength(r.QuantityMaxlength),t.showAddToFavorite(r.ShowAddToFavorite),t.isBedrift(r.IsBedrift),t.quantityStepValue(r.QuantityStepValue),t.minimumSessionTimeoutUponLoginOrPurchase=r.MinimumSessionTimeoutUponLoginOrPurchase,t.maximumSessionTimeoutWhenNotLoggedInAndEmptyCart=r.MaximumSessionTimeoutWhenNotLoggedInAndEmptyCart,t.sessionEndTime=r.MaximumSessionTimeoutWhenNotLoggedInAndEmptyCart,t.sessionEndPopupTime=r.SessionEndPopupTime,r.ShowRegistrationType||i(".registration-type").hide()),f=t.chkPriceIncExVat()!=t.chkPriceIncExVatPrev(),f&&PubSub.publish(mcWeb.shipment.events.reloadShipment,""),!n||n==null){e={cartName:null,useVat:f?t.chkPriceIncExVat():null,discountCode:null,vatChange:f,isCheckout:t.isCheckout(),guid:c(),favGuid:t.getFavoriteGuid()};t.chkPriceIncExVatPrev(t.chkPriceIncExVat());t.showRefreshSpin(!0);t.service.GetAction("LoadCart",e).done(function(n){t.showRefreshSpin(!1);n!=null&&(u?PubSub.publish(mcWeb.cart.events.onChangedCart,n):t.load(n))});return}t.setFavoriteGuid(n.FavoriteGuid,t.isLoggedIn());t.OrderbookDate(n.OrderbookDate);t.isMobile(n.IsMobile);t.CampaignCodeTxt(n.CampaignCodeTxt);t.CampaignTxt(n.CampaignTxt);t.CampaignUncombinableTxt(n.CampaignUncombinableTxt);t.CampaignFreeFreightRequirementTxt(n.CampaignFreeFreightRequirementTxt);t.isMobile()&&i.mobile.loading("hide");n.CartName!=null&&(t.cartTitle(n.CartTitle),t.cartName(n.CartName),t.guId(n.GuId),PubSub.publish(mcWeb.cart.events.cartGuid,{cartName:n.CartName,cartGuid:n.GuId}));t.itemCount(mc.format.asCulture(n.ItemCount,t.nbrOfDecimals()));t.hasCart(n.HasCart);t.isLoadingCart(!1);t.showEmptyCart(!n.HasCart);PubSub.publish(mcWeb.cart.events.hasCartItems,n.HasCart);t.hasCart()?(t.isMobile()&&i("#cart-footer").show(),t.priceCarrier(n.PriceCarrier),t.priceCarrierInkVat(n.PriceCarrierInkVat),t.priceTotal(n.PriceTotal),t.priceTotalInkVat(n.PriceTotalInkVat),t.priceTotalProducts(n.PriceTotalProducts),t.priceTotalProductsInkVat(n.PriceTotalProductsInkVat),t.giftVoucherReduction(n.GiftVoucherReduction),t.giftVoucherValue(n.GiftVoucherValue),t.priceTotalInkCarrier(n.PriceTotalInkCarrier),t.priceTotalInkCarrierInkVat(n.PriceTotalInkCarrierInkVat),t.vatTotal(n.VatTotal),t.vatTotalInkCarrier(n.VatTotalInkCarrier),t.chkPriceIncExVatPrev(n.IncVat),t.chkPriceIncExVat(n.IncVat),t.zipCodePrev(n.ZipCode),t.zipCode(n.ZipCode),t.shippingPrice(n.ShippingPrice),t.shippingPriceInkVat(n.ShippingPriceInkVat),t.invoiceFee(n.InvoiceFee),t.invoiceFeeInkVat(n.InvoiceFeeInkVat),t.invoiceFeeAndShipping(n.InvoiceFeeAndShipping),t.invoiceFeeAndShippingInkVat(n.InvoiceFeeAndShippingInkVat),t.messageToSalesDep(n.MessageToSalesDep),t.messageBookingRef(n.MessageBookingRef),t.notFixAmount(!n.FixAmount),t.isSoftLog=n.IsSoftLog,h(n),t.messageToSalesDep()!=null&&t.messageToSalesDep().trim().length>0&&t.isCheckout()&&t.salesMessageVisible(!0),t.messageBookingRef()!=null&&t.messageBookingRef().trim().length>0&&t.isCheckout()&&t.salesMessageVisible(!0),n.Orderbooks!==null&&t.orderbooks(n.Orderbooks),ko.utils.arrayForEach(n.CartItems,function(n){ko.isObservable(n.Quantity)||(n.Quantity=ko.observable(mc.format.asCulture(n.Quantity,t.nbrOfDecimals())));ko.isObservable(n.QuantityMinimum)||(n.QuantityMinimum=ko.observable(n.QuantityMinimum));ko.isObservable(n.Price1)||(n.Price1=ko.observable(n.Price1));ko.isObservable(n.Price1Stk)||(n.Price1Stk=ko.observable(n.Price1Stk));ko.isObservable(n.Price2)||(n.Price2=ko.observable(n.Price2));ko.isObservable(n.ShowConfig)||(n.ShowConfig=ko.observable(!1));ko.isObservable(n.CampaignCode)||(n.CampaignCode=ko.observable(n.CampaignCode));ko.isObservable(n.FromAutoCampaign)||(n.FromAutoCampaign=ko.observable(n.FromAutoCampaign));ko.isObservable(n.CampaignCombinable)||(n.CampaignCombinable=ko.observable(n.CampaignCombinable));ko.isObservable(n.CampaignFreeFreightOnlyForCollectedDelivery)||(n.CampaignFreeFreightOnlyForCollectedDelivery=ko.observable(n.CampaignFreeFreightOnlyForCollectedDelivery));ko.isObservable(n.ShowQuantity)||(n.ShowQuantity=ko.computed(function(){return n.CampaignCode().length==0&&n.ConfigProducts==null}));ko.isObservable(n.ShowConfigQuantity)||(n.ShowConfigQuantity=ko.observable(n.ShowConfigQuantity));ko.isObservable(n.ProduktStatusId)||(n.ProduktStatusId=ko.observable(n.ProduktStatusId));ko.isObservable(n.GlyphIcon)||(n.GlyphIcon=ko.observable(n.GlyphIcon));ko.isObservable(n.Packsize)||(n.Packsize=ko.observable(n.Packsize));ko.isObservable(n.Info)||(n.Info=ko.observable(n.Info));ko.isObservable(n.FavoriteItemExist)||(n.FavoriteItemExist=ko.observable(n.FavoriteItemExist))}),t.cartItems(n.CartItems),t.showShipments()&&t.cartItems()!=null&&t.cartItems().length>0&&(o=new WebApiService("Shipment"),o.GetAction("CarrierList",{isCheckout:t.isCheckout()}).done(function(n){PubSub.publish(mcWeb.shipment.events.onChangedShipment,n)})),t.startSessionCountdown(),t.showRefreshSpin(!1),t.showCart(!0)):(t.showRefreshSpin(!1),t.showCart(!1),t.isMobile()&&i("#cart-footer").hide());t.inlineEditor&&!!mcWeb.inlineEditor&&mcWeb.inlineEditor.init(!0)};h=function(n){try{n.IsSoftLog!=null&&n.IsSoftLog==!0?window.StorageService.sessionStorage.setItem("sCartId",n.GuId):window.StorageService.sessionStorage.removeItem("sCartId")}catch(t){}};c=function(){try{var n=window.StorageService.sessionStorage.getItem("sCartId");return n===null||n.length<30?null:(window.StorageService.sessionStorage.removeItem("sCartId"),n)}catch(t){return null}};this.toggleDiscount=function(){t.discountVisible(!t.discountVisible())};this.toggleSalesMessage=function(){t.salesMessageVisible(!t.salesMessageVisible())};this.onToggleCarrierTypes=function(){i("#carrier-types").slideToggle()};this.saveSelectedCarrier=function(n){t.selectedCarrierName(n.Name);t.selectedCarrierPrice(n.PrintPrice);var i={carrierItem:n},r=new WebApiService("Shipment");return r.GetAction("SaveSelectedCarrier",i).done(function(t){PubSub.publish(mcWeb.cart.events.onChangedCart,"");PubSub.publish(mcWeb.shipment.events.onSelectedShipment,n);t!==null&&t!=undefined&&t.DoUpdateDeliveryAddress}),!0};this.onClickShowConfig=function(n){n.ShowConfig(!n.ShowConfig())};this.onClickEditConfig=function(n){t.showRefreshSpin(!0);t.service.GetAction("EditConfigProduct",{plid:n.ProductId}).done(function(){t.showRefreshSpin(!1)})};this.onClickAssembly=function(n){var i={cartProduktId:n.ProductId};t.service.GetAction("ShowSkiAssembly",i).done(function(n){n!=null&&n!=!1&&(n=="mcWeb.SkiAssembly"?mcWeb.SkiAssembly.load():n=="mcWeb.SkiAttributeAssembly"?mcWeb.SkiAttributeAssembly.load():alert("Error - Cant show ski assembly"))})};this.onClickFav=function(n){n.FavoriteItemExist(!0);mcWeb.productlist.fav.add(null,n.Plid,1,t.isCheckout(),0,-1)};o=function(n){return t.quantityStepValue()!="0"?r(t.quantityStepValue()):n.Packsize()};this.onClickIncQua=function(n){u&&(clearTimeout(u),u=null);var f=r(n.Quantity()),e=r(n.Packsize()),s=r(o(n)),i=parseFloat(r(parseFloat(f)+parseFloat(s)));i<e&&(i=0);n.Quantity(mc.format.asCulture(i,t.nbrOfDecimals()));u=setTimeout(function(){t.updateQuantity(n,i,f)},500)};this.setQua=function(n){l(n);var i=r(n.Quantity());t.updateQuantity(n,parseFloat(i),parseFloat(i))};this.onClickDecQua=function(n){u&&(clearTimeout(u),u=null);var f=r(n.Quantity()),e=r(n.QuantityMinimum()),s=r(o(n)),i=parseFloat(r(parseFloat(f)-parseFloat(s)));i<e&&(i=0);n.Quantity(mc.format.asCulture(i,t.nbrOfDecimals()));u=setTimeout(function(){t.updateQuantity(n,i,f)},500)};this.onClickRemove=function(n){t.updateQuantity(n,0)};this.enterKey=function(n,t){return t.keyCode===13?(document.activeElement.blur(),!1):!0};r=function(n){try{n!=null&&(n=n.toString().replace(",","."));isNaN(n)&&(n=1);var i=parseFloat(Math.round(n*100)/100).toFixed(t.nbrOfDecimals());return isNaN(i)?1:i}catch(r){return 1}};l=function(n){var u=r(n.Quantity()),f,e;isNaN(u)&&(u=1,n.Quantity("1"));f=r(n.QuantityMinimum());parseFloat(u)>0&&parseFloat(u)<parseFloat(f)&&(e=parseFloat(f)-parseFloat(u),n.Quantity(f),t.quantityQtip(i("#quan-"+n.ProductId),i("#pack-quantity").text(),"+"+mc.format.asCulture(e,t.nbrOfDecimals())))};this.isLastQua=function(n,t){var i=r(n),u;return isNaN(i)&&(i=1),u=r(t),parseFloat(i)<=parseFloat(u)};this.resultQuantity=function(n,r,u,f){var e,o,s;if(t.hasCart(n.HasCart),t.itemCount(mc.format.asCulture(n.ItemCount,t.nbrOfDecimals())),n.PriceTotal&&(t.priceTotal(n.PriceTotal),t.priceTotalInkVat(n.PriceTotalInkVat),t.priceTotalProducts(n.PriceTotalProducts),t.priceTotalProductsInkVat(n.PriceTotalProductsInkVat),t.giftVoucherReduction(n.GiftVoucherReduction),t.giftVoucherValue(n.GiftVoucherValue),t.priceTotalInkCarrier(n.PriceTotalInkCarrier),t.priceTotalInkCarrierInkVat(n.PriceTotalInkCarrierInkVat),t.shippingPrice(n.ShippingPrice),t.shippingPriceInkVat(n.ShippingPriceInkVat),t.invoiceFee(n.InvoiceFee),t.invoiceFeeInkVat(n.InvoiceFeeInkVat),t.invoiceFeeAndShipping(n.InvoiceFeeAndShipping),t.invoiceFeeAndShippingInkVat(n.InvoiceFeeAndShippingInkVat)),n.VatTotal&&(t.vatTotal(n.VatTotal),t.vatTotalInkCarrier(n.VatTotalInkCarrier),PubSub.publish(mcWeb.shipment.events.reloadShipment,"")),t.hasCart())n.CartItems==null||n.CartItems.length<1?t.cartItems.remove(r):n.CartItems!=null&&(e=mc.format.asNumber(n.CartItems[0].Quantity,t.nbrOfDecimals()),f=mc.format.asNumber(f,t.nbrOfDecimals()),u=mc.format.asNumber(u,t.nbrOfDecimals()),f==e&&f!=u?t.quantityQtip(i("#quan-"+r.ProductId),i("#no-quantity").text()):u!=e&&(o=e-f,s=" "+(o>0?"+":"")+mc.format.asCulture(o,t.nbrOfDecimals()),n.CartItems[0].Packsize==1?t.quantityQtip(i("#quan-"+r.ProductId),i("#max-quantity").text()+" "+mc.format.asCulture(e,t.nbrOfDecimals())+" "+i("#instock-quantity").text(),""):t.quantityQtip(i("#quan-"+r.ProductId),i("#pack-quantity").text(),s)),r.Quantity(mc.format.asCulture(n.CartItems[0].Quantity,t.nbrOfDecimals())),r.Price1(n.CartItems[0].Price1),r.Price1Stk(n.CartItems[0].Price1Stk),r.Price2(n.CartItems[0].Price2),r.CampaignCode(n.CartItems[0].CampaignCode),r.FromAutoCampaign(n.CartItems[0].FromAutoCampaign));else{t.cartItems.removeAll();PubSub.publish(mcWeb.cart.events.hasCartItems,t.hasCart());t.showEmptyCart(!0);return}document.activeElement&&document.activeElement.blur()};this.updateQuantity=function(n,i,r){var u={plid:n.ProductId,quantity:i,cartName:null,isCheckout:t.isCheckout(),info:n.Info()};t.showRefreshSpin(!0);t.service.GetAction("UpdateCartItem",u).done(function(u){if(t.showRefreshSpin(!1),u!=null){PubSub.publish(mcWeb.freeShippingTxt.events.onUpdateFreeShipping);var f={};f.result=u;f.newQuantity=i;f.ProductId=n.ProductId;t.resultQuantity(u,n,i,r);t.isMobile()&&mcMobile.headerBar.update();PubSub.publish(mcWeb.cart.events.onChangedQuantityCart,f);u.WebCartProductIdsRemoved!=null&&u.WebCartProductIdsRemoved.length>0&&PubSub.publish(mcWeb.cart.events.onChangedCart,null)}})};this.quantityQtip=function(n,t,u){var f=u?'<span class="bold">'+r(u)+"<\/span>":"";n.qtip({content:{text:t+f},hide:{inactive:5e3,event:"click mouseleave mouseover",effect:function(){i(this).slideUp()}},position:{my:"top center",at:"bottom center"},style:{classes:"qtip-bootstrap qtip-cart"},show:{ready:!0}})};this.onClickVat=function(){return t.load("","",!0),!0};this.onClickContinueShoping=function(){t.service.GetAction("ContinueShoping","").done(function(n){window.location.href=n})};this.onClickRemoveCart=function(){t.service.GetAction("RemoveCart",{cartName:null,isCheckout:t.isCheckout()}).done(function(n){n!=null&&(t.isMobile()&&mcMobile.headerBar.update(),t.hasCart(!1),t.priceTotal(""),t.priceTotalInkVat(""),t.priceTotalProducts(""),t.priceTotalProductsInkVat(""),t.giftVoucherReduction(""),t.giftVoucherValue(""),t.priceTotalInkCarrier(""),t.priceTotalInkCarrierInkVat(""),t.vatTotal(""),t.vatTotalInkCarrier(""),t.cartItems.removeAll(),t.showEmptyCart(!0),PubSub.publish(mcWeb.cartsmall.events.onUpdateCart,""))})};this.onClickGoToCheckout=function(){try{var n={cartName:t.cartName};t.showRefreshSpin(!0);t.service.GetAction("GoToCheckOut",n).done(function(n){(t.showRefreshSpin(!1),n!=null)&&(window.location.href=n)})}catch(i){t.showRefreshSpin(!1)}};this.LoadZipCode=function(n){if(n!=null&&n.length>=3&&n.indexOf("*")==-1)try{t.zipCodePrev(n);t.zipCode(n);PubSub.publish(mcWeb.customerRegistration.events.onChangedZipCode,n)}catch(i){t.showRefreshSpin(!1)}};this.loadCarrier=function(n){var u,i,r;if(n!=null&&n)for(u=t.previousCarrierId(),t.carrierTypes(n.CarrierList),t.selectedCarrierId(n.SelectedCarrierId),i=0;i<n.CarrierList.length;i++)if(r=n.CarrierList[i],r.Id==n.SelectedCarrierId){t.selectedCarrierName(r.Name);t.selectedCarrierPrice(r.PrintPrice);t.previousCarrierId(n.SelectedCarrierId);break}};this.isNumberKey=function(n,t){var i=t.which?t.which:t.keyCode;return i==13?(document.activeElement.blur(),!1):!(i>31&&(i<48||i>57))};t.zipCode.subscribe(function(n){t.zipCodePrev()!=n&&n!=null&&n.length>3&&(t.zipCodePrev(n),t.LoadZipCode(n))});this.storeMessages=function(){var n={messageToSalesDep:t.messageToSalesDep()==null?"":t.messageToSalesDep(),messageBookingRef:t.messageBookingRef()==null?"":t.messageBookingRef()};t.service.PostAction("StoreMessageToSalesDep",n).done(function(n){(n==null||n!=!0)&&alert("Error saving message!")})};i("#qt-zipcode-i").popover({trigger:"hover",title:i("#qt-zipcode-t").html(),content:i("#qt-zipcode-c").html(),placement:"top",container:"body"});this.showTotalPrice=function(){i("#checkout-total").html(t.priceTotalInkVat())};PubSub.subscribe(mcWeb.login.events.onIsloggedIn,function(n,i){t.isLoggedIn(i)});t.onClickLoginDiscoutCode=function(){try{window.StorageService.sessionStorage.setItem("focusDiscoutCode",!0)}catch(n){}t.hrefLogin()==="#login"?mcWeb.login.load():window.location.href=t.hrefLogin()};PubSub.subscribe(mcWeb.cart.events.focusDiscoutCode,function(){try{var n=window.StorageService.sessionStorage.getItem("focusDiscoutCode");n!==null&&n==="true"&&(t.discountVisible(!0),window.StorageService.sessionStorage.setItem("focusDiscoutCode",!1),setTimeout(function(){i("#discount-code-input").focus()},400))}catch(r){console.log("CartView.PubSub.subscribe(mcWeb.cart.events.focusDiscoutCode) - ex: "+r)}});PubSub.subscribe(mcWeb.cart.events.onChangeCollectedDelivery,function(n,i){t.service.GetAction("UseCollectedDelivery",{active:i,isCheckout:t.isCheckout()}).done(function(n){n==null||n.Success===!1?alert("Error saving collected delivery change!"):n.MustRefreshCart&&PubSub.publish(mcWeb.cart.events.onChangedCart,null)})});PubSub.subscribe(mcWeb.cart.events.hasCartItems,function(n,t){t==!0?i(".checkout").removeClass("empty-cart"):i(".checkout").addClass("empty-cart")});this.onClickShowSelectedCartItemTextbox=function(n){var t="productId-"+n.ProductId;i("#"+t).is(":visible")?i("#"+t).slideUp():i("#"+t).slideDown()};this.onClickSaveCartItemInfo=function(n){n.Info()!=null&&t.updateInfo(n)};this.updateInfo=function(n){var i=r(n.Quantity()),u={plid:n.ProductId,quantity:i,cartName:null,isCheckout:t.isCheckout(),info:n.Info()};t.showRefreshSpin(!0);t.service.GetAction("UpdateCartItem",u).done(function(n){t.showRefreshSpin(!1);n==null})};PubSub.subscribe(mcWeb.cart.events.onShowNewItemInCartText,function(n,i){t.popupMsgWait.hide();t.popupMsgText.show();i.status==!0?t.popupMsgSuccess.show():(t.popupMsg.addClass("notifier-error"),t.popupMsgError.show());t.popupMsgText.html(i.msg);t.popupMsg.fadeIn();i.popupTime!=undefined&&i.popupTime!=null&&(t.popupTime=i.popupTime);setTimeout(function(){PubSub.publish(mcWeb.cart.events.onHideNewItemInCart)},t.popupTime)});f=!1;PubSub.subscribe(mcWeb.cart.events.onShowNewItemInCart,function(){f!=!0&&(f=!0,t.popupMsgText.hide(),t.popupMsgWait.show(),t.popupMsg.fadeIn())});PubSub.subscribe(mcWeb.cart.events.onHideNewItemInCart,function(){t.popupMsg.fadeOut(700,function(){t.popupMsgSuccess.hide();t.popupMsgError.hide();t.popupMsg.removeClass("notifier-error")});f=!1});this.setFavoriteGuid=function(n,t){try{if(n==null||n.length<30)window.StorageService.localStorage.removeItem("sFavCartId");else{var i=t?n+";l":n;window.StorageService.localStorage.setItem("sFavCartId",i)}}catch(r){}};this.getFavoriteGuid=function(){try{var n=window.StorageService.localStorage.getItem("sFavCartId");return n===null||n===undefined||n.length<30?null:(window.StorageService.localStorage.removeItem("sFavCartId"),n)}catch(t){console.log("CartView.getFavoriteGuid - ex: "+t)}return null};t.showTemplate=function(n){var t=i("#lightbox-placeholder");if(t.length<1){PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!1,disabledBtn:!1});return}t.html(n)}}});mcWeb.checkout=new function(){this.events={onShowSendOrder:"mcWeb.checkout.onShowSendOrder"};var t=jQuery,n=this;n.service=new WebApiService("Checkout");n.langService=new LanguageService;n.cartName=null;n.cartGuid=null;t(function(){var r;if(n.isCheckoutPage=t("#checkout").length>0?!0:!1,n.isCheckoutPage){r=n.getParameterByName("returnCode");n.showErrorMessageFromReturnCode(r);var i=t("#McPaymentAddOrderbottom"),u=t("#checkout-amount"),f=t("#mcweb-salesconditions-sales-conditions");PubSub.subscribe(mcWeb.checkout.events.onShowSendOrder,function(n,r){if(r!==null){var e=mcWeb.customerRegistration.instances["checkout-registration"];e!==null&&e.registrationVM.blockedCustomer()&&(r.showBtn=!1,r.disabledBtn=!0,t(".sales-conditions").hide());(r.showBtn!==null||r.disabledBtn!==null)&&(r.disabledBtn!==null&&(r.disabledBtn===!0?(i.removeClass("btn-primary"),i.addClass("btn-default disabled")):(i.removeClass("btn-default disabled"),i.addClass("btn-primary"))),r.showBtn!==null&&(r.showBtn===!0?i.show():i.hide()));r.showPrice!==null&&(r.showPrice===!0?u.show():u.hide());r.showSalesConditions!==null&&(r.showSalesConditions===!0?f.show():f.hide())}})}});n.findElement=function(n,i){return t("div[id="+n.selectedPayment()+"]").find("input[id*='"+i+"']")};n.findClass=function(n,i){return t("div[id="+n.selectedPayment()+"]").find("input[class*='"+i+"']")};n.validatePayment=function(i){var e=i.selectedPayment(),r,o=!1,u=!1,f="",h,s,c,l,a;if(e===96||e===97)o=!0,i.CustomerType()==="private"||i.CustomerType()==="privatkunde"?(r=n.findElement(i,"fodselsnummer"),u=i.isFodselsnummerValid(t("#fodselsnummer"),!0),f="FodselsnummerError"):(r=n.findElement(i,"orgnr"),u=i.isOrgnrValid(t("#orgnr"),!0),f="OrgnummerError");else if(e===94||e===107)r=n.findElement(i,"birth_ssn"),o=!0,u=i.isFodselsnummerValid(t("#birth_ssn"),!1),f="FodselsnummerError";else if(e===95)r=n.findElement(i,"orgnr_ssn"),o=!0,u=i.isOrgnrValid(t("#orgnr_ssn"),!1),f="OrgnummerError";else if(e===112||e===115||e===168)o=!0,s=mcWeb.payments.instances["payment-view"],h=s.validateSantander(i),u=h.IsValid,f=h.ResName,r=h.Element;else if(e===87||e===128)o=!0,s=mcWeb.payments.instances["payment-view"],c=s.validateSveaWebPay(i),u=c.IsValid,f=c.ResName,r=c.Element;else if(i.ShowOrgnrSsn()){o=!0;l=i.ShowOrgnrSsnField();switch(l){case 1:r=n.findClass(i,"genericOrgnr");u=i.isOrgnrValid(t(".genericOrgnr"),!1);f="OrgnummerError";break;case 2:r=n.findClass(i,"genericSsn");u=i.isFodselsnummerValid(t(".genericSsn"),!1);f="FodselsnummerError";break;case 3:r=n.findClass(i,"genericBirthdate");u=i.isBirthdateValid(t(".genericBirthdate"),!1);f="FodselsdatoError";break;default:u=!1;f="MissingFields"}}else u=!0;return o&&(u?r&&mcWeb.validation.setValidCss(r):(a=mcWeb.validation.getErrorMessage("VALIDATION,"+f),a.done(function(n){mcWeb.validation.qTipActionShow(r,n,!1);mcWeb.validation.addErrorClass(r)}))),u};n.disableOrderButton=function(){t("#McPaymentAddOrderbottom").attr("disabled","disabled")};n.enableOrderButton=function(){t("#McPaymentAddOrderbottom").removeAttr("disabled")};n.insertOrder=function(i){var o,f,r,u,e;if(n.disableOrderButton(),n.conditionsVM=i,o=t("#McPaymentAddOrderbottom.btn-default.disable"),o.length>0){n.showErrorMessage(t("#missing-info").html());n.enableOrderButton();return}if(t(".hide-zipcode").length===0&&(f=t("#carrier-zipcode"),f.val().length<1)){f.focus();n.enableOrderButton();return}if(t("#insert-order-alert").hide(),r=mcWeb.customerRegistration.instances["checkout-registration"],u=mcWeb.payments.instances["payment-view"],typeof r.registrationVM.epost()=="string"&&r.registrationVM.epost(r.registrationVM.epost().toLowerCase()),e=n.validatePayment(u),n.showWaitTemplate(),!r.validateCustomerSelectionType()){n.enableOrderButton();return}r.validate().then(function(i){if(!i.success||!e){e&&(r.requireLogin()?n.showErrorMessage(t(".text-email-blocked").html()):i.invalidElements.length>0?n.scrollToFirstInvalidElement(i.invalidElements[0].elem):i.message!==null&&i.message.length>0&&n.showErrorMessage(i.message));n.enableOrderButton();return}if(!n.salesConditionsAccepted()){n.showErrorMessage(t(".sales-cond-warning").html());n.enableOrderButton();return}n.service.GetAction("ShowSkiAssembly",null).done(function(i){var e,f,o,s;if(i.length>0){n.enableOrderButton();i==="mcWeb.SkiAssembly"?mcWeb.SkiAssembly.load():i==="mcWeb.SkiAttributeAssembly"?mcWeb.SkiAttributeAssembly.load():alert("Error - Cant show ski assembly");return}if(PubSub.publish(mcWeb.lightbox.events.onShowLightbox,{backdrop:"static",keyboard:!1,show:!0}),e=r.getJsonData(n.conditionsVM),f=u.getJsonData(),f.selectedPayment===112||f.selectedPayment===115||f.selectedPayment===168){if(s=u.validateSantanderAddress(e.postnr,e.poststed,e.adress),s!==""){n.langService.getValue("VALIDATION",s).done(function(t){t.length>0&&n.showErrorMessage(t)});n.enableOrderButton();return}o=f.santanderApplicationDetails;o.RegisteredPostCode=f.paymentDetails.RegisteredPostCode}else o=f.paymentDetails;f.paymentDetails.Birthdate!=="undefined"&&(e.birthDate=f.paymentDetails.Birthdate);e.customerType==="undefined"&&u.CustomerType()==="privatkunde"&&(e.customerType="private");n.service.PostAction("ProcessOrder",{CustomerData:e,PaymentDetails:o,CartGuid:n.cartGuid,CartName:n.cartName}).done(function(i){if(i.ReturnCode==="Success")window.location=i.RedirectUrl;else if(n.enableOrderButton(),PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!0,disabledBtn:!1}),i.ReturnCode==="ValidatePostalAddressFailed"&i.ErrorMessageSpecified)n.showErrorMessageFromReturnCode(i.ErrorMessage);else if(i.ErrorMessageSpecified){if(n.showErrorMessage(i.ErrorMessage),i.ReturnCode==="ProductValidationFailed")t("#center-popup").on("hidden.bs.modal",function(){PubSub.publish(mcWeb.cart.events.onChangedCart)})}else if(i.ReturnCode==="SessionNotValid"&&(i.ReturnCode="CurrentSessionHasExpired"),n.showErrorMessageFromReturnCode(i.ReturnCode),i.ReturnCode==="CurrentSessionHasExpired"||i.ReturnCode==="ExperianError"||i.ReturnCode==="ExperianNoCreditApproval"||i.ReturnCode==="CampaignInvalid"||i.ReturnCode==="CartArchivedOrInserted")t("#center-popup").on("hidden.bs.modal",function(){window.location.reload(!0)});else if(i.showErrorMessageFromReturnCode==="CartValueAltered")t("#center-popup").on("hidden.bs.modal",function(){PubSub.publish(mcWeb.cart.events.onChangedCart)})})})}).fail(function(i){t("#checkout-popup").modal("hide");n.enableOrderButton();console.log(i)})};n.salesConditionsAccepted=function(){var i=t(".checkbox-sales-cond"),n=t(".sales-conditions");if(n.removeClass("has-error"),i.length>0&&n.is(":visible")){if(i.prop("checked"))return!0}else return!0;return n.addClass("has-error"),!1};n.showErrorMessage=function(t){t.length>0&&n.showAlertErrorMessage(t)};n.showErrorMessageFromReturnCode=function(t){if(t.length!==0)["CartIsNull","SetCustomerDataFailed","SetCartValuesFailed","SaveCartFailed","CommitPhoneFailed","ProductValidationFailed","BrokenCartReplaced"].indexOf(t)!==-1&&(t="UnknownError"),n.langService.getValue("CheckoutReturnCodes",t).done(function(t){t.length>0?n.showAlertErrorMessage(t):n.langService.getValue("CheckoutReturnCodes","UnknownError").done(function(t){t.length>0?n.showAlertErrorMessage(t):n.showAlertErrorMessage("")})})};n.showAlertErrorMessage=function(i,r){var u=t("#error-message-label");r===!0?u.append(i):u.html(i);n.showTemplate(t("#popup-error-message").html());PubSub.publish(mcWeb.lightbox.events.onShowLightbox,{show:!0})};n.scrollToFirstInvalidElement=function(n){t("html, body").animate({scrollTop:t(n).offset().top-120},750);n.focus()};n.getParameterByName=function(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)"),t=i.exec(location.search);return t===null?"":decodeURIComponent(t[1].replace(/\+/g," "))};n.showWaitTemplate=function(){var i=t("#popup-wait");i.length<1||n.showTemplate(i.html())};n.showTemplate=function(n){var i=t("#lightbox-placeholder");if(i.length<1){PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!1,disabledBtn:!1});return}i.html(n)};PubSub.subscribe(mcWeb.cart.events.cartGuid,function(t,i){i!==null&&(n.cartName=i.cartName,n.cartGuid=i.cartGuid)})};mcWeb.checkoutConfirmation=new function(){this.instance=new function(){};this.checkoutConfirmationObj=function(n,t,i){var u=jQuery,r=this;r.id="#"+n;r.service=new WebApiService("Cart");r.vm=new function(){var n=this;n.referenceNo=ko.observable()};r.load=function(n){n!=null&&r.vm.referenceNo(n.ReferenceNo)};ko.applyBindings(r.vm,document.getElementById(n));r.load(t,i)}};mcWeb.checkoutFooterView=new function(){this.events={};this.vm=function(n){var t=this;this.id="#"+n;this.conditionsStatus={isFunctionalConditionAccepted:ko.observable(!1),acceptDocuments:ko.observableArray([]),usageArea:3,refCondVm:null};this.load=function(){PubSub.subscribe(mcWeb.conditions.events.onAcceptChange,function(n,i){t.conditionsStatus.usageArea==i.usageArea&&(i.functionalConditionIsAccepted===null?t.conditionsStatus.isFunctionalConditionAccepted(!0):t.conditionsStatus.isFunctionalConditionAccepted(i.functionalConditionIsAccepted),t.conditionsStatus.acceptDocuments(i.acceptDocuments),t.conditionsStatus.refCondVm=i.vm)})};this.insertOrder=function(){var n={isFunctionalConditionAccepted:t.conditionsStatus.isFunctionalConditionAccepted,acceptDocuments:t.conditionsStatus.acceptDocuments(),usageArea:t.conditionsStatus.usageArea};if(t.conditionsStatus==null||t.conditionsStatus.acceptDocuments==null||t.conditionsStatus.acceptDocuments().length<=0){n.isFunctionalConditionAccepted(!0);mcWeb.checkout.insertOrder(n);return}t.conditionsStatus.isFunctionalConditionAccepted()?mcWeb.checkout.insertOrder(n):t.conditionsStatus.refCondVm!==null&&t.conditionsStatus.refCondVm.highlightRequired("checkoutconditions")&&mcWeb.validation.qTipActionShowClickHide(t.id+" #McPaymentAddOrderbottom",jQuery(".langtext-conditions-required").length>0?jQuery(".langtext-conditions-required")[0].innerText:"")}}};mcWeb.loginCheckout=new function(){var n=jQuery;this.events={onShowHideLogin:"mcWeb.loginCheckout.events.onShowHideLogin",onShowLoginEmail:"mcWeb.loginCheckout.events.onShowLoginEmail",onShowLoginPassword:"mcWeb.loginCheckout.events.onShowLoginPassword",onChangedEmail:"mcWeb.loginCheckout.events.onChangedEmail"};this.vm=function(t){var f=167,i=this,e,h;this.id="#"+t;this.service=new WebApiService("CustomerRegistration");this.isLoggedIn=ko.observable(!1);this.isSoftLoggedIn=ko.observable(!1);this.forceLogin=ko.observable(!1);this.showSearchBtn=ko.observable(!0);this.showSearchSpin=ko.observable(!1);this.showPswPanel=ko.observable(!1);this.showPswBtn=ko.observable(!1);this.showPswSpin=ko.observable(!1);this.showNewCustomerBtn=ko.observable(!1);this.email=ko.observable("");this.psw=ko.observable("");this.isEmailSelected=ko.observable(!0);this.onBlurMail=ko.observable(!1);this.onBlurMail.subscribe(function(){i.isEmailSelected(!1)});this.isPswSelected=ko.observable(!1);this.showErrorLogin=ko.observable(!1);this.showCustomerRegistration=ko.observable(!1);this.onlyExpressCheckout=ko.observable(!1);this.paymentId=ko.observable();this.isCheckout=ko.observable(!1);this.checkoutRequirePassword=!1;this.useCustomerRegistration=!1;this.registration=mcWeb.customerRegistration.instances["checkout-registration"];this.data=null;var o="********************",u=function(){window.StorageService.localStorage.removeItem("user");window.StorageService.localStorage.removeItem("id");window.StorageService.localStorage.removeItem("remember");window.StorageService.localStorage.removeItem("authenticatedGuid")},c=function(){var n=mcWeb.currentUser.getUser();n!==null&&i.email(n);r(!1)};this.load=function(t,u){if(u!==null){i.isCheckout(n(".body-checkout").length>0);var f=mcWeb.currentUser.getUser();!u.IsLoggedIn&&u.SecuritySoftening&&f!==null&&i.email(f);i.securitySoftening=u.SecuritySoftening;i.isSoftLoggedIn(u.IsSoftLoggedIn);i.isLoggedIn(u.IsLoggedIn||u.ReadOnly||u.SecuritySoftening&&f!==null);i.checkoutRequirePassword=u.CheckoutRequirePassword;i.useCustomerRegistration=u.ShowCustomerRegistration}if(i.isLoggedIn()||i.isSoftLoggedIn()){r(!1);return}c()};var r=function(n){var t=null;t=n?{WebBrukerId:"",NewCustomer:!0}:{WebBrukerId:i.email(),NewCustomer:!1};i.showSearchSpin(!0);i.service.PostAction("CheckNextCheckoutStage",t).done(function(n){if(i.showSearchSpin(!1),n&&n.Success)switch(n.NextStage){case"DoSoftLogin":y();return;case"ShowUserName":v();break;case"ShowUserNameAndPassword":s(n.AutoFillUserName);PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,null);break;case"ShowUserDetails":a();break;case"ShowCustomerRegistration":l()}})},l=function(){i.showCustomerRegistration(!0);i.showNewCustomerBtn(!1);i.showPswPanel(!1);i.isPswSelected(!1);i.showPswBtn(!1);i.showSearchSpin(!1);i.forceLogin(!1);PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,null)},a=function(){i.showCustomerRegistration(!1);i.showNewCustomerBtn(!1);i.showPswPanel(!1);i.isPswSelected(!1);i.showPswBtn(!1);i.showSearchSpin(!1);i.forceLogin(!1);PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,null);p()},v=function(){i.showCustomerRegistration(!1);i.showSearchBtn(!0);i.showPswPanel(!1);i.showPswBtn(!1);i.showNewCustomerBtn(!1);i.forceLogin(!1);i.setLoginFocus(!0);PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,null)},y=function(){i.showCustomerRegistration(!1);i.showPswPanel(!1);i.showNewCustomerBtn(!1);i.showPswBtn(!1);i.forceLogin(!1);mcWeb.currentUser.doSecuritySofteningLogin(i.email())},s=function(n){i.showSearchBtn(!1);i.showCustomerRegistration(!1);i.showNewCustomerBtn(i.useCustomerRegistration);i.showPswPanel(!0);i.showPswBtn(!0);i.showSearchSpin(!1);n!==undefined&&n!==null&&n.length>0&&i.email(n);i.setLoginFocus();i.forceLogin(!0)},p=function(){var n={email:i.email(),zipCode:null,isCheckout:i.isCheckout()};i.service.PostAction("IsRegistered",n).done(function(n){if(i.showSearchSpin(!1),i.showPswSpin(!1),n!==null){if(n.useSoftlog&&i.checkoutRequirePassword===!0){i.showPswPanel(!0);i.isPswSelected(!0);i.showPswBtn(!0);return}var t=n.epost===null||n.epost.length<2?i.email():n.epost;n.epost=t;e(n)}})};this.runCheckEmail=function(){r()};e=function(n){if(n===null){i.showPswSpin(!1);i.showPswBtn(!0);return}i.showCustomerRegistration(!0);PubSub.publish(mcWeb.customerRegistration.events.onChangedCustomerData,n);PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,null)};this.newCustomer=function(){if(i.isLoggedIn()||i.isSoftLoggedIn()){PubSub.publish(mcWeb.customerRegistration.onRememberedUserNotMe,null);var n=new WebApiService("CustomerRegistration");n.GetAction("ChangeSessionToDefaultCustomer").done(function(){window.location.reload()})}else r(!0)};this.onClickCheckEmail=function(n,t){return(i.showErrorLogin(!1),t.keyCode===13||t.type==="click")?(i.email()!==null&&i.email().length>0?r():(u(!1),i.showErrorLogin(!0)),!1):!0};h=function(){var h,c;try{var t=i.psw(),r=t===o,f=window.StorageService.localStorage.getItem("id"),s=f!==null&&r?f:t;if(s===null||t===o){u();PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);n("#error-msg-login").show();return}i.showPswBtn(!1);i.showPswSpin(!0);h={username:i.email(),password:s,localstorge:r,allowasynclogin:!1,isCheckout:i.isCheckout(),IsNormalMode:i.email().indexOf("@multicase.no")>0};c=new WebApiService("Login");c.PostAction("Login",h).done(function(n){var t,r,f,o;return i.showPswSpin(!1),n.Success===!0?(t=!0,r=window.StorageService.localStorage.getItem("remember"),r!==null&&r==="true"&&(f=mcWeb.currentUser.getUser(),f!==null&&f===n.User&&(window.StorageService.localStorage.setItem("id",n.Id),t=!1)),t&&(window.StorageService.localStorage.removeItem("id"),window.StorageService.localStorage.removeItem("remember")),o={email:i.email(),zipCode:null,isCheckout:i.isCheckout(),authenticationGuid:n.AuthenticatedUserGuid},PubSub.publish(mcWeb.cart.events.onChangedCart,null),i.service.PostAction("IsRegistered",o).done(function(n){PubSub.publish(mcWeb.login.events.onIsloggedIn,!0);PubSub.publish(mcWeb.payments.events.reloadPayments,null);e(n)})):(i.showPswSpin(!1),i.showPswBtn(!0),u(!1),i.showErrorLogin(!0)),!1})}catch(l){alert("Exception: "+l)}};this.onClickLogin=function(n,t){return(i.showErrorLogin(!1),t.keyCode===13||t.type==="click")?(i.psw()!==null&&i.psw().length>4?h():i.showErrorLogin(!0),!1):!0};this.setLoginFocus=function(n){if(n)i.isPswSelected(!1),i.isEmailSelected(!0);else{var t=i.email()!==null&&i.email().length>0;i.isPswSelected(t);i.isEmailSelected(!t)}};PubSub.subscribe(mcWeb.cart.events.hasCartItems,function(n,t){t===!0&&(PubSub.publish(mcWeb.customerRegistration.events.onChangedCustomerData,null),PubSub.publish(mcWeb.cart.events.focusDiscoutCode))});PubSub.subscribe(mcWeb.customerRegistration.onRememberedUserNotMe,function(){u(!0);i.email("")});PubSub.subscribe(mcWeb.loginCheckout.events.onShowLoginEmail,function(t,r){i.isLoggedIn(!1);i.showCustomerRegistration(!1);n("#payments-tab-nav").slideUp(800);i.showSearchBtn(!0);PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,r)});PubSub.subscribe(mcWeb.loginCheckout.events.onShowLoginPassword,function(t,r){i.isLoggedIn(!1);i.showCustomerRegistration(!1);n("#payments-tab-nav").slideUp(800);i.showPswPanel(!0);i.showPswBtn(!0);mcWeb.responsive.getScreenSize()!=="xs"&&n("#checkout-email").focus();s();PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,r)});PubSub.subscribe(mcWeb.loginCheckout.events.onShowHideLogin,function(t,r){if(r!==null?i.paymentId(r):r=i.paymentId(),i.isLoggedIn()||i.showCustomerRegistration()||i.isSoftLoggedIn()&&!i.checkoutRequirePassword&&!i.forceLogin()){var u=n("#payments-tab-nav");u.slideDown(800);n("#checkout-login").fadeOut("slow",function(){n(".registration-type").hide();n(".payment-title").slideDown("slow",function(){n(".registration-type").fadeIn(400);n(".klarna-konto").fadeIn(400);n(".santander-partpayment").fadeIn(400);n(".santander-invoice").fadeIn(400);n(".sveawebpay").fadeIn(400);n(".gothia").fadeIn(400);n("#OrgnrSsn").fadeIn(400);n(".tab-content").removeClass("tab-radius");var t=!0;r===f&&(t=!1);PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:t,disabledBtn:!1});n(".checkout").removeClass("l-out").addClass("l-in");r!==f&&setTimeout(function(){n("#customer-registration").fadeIn();n("#registrationFieldContainer").fadeIn();n(".checkout .customer-registration .requiredMsg").fadeIn()},400);i.isLoggedIn()||(PubSub.publish(mcWeb.payments.events.focusFirstName),PubSub.publish(mcWeb.payments.events.processPaymentMethods,r))})});return}r!==null&&(n(".payment-title").slideUp("slow"),n(".registration-type").fadeOut("slow"),n(".klarna-konto").fadeOut("slow"),n(".santander-partpayment").fadeOut("slow"),n(".santander-invoice").fadeOut("slow"),n(".sveawebpay").fadeOut("slow"),n(".gothia").fadeOut("slow"),n("#customer-registration").fadeOut("slow"),n("#OrgnrSsn").fadeOut("slow",function(){n(".tab-content").addClass("tab-radius");r!==f&&(n("#mcweb-logincheckout-login-checkout").detach().appendTo("#"+r),n("#checkout-login").fadeIn("slow"));n(".checkout").removeClass("l-in").addClass("l-out");PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!0,disabledBtn:!0});i.setLoginFocus()}))});PubSub.subscribe(mcWeb.payments.events.onSelectedPayment,function(n,t){t!==null&&i.paymentId(t)});PubSub.subscribe(mcWeb.login.events.onIsloggedIn,function(n,t){i.isLoggedIn(t)});PubSub.subscribe(mcWeb.loginCheckout.events.onChangedEmail,function(n,t){if(!(t.length<3)){var u=i.registration.getJsonData();(u===null||u.epost===null||u.epost!==t)&&(i.email(t),r())}})};this.getEmail=function(){var n=mcWeb.loginCheckout.instances["login-checkout"];return n.email()};this.ResetLoginCheckoutPosision=function(){n(".cart-login #mcweb-logincheckout-login-checkout").length<1&&(n("#checkout-login").hide(),n("#mcweb-logincheckout-login-checkout").detach().appendTo(".cart-login"))}};mcWeb.payments=new function(){};mcWeb.payments.events={onShowUpdateIcon:"mcWeb.payments.onShowUpdateIcon",onHideUpdateIcon:"mcWeb.payments.onHideUpdateIcon",reloadPayments:"mcWeb.payments.reloadPayments",focusFirstName:"mcWeb.payments.paymentsfocusFirstName",updateOrgNr:"mcWeb.payments.updateOrgNr",processPaymentMethods:"mcWeb.payments.processPaymentMethods",onSelectedPayment:"mcWeb.payments.onSelectedPayment",updateKco:"mcWeb.payments.events.updateKco"};mcWeb.payments=jQuery.extend(mcWeb.payments,new function(){this.vm=function(n){var f=96,h=97,r=167,s=128,c=107,l=95,u=183,i,t,e,o;this.netsEasyCheckout=null;i=jQuery;t=this;this.id="#"+n;this.settings=null;t.isPublishMode=!1;e=i("body.publish-mode");e!==undefined&&e!==null&&e.length>0&&(t.isPublishMode=!0);t.cartName=null;t.cartGuid=null;t.service=new WebApiService("Payment");t.waitCheckoutSnippet=!1;t.langService=new LanguageService;t.conditionsVM=null;t.cancelEnter=function(){if(event.keyCode===13)event.preventDefault();else return!0};this.load=function(n,i){var e,o,s,h,f;if(PubSub.publish(mcWeb.payments.events.onShowUpdateIcon,null),i!==null&&i&&(t.settings=i),n===null||!n){t.service.GetAction("GetPaymentList",null).done(function(n){t.load(n)});return}if(t.CustomerCountryId=t.settings.CustomerCountryId,t.KlarnaLandId=t.settings.KlarnaLandId,t.KlarnaVersion=t.settings.KlarnaVersion,t.registration.registrationVM.readOnly()===!0)if(e=!1,t.registration.registrationVM.hideExperianBetBet()){if(o=-1,n.PaymentTypes!==null)for(f=0;f<n.PaymentTypes.length;f++)n.PaymentTypes[f].PaymentId===t.registration.registrationVM.experianBetBetId()&&(o=f);o!==-1&&(n.PaymentTypes.splice(o,1),e=!0)}else t.registration.registrationVM.hideOrgnrSsn()&&(t.ShowOrgnrSsn(!1),t.ShowOrgnrSsnField(0));if(t.PaymentTypes(n.PaymentTypes),t.GetKlarnaJson(n.PaymentTypes),t.KlarnaCustomerType(n.CustomerType),t.CustomerType(n.CustomerType),t.addBindings(),t.isLoggedIn(n.IsLoggedIn),t.BirthDate(n.BirthDate),s=!1,h=!1,n.PaymentTypes!==null)for(f=0;f<n.PaymentTypes.length;f++)n.PaymentTypes[f].PaymentId===r&&(h=!0),n.PaymentTypes[f].PaymentId===u&&(h=!0),e===!0&&(t.selectPaymentType(n.PaymentTypes[f]),s=!0,e=!1),n.PaymentTypes[f].PaymentId===n.SelectedId&&(t.selectPaymentType(n.PaymentTypes[f]),t.loadCustomerForm(n.PaymentTypes[f].PaymentId,h),s=!0);s===!1&&console.log("Advarsel: Ingen betalingsmåter er aktivert for denne kunden!");PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null)};this.highlightRequiredConditions=function(){t.conditionsVM&&t.conditionsVM.highlightRequired("checkoutconditions")};this.getTemplateNameKonto=function(){if(t.selectedKlarnaKontoCampaign())return t.selectedKlarnaKontoCampaign().name==="Account"?t.KlarnaLandId===2?"klarna-konto-account-details-se":"klarna-konto-account-details-no":t.selectedKlarnaKontoCampaign().name==="Part Payment"?t.KlarnaLandId===2?"klarna-konto-partPayment-details-se":"klarna-konto-partPayment-details-no":""};this.getTemplateNameFaktura=function(){if(t.selectedKlarnaFakturaCampaign()&&t.selectedKlarnaFakturaCampaign().pclass_id!==-1){if(t.KlarnaLandId===1)return"klarna-faktura-campaign-details-no";if(t.KlarnaLandId===2)return"klarna-faktura-campaign-details-se"}return"klarna-faktura-details-no"};this.addBindings=function(){i(document).on("shown.bs.tab",'a[href="#97"]',function(){})};this.registration=mcWeb.customerRegistration.instances["checkout-registration"];this.hasCartItems=ko.observable(!1);this.functionalConditionsAccepted=ko.observable(!0);this.showPayments=ko.computed(function(){return t.hasCartItems()},this);this.PaymentTypes=ko.observableArray();this.selectedPaymentOld=ko.observable();this.selectedPayment=ko.observable();this.selectedPayment.subscribe(function(n){t.selectedPaymentOld()!==n&&(t.selectedPaymentOld(n),t.selectedPayment(n),PubSub.publish(mcWeb.payments.events.onSelectedPayment,n))});this.KlarnaCampaigns=ko.observableArray();this.Fodselsnummer=ko.observable();this.RegisteredZip=ko.observable();this.BirthDate=ko.observable();this.BirthDate.subscribe(function(n){n!==null&&n.length>0&&(n=n.replace(/[^\d]/,""),t.BirthDate(n),t.isValidDateddmmyy(n)&&t.service.GetAction("UpdateBirthDate",{date:n}).done(function(n){var t=i(".col-birthdate .genericBirthdate"),r=i(".col-birthdate i");n===!0?(r.addClass("icon-check green"),t.removeClass("validation_error")):(r.removeClass("icon-check green"),t.addClass("validation_error"))}))});this.Orgnr=ko.observable();this.Orgnr.subscribe(function(n){PubSub.publish(mcWeb.payments.events.updateOrgNr,n)});this.selectedKlarnaKontoCampaign=ko.observable();this.selectedKlarnaFakturaCampaign=ko.observable();this.CustomerCountryId=1;this.KlarnaLandId=1;this.GothiaTOS=ko.observable();this.GothiaRequireCustomerConfirmation=ko.observable();this.AcceptedTermsAndConditions=ko.observable();this.ShowOrgnrSsn=ko.observable();this.ShowOrgnrSsnField=ko.observable();this.KlarnaCustomerType=ko.observable();this.CustomerType=ko.observable();this.showRefreshSpin=ko.observable(!1);this.showRefreshSpinMargin=ko.observable(0);this.isLoggedIn=ko.observable(!1);this.SveaWebPayPaymentPlanOptions=ko.observableArray();this.GetSveaWebPayPaymentPlanOptions=ko.observable();this.KlarnaInvoiceFee=ko.observable();this.showRefreshSpin.subscribe(function(){var n=parseFloat(i("#payments.payments").height());n!==NaN&&n>1&&(n=n/2-30,n<5&&(n=5),t.showRefreshSpinMargin(n+"px"))});this.selectedKlarnaPclass=ko.computed(function(){return t.selectedPayment()===f&&t.selectedKlarnaFakturaCampaign()?t.selectedKlarnaFakturaCampaign().pclass_id:t.selectedKlarnaKontoCampaign()&&t.selectedKlarnaKontoCampaign()?t.selectedKlarnaKontoCampaign().pclass_id:void 0});o=!0;PubSub.subscribe(mcWeb.cart.events.hasCartItems,function(n,i){i===!1?(t.hasCartItems(!1),o=!1):o=!0});PubSub.subscribe(mcWeb.customerRegistration.events.onChangedCustomerData,function(n,i){i!==null&&i.isLoggedIn!==null&&t.isLoggedIn(i.isLoggedIn);o===!1?t.hasCartItems(!1):t.hasCartItems(!0);t.RegisterKlarnaListener()});PubSub.subscribe(mcWeb.conditions.events.onAcceptChange,function(n,i){if(i.usageArea===3){var f=t.functionalConditionsAccepted();t.conditionsVM=i.vm;i.functionalConditionIsAccepted===null?t.functionalConditionsAccepted(!0):i.acceptDocuments===null||i.acceptDocuments.length<=0?t.functionalConditionsAccepted(!0):t.functionalConditionsAccepted(i.functionalConditionIsAccepted);t.functionalConditionsAccepted()?(t.selectedPayment()===r||t.selectedPayment()===u)&&(PubSub.publish(mcWeb.payments.events.onShowUpdateIcon,null),f!==t.functionalConditionsAccepted()&&(t.KCOisLoaded()||(t.KCOisLoaded(!0),t.loadCustomerForm(t.selectedPayment(),!0)),t.UpdateCheckoutCartItems()),PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null)):((t.selectedPayment()===r||t.selectedPayment()===u)&&t.highlightRequiredConditions(),t.KCOisLoaded(!1))}});PubSub.subscribe(mcWeb.loginCheckout.events.onShowLoginPassword,function(){t.ShowOrgnrSsn(!1)});this.loadCustomerForm=function(n,e){var l=i("#mcweb-customerregistration-checkout-registration"),s=i(".tab-content"),a=s.height(),h,o,c;s.css("min-height",a+"px");h=null;t.isPublishMode||(h=l.detach());i('#payments-tab-nav a[href="#'+n+'"]').tab("show");t.selectedPayment(n);t.isPublishMode||h.appendTo("#"+n);i("#mcweb-customerregistration-checkout-registration").show();s.animate({"min-height":"250px"},{queue:!1,duration:800});o=i(".checkout");c=i("#payments-tab-nav");e&&(c.show(),o.removeClass("l-out").addClass("l-in"));t.isLoggedIn()||n===r||n===u?(n===r||n===u?(o.removeClass("l-in").addClass("l-out"),PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!1,disabledBtn:!1,showPrice:!1,showSalesConditions:!1})):(o.removeClass("l-out").addClass("l-in"),PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!0,disabledBtn:!1,showPrice:!0,showSalesConditions:!0})),c.show(),i(".payment-title").show(),i(".klarna-konto-content").show(),i(".tab-content").removeClass("tab-radius"),t.processPaymentMethods(n)):(PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!0,disabledBtn:!0,showPrice:!0,showSalesConditions:!0}),o.removeClass("l-out").addClass("l-in"),PubSub.publish(mcWeb.loginCheckout.events.onShowHideLogin,n));n===f&&t.getFakturaGebyr().done(function(n){t.KlarnaInvoiceFee(n)});t.getGothiaAccountTos(n);t.getSveaWebPayPaymentPlanOptions(n);PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null);!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0)};this.KCOisLoaded=ko.observable(!1);this.selectPaymentType=function(n){var i={paymentId:n.PaymentId,paymentText:n.PaymentText};t.service.GetAction("SelectPayment",i).done(function(){PubSub.publish(mcWeb.cart.events.onChangedCart,null)})};this.handlePaymentChange=function(n){PubSub.publish(mcWeb.payments.events.onShowUpdateIcon,null);i(".qtip").qtip("destroy",!0);t.selectedPayment(n.PaymentId);t.selectPaymentType(n);t.loadCustomerForm(n.PaymentId);(n.PaymentId===r||n.PaymentId===u)&&(t.KCOisLoaded(!0),t.functionalConditionsAccepted()||t.highlightRequiredConditions());PubSub.publish(mcWeb.cart.events.onChangedCart,null)};this.getJsonData=function(){var r=t.selectedKlarnaPclass(),n,i,u;return t.selectedPayment()===s&&(r=t.SveaWebPaySelectedPaymentPlanOptions),n=t.Orgnr(),t.selectedPayment()===l&&(n=t.Fodselsnummer()),i="undefined",t.ShowOrgnrSsn()&&(i=t.BirthDate()),u={SocialSecurityNumber:t.Fodselsnummer(),CampaignCode:r,AcceptCreditCheck:t.AcceptedTermsAndConditions(),OrgNumber:n,Birthdate:i,RegisteredPostCode:t.RegisteredZip()},{selectedPayment:t.selectedPayment(),paymentDetails:u}};this.indexOfKlarnaFaktura=function(){if(t.KlarnaCampaigns()!==null&&typeof t.KlarnaCampaigns()!="undefined")for(var n=0;n<t.KlarnaCampaigns().length;n++)if(t.KlarnaCampaigns()[n].group.code==="invoice")return n;return 0};this.indexOfFirstKlarnaKonto=function(){if(t.KlarnaCampaigns()!==null&&typeof t.KlarnaCampaigns()!="undefined")for(var n=0;n<t.KlarnaCampaigns().length;n++)if(t.KlarnaCampaigns()[n].group.code==="part_payment")return n;return 0};this.GetKlarnaJson=function(n){var r=!1,i;if(n!==null){for(i=0;i<n.length;i++)(n[i].PaymentId===f||n[i].PaymentId===h)&&(r=!0);r&&(PubSub.publish(mcWeb.payments.events.onShowUpdateIcon,null),t.service.GetAction("GetKlarnaCampaigns",null).done(function(n){var i,r,u;(PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null),n===null||n.length<1)||(i=JSON.parse(n),t.KlarnaCampaigns(i.payment_methods),r=t.KlarnaCampaigns()===null||typeof t.KlarnaCampaigns()=="undefined"?0:t.KlarnaCampaigns()[t.indexOfKlarnaFaktura()],t.selectedKlarnaFakturaCampaign(r),u=t.KlarnaCampaigns()===null||typeof t.KlarnaCampaigns()=="undefined"?0:t.KlarnaCampaigns()[t.indexOfFirstKlarnaKonto()],t.selectedKlarnaKontoCampaign(u))}))}};this.validateSveaWebPay=function(n){var u=n.selectedPayment(),r;if(t.CustomerType()==="bedriftskunde")if(r=t.findClass(u,"SveaWebPay_OrgNo","input"),n.isOrgnrValid(i(".SveaWebPay_OrgNo"),!1))mcWeb.validation.setValidCss(r);else return{IsValid:!1,ResName:"OrgnummerError",Element:r};else if(r=t.findClass(u,"SveaWebPay_PersonalId","input"),n.isFodselsnummerValid(i(".SveaWebPay_PersonalId"),!1))mcWeb.validation.setValidCss(r);else return{IsValid:!1,ResName:"FodselsnummerError",Element:r};return{IsValid:!0,ResName:"",Element:r}};this.findClass=function(n,t,r){try{var u=i("div[id="+n+"]"),f=r+"[class*='"+t+"']";return u.find(f)}catch(o){return null}};this.getSveaWebPayPaymentPlanOptions=function(n){n===s&&(PubSub.publish(mcWeb.payments.events.onShowUpdateIcon,null),t.service.GetAction("GetSveaWebPayPaymentPlanOptions",null).done(function(n){PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null);t.SveaWebPayPaymentPlanOptions(JSON.parse(n))}))};this.getGothiaAccountTos=function(n){n===c&&(PubSub.publish(mcWeb.payments.events.onShowUpdateIcon,null),t.service.GetAction("GetAccountTermsAndConditions",null).done(function(n){PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null);t.GothiaTOS(n.TermsAndConditions);t.GothiaRequireCustomerConfirmation(n.RequireCustomerConfirmation)}))};this.gothiaShowTermsAndConditions=function(){var n=window.open("","gothiaTos","height=600,width=730,location=0,menubar=0");n.document.write(t.GothiaTOS());n.document.close()};this.getFakturaGebyr=function(){return t.service.GetAction("GetFakturaGebyr",null)};this.isFodselsnummerValid=function(n,i){var r=null;return(i?t.KlarnaLandId===1?r=/^[0-9]{2}[0,1][0-9][0-9]{2}[ ]?[0-9]{5}$/:t.KlarnaLandId===2?r=/^([0-9]{2})?[0-9]{2}[0-1][0-9][0-9]{2}[-+]?[0-9]{4}$/:t.KlarnaLandId===3&&(r=/^[0-9]{2}[0,1][0-9][0-9]{2}[0-9]{4}$/):t.CustomerCountryId===1?r=/^[0-9]{2}[0,1][0-9][0-9]{2}[ ]?[0-9]{5}$/:t.CustomerCountryId===2?r=/^([0-9]{2})?[0-9]{2}[0-1][0-9][0-9]{2}[-+]?[0-9]{4}$/:t.CustomerCountryId===3?r=/^[0-9]{2}[0,1][0-9][0-9]{2}[0-9]{4}$/:t.CustomerCountryId===4&&(r=/^[0-9]{2}\.?[0,1][0-9]\.?[0-9]{2}[-+A][0-9]{3}[0-9A-Z]{1}$/),r===null)?!0:r.test(n.val())};this.isZipCodeValid=function(n){return n.val().length<=0?!1:!0};this.isZipCodeValidFormat=function(n){var t=n.val();return t.match(/^\d{4}$/)!==null?!0:!1};this.isPhoneValidFormat=function(n){var t=n.val();return t.match(/^\d{8}$/)!==null?!0:!1};this.isValidDateddmmyy=function(n){return n.match(/\d{2}\d{2}\d{2}/)!==null?!0:!1};this.isOrgnrValid=function(n,i){var r=null;return(i?t.KlarnaLandId===1?r=/^(\d{9})$|((\d{3})\s(\d{3})\s(\d{3}))$/:t.KlarnaLandId===2&&(r=/^(\d{10})$|(\d{6}[-]\d{4})$/):t.CustomerCountryId===1?r=/^(\d{9})$|((\d{3})\s(\d{3})\s(\d{3}))$/:t.CustomerCountryId===2&&(r=/^(\d{10})$|(\d{6}[-]\d{4})$/),r===null)?!0:r.test(n.val())};this.isBirthdateValid=function(n){var i=!1,r=n.val();return r.length>0&&t.isValidDateddmmyy(r)&&(i=!0),i};this.showKlarnaTerms=function(){var n="";n+=t.selectedPayment()===f&&t.selectedKlarnaFakturaCampaign().group.code==="invoice"?t.selectedKlarnaFakturaCampaign().terms.uri+t.KlarnaInvoiceFee():t.selectedKlarnaKontoCampaign().terms.uri;window.open(n,"Klarna terms","width=500,height=500,location=0,toolbar=0,titlebar=0,status=0,menubar=0")};this.selectFirstInList=function(){i("input:radio").filter(":visible:first").attr("checked",!0)};this.GetCheckoutSnippet=function(n){n===r||n===u?t.GetCheckout(n):(i("#customer-registration").show(),PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!0,disabledBtn:!1,showPrice:!1}))};this.GetCheckout=function(n){var f,e;if(i("#customer-registration").hide(),i("#nets-easy-checkout-error").hide(),n===r&&console.log("GetCheckout Klarna v"+t.KlarnaVersion),t.cartGuid===null||t.cartName===null){t.waitCheckoutSnippet=!0;return}t.waitCheckoutSnippet=!1;PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!1,disabledBtn:!1,showPrice:!1});f=this.registration.getJsonData();typeof f.epost!="undefined"&&f.epost.length>0&&(f.epost=f.epost.trim());e={customer:f,cartGuid:t.cartGuid,cartName:t.cartName,paymentId:n};t.service.GetAction("GetCheckoutSnippet",e).done(function(f){if(f===null||f.length<1){n===u&&i("#nets-easy-checkout-error").show();console.log("Kunne ikke laste Checkout");return}n===r?t.SetKlarnaCheckout(f):n===u&&t.SetNetsEasyCheckout(f)})};this.SetNetsEasyCheckout=function(n){try{var r={checkoutKey:"test-checkout-key-0c85629baff245beac577f6ba8e3def2",paymentId:n,containerId:"nets-easy-checkout-snippet"};i("#nets-easy-checkout-snippet").html("");t.netsEasyCheckout=new Dibs.Checkout(r);t.RegisterNetsEasyCallback(t.netsEasyCheckout)}catch(u){console.log("Warning - PaymentView.js:SetNetsEasyCheckout. Exception: "+u)}};this.RegisterNetsEasyCallback=function(n){n.on("payment-completed",function(n){alert("Response: "+n)});n.on("address-changed",function(n){if(n&&n.postalCode!==null&&n.postalCode.length>1)if(n.postalCode.indexOf("*")===-1){var t=n.postalCode;PubSub.publish(mcWeb.customerRegistration.events.onChangedZipCode,t)}else n.postalCode=""})};this.SetKlarnaCheckout=function(n){i("#klarna-checkout-snippet").html(n);t.RegisterKlarnaListener()};this.SuspendKlarnaCheckout=function(){try{typeof _klarnaCheckout!="undefined"&&window._klarnaCheckout(function(n){n.suspend()})}catch(n){console.log("Warning - PaymentView.js:SuspendKlarnaCheckout. Exception: "+n)}};this.ResumeKlarnaCheckout=function(){try{typeof _klarnaCheckout!="undefined"&&window._klarnaCheckout(function(n){n.resume()})}catch(n){console.log("Warning - PaymentView.js:ResumeKlarnaCheckout. Exception: "+n)}};PubSub.subscribe(mcWeb.payments.events.onShowUpdateIcon,function(){t.showRefreshSpin(!0)});PubSub.subscribe(mcWeb.payments.events.onHideUpdateIcon,function(){t.showRefreshSpin(!1)});this.IsKcoEnabled=function(){var i,n;try{if(t.PaymentTypes()===null)return!1;for(i=!1,n=0;n<t.PaymentTypes().length;n++)t.PaymentTypes()[n].PaymentId===r&&(i=!0);return i}catch(u){return console.log("Warning - PaymentView.js:kcoEnabled. Exception: "+u),!1}};this.UpdateCheckoutZipCode=function(n){var i,u,f;try{if(i=t.selectedPayment(),i===r){if(t.KlarnaVersion===3)return;if(t.KlarnaLandId===1&&n.length!==4)return;if(u=t.IsKcoEnabled(),!u)return;t.SuspendKlarnaCheckout()}f={paymentId:i,zipCode:n};t.service.GetAction("UpdateCheckoutZipCode",f).done(function(){i===r&&t.ResumeKlarnaCheckout();t.netsEasyCheckout!==null})}catch(e){console.log("Warning - PaymentView.js:UpdateCheckoutZipCode. Exception: "+e)}};this.UpdateCheckoutCartItems=function(){if(t.selectedPayment()===r||t.selectedPayment()===u){t.SuspendKlarnaCheckout();i("#klarna-checkout-snippet-error").hide();var n={paymentId:t.selectedPayment()};t.service.GetAction("UpdateCheckoutCartItems",n).done(function(n){if(n===null||n.length<1){t.ResumeKlarnaCheckout();return}t.ResumeKlarnaCheckout();t.selectedPayment()===r&&(n.Success||(i("#klarna-checkout-snippet").hide(),i("#klarna-checkout-snippet-error").show()),i("#klarna-checkout-snippet").show(),i("#klarna-checkout-snippet-error").hide());t.selectedPayment()===u&&(n.Success?(console.log("PaymentId="+n.Payload+", OrderAmount="+n.OrderAmount/100),t.SetNetsEasyCheckout(n.Payload)):console.log("Nets Easy failed..."))})}};this.RegisterKlarnaListener=function(){try{if(t.selectedPayment()!==r)return;typeof _klarnaCheckout!="undefined"&&(console.log("RegisterKlarnaListener 'change'"),window._klarnaCheckout(function(n){n.on({change:function(n){if(n!==null&&n.email!==null&&typeof n.email!="undefined"&&n.email.length>3&&PubSub.publish(mcWeb.loginCheckout.events.onChangedEmail,n.email),n!==null&&n.postal_code!==null&&n.postal_code.length>1)if(console.log(n.postal_code),n.postal_code.indexOf("*")===-1){var t=n.postal_code;PubSub.publish(mcWeb.customerRegistration.events.onChangedZipCode,t)}else n.postal_code=""}})}))}catch(n){console.log("Warning - PaymentView.js:RegisterKlarnaListener. window._klarnaCheckout Exception: "+n)}};this.zipCodePrev=ko.observable();this.zipCode=ko.observable();this.showOrgnrSsn=function(n){var i={paymentId:n};t.registration.registrationVM.readOnly()===!0&&t.registration.registrationVM.hideOrgnrSsn()?t.ShowOrgnrSsn(!1):t.service.GetAction("ShowOrgnrSsn",i).done(function(n){n.Show===!0&&n.FieldToShow!==0?(t.ShowOrgnrSsn(n.Show),t.ShowOrgnrSsnField(n.FieldToShow),t.CustomerType(n.CustomerType)):t.ShowOrgnrSsn(!1)})};PubSub.subscribe(mcWeb.customerRegistration.events.onChangedZipCode,function(n,i){i&&t.zipCode()!==i&&(t.zipCodePrev(i),t.zipCode(i),t.UpdateCheckoutZipCode(i))});PubSub.subscribe(mcWeb.payments.events.updateKco,function(){t.UpdateCheckoutCartItems();PubSub.publish(mcWeb.payments.events.reloadPayments,null)});PubSub.subscribe(mcWeb.campaignCode.onChangedCampaignCode,function(){t.UpdateCheckoutCartItems();PubSub.publish(mcWeb.payments.events.reloadPayments,null)});PubSub.subscribe(mcWeb.cart.events.onChangedCart,function(){t.UpdateCheckoutCartItems()});PubSub.subscribe(mcWeb.cart.events.onChangedQuantityCart,function(){t.UpdateCheckoutCartItems();PubSub.publish(mcWeb.payments.events.reloadPayments,null)});PubSub.subscribe(mcWeb.shipment.events.onSelectedShipment,function(){PubSub.publish(mcWeb.payments.events.reloadPayments,null)});PubSub.subscribe(mcWeb.shipment.events.onChangedShipment,function(){t.UpdateCheckoutCartItems()});PubSub.subscribe(mcWeb.payments.events.reloadPayments,function(){mcWeb.loginCheckout.ResetLoginCheckoutPosision();t.isPublishMode||i("#mcweb-customerregistration-checkout-registration").hide().detach().appendTo("body");t.load(null)});PubSub.subscribe(mcWeb.payments.events.focusFirstName,function(){mcWeb.responsive.getScreenSize()!=="xs"&&setTimeout(function(){if(t.ShowOrgnrSsn())switch(t.ShowOrgnrSsnField()){case 1:i("div[id="+t.selectedPayment()+"]").find("input[class*='genericOrgnr']").focus();break;case 2:i("div[id="+t.selectedPayment()+"]").find("input[class*='genericSsn']").focus();break;case 3:i("div[id="+t.selectedPayment()+"]").find("input[class*='genericBirthdate']").focus()}else i("#firstName").focus()},400)});PubSub.subscribe(mcWeb.login.events.onIsloggedIn,function(n,i){t.isLoggedIn(i)});PubSub.subscribe(mcWeb.payments.events.processPaymentMethods,function(n,i){t.processPaymentMethods(i)});this.processPaymentMethods=function(n){if(n===null){n=t.selectedPayment();return}t.showOrgnrSsn(n);t.GetCheckoutSnippet(n)};PubSub.subscribe(mcWeb.payments.events.updateOrgNr,function(n,i){t.Orgnr(i);PubSub.publish(mcWeb.customerRegistration.events.updateOrgNr,i)});PubSub.subscribe(mcWeb.cart.events.cartGuid,function(n,i){i!==null&&(t.cartName=i.cartName,t.cartGuid=i.cartGuid,t.cartGuid!==null&&t.cartName!==null&&t.waitCheckoutSnippet===!0&&t.GetCheckoutSnippet(t.selectedPayment()))});this.validate=function(){return vm.validateModel().then(function(n){var t={success:!1,message:"",invalidElements:[]};return vm.lastValidationResult=n,n.every(mcWeb.validation.elementIsValid)?vm.settings.SoftAdressValidation&&!vm.adress()&&vm.addressWarningFlag===0?(t.message="Adresse feltet er tomt.<br/> Fortsett med registrering om du ikke har gateadresse!",vm.addressWarningFlag=1):t.success=!0:(n.forEach(function(n){n.valid||t.invalidElements.push(n)}),t.message=i("#validation-error-text").html()),t})};this.validateModel=function(){i(".qtip").remove();var n,t=mcWeb.validation.validateModel(vm.validationRules);return t.then(function(t){for(n=0;n<t.length;n++)if(t[n].valid){mcWeb.validation.setValidCss(t[n].elem);continue}else{mcWeb.validation.removeValidCss(t[n].elem);mcWeb.validation.addErrorClass(t[n].elem);mcWeb.validation.qTipActionShow(t[n].elem,vm.getErrorMessage(t[n].elem,t[n].rule));break}return t})};this.validateElement=function(n,t){mcWeb.validation.validateElement(vm.validationRules,t.target).done(function(n){n.valid?mcWeb.validation.setValidCss(t.target):mcWeb.validation.removeValidCss(t.target)})}}});mcWeb.receipt=new function(){this.events={};this.vm=function(n){var i=jQuery,t=this;this.id="#"+n;this.langService=new LanguageService;this.expressCustomer=ko.observable(!1);this.showCheckoutConfirmation=ko.observable(!1);this.showReceiptInformation=ko.observable(!0);this.showSantanderApproved=ko.observable(!1);this.showSantanderManual=ko.observable(!1);this.santanderIdentUrl=ko.observable();this.showSantanderPayeverApproved=ko.observable(!1);this.showSantanderPayeverManual=ko.observable(!1);this.load=function(n){n.ExpressCustomer&&t.expressCustomer(!0);t.showCheckoutConfirmation(!1);t.GetCheckoutConfirmationSnippet();t.showSantanderApproved(!1);t.showSantanderManual(!1);t.santanderIdentUrl("");t.GetSantanderApplicationResult();t.showSantanderPayeverApproved(!1);t.showSantanderPayeverManual(!1);t.GetSantanderPayeverApplicationResult()};this.GetSantanderPayeverApplicationResult=function(){var n=new WebApiService("Payment");n.GetAction("GetSantanderPayeverApplicationResult",null).done(function(n){var r,i;n==null||n.length<1||(r=n.CurrentPaymentMethod,r==="SantanderPayever")&&(i=JSON.parse(n.ExtraInfoJson),i.Status=="APPROVED"?(t.showSantanderPayeverApproved(!0),t.showReceiptInformation(!1)):i.Status=="MANUAL"&&(t.showSantanderPayeverManual(!0),t.showReceiptInformation(!1)))})};this.GetSantanderApplicationResult=function(){var n=new WebApiService("Payment");n.GetAction("GetSantanderApplicationResult",null).done(function(n){var r,i;n==null||n.length<1||(r=n.CurrentPaymentMethod,r==="Santander")&&(i=JSON.parse(n.ExtraInfoJson),t.santanderIdentUrl(i.UrlIdentificationGEMB),i.UrlIdentificationGEMB===""&&t.santanderIdentUrl(i.ApplicantSignReferenceUrl),i.Status=="APPROVED"?(t.showSantanderApproved(!0),t.showReceiptInformation(!1)):i.Status=="MANUAL"&&(t.showSantanderManual(!0),t.showReceiptInformation(!1)))})};this.GetCheckoutConfirmationSnippet=function(){var n=new WebApiService("Payment");n.GetAction("GetCheckoutConfirmationSnippet",null).done(function(n){n===null||n.length<1||n.Snippet.length===0||(n.UseSoftlog&&n.CustomerEmail!==mcWeb.currentUser.getUser()&&mcWeb.currentUser.setUser(n.CustomerEmail),t.showCheckoutConfirmation(!0),i("#klarna-confirmation-snippet").html(n.Snippet))})}}};mcWeb.salesConditions=new function(){this.events={};this.vm=function(n){var t=this;this.id="#"+n;t.hasCartItems=ko.observable(!1);t.showConditons=ko.observable(!1);this.load=function(){};this.onClickConditions=function(){t.showConditons(!t.showConditons())};PubSub.subscribe(mcWeb.cart.events.hasCartItems,function(n,i){i!=null&&t.hasCartItems(i)})}};mcWeb.shipment=new function(){};mcWeb.shipment.events={reloadShipment:"mcWeb.shipment.reloadShipment",onChangedShipment:"mcWeb.shipment.onChangedShipment",onSelectedShipment:"mcWeb.shipment.onSelectedShipment",onSelectedShipmentForCustomerRefresh:"mcWeb.shipment.onSelectedShipmentForCustomerRefresh"};mcWeb.shipment=jQuery.extend(mcWeb.shipment,new function(){this.vm=function(n){var i=jQuery,t=this,r;t.id="#"+n;t.service=new WebApiService("Shipment");t.showShipments=ko.observable(!1);t.hasCartItems=ko.observable(!1);t.showShipmentPrice=ko.observable(!1);t.showOnlyCarrierList=ko.observable();t.showCheckoutZipCode=ko.observable(!0);t.selectedCarrierName=ko.observable();t.carrierList=ko.observableArray();t.selectedCarrierId=ko.observable();t.selectedCarrierPrice=ko.observable();t.pickupPointEnabled=ko.observable(!1);t.pickupPointRegionList=ko.observableArray();t.pickupPointCustomerList=ko.observableArray();t.pickupPointSelectedRegion=ko.observable();t.pickupPointSelectedCustomer=ko.observable();t.pickupPointRegion=ko.observable();t.pickupPointRegionId=ko.observable();t.pickupPointCustomername=ko.observable();t.popoverOpen=ko.observable(!1);t.zipCodePrev=ko.observable();t.zipCode=ko.observable();t.focusZipCode=ko.observable(!1);t.postOffice=ko.observable();t.adressDelivery=ko.observable();t.adresstillegDelivery=ko.observable();t.poststedDelivery=ko.observable();t.showRefreshSpin=ko.observable(!1);t.showRefreshSpinMargin=ko.observable(0);t.isCheckout=ko.observable(!1);t.inlineEditor=ko.observable(!1);t.showCollectedDelivery=ko.observable(!1);t.useCollectedDeliveryPrev=ko.observable(!1);t.useCollectedDelivery=ko.observable(!1);t.useCollectedDelivery.subscribe(function(n){t.useCollectedDeliveryPrev()!=n&&(t.useCollectedDeliveryPrev(n),PubSub.publish(mcWeb.cart.events.onChangeCollectedDelivery,n))});t.showInsuranceProduct=ko.observable(!1);t.useInsuranceProduct=ko.observable(!1);t.showPrintPackingList=ko.observable(!1);t.usePrintPackingListPrev=ko.observable(!1);t.usePrintPackingList=ko.observable(!1);t.usePrintPackingList.subscribe(function(n){t.usePrintPackingListPrev()!==n&&PubSub.publish(mcWeb.customerRegistration.events.onChangedUsePrintPackingList,n)});PubSub.subscribe(mcWeb.customerRegistration.events.onChangedUsePrintPackingList,function(n,i){(i===!0||i===!1)&&(t.usePrintPackingList()!==i?t.usePrintPackingList(i):t.usePrintPackingListPrev(i))});this.showRefreshSpin.subscribe(function(){var n=parseFloat(i("#carrier-selected.panel").height());n!=NaN&&n>1&&t.showRefreshSpinMargin(n/2-30+"px")});this.load=function(n,u){if(t.showRefreshSpin(!0),u&&(t.showShipments(u.ShowShipments),t.showShipmentPrice(u.ShowShipmentPrice),t.showOnlyCarrierList(u.ShowOnlyCarrierList),t.showCheckoutZipCode(u.ShowCheckoutZipCode),t.isCheckout(i(".body-checkout").length>0?!0:!1),t.showCollectedDelivery(u.ShowCollectedDelivery),t.showPrintPackingList(u.ShowPrintPackingList),t.showInsuranceProduct(u.ShowInsuranceProduct),t.inlineEditor(u.InlineEditor)),!n){t.service.GetAction("CarrierList",{isCheckout:t.isCheckout()}).done(function(n){if(n==null){t.showRefreshSpin(!1);return}t.load(n)});return}t.pickupPointEnabled(n.PickupPointEnabled);t.carrierList(n.CarrierList);t.selectedCarrierId(n.SelectedCarrierId);r(n);t.zipCode()==null&&t.zipCodePrev()==null&&(t.zipCodePrev(n.ZipCode),t.zipCode(n.ZipCode));t.useCollectedDeliveryPrev(n.UseCollectedDelivery);t.useCollectedDelivery(n.UseCollectedDelivery);t.useInsuranceProduct(n.UseInsuranceProduct);t.usePrintPackingList(n.UsePrintPackingList);t.usePrintPackingListPrev(n.UsePrintPackingList);t.showRefreshSpin(!1);PubSub.publish(mcWeb.shipment.events.onChangedShipment,n)};this.useInsuranceProduct.subscribe(function(n){if(!t.showInsuranceProduct())return!0;t.showRefreshSpin(!0);var i={addProduct:n};return t.service.GetAction("SetInsuranceProduct",i).done(function(n){(t.showRefreshSpin(!1),n==null||n.length<1)||PubSub.publish(mcWeb.cart.events.onChangedCart,"")}),!0});this.getPickupPointRegions=function(){return t.pickupPointEnabled()?(t.showRefreshSpin(!0),t.service.GetAction("GetPickupPointRegions",null).done(function(n){(t.showRefreshSpin(!1),n==null||n.length<1)||(t.pickupPointRegionList(n),t.pickupPointRegion(t.pickupPointRegionList()[0].Region),t.pickupPointRegionId(t.pickupPointRegionList()[0].RegionId),n.length===1&&t.pickupPointSelectedRegion(t.pickupPointRegionId()))}),!0):!0};this.pickupPointSelectedRegion.subscribe(function(n){if(n==null||n===""||t.selectedCarrierId==null)return!1;t.showRefreshSpin(!0);var i={regionId:n};return t.service.GetAction("GetPickupPointCustomers",i).done(function(n){(t.showRefreshSpin(!1),n==null||n.length<1)||(t.pickupPointCustomerList(n),t.pickupPointCustomername(t.pickupPointCustomerList()[0].Customername))}),!0});this.saveSelectedPickupPointCustomer=function(n,i,r){if(n==null||i==null||r==null)return!1;var u={customerId:n,customerName:i,customerEmail:r};return t.showRefreshSpin(!0),t.service.GetAction("SaveSelectedPickupPointCustomer",u).done(function(){t.showRefreshSpin(!1)}),!0};this.pickupPointSelectedCustomer.subscribe(function(n){if(n==null||t.selectedCarrierId==null)return!1;var i="",r="";return n.Customername!=null&&(i=n.Customername.trim()),n.EmailAddress!=null&&(r=n.EmailAddress.trim()),t.saveSelectedPickupPointCustomer(n.CustomerId,i,r),!0});r=function(n){jQuery.each(n.CarrierList,function(i,r){r.Id==n.SelectedCarrierId&&(t.selectedCarrierName(r.Name),t.selectedCarrierPrice(r.PrintPrice),PubSub.publish(mcWeb.cartsmall.events.onChangedQuantityCartSmall,""))});t.getPickupPointRegions()};this.saveSelectedCarrier=function(n){var i,r,u;return t.showRefreshSpin(!0),t.pickupPointSelectedCustomer(undefined),t.pickupPointSelectedRegion(undefined),t.pickupPointCustomerList.removeAll(),t.selectedCarrierName(n.Name),t.selectedCarrierPrice(n.PrintPrice),i=mcWeb.currentUser.getAuthenticationGUID(),r=mcWeb.loginCheckout.getEmail(),n.PickupPoint=null,u={carrierItem:n,email:r,zipCode:null,isCheckout:t.isCheckout,authenticationGuid:i},t.service.GetAction("SaveSelectedCarrier",u).done(function(i){t.showRefreshSpin(!1);PubSub.publish(mcWeb.cart.events.onChangedCart,"");PubSub.publish(mcWeb.shipment.events.onSelectedShipment,n);i!==null&&i!=undefined&&PubSub.publish(mcWeb.customerRegistration.events.onChangedCustomerData,i.CustomerRegistration)}),!0};PubSub.subscribe(mcWeb.shipment.events.onSelectedShipment,function(n,i){i&&(t.selectedCarrierName(i.Name),t.selectedCarrierPrice(i.PrintPrice))});this.showCarrierList=function(){t.showOnlyCarrierList(!0)};PubSub.subscribe(mcWeb.cart.events.hasCartItems,function(n,i){i!=null&&t.hasCartItems(i)});PubSub.subscribe(mcWeb.shipment.events.reloadShipment,function(n,i){t.load(i)});PubSub.subscribe(mcWeb.customerRegistration.events.onChangedCustomerData,function(n,i){var r=null;i!=null&&(i.useDifferentDeliveryAddress!=null&&i.useDifferentDeliveryAddress==!0?(i.postnrDelivery!=null&&i.postnrDelivery!=t.zipCode()&&t.LoadZipCode(i.postnrDelivery),t.adressDelivery(i.adressDelivery==null?"":i.adressDelivery),t.adresstillegDelivery(i.adresstillegDelivery==null?"":i.adresstillegDelivery),t.poststedDelivery(i.poststedDelivery==null?"":i.poststedDelivery),r=i.poststedDelivery):(i.postnr!=null&&i.postnr!=t.zipCode()&&t.LoadZipCode(i.postnr),t.adressDelivery(i.adress==null?"":i.adress),t.adresstillegDelivery(i.adresstilleg==null?"":i.adresstilleg),t.poststedDelivery(i.poststed==null?"":i.poststed),r=i.poststed))});PubSub.subscribe(mcWeb.customerRegistration.events.onChangedCity,function(n,i){t.poststedDelivery(i==null||i.length<1?"":i)});PubSub.subscribe(mcWeb.customerRegistration.events.onChangedZipCode,function(n,i){i&&t.zipCode()!=i&&(t.zipCodePrev(i),t.zipCode(i),t.load())});PubSub.subscribe(mcWeb.payments.events.onSelectedPayment,function(n,i){i!=null&&t.service.GetAction("ShowCollectedDeliveryBasedOnPayment",{betBetId:i}).done(function(n){n==2&&(t.showCollectedDelivery(!1),t.useCollectedDelivery(!0));t.showCollectedDelivery(n===1)})});this.LoadZipCode=function(n){if(n!=null&&n.length>=3)try{if(n.indexOf("*")>-1){t.showCheckoutZipCode(!1);return}t.showRefreshSpin(!0);PubSub.publish(mcWeb.customerRegistration.events.onChangedZipCode,n);PubSub.publish(mcWeb.cart.events.onChangedCart,null)}catch(i){stopUpdateIcon();console.error(i)}};this.shipmentInfo=function(){if(t.zipCode()!=null&&t.zipCode().indexOf("*")>-1)return"";var n=t.postOffice()==null||t.postOffice().length<1?"":t.postOffice()+" ";return n+=t.zipCode()==null||t.zipCode().length<1?"":t.zipCode()+" ",n+(t.poststedDelivery()==null||t.poststedDelivery().length<1?"":t.poststedDelivery()+" ")};this.onToggleCarrierTypes=function(){i("#carriers").slideToggle()};this.isNumberKey=function(n,t){var i=t.which?t.which:t.keyCode;return i==13?(document.activeElement.blur(),!1):!(i>31&&(i<48||i>57))};t.zipCode.subscribe(function(n){t.zipCodePrev()!=n&&(t.poststedDelivery(""),n!=null&&n.length>3&&(t.zipCodePrev(n),t.LoadZipCode(n)))});i("#qt-carrier-zipcode-i").popover({trigger:"hover",title:i("#qt-carrier-zipcode-t").html(),content:i("#qt-carrier-zipcode-c").html(),placement:"top",container:"body"});i("#qt-coll-delivery-i").popover({trigger:"hover",title:i("#qt-coll-delivery-t").html(),content:i("#qt-coll-delivery-c").html(),placement:"top",container:"body"});i("#qt-print-packing-i").popover({trigger:"hover",title:i("#qt-print-packing-t").html(),content:i("#qt-print-packing-c").html(),placement:"top",container:"body"});i("#qt-insurance-i").popover({trigger:"hover",title:i("#qt-insurance-t").html(),content:i("#qt-insurance-c").html(),placement:"top",container:"body"});ko.bindingHandlers.popoverShipping={init:function(n,r){var u=i(n);t.popoverNode=u;var f=ko.utils.unwrapObservable(r()),e=f.contentid,o=f.titleid,s="-kn",h="<div id='"+e+s+"'>"+i("#"+e).html()+"<\/div>",c="<div id='"+o+s+"'>"+i("#"+o).html()+"<\/div>";t.togglePopover=function(){i(event.target.parentElement).popover("toggle");var n=document.getElementById(e);ko.cleanNode(n)};u.popover({title:c,content:h,html:f.html,trigger:"manual",placement:function(n){var r=jQuery(n),e;if(r.addClass(f.contentClass),e=i("body.mc-inline-editor"),e.length>0)return"bottom";r.on("mouseleave",function(){return u.popover("hide"),t.popoverOpen(!1),!0});return"bottom"}});u.click(function(){t.togglePopover();t.popoverOpen(!t.popoverOpen());t.inlineEditor&&!!mcWeb.inlineEditor&&mcWeb.inlineEditor.init(!0)})}}}});mcWeb.campaignCode=new function(){var n=jQuery,t;this.events={onChangedCampaignCode:"mcWeb.campaignCode.onChangedCampaignCode",onShowHideCampaignCode:"mcWeb.campaignCode.onShowHideCampaignCode",onShowHideCampaignCodeInlineEdit:"mcWeb.campaignCode.onShowHideCampaignCodeInlineEdit"};t=function(n){return(2+n.length/6*.15)*1e3};this.vm=function(i){var r=this,u;r.id="#"+i;r.settings=null;r.service=new WebApiService("Campaign");r.hasCartItems=ko.observable(!1);r.showLoginButton=ko.observable(!1);r.code=ko.observable("");r.code.subscribe(function(){n(".qtip").remove()});r.hrefLogin=ko.observable("#Login");r.showSearchBtn=ko.observable(!0);r.showSearchSpin=ko.observable(!1);r.showErrorCampaignCode=ko.observable(!1);r.showErrorCampaignCodeInfo=ko.observable(!1);r.showCampaignMessage=ko.observable(!1);r.isCodeSelected=ko.observable(!1);r.onBlurCode=ko.observable(!1);r.showCampaignInlineEdit=ko.observable(!1);r.showCampaignInlineEditors=ko.observable(!1);r.onBlurCode.subscribe(function(){r.isCodeSelected(!1)});r.clearqtip=function(){n(".qtip").remove()};r.load=function(n,t){r.clearqtip();t!==null&&t&&(r.settings=t,r.hrefLogin(t.HrefLogin),r.settings.ShowCampaignCodeRegistration&&PubSub.publish(mcWeb.campaignCode.events.onShowHideCampaignCode,null),r.settings.ShowCampaignInlineEdit&&PubSub.publish(mcWeb.campaignCode.events.onShowHideCampaignCodeInlineEdit,null))};u=function(){r.showSearchBtn(!1);r.showSearchSpin(!0);var i={code:r.code()};r.service.GetAction("ApplyCampaignCode",i).done(function(i){var u,f;if(r.clearqtip(),r.showSearchSpin(!1),r.showSearchBtn(!0),r.showCampaignMessage(!1),i!==null&&i.Success)i.SuccessMsg!==null&&i.SuccessMsg.length>0&&(f=n("#btn-add-campaign"),i.ErrorType===17&&r.showLoginButton(!0),mcWeb.validation.qTipActionShowAndHide(f,i.SuccessMsg,!1,t(i.SuccessMsg)));else{i!==null&&(u=n("#campaing-code-field"),mcWeb.validation.qTipActionShowAndHide(u,i.ErrorMsg,!1,t(i.ErrorMsg)),i.ErrorType===17&&r.showLoginButton(!0));return}PubSub.publish(mcWeb.cart.events.onChangedCart,null);PubSub.publish(mcWeb.campaignCode.onChangedCampaignCode,!0)})};r.onClickCheckCampaignCode=function(t,i){if(r.clearqtip(),i.keyCode===13||i.type==="click"){if(r.code()!==null&&r.code().length>0)u();else{var f=n("#campaing-code-field"),e=n("#error-msg-campaign").text();mcWeb.validation.qTipActionShow(f,e)}i.preventDefault()}return!0};r.onClickLoginCampaignCode=function(){r.hrefLogin()==="#login"?mcWeb.login.load():window.location.href=r.hrefLogin()};r.onClickShowCampaignInlineEdit=function(n,t){if(t.keyCode===13||t.type==="click")return r.showCampaignInlineEditors(!r.showCampaignInlineEditors()),!1};PubSub.subscribe(mcWeb.campaignCode.events.onShowHideCampaignCode,function(){n("#campaign-code").show()});PubSub.subscribe(mcWeb.campaignCode.events.onShowHideCampaignCodeInlineEdit,function(){n("#inline-edit-campaign").show()});PubSub.subscribe(mcWeb.cart.events.hasCartItems,function(n,t){t!==null&&(r.hasCartItems(t),t===!1&&r.clearqtip())})}};mcWeb.warning=new function(){var n=this,t,u,i,r;n.service=new WebApiService("Login");t=!1;n.load=function(n){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);jQuery("#lightbox-placeholder").load(n,function(){if(jQuery("#warningView").length<1){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);return}PubSub.publish(mcWeb.lightbox.events.onShowLightbox);PubSub.publish(mcWeb.lightbox.events.onHideSpinicon)})};n.loadMobile=function(){t=!0;u()};u=function(){jQuery("#password").on("keypress",function(n){n.keyCode==13&&(mcWeb.login.login(),n.preventDefault())});jQuery("#username").on("keypress",function(n){n.keyCode==13&&(mcWeb.login.login(),n.preventDefault())});jQuery("#remember_me").on("click",function(){var n=jQuery(this).is(":checked");n&&window.StorageService.localStorage.setItem("remember",n)})};i="********************";n.login=function(){try{jQuery("#UpdateIcon").show();var u=jQuery("#password").val(),f={username:encodeURIComponent(jQuery("#username").val()),password:encodeURIComponent(u===i?window.StorageService.localStorage.getItem("id"):u),localstorge:u===i?!0:!1,allowasynclogin:!0};n.service.PostAction("Login",f).done(function(n){return PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),n.Success===!0?(r(),n.LoginContacts!=null&&t==!1?mcWeb.loginContacts.load(n.LoginContacts):window.location.href=t?jQuery("#url-ref").text():document.location.href.replace(location.hash,"")):(r(),jQuery("#error-msg-login").show()),!1})}catch(e){t==!0&&jQuery.mobile.loading("hide")}};n.loginAfterPasswordReset=function(){try{var r=jQuery("#password").val(),u={username:encodeURIComponent(jQuery("#username").val()),password:encodeURIComponent(r===i?window.StorageService.localStorage.getItem("id"):r),localstorge:r===i?!0:!1,allowasynclogin:!0};n.service.PostAction("Login",u).done(function(n){return n.Success===!0&&(window.location.href="http://"+location.hostname),!1})}catch(f){t==!0&&jQuery.mobile.loading("hide")}};r=function(){try{window.StorageService.localStorage.removeItem("id");window.StorageService.localStorage.removeItem("user");window.StorageService.localStorage.removeItem("remember")}catch(n){console.log("WarningView - ex: "+n)}};this.logout=function(i){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);t=i;n.service.GetAction("Logout","").done(function(n){n===!0?(window.location.href=t?"http://"+location.hostname:document.location.href.replace(location.hash,""),PubSub.publish(mcWeb.lightbox.events.onHideSpinicon)):alert("Error logg ut")})};this.LoginOut=function(){n.service.GetAction("Loginout","").done(function(n){var i,t;n!=null&&(i=jQuery("#loginout"),i.text(n.LoginText),t=jQuery("#loginout-content"),n.IsLogedin===!0?(i.attr("href",n.ShowClubLogin?"#logincontact":"#logout"),t.removeClass("LogInButtonContainer"),t.addClass("LogUtButtonContainer")):(i.attr("href",n.ShowClubLogin?"#logincontact":"#login"),t.removeClass("LogUtButtonContainer"),t.addClass("LogInButtonContainer")),jQuery("#loginuser").text(n.LoginUser))})}};mcWeb.magamenu=new function(n){"use strict";this.init=function(){var n=this};this.toggle=function(t,i){var r=n(t).next(".nav-content-"+i),u=n("body");return r.is(":hidden")?(n(".nav-content-1").removeClass("active"),u.addClass("mc-menu-overlay"),r.addClass("active")):(r.removeClass("active"),u.removeClass("mc-menu-overlay")),!1};this.show=function(t,i){var r=n(".nav-content-1.active").find("div.active"),u;return r.length>0&&r.removeClass("active"),u=n(t).next(".nav-content-"+i),u.addClass("active"),!1};this.hide=function(){return n(".nav-content-1").removeClass("active"),!1}}(jQuery);mcWeb.MegaMenuResponsive=new function(){var n=jQuery,t=this,i,h,u,f,c;t.service=new WebApiService("Menu");t.hasCacheData=!1;t.stickybar=null;t.load=function(i,r,u,e,o){var s,h,c;if(t.hideSubmenu(),s=mcWeb.responsive.useMobileMenu(u),h=s?n("#smenu"):n("#SubMenuArea"),h.length<1){alert("Error loading menu, please reload page!");return}i=i==null?!1:i;c=a(i,s);c!==null&&(h.html(c),f(s,!1,!1,!0));l(c!==null,h,r,i,s,e,o)};var l=function(n,i,r,u,e,o,s){try{n||PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);var h=window.devicePixelRatio||1,c=Math.floor(screen.width*h),l=Math.floor(screen.height*h),a={nodeId:r,screensize:mcWeb.responsive.getScreenSize(),screensizePixels:mcWeb.responsive.getScreenSizePixels(),width:Math.abs(window.orientation)===90?l:c,height:Math.abs(window.orientation)===90?c:l,showMobileMenuCollapsed:u};t.service.GetHTML("GetHtmlMenu",a).done(function(t){t!=null&&(v(t,u,e),i.html(t),f(e,o,s),n||PubSub.publish(mcWeb.lightbox.events.onHideSpinicon))})}catch(y){PubSub.publish(mcWeb.lightbox.events.onHideSpinicon)}},a=function(n,t){try{var i;if(i=n===!0&&t?window.StorageService.sessionStorage.getItem("menucache_collapsed"):window.StorageService.sessionStorage.getItem("menucache"),i!=null&&i.length>10&&t.toString()===window.StorageService.sessionStorage.getItem("menucache_ismob"))return i}catch(r){}return null},v=function(n,t,i){try{t===!0&&i?window.StorageService.sessionStorage.setItem("menucache_collapsed",n):window.StorageService.sessionStorage.setItem("menucache",n);window.StorageService.sessionStorage.setItem("menucache_ismob",i)}catch(r){}},e=function(){try{var n=window.StorageService.sessionStorage.getItem("filter_active");return n!==null&&n==="true"?!0:!1}catch(t){return!1}},o=function(n){try{window.StorageService.sessionStorage.setItem("filter_active",n)}catch(t){}},s=function(){try{var n=window.StorageService.sessionStorage.getItem("filter_scrollx");return n!==null?parseInt(n):-1}catch(t){return-1}},y=function(n){try{window.StorageService.sessionStorage.setItem("filter_scrollx",n)}catch(t){}},r=function(){document.querySelector(".mmenu_close").click()};t.Login=function(){r();setTimeout(function(){window.location.hash="#login"},400)};t.Logout=function(n){r();setTimeout(function(){window.location.hash=n===!0?"#loginagent":"#logout"},400)};t.RegisterCust=function(){r();setTimeout(function(){window.location.hash="#customerregistration"},400)};t.hideSubmenu=function(){var t=n(".SubMenuArea .navbar li.dropdown.open");t.removeClass("open");t.find('a[aria-expanded="true"]').attr("aria-expanded",!1);n("body").removeClass("mc-menu-overlay");mcWeb.magamenu!=null&&mcWeb.magamenu.hide()};i=null;h=function(t){var b,o,a,h,tt,u,k,r,v,l,w;if(t){if(b=document.querySelector(".mmenu-push-right .mmenu-iInfoMenu"),b==null){if(o=document.getElementsByClassName("top-menu")[0],o==null)return;if(a=document.querySelector("#mmenu-push-right"),a==null)return;for(h=0;h<o.children.length;h++)a.appendChild(o.children[h])}tt=new Menu({wrapper:"#o-wrapper",type:"push-right",menuOpenerClass:".container-top-menu",maskId:"#m-mask",btn:".container-top-menu",menuStartId:"#mmenu-",closeClass:".mmenu_close"})}if(u=n("#PageColumnLeft"),u.find(".ProductMenu ul li").length<1&&(r=n("body"),r.length>0&&!r.hasClass("empty-product-menu")&&r.addClass("empty-product-menu")),u.find(".has-filters").length<1&&(r=n("body"),r.length>0&&!r.hasClass("has-no-filter")&&r.addClass("has-no-filter")),k=n(".breadcrumb-container").height()>0,r=n("body"),k?r.length>0&&!r.hasClass("has-breadcrumb")&&r.addClass("has-breadcrumb"):r.length>0&&!r.hasClass("no-breadcrumb")&&r.addClass("no-breadcrumb"),v=mcWeb.responsive.getScreenSize(),i==null&&v!="md"&&v!="lg"){var f=null,p=".container-filter-menu",c=jQuery(".container-filter-menu");if(c.length<1&&(c=jQuery(".container-filter-menu-cells"),p=".container-filter-menu-cells"),c.length>0&&(f=new Menu({wrapper:"#o-wrapper",type:"slide-left",menuOpenerClass:p,maskId:"#m-mask",btn:p}),i=f),c.length>0&&u.length>0&&u.find(".attribute-left-box .has-filters").length>0){u.removeClass("hidden-xs");l=n("#mmenu-left");l.on("scroll",function(){y(this.scrollTop)});l.append(u);var d=n(".filter-selection .SelectedAttribute").length,g=n("#filter-btn"),nt=g.find(".filters-count");d<1?nt.addClass("hidden"):nt.removeClass("hidden").html(d);g.show();e()==!0&&(f.notransition(),f.open(),w=s(),w>-1&&l.scrollTop(w),setTimeout(function(){f.transition()},300))}}};PubSub.subscribe(window.Menu.prototype.events.onAddNewFilterButton,function(){var r=n("#mmenu-left"),t=null,u=".container-filter-menu",f=jQuery(".container-filter-menu"),o,c,h;f.length<1&&(f=jQuery(".container-filter-menu-cells"),u=".container-filter-menu-cells");f.length>0&&(t=new Menu({wrapper:"#o-wrapper",type:"slide-left",menuOpenerClass:u,maskId:"#m-mask",btn:u}),i=t,r.find("#PageColumnLeft").length<=0&&(o=n("#PageColumnLeft"),o.removeClass("hidden-xs"),r.append(o)));c=n("#filter-btn");c.show();t!==null&&e()==!0&&(t.notransition(),t.open(),h=s(),h>-1&&r.scrollTop(h),setTimeout(function(){t.transition()},300))});PubSub.subscribe(window.Menu.prototype.events.onOpen,function(n,t){t==="c-menu--slide-left"&&o(!0)});PubSub.subscribe(window.Menu.prototype.events.onClose,function(n,t){t==="c-menu--slide-left"&&o(!1)});u=function(){var n=document.querySelector(".HeaderSearch");n.classList.toggle("show-search");n.classList.contains("show-search")?document.querySelector(".main-search-a input").focus():document.activeElement.blur()};t.setOverlay=function(t){var i=n("body");t===!0?i.addClass("mc-menu-overlay"):i.removeClass("mc-menu-overlay")};f=function(i,r,f,e){var s,l,o,a;if(h(i),s=document.getElementById("m-search"),l=document.getElementById("CloseSearchButton"),s&&s.addEventListener("click",u,!1),l&&l.addEventListener("click",u,!1),i)mcWeb.responsive.getScreenSize()==="xs"&&c(".m-header-dock",".menu-container"),a=document.getElementById("mback").innerHTML,jQuery("#mmenu").slinky({label:a,title:!0});else{r||f||(n(".SubMenuArea .navbar .dropdown").hover(function(){n(this).find(".dropdown-menu").first().stop(!0,!0).show()},function(){n(this).find(".dropdown-menu").first().stop(!0,!0).hide()}),n(".SubMenuArea .navbar .dropdown-menu").hover(function(){n(this).parent().addClass("open")},function(){n(this).parent().removeClass("open")}));o=f;n(".SubMenuArea .navbar .dropdown > a").on("touchstart",function(){o=!0});n(".SubMenuArea .navbar .dropdown > a").click(function(){var e=n(this).parent(),s=e.find(".dropdown-menu"),i,u;if(!o||s.length<1||r){if(i="http",this.href.substr(0,i.length)===i)return window.open(this.href,this.target),!1;location.href=this.href;return}o=f;u=s.children("ul").stop(!0,!0);e.hasClass("open")===!0?(u.hide(),t.setOverlay(!1)):(u.show(),t.setOverlay(!0))});e==undefined&&n("document").ready(function(n){var u=n(".use-sticky-header"),r,i,f;u.length>0?t.stickybar==null&&(r=n(".use-sticky-smallcart .m-header-dock .top-menu"),i=r.length>0?r.height():0,i=i>0?i*-1:i,r.length>0&&(f=new Stickybar(jQuery,".m-header-dock",0,i)),t.stickybar=new Stickybar(jQuery,".menu-container",0,i),n(document).trigger("header-menu-ready")):n(document).trigger("header-menu-ready")})}};c=function(n,t){var i=document.querySelector(n),r,u;i!=null&&(r=document.querySelector(t),r!=null&&(r.style.paddingTop=jQuery(i).height()+"px"),u=new Headroom(i,{tolerance:5,offset:205,classes:{initial:"animated",pinned:"slideDown",unpinned:"slideUp"}}),u.init())}};mcWeb.registrationValidation=new function(){this.loadPrivateValidation=function(){jQuery("#aspnetForm").validate({errorClass:"validation_error",validClass:"ok",success:function(n){var t=jQuery(n).prop("for");jQuery("#"+t).prev().addClass("icon-star icon-ok green")},highlight:function(n){jQuery(n).prev().removeClass("icon-ok green");jQuery(n).removeClass("ok");jQuery(n).addClass("validation_error")},errorPlacement:function(){return!0},rules:{firstName:{required:!0},lastName:{required:!0},address1:{required:!0},city:{required:!0},zipCode:{required:!0},email:{required:!0,email:!0,remote:{type:"POST",url:"api/CustomerRegistration/IsUsernameNew",data:{userName:function(){return jQuery("#email").val()}}}},levName:{required:!0},levAddress1:{required:!0},levZzipCode:{required:!0},levCity:{required:!0},phone:{digits:!0,minlength:8,maxlength:8}},ignore:"#addressSearch, :hidden"})};this.loadBusinessValidation=function(){jQuery("#aspnetForm").validate({errorClass:"validation_error",validClass:"ok",success:function(n){var t=jQuery(n).prop("for");jQuery("#"+t).prev().addClass("icon-star icon-ok green")},highlight:function(n){jQuery(n).prev().removeClass("icon-ok green");jQuery(n).removeClass("ok");jQuery(n).addClass("validation_error")},errorPlacement:function(){return!0},rules:{firstName:{required:!0},lastName:{required:!0},address1:{required:!0},city:{required:!0},zipCode:{required:!0},orgnr:{required:!0,digits:!0,minlength:9,maxlength:9},email2:{required:!0,email:!0,remote:{type:"POST",url:"api/CustomerRegistration/IsUsernameNew",data:{userName:function(){return jQuery("#email2").val()}}}},levName:{required:!0},levAddress1:{required:!0},levZzipCode:{required:!0},levCity:{required:!0},firmanavn:{required:!0},phone:{digits:!0,minlength:8,maxlength:8}},ignore:"#addressSearch, :hidden"})};this.loadGovernmentValidation=function(){jQuery("#aspnetForm").validate({errorClass:"validation_error",validClass:"ok",success:function(n){var t=jQuery(n).prop("for");jQuery("#"+t).prev().addClass("icon-star icon-ok green")},highlight:function(n){jQuery(n).prev().removeClass("icon-ok green");jQuery(n).removeClass("ok");jQuery(n).addClass("validation_error")},errorPlacement:function(){return!0},rules:{firstName:{required:!0},lastName:{required:!0},address1:{required:!0},city:{required:!0},zipCode:{required:!0},orgnr:{required:!0,digits:!0,minlength:9,maxlength:9},email2:{required:!0,email:!0,remote:{type:"POST",url:"api/CustomerRegistration/IsUsernameNew",data:{userName:function(){return jQuery("#email2").val()}}}},levName:{required:!0},levAddress1:{required:!0},levZzipCode:{required:!0},levCity:{required:!0},phone:{digits:!0,minlength:8,maxlength:8}},ignore:"#addressSearch, :hidden"})};this.loadPasswordResetValidation=function(){}};mcWeb.customerRegistration=new function(){var n=jQuery;this.events={onChangedCustomerData:"mcWeb.customerRegistration.onChangedCustomerData",onChangedZipCode:"mcWeb.customerRegistration.onChangedZipCode",onChangedCity:"mcWeb.customerRegistration.onChangedCity",onChangedCustomerType:"mcWeb.customerRegistration.onChangedCustomerType",reloadRegistration:"mcWeb.customerRegistration.reloadRegistration",onChangedUsePrintPackingList:"mcWeb.customerRegistration.onChangedUsePrintPackingList",onRememberedUserNotMe:"mcWeb.customerRegistration.onRememberedUserNotMe",updateOrgNr:"mcWeb.customerRegistration.updateOrgNr"};this.LoadView=function(t){var i=new WebApiService("CustomerRegistration");i.GetAction("RegistrationSettingsJson",{isCheckout:n(".body-checkout").length>0,token:t!=null?t:null}).done(function(n){n!=null&&n.ShowCustomerRegistration===!0&&(PubSub.publish(mcWeb.lightbox.events.onShowLightbox),n.Token=t,mcWeb.customerRegistration.lightbox.load(n))})};this.vm=function(t){var r=this,u,f;this.id="#"+t;this.settings=null;this.registrationVM=null;this.conditionVM=new mcWeb.conditions.vm(r.id);this.conditionsStatus={isFunctionalConditionAccepted:ko.observable(!1),acceptDocuments:ko.observableArray([]),usageArea:2};this.service=new WebApiService("CustomerRegistration");this.load=function(n,t){r.settings=t;r.registrationVM=new f(t);r.getAvailableCountries();t.IsLoggedIn===!0?r.registrationVM.showRegTypes():(r.registrationVM.selectedCountry(r.settings.SessionLandId),r.registrationVM.invoiceSelectedCountry(r.settings.SessionLandId));t.IsCheckout||r.conditionVM.load(null,{usageArea:2,functionName:"CUSTOMERREGISTRATION",forUnknownUser:!0,isInLightbox:!0,status:r.conditionsStatus});r.loadInitialView(r.registrationVM.isLoggedIn())};this.getAvailableCountries=function(){r.service.GetAction("GetAvailableCountries",null).done(function(n){return n==null||n.length<1?null:(r.registrationVM.availableCountries(n),null)})};this.loadInitialView=function(n){!n&&r.settings.OnlyBussines||n&&r.registrationVM.customerType()==="business"?r.loadBusinessView():r.loadPrivateView()};this.loadPrivateView=function(){mcWeb.loginCheckout.ResetLoginCheckoutPosision();n(".qtip").remove();var t=n(r.id+" #registrationFieldContainer");if(t.hide(),PubSub.publish(mcWeb.lightbox.events.contentChanged),n(r.id+" #privateCustomerRegistration").length>0){r.registrationVM.isLoggedIn()&&t.fadeIn();return}t.load("/Webpages/ViewProvider.aspx?view=PrivateCustomer",function(){if(t.fadeTo("slow",1),PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null),!(n(r.id+" #privateCustomerRegistration").length<1)){u();r.registrationVM.customerType("private");r.registrationVM.validationRules=[];ko.applyBindings(r.registrationVM,n(r.id+" #privateCustomerRegistration")[0]);r.registrationVM.getErrorMessages();(r.settings.DisableDeliveryAddressEdit&&r.settings.IsCheckout||r.registrationVM.useDifferentDeliveryAddress())&&n(r.id+" #otherDeliveryAddressContainer").show();r.settings.SoftAdressValidation&&n(r.id+" #address1").prev().removeClass("icon-star");r.registrationVM.phoneMandatory()||(n(r.id+" #phone").prev().removeClass("icon-star"),n(r.id+" #levPhone").prev().removeClass("icon-star"));r.registrationVM.receiveoffers(r.settings.EdmEmailCheckedPrivate);!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0);r.disableEnterKey();var i=r.registrationVM.invoiceSelectedCountry();!r.registrationVM.invoiceCountryId()||!r.registrationVM.landID()||r.registrationVM.landID()===r.registrationVM.invoiceCountryId()||(i=r.registrationVM.landID());r.registrationVM.setZipCodeMaskDelivery(i);r.registrationVM.setZipCodeMaskInvoice(r.registrationVM.invoiceSelectedCountry());r.registrationVM.isLoggedIn()&&t.show();r.registrationVM.showCustomerType()||r.conditionVM.isVisible(!0)}})};this.IsPublishMode=function(){return n("body.publish-mode").length>0?!0:!1};u=function(){var t,i,u,f,e,o,s,h,c,l,a,v,y,p;r.IsPublishMode()||(t=n(".customer-reg-pub #PanelAreaPreviewHelp"),t.length<1)||(i=t.detach(),i.appendTo("#pub-area-preview-help"),u=n("#PanelAreaPreviewTop"),f=u.detach(),f.appendTo("#pub-area-preview-top"),e=n("#PanelAreaPreviewBottom"),o=e.detach(),o.appendTo("#pub-area-preview-bottom"),s=n("#PanelAreaPreviewBottomOutside"),h=s.detach(),h.appendTo("#pub-area-preview-bottom-out"),c=n("#PanelAreaBlocKPrivate"),l=c.detach(),l.appendTo("#pub-area-block-cust-private"),a=n("#PanelAreaBlocKBusiness"),v=a.detach(),v.appendTo("#pub-area-block-cust-business"),y=n("#PanelAreaBlocKReadonly"),p=y.detach(),p.appendTo("pub-area-block-cust-readonly"))};this.loadBusinessView=function(){r.registrationVM.showCustomerType()||r.conditionVM.isVisible(!0);mcWeb.loginCheckout.ResetLoginCheckoutPosision();n(".qtip").remove();n("#privateCustomer").removeClass("active");n("#companyCustomer").addClass("active");n("#govermentCustomer").removeClass("active");var t=n(r.id+" #registrationFieldContainer");if(t.hide(),PubSub.publish(mcWeb.lightbox.events.contentChanged),n(r.id+" #businessRegistrationView").length>0){r.registrationVM.isLoggedIn()&&t.fadeIn();return}t.load("/Webpages/ViewProvider.aspx?view=BusinessCustomer",function(){if(t.fadeTo("slow",1),PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null),!(n(r.id+" #businessRegistrationView").length<1)){u();r.registrationVM.customerType("business");r.registrationVM.validationRules=[];ko.applyBindings(r.registrationVM,n(r.id+" #businessRegistrationView")[0]);r.registrationVM.getErrorMessages();(r.settings.DisableDeliveryAddressEdit&&r.settings.IsCheckout||r.registrationVM.useDifferentDeliveryAddress())&&n(r.id+" #otherDeliveryAddressContainer").show();r.settings.SoftAdressValidation&&n(r.id+" #address1").prev().removeClass("icon-star");r.registrationVM.phoneMandatory()||(n(r.id+" #phone").prev().removeClass("icon-star"),n(r.id+" #levPhone").prev().removeClass("icon-star"));r.registrationVM.receiveoffers(r.settings.EdmEmailCheckedCompany);!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0);r.disableEnterKey();var i=r.registrationVM.invoiceSelectedCountry();!r.registrationVM.invoiceCountryId()||!r.registrationVM.landID()||r.registrationVM.landID()===r.registrationVM.invoiceCountryId()||(i=r.registrationVM.landID());r.registrationVM.setZipCodeMaskDelivery(i);r.registrationVM.setZipCodeMaskInvoice(r.registrationVM.invoiceSelectedCountry());r.registrationVM.setOrgNrLenght(r.registrationVM.invoiceSelectedCountry());r.registrationVM.isLoggedIn()&&t.fadeIn()}})};this.disableEnterKey=function(){n(".reg-textbox").on("keypress",function(n){n.keyCode===13&&n.preventDefault()})};this.getJsonData=function(n){return r.registrationVM.getJsonData(n)};this.validate=function(){return r.registrationVM.validate()};this.validateCustomerSelectionType=function(){return!r.registrationVM.readOnly()&&r.registrationVM.showCustomerType()?(mcWeb.validation.qTipActionShow(jQuery("#privateCustomerRegistration .customerTypeSelector"),jQuery(".customerTypeSelectionValidationError").text(),!1),!1):!0};this.requireLogin=function(){return r.registrationVM.requireLogin()};f=function(t){var u=this,f;u.settings=t;u.id=r.id;this.phoneMandatory=ko.observable(t.PhoneMandatory);this.address1Mandatory=ko.observable(t.Address1Mandatory);this.onlyPrivate=ko.observable(t.OnlyPrivate);this.onlyBusiness=ko.observable(t.OnlyBussines);this.isLoggedIn=ko.observable(t.IsLoggedIn);this.calculateCarrierEventByAddress=ko.observable(t.CalculateCarrierEventByAddress);this.isNotLoggedIn=ko.computed(function(){return!u.isLoggedIn()});this.token=t.Token;this.token!=null&&t.User!=null?(f=t.User,this.epost=ko.observable(f.Username.toLowerCase()),this.epostCustomer=ko.observable(f.Username.toLowerCase()),this.firstName=ko.observable(f.Firstname),this.lastName=ko.observable(f.Lastname),this.invoiceAddressPrev=ko.observable(f.Address),this.invoiceAddress=ko.observable(f.Address),this.invoiceZipCodePrev=ko.observable(f.ZipCode),this.invoiceZipCode=ko.observable(f.ZipCode),this.invoiceCity=ko.observable(f.City),this.telephoneno=ko.observable(f.Phone),this.orgnr=ko.observable(f.Orgnr)):(this.epost=ko.observable(),this.epostCustomer=ko.observable(""),this.firstName=ko.observable(),this.lastName=ko.observable(),this.invoiceAddress=ko.observable(),this.invoiceAddressPrev=ko.observable(),this.invoiceZipCode=ko.observable(),this.invoiceZipCodePrev=ko.observable(),this.invoiceCity=ko.observable(),this.telephoneno=ko.observable(""),this.orgnr=ko.observable(""));this.hasCartItems=ko.observable(!1);this.discountCode=ko.observable("");this.usePrintPackingList=ko.observable(!1);this.postbox=ko.observable("");this.adresstilleg=ko.observable();this.adress=ko.observable();this.postnrPrev=ko.observable();this.postnr=ko.observable();this.poststed=ko.observable();this.receiveoffers=ko.observable();this.useDifferentDeliveryAddressPrev=ko.observable(!1);this.useDifferentDeliveryAddress=ko.observable(!1);this.nameDelivery=ko.observable();this.adressDelivery=ko.observable();this.adressDeliveryPrev=ko.observable();this.adresstillegDelivery=ko.observable();this.postnrDeliveryPrev=ko.observable();this.postnrDelivery=ko.observable();this.poststedDelivery=ko.observable();this.phoneDelivery=ko.observable();this.contactPerson=ko.observable();this.companyName=ko.observable();this.customerType=ko.observable();this.country=ko.observable();this.landID=ko.observable(0);this.invoiceCompanyName=ko.observable();this.invoiceAddress2=ko.observable();this.invoicePOBox=ko.observable();this.invoiceCountryId=ko.observable();this.invoiceCountry=ko.observable();this.invoiceReadOnly=ko.observable(!1);this.invoiceSelectedCountry=ko.observable(1);this.readonlyInvoiceAddress=!1;this.orgnr.subscribe(function(n){PubSub.publish(mcWeb.payments.events.updateOrgNr,n)});this.orgnrSsn=ko.observable();this.birthDate=ko.observable();this.registeredZip=ko.observable();this.validationRules=[];this.lastValidationResult=[];this.errorMessages=[];this.addressWarningFlag=0;this.zipcodeWarningFlag=0;this.cityDoesNotMatch=ko.observable(!0);this.hideOrgnrSsn=ko.observable(!1);this.hideExperianBetBet=ko.observable(!1);this.experianBetBetId=ko.observable();this.readOnlyPrev=ko.observable(t.ReadOnly);this.readOnly=ko.observable(t.ReadOnly);this.locked=ko.observable(!1);this.readOnly.subscribe(function(n){u.readOnlyPrev()!=n});this.blockedCustomer=ko.observable(!1);this.showPreviewHelp=ko.observable(!1);this.tempShowCustomerEdit=u.isLoggedIn()&&t.ShowCustomerEdit?!0:!1;this.validateUniqueUsername=ko.computed(function(){return t.IsCheckout&&(u.isLoggedIn()||u.readOnly())?!1:!0});this.validateAddress1Empty=ko.computed(function(){return u.address1Mandatory()?!t.SoftAdressValidation:!1},this);this.validateByPostbox=ko.computed(function(){if(!u.address1Mandatory())return!1;return u.postbox().length>0?!1:!0},this);this.clickShowPreviewHelp=function(){u.showPreviewHelp(!0)};this.clickHidePreviewHelp=function(){u.showPreviewHelp(!1)};this.clickViewLoginEmail=function(){PubSub.publish(mcWeb.customerRegistration.onRememberedUserNotMe,null);var n=new WebApiService("CustomerRegistration");n.GetAction("ChangeSessionToDefaultCustomer").done(function(n){n!=null&&(window.StorageService.sessionStorage.removeItem("authenticatedGuid"),window.location.href="/")})};this.clickLoginChangeAddress=function(){u.tempShowCustomerEdit=!0;PubSub.publish(mcWeb.loginCheckout.events.onShowLoginPassword,null)};this.clickLogin=function(){PubSub.publish(mcWeb.loginCheckout.events.onShowLoginPassword,null)};this.showCustomerType=ko.observable(t.ShowCustomerType);this.showRegButtons=function(t){var f=n("#privateActionButtons"),i,u;f.length>0&&(t==!0?f.fadeIn("slow"):f.hide());i=n(".registration-req-info");i.length>0&&(t==!0?i.fadeIn("slow"):i.hide());u=n("#McPaymentAddOrderbottom");u.length>0&&(t==!0?u.fadeIn("slow"):u.hide());t?r.conditionVM.isVisible(!0):r.conditionVM.isVisible(!1)};t.ShowCustomerType===!0&&u.showRegButtons(!1);this.clickPrivate=function(t,i){return i==null?!1:(n(".qtip").remove(),i.preventDefault(),i.stopPropagation(),u.showCustomerType(!1),u.showRegButtons(!0),u.customerType()!=="private"&&PubSub.publish(mcWeb.customerRegistration.events.onChangedCustomerType,0),!1)};this.clickBusiness=function(t,i){return i==null?!1:(n(".qtip").remove(),i.preventDefault(),i.stopPropagation(),u.showCustomerType(!1),u.showRegButtons(!0),u.customerType()!=="business"&&PubSub.publish(mcWeb.customerRegistration.events.onChangedCustomerType,1),!1)};this.clickChangeAddress=function(){if(u.isLoggedIn){u.showCustomerType(!1);var t=n(".preview-content"),i=t.height();t.css("min-height",i+"px");t.fadeOut(function(){u.readOnly(!1)})}};this.availableCountries=ko.observableArray();this.selectedCountry=ko.observable(1);this.selectedCountryName=ko.computed(function(){var n=ko.utils.arrayFirst(u.availableCountries(),function(n){return u.isLoggedIn()?n.LandId===u.landID():n.LandId===u.invoiceSelectedCountry()});if(n)return n.CountryName});this.storeDeliveryAddress=ko.observable(!1);this.invoiceZipCode.subscribe(function(n){if(u.invoiceZipCodePrev()!=n){if(u.useDifferentDeliveryAddress()){u.invoiceZipCodePrev(n);u.invoiceZipCode(n);n.indexOf("*")==-1&&(u.invoiceCity()==null&&u.invoiceCity(""),u.getCity(u.invoiceCity,u.invoiceZipCode(),!1,u.invoiceSelectedCountry()));return}n!=null&&n.length>=3&&PubSub.publish(mcWeb.customerRegistration.events.onChangedZipCode,u.invoiceZipCode())}});this.delayedInvoiceAddress=ko.pureComputed(this.invoiceAddress).extend({rateLimit:{method:"notifyWhenChangesStop",timeout:2e3}});this.delayedInvoiceAddress.subscribe(function(n){u.calculateCarrierEventByAddress()&&(u.useDifferentDeliveryAddress()||n!=null&&u.invoiceAddressPrev()!==n&&(u.invoiceAddressPrev(n),u.updateDeliveryZipCode(u.invoiceZipCode(),u.invoiceCity(),u.invoiceAddress(),u.invoiceAddress2())))});this.delayedAdressDelivery=ko.pureComputed(this.adressDelivery).extend({rateLimit:{method:"notifyWhenChangesStop",timeout:2e3}});this.delayedAdressDelivery.subscribe(function(n){u.calculateCarrierEventByAddress()&&u.useDifferentDeliveryAddress()&&n!=null&&u.adressDeliveryPrev()!==n&&(u.adressDeliveryPrev(n),u.updateDeliveryZipCode(u.postnrDelivery(),u.poststedDelivery(),u.adressDelivery(),u.adresstillegDelivery()))});this.postnrDelivery.subscribe(function(n){u.postnrDeliveryPrev()!=n&&n!=null&&n.length>=3&&PubSub.publish(mcWeb.customerRegistration.events.onChangedZipCode,u.postnrDelivery())});this.invoiceSelectedCountry.subscribe(function(){var n=u.invoiceSelectedCountry();!u.invoiceCountryId()||!u.landID()||u.landID()===u.invoiceCountryId()||(n=u.landID());u.setZipCodeMaskDelivery(n);u.setZipCodeMaskInvoice(u.invoiceSelectedCountry());u.setOrgNrLenght(u.invoiceSelectedCountry())});this.epost.subscribe(function(){});PubSub.subscribe(mcWeb.customerRegistration.events.onChangedUsePrintPackingList,function(n,t){(t===!0||t===!1)&&u.usePrintPackingList(t)});PubSub.subscribe(mcWeb.shipment.onSelectedShipmentForCustomerRefresh,function(t,i){i&&(u.locked(i.DeliveryAddressIsLocked),i.DeliveryAddressIsLocked&&(i.DeliveryAddressIsLocked?n(r.id+" #otherDeliveryAddressContainer").slideDown():u.useDifferentDelivery()||n(r.id+" #otherDeliveryAddressContainer").slideUp(),u.nameDelivery(i.nameDelivery==null?"":i.nameDelivery),u.adressDelivery(i.adressDelivery==null?"":i.adressDelivery),u.adresstillegDelivery(i.adresstillegDelivery==null?"":i.adresstillegDelivery),u.telephoneno(i.telephoneno==null?"":i.telephoneno),u.postnrDelivery(i.postnrDelivery==null?"":i.postnrDelivery),u.poststedDelivery(i.poststedDelivery==null?"":i.poststedDelivery),u.phoneDelivery(i.phoneDelivery==null?"":i.phoneDelivery)))});PubSub.subscribe(mcWeb.customerRegistration.events.updateOrgNr,function(n,t){var i=r.registrationVM!==null&&r.registrationVM.orgnr()!==undefined&&r.registrationVM.orgnr()!==t;i&&r.registrationVM.orgnr(t)});this.useDifferentDeliveryAddress.subscribe(function(){var i,f=u.useDifferentDeliveryAddress()!=u.useDifferentDeliveryAddressPrev(),t;u.useDifferentDeliveryAddressPrev(u.useDifferentDeliveryAddress());u.useDifferentDeliveryAddress()?(i=u.postnrDeliveryPrev(),n(r.id+" #otherDeliveryAddressContainer").slideDown()):(i=u.invoiceZipCodePrev(),n(r.id+" #otherDeliveryAddressContainer").slideUp());f&&u.postnrDeliveryPrev()!=u.invoiceZipCodePrev()&&(u.invoiceZipCodePrev(""),u.postnrDeliveryPrev(""),PubSub.publish(mcWeb.customerRegistration.events.onChangedZipCode,i),t=r.registrationVM.getJsonData(),t.isLoggedIn&&(t.useSoftlog=!1,u.tempShowCustomerEdit=!0),PubSub.publish(mcWeb.customerRegistration.events.onChangedCustomerData,t))});PubSub.subscribe("EniroResultSelected",function(n,t){u.applyEniroResultValuesToRegistrationViewModel(t)});PubSub.subscribe(mcWeb.customerRegistration.events.onChangedCustomerData,function(n,t){t!=null&&(t.isLoggedIn!=undefined&&(u.isLoggedIn(t.isLoggedIn),u.isLoggedIn()===!0&&u.showCustomerType(!1)),u.epostCustomer(t.epost.toLowerCase()),u.readOnly(t.useSoftlog),u.locked(t.LockedDelivery),r.registrationVM.showRegTypes(),u.popuateModelFromLoggedInCustomer(t),t.experianBetBetId&&t.experianBetBetId!==0&&u.customerType("undefined"),t.customerType==="private"?PubSub.publish(mcWeb.customerRegistration.events.onChangedCustomerType,0):t.customerType==="business"&&PubSub.publish(mcWeb.customerRegistration.events.onChangedCustomerType,1))});this.updateDeliveryZipCode=function(n,t,i,u){var f,e;n!=null&&(f={zipCode:n,city:t===undefined?null:t,address1:i===undefined?null:i,address2:u===undefined?null:u,isCheckout:r.settings.IsCheckout},PubSub.publish(mcWeb.payments.events.onShowUpdateIcon,null),e=new WebApiService("Cart"),e.GetAction("UpdateDeliveryZipCode",f).done(function(n){(PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null),n!=null)&&PubSub.publish(mcWeb.shipment.events.reloadShipment,"")}))};PubSub.subscribe(mcWeb.customerRegistration.events.onChangedZipCode,function(n,t){var i,r;if(t!=null){if(i=null,u.useDifferentDeliveryAddress()){if(u.postnrDeliveryPrev()===t)return;u.postnrDeliveryPrev(t);u.postnrDelivery(t);t.indexOf("*")==-1&&(u.poststedDelivery()==null&&u.poststedDelivery(""),r=u.landID(),u.isLoggedIn()||(r=u.invoiceSelectedCountry()),i=u.getCity(u.poststedDelivery,u.postnrDelivery(),!0,r));i!==null?i.then(function(){u.updateDeliveryZipCode(t,u.poststedDelivery(),u.adressDelivery(),u.adresstillegDelivery());PubSub.publish(mcWeb.customerRegistration.events.onChangedZipCode,u.postnrDelivery());PubSub.publish(mcWeb.customerRegistration.events.onChangedCity,u.poststedDelivery())}):u.updateDeliveryZipCode(t,u.poststedDelivery(),u.adressDelivery(),u.adresstillegDelivery());return}if(u.invoiceZipCodePrev()!==t){u.invoiceZipCodePrev(t);u.invoiceZipCode(t);t.indexOf("*")==-1&&(u.invoiceCity()==null&&u.invoiceCity(""),i=u.getCity(u.invoiceCity,u.invoiceZipCode(),!1,u.invoiceSelectedCountry()));i!==null?i.then(function(){u.updateDeliveryZipCode(t,u.invoiceCity(),u.invoiceAddress(),u.invoiceAddress2());PubSub.publish(mcWeb.customerRegistration.events.onChangedZipCode,u.invoiceZipCode());PubSub.publish(mcWeb.customerRegistration.events.onChangedCity,u.invoiceCity())}):u.updateDeliveryZipCode(t,u.invoiceCity(),u.invoiceAddress(),u.invoiceAddress2());return}}});PubSub.subscribe(mcWeb.customerRegistration.events.onChangedCustomerType,function(n,i){(typeof u.customerType()=="undefined"||i!==0||u.customerType()!=="private")&&(typeof u.customerType()=="undefined"||i!==1||u.customerType()!=="business")&&(PubSub.publish(mcWeb.payments.events.onShowUpdateIcon,null),r.service.GetAction("SetCustomerType",{customerType:i}).done(function(n){if(n==null||n.length<1){alert("Error - Can't select select cutomer type");return}i===0?(r.loadPrivateView(),u.isLoggedIn()||u.readOnly()||u.blockedCustomer(t.BlockedPrivateCustomer)):(r.loadBusinessView(),u.isLoggedIn()||u.readOnly()||u.blockedCustomer(t.BlockedBusinessCustomer));u.blockedCustomer()===!0&&PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!1,disabledBtn:!0});PubSub.publish(mcWeb.shipment.events.reloadShipment,null);PubSub.publish(mcWeb.payments.events.reloadPayments,null)}))});this.getCity=function(n,t,i,f){if(t==null||t.length<3)return PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null),null;var e={zipCode:t,landId:f};return r.service.GetAction("GetCity",e).then(function(t){if(PubSub.publish(mcWeb.payments.events.onHideUpdateIcon,null),i===!0&&PubSub.publish(mcWeb.customerRegistration.events.onChangedCity,t),t==null||t.length<1){u.cityDoesNotMatch=!0;return}return n(t),u.cityDoesNotMatch=!1,t})};this.setZipCodeMaskInvoice=function(t){t===2?n("#zipCode").mask("999 99"):t===1||t===3?n("#zipCode").mask("9999"):n("#zipCode").unmask()};this.setZipCodeMaskDelivery=function(t){t===2?n("#levZzipCode").mask("999 99"):t===1||t===3?n("#levZzipCode").mask("9999"):n("#levZzipCode").unmask()};this.setOrgNrLenght=function(t){r.registrationVM.readOnly()||(t===2?n("#orgNumber").attr("maxlength","10"):t===1?n("#orgNumber").attr("maxlength","9"):t===3&&n("#orgNumber").attr("maxlength","8"))};this.checkPostnr=function(n){var t={zipCode:n};return r.service.GetAction("GetCity",t)};this.tryRegisterCustomer=function(n,t){var i={isFunctionalConditionAccepted:r.conditionsStatus.isFunctionalConditionAccepted,acceptDocuments:r.conditionsStatus.acceptDocuments(),usageArea:r.conditionsStatus.usageArea};(r.conditionsStatus==null||r.conditionsStatus.acceptDocuments==null||r.conditionsStatus.acceptDocuments().length<=0)&&(i.isFunctionalConditionAccepted(!0),r.registrationVM.registerCustomer(i,t));r.conditionsStatus.isFunctionalConditionAccepted()?r.registrationVM.registerCustomer(i,t):r.conditionVM.highlightRequired()};this.registerCustomer=function(t,i){n("#UpdateIcon").show();u.epost()!=null&&u.epost(u.epost().toLowerCase());u.adress()||u.adress(u.invoiceAddress());u.adresstilleg()||u.adresstilleg(u.invoiceAddress2());u.postnr()||u.postnr(u.invoiceZipCode());u.poststed()||u.poststed(u.invoiceCity());u.validate().done(function(r){r&&!!r.success?(mcWeb.customerRegistration.lightbox.sendRegistrationRequest(u,t,i.target),window.dataLayer=window.dataLayer||[],dataLayer.push({event:"RegisterNewUser"})):(mcWeb.validation.qTipActionShow(i.target,r.message),n("#UpdateIcon").hide())})};this.popuateModelFromLoggedInCustomer=function(n){if(n!=null){u.firstName(n.firstName==null?"":n.firstName);u.lastName(n.lastName==null?"":n.lastName);u.postbox(n.postbox==null?"":n.postbox);u.adress(n.adress==null?"":n.adress);u.adresstilleg(n.adresstilleg==null?"":n.adresstilleg);u.postnrPrev(n.postnr==null?"":n.postnr);u.postnr(n.postnr==null?"":n.postnr);u.poststed(n.poststed==null?"":n.poststed);(n.epost!=null&&u.epost()!=null||u.epost()!="")&&u.epost(n.epost==null?"":n.epost.toLowerCase());u.landID(n.landID);u.telephoneno(n.telephoneno==null?"":n.telephoneno);u.isLoggedIn()&&u.receiveoffers(n.receiveoffers);u.nameDelivery(n.nameDelivery==null?"":n.nameDelivery);u.adressDelivery(n.adressDelivery==null?"":n.adressDelivery);u.adressDeliveryPrev(n.adressDelivery==null?"":n.adressDelivery);u.adresstillegDelivery(n.adresstillegDelivery==null?"":n.adresstillegDelivery);u.phoneDelivery(n.phoneDelivery==null?n.telephoneno==null||n.LockedDelivery?"":n.telephoneno:n.phoneDelivery);u.postnrDeliveryPrev(n.postnrDelivery==null?"":n.postnrDelivery);u.postnrDelivery(n.postnrDelivery==null?"":n.postnrDelivery);u.poststedDelivery(n.poststedDelivery==null?"":n.poststedDelivery);u.hideOrgnrSsn(n.hideOrgnrSsn==null?"false":n.hideOrgnrSsn);u.hideExperianBetBet(n.hideExperianBetBet==null?"false":n.hideExperianBetBet);u.experianBetBetId(n.experianBetBetId==null?"":n.experianBetBetId);u.country(n.country==null?"":n.country);n.customerType==="business"&&(u.companyName(n.companyName==null?"":n.companyName),u.orgnr(n.orgnr==null?"":n.orgnr),u.invoiceCompanyName(u.companyName()));u.invoiceAddress(n.invoiceAddress==null?"":n.invoiceAddress);u.invoiceAddressPrev(n.invoiceAddress==null?"":n.invoiceAddress);u.invoiceAddress2(n.invoiceAddress2==null?"":n.invoiceAddress2);u.invoicePOBox(n.invoicePOBox==null?"":n.invoicePOBox);u.invoiceZipCodePrev(n.invoiceZipCode==null?"":n.invoiceZipCode);u.invoiceZipCode(n.invoiceZipCode==null?"":n.invoiceZipCode);u.invoiceCity(n.invoiceCity==null?"":n.invoiceCity);u.invoiceCountryId(n.invoiceCountryId==null?"1":n.invoiceCountryId);u.invoiceCountry(n.invoiceCountry==null?"":n.invoiceCountry);n.invoiceCountryId!=null&&n.invoiceCountryId!==0&&u.invoiceSelectedCountry(n.invoiceCountryId);n.readonlyInvoiceAddress!=undefined&&(u.readonlyInvoiceAddress=n.readonlyInvoiceAddress);n.landID!=n.invoiceCountryId||n.readonlyInvoiceAddress||u.readonlyInvoiceAddress?u.invoiceReadOnly(!0):u.invoiceReadOnly(!1);u.useDifferentDeliveryAddressPrev(n.useDifferentDeliveryAddress);u.useDifferentDeliveryAddress(n.useDifferentDeliveryAddress);var i=u.useDifferentDeliveryAddress()?u.postnrDelivery():u.invoiceZipCode();PubSub.publish(mcWeb.customerRegistration.events.onChangedZipCode,i);n.usePrintPackingList!==!0&&n.usePrintPackingList!==!1||n.emptyCustomer||PubSub.publish(mcWeb.customerRegistration.events.onChangedUsePrintPackingList,n.usePrintPackingList);n.emptyCustomer?u.blockedCustomer(u.customerType()==="private"?t.BlockedPrivateCustomer:t.BlockedBusinessCustomer):(t.BlockedBusinessCustomer=!1,t.BlockedPrivateCustomer=!1,u.blockedCustomer(n.blockedCustomer));u.blockedCustomer()==!0&&PubSub.publish(mcWeb.checkout.events.onShowSendOrder,{showBtn:!1,disabledBtn:!0});u.tempShowCustomerEdit===!0?(u.tempShowCustomerEdit=!1,u.isLoggedIn()&&u.readOnly(!1)):u.readOnly(n.useSoftlog||u.isLoggedIn())}};this.applyEniroResultValuesToRegistrationViewModel=function(n){u.customerType()!=="business"&&(u.firstName(n.FirstName),u.lastName(n.LastName));u.adress(n.StreetAddress);u.invoiceZipCodePrev("");u.invoiceZipCode(n.PostCode);u.invoiceCity(n.Location);u.orgnr(n.OrgNr);n.SelectedPhone()?u.telephoneno(n.SelectedPhone().replace(/ /g,"")):u.telephoneno(n.Telephone.length>0?n.Telephone[0].replace(/\s+/g,""):"");u.companyName(n.LastName);u.invoiceCompanyName(n.LastName);u.invoiceAddress(n.StreetAddress);u.invoiceAddressPrev(n.StreetAddress);u.invoiceZipCode(n.PostCode);u.invoiceCity(n.Location);u.validateModel()};this.getConditionsData=function(n){var r,u,t,f;if(n!=null&&n!=undefined){if(r=[],n.acceptDocuments!=null&&n.acceptDocuments.length>0)for(u=n.acceptDocuments,i=0;i<u.length;i++)t=u[i],f={Accepted:t.Accepted,DocUsageID:t.DocUsageID,DocumentID:t.DocumentID,RevDataID:t.RevDataID,FunctionReferenceString:t.FunctionReferenceString},r.push(f);return r}return null};this.getJsonData=function(n){var i=u.epost(),r="";i!==null&&i!==undefined&&(r=i.toLowerCase());!u.isLoggedIn()&&u.readOnly()&&(r=u.epostCustomer().toLowerCase());var f=u.getConditionsData(n),e=mcWeb.currentUser.getAuthenticationGUID(),t={firstName:u.firstName(),lastName:u.lastName(),postbox:u.postbox(),adress:u.adress(),adresstilleg:u.adresstilleg(),postnr:u.invoiceZipCode(),poststed:u.invoiceCity(),epost:r.toLowerCase(),telephoneno:u.telephoneno(),receiveoffers:u.receiveoffers(),useDifferentDeliveryAddress:u.useDifferentDelivery(),nameDelivery:u.nameDelivery(),adressDelivery:u.adressDelivery(),adresstillegDelivery:u.adresstillegDelivery(),phoneDelivery:u.phoneDelivery(),postnrDelivery:u.postnrDelivery(),poststedDelivery:u.poststedDelivery(),contactPerson:u.contactPerson(),companyName:u.companyName(),customerType:u.customerType(),orgnr:u.orgnr(),landID:u.landID(),storeDeliveryAddress:u.storeDeliveryAddress(),birthDate:u.birthDate(),discountCode:u.discountCode(),usePrintPackingList:u.usePrintPackingList(),useSoftlog:u.readOnly(),isLoggedIn:u.isLoggedIn(),blockedCustomer:u.blockedCustomer(),LockedDelivery:u.locked(),invoiceCompanyName:u.invoiceCompanyName(),invoiceAddress:u.invoiceAddress(),invoiceAddress2:u.invoiceAddress2(),invoicePOBox:u.invoicePOBox(),invoiceZipCode:u.invoiceZipCode(),invoiceCity:u.invoiceCity(),invoiceCountryId:u.invoiceSelectedCountry(),invoiceCountry:u.invoiceCountry(),invoiceReadOnly:u.invoiceReadOnly(),acceptDocuments:f,AuthenticationGuid:e,readonlyInvoiceAddress:u.readonlyInvoiceAddress,token:u.token};return t.adress||(t.adress=t.invoiceAddress),t.adresstilleg||(t.adresstilleg=t.invoiceAddress2),t.landID===0&&(t.landID=t.invoiceCountryId),t};this.useDifferentDelivery=function(){return!t.IsCheckout&&u.customerType()==="private"?!1:u.useDifferentDeliveryAddress()};this.getErrorMessage=function(n,t){for(var i=0;i<u.errorMessages.length;i++)if(u.errorMessages[i].elem===n&&u.errorMessages[i].rule==t)return u.errorMessages[i].text};this.getErrorMessages=function(){var i,f=[],n,t,r=0;mcWeb.validation.getErrorMessages(u.validationRules).done(function(e){var o;for(i=e,n=0;n<u.validationRules.length;n++)for(o=u.validationRules[n].element,t=0;t<u.validationRules[n].rules.length;t++){var h=u.validationRules[n].rules[t],c=h.rule,s="";r<i.length&&(s=i[r].Value);f.push({elem:o,rule:c,text:s});r++}u.errorMessages=f})};this.validate=function(){return u.validateModel().then(function(t){var i={success:!1,message:"",invalidElements:[]};return u.lastValidationResult=t,t.every(mcWeb.validation.elementIsValid)?!u.settings.SoftAdressValidation||u.adress()||u.invoiceAddress()||u.addressWarningFlag!=0?i.success=!0:(i.message=n(".text-street-address-missing").html(),u.addressWarningFlag=1,u.clickChangeAddress()):(t.forEach(function(n){n.valid||i.invalidElements.push(n)}),i.message=n("#validation-error-text").html()),i})};this.validateModel=function(){n(".qtip").remove();var t,i=mcWeb.validation.validateModel(u.validationRules);return i.then(function(n){for(t=0;t<n.length;t++)if(n[t].valid){mcWeb.validation.setValidCss(n[t].elem);continue}else{mcWeb.validation.removeValidCss(n[t].elem);mcWeb.validation.addErrorClass(n[t].elem);mcWeb.validation.qTipActionShow(n[t].elem,u.getErrorMessage(n[t].elem,n[t].rule));break}return n})};this.validateElement=function(n,t){mcWeb.validation.validateElement(u.validationRules,t.target).done(function(n){n.valid?mcWeb.validation.setValidCss(t.target):mcWeb.validation.removeValidCss(t.target)})};this.validateOrgNr=function(){return t.ValidateOrgNr?u.invoiceSelectedCountry()===1&&u.orgnr().length===9||u.invoiceSelectedCountry()!==1?!0:!1:!0};this.validateTel=function(){if(u.readOnly())return!0;var n=u.telephoneno().replace(/ /g,""),t=n.length;return t<8||t>30?!1:t==8&&!/^\d+$/.test(n)?!1:t>8&&!/^\d+$/.test(n.substr(n.length-6))?!1:!0};this.validatePhoneDelivery=function(){var n,t;return u.readOnly()?!0:(n=u.phoneDelivery(),n===undefined||n===null)?!1:(n=n.replace(/ /g,""),t=n.length,t<8||t>30)?!1:t==8&&!/^\d+$/.test(n)?!1:t>8&&!/^\d+$/.test(n.substr(n.length-6))?!1:!0};this.requireLogin=function(){if(u.isLoggedIn())return!1;var n=!1;return u.lastValidationResult.forEach(function(t){t.rule==="usernameUnique"&&(n=t.valid)}),!n};this.showRegTypes=function(){(r.registrationVM.isLoggedIn()||r.registrationVM.readOnly()||!r.registrationVM.hasCartItems())&&t.IsCheckout?n(".registration-type").hide():n(".registration-type").show()};PubSub.subscribe(mcWeb.login.events.onIsloggedIn,function(n,t){u.isLoggedIn(t);t==!0&&u.readOnly(!1);r.registrationVM.showRegTypes()})};PubSub.subscribe(mcWeb.cart.events.hasCartItems,function(n,t){r.registrationVM.hasCartItems(t)})}};mcWeb.customerRegistration.lightbox=new function(){var n=jQuery,t=this;t.service=new WebApiService("CustomerRegistration");this.load=function(i){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);n("#lightbox-placeholder").load("/Webpages/ViewProvider.aspx?view=LightboxCustomerRegistration",function(){if(!(n("#lightboxCustomerRegistration").length<1)){var r="lightboxCustomerRegistration";loadModule(mcWeb.customerRegistration,r,r,null,i);t.activateView();PubSub.publish(mcWeb.lightbox.events.onHideSpinicon);!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0)}})};this.activateView=function(){PubSub.publish(mcWeb.lightbox.events.modifyOptions,{backdrop:"static"})};this.loadPrivateConfirmation=function(){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);mcWeb.customerRegistration.lightbox.clearEntireRegistrationContainer();n("#lightbox-placeholder").load("/Webpages/Kunde/PrivateCustomerRegistrationConfirmationView.aspx",function(){(PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),n("#lightbox-placeholder").length<1)||!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0)})};this.loadBusinessConfirmation=function(){PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);mcWeb.customerRegistration.lightbox.clearEntireRegistrationContainer();n("#lightbox-placeholder").load("/Webpages/Kunde/BusinessCustomerRegistrationConfirmationView.aspx",function(){(PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),n("#lightbox-placeholder").length<1)||!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0)})};this.loadClosedBusinessConfirmation=function(){mcWeb.customerRegistration.lightbox.clearEntireRegistrationContainer();n("#lightbox-placeholder").load("/Webpages/Kunde/BusinessCustomerClosedRegistrationConfirmationView.aspx",function(){(PubSub.publish(mcWeb.lightbox.events.onHideSpinicon),n("#lightbox-placeholder").length<1)||!mcWeb.inlineEditor||mcWeb.inlineEditor.init(!0)})};this.clearEntireRegistrationContainer=function(){n("#lightbox-placeholder").children().remove()};this.handleLoadingConfirmationPage=function(n,t){switch(n.customerType()){case"private":mcWeb.customerRegistration.lightbox.loadPrivateConfirmation();break;case"business":window.nyKundeSperret==="True"?mcWeb.customerRegistration.lightbox.loadClosedBusinessConfirmation():mcWeb.customerRegistration.lightbox.loadBusinessConfirmation()}window.StorageService.localStorage.removeItem("remember");n.epost()!==mcWeb.currentUser.getUser()&&mcWeb.currentUser.setUser(n.epost());t.AuthenticatedGuid!==mcWeb.currentUser.getAuthenticationGUID()&&mcWeb.currentUser.setAuthenticationGUID(t.AuthenticatedGuid)};this.sendRegistrationRequest=function(i,r,u){var f=i.getJsonData(r);f.invoiceCountryId!==0&&(f.landID=f.invoiceCountryId);t.service.PostAction("Register",f).done(function(t){t!=null&&t.ReturnCode==="Success"?i.token!=null?location.href="/":mcWeb.customerRegistration.lightbox.handleLoadingConfirmationPage(i,t,r):mcWeb.validation.qTipActionShow(u,n("#reg-error-text").html(),!1);n("#UpdateIcon").hide()})}};mcWeb.eniro=new function(){var n=this;n.service=new WebApiService("Eniro");this.people=ko.observableArray();this.gridViewModel=new ko.simpleGrid.viewModel({data:this.people,columns:[{headerText:"",rowText:"HitLine"},{headerText:"Name",rowText:"Name"},{headerText:"Address",rowText:"DisplayAddress"},{headerText:"Telephone",rowText:"Telephone"},{headerText:"",rowText:""}],pageSize:20});this.populatePeople=function(t){n.people.removeAll();jQuery.each(t,function(t,i){var u="",f="",e="",o="",r=[];i.Addresses!=null&&i.Addresses.length>0&&(u=i.Addresses[0].Street+" <br/> "+i.Addresses[0].Code+" "+i.Addresses[0].Locality,f=i.Addresses[0].Street,e=i.Addresses[0].Code,o=i.Addresses[0].Locality);i.Phones!=null&&i.Phones.length>0&&(r[0]=i.Phones[0].PhoneNumber,i.Phones.length>1&&(r[1]=i.Phones[1].PhoneNumber));n.people.push({HitLine:i.HitLine,Name:i.DisplayName,FirstName:i.FirstName,LastName:i.LastName,StreetAddress:f,PostCode:e,DisplayAddress:u,Telephone:r,Location:o,OrgNr:i.OrgNo,SelectedPhone:ko.observable()})})};this.selectResult=function(n){PubSub.publish("EniroResultSelected",n);jQuery("#eniro-lightbox").modal("hide");ko.cleanNode(document.getElementById("ResultLightbox"))};this.applyResultWindowBindings=function(t){n.populatePeople(JSON.parse(t));ko.applyBindings(n,document.getElementById("ResultLightbox"))};this.loadResultView=function(t){if(jQuery("#EniroResultLightBox").length==0){var i=jQuery('<div id="EniroResultLightBox"><\/div>');jQuery("body").append(i);i.load("/Webpages/Kunde/EniroResultView.aspx",function(){if(i.length<1)return!1;jQuery("#eniro-lightbox").modal({show:!0});jQuery("#UpdateIcon").hide();n.applyResultWindowBindings(t);jQuery("#eniro-lightbox").on("hidden.bs.modal",function(){ko.cleanNode(document.getElementById("ResultLightbox"))});return!0})}else{jQuery("#eniro-lightbox").modal({show:!0});jQuery("#UpdateIcon").hide();n.applyResultWindowBindings(t);jQuery("#eniro-lightbox").on("hidden.bs.modal",function(){ko.cleanNode(document.getElementById("ResultLightbox"))})}};this.showResults=function(t){n.loadResultView(t)};this.sendQueryAsync=function(t){var i,r;jQuery(t+" #addressSearch").val()?(i={text:jQuery(t+" #addressSearch").val(),commonname:jQuery("#eniroCommonName").text()},jQuery("#UpdateIcon").show(),n.service.GetAction("SendQueryAsync",i).done(function(t){t&&n.showResults(t)})):jQuery(t+" #addressSearchCompany").val()&&(r={text:jQuery(t+" #addressSearchCompany").val(),commonname:jQuery("#eniroCommonName").text()},jQuery("#UpdateIcon").show(),n.service.GetAction("SendQueryAsync",r).done(function(t){t&&n.showResults(t)}))};this.triggerQueryByEnter=function(t,i,r){return r.keyCode==13?(n.sendQueryAsync(t),!1):!0}};mcWeb.attributeFilte=new function(n){"use strict";var t=this,i,r;t.showMoreText="none";t.hideMoreText="none";i=function(t,i,r,u,f,e){var o,s;return e===0&&(o=n("#filteroptions .AttributeBox .selected"),o!=null&&o.length>0)?(n(".filter-toggle-hide").show(),r.css("display",""),!0):t==="*"||f.hasClass("department-id-"+t.trim())?(s=parseInt(i)<=u,n(s?".filter-toggle-hide":".filter-toggle-show").show(),r.css("display",s?"":"none"),!0):!1};r=function(t,r){var u,s,f,h;t.trim().length<1&&r.css("display","");var c=t.split(";"),l=n("body"),e=l.attr("class").split(" "),o=-1;for(u=0;u<e.length;u++)if(e[u].indexOf("body-menu-level-")>-1){o=parseInt(e[u].replace("body-menu-level-",""));break}if(o===-1){r.css("display","");return}for(s=!1,f=0;f<c.length;f++)if(h=c[f].split(","),i(h[0],h[1],r,o,l,f)){s=!0;break}s===!1&&n(".filter-toggle-show").show()};t.init=function(i){var u,c,o,s,h,f,e;if(ToggleOffAllAttributeValues(),i&&(u=n("#filter-toggle"),c=n(".filter-toggle-text"),u.css("display")!=="none")){if(o=n("#filter-content"),jQuery("aside.c-menu #filter-toggle").length>0||jQuery("body.layoutver4").length>0&&(jQuery("body.device-size-xs").length>0||jQuery("body.device-size-sm").length>0)){u.hide();o.show();return}u.on("click",function(){o.slideToggle(200,function(){c.toggle()})});u.length>0&&r(u.data("expandlevel"),o)}if(s=n("[ID*='LBClearFilter']"),document.location.href.indexOf("Filter=")>=0)s.on("click",RemoveFilter);else s.attr("disabled","disabled"),s.toggleClass("disabled");h=n("[ID*='LBCloseFilter'], [ID*='LBShowFilter']");h.on("click",function(){h.toggle();n("#AttributeListBox").slideToggle(200)});f=n("[ID*='LinkButtonShowAllAttributes']");e=n(".AttributeHide");f.on("click",function(){e.is(":visible")?f.text(t.showMoreText):f.text(t.hideMoreText);e.slideToggle(100)});window.location.href.indexOf(keepFilterOpen)>=0&&(e.slideToggle(100),e.is(":visible")?f.text(t.hideMoreText):f.text(t.showMoreText))}}(jQuery);mcWeb.partStream=new function(){var n=this;n.service=new WebApiService("ProductInfo");this.getAllIndexes=function(n,t){for(var r=[],i=0;i<n.length;i++)n[i].indexOf(t)>-1&&r.push(i);return r};this.getListOfVareNr=function(t){for(var e,r=t.split("&"),u=[],f=n.getAllIndexes(r,"arisku"),i=0;i<f.length;i++)e=r[f[i]],u.push(e.substring(7));return u};this.getListOfQuantities=function(t){for(var e,r=t.split("&"),u=[],f=n.getAllIndexes(r,"ariqty"),i=0;i<f.length;i++)e=r[f[i]],u.push(e.substring(7));return u};this.getListOfBrand=function(t){for(var e,r=t.split("&"),u=[],f=n.getAllIndexes(r,"aribrand"),i=0;i<f.length;i++)e=r[f[i]],u.push(e.substring(9));return u[0]};this.parseProducts=function(n){var t=n.split("&"),i;console.log(t);i=[]};this.addToCart=function(t){var i=n.getListOfVareNr(t),r=n.getListOfQuantities(t),u=n.getListOfBrand(t),f={varenr:i,amount:r,brand:u,isCheckout:!1};PubSub.publish(mcWeb.lightbox.events.onShowSpinicon);n.service.GetAction("AddToCartVareNr",f).done(function(n){n!=null&&n.Success==!0?(PubSub.publish(mcWeb.cartsmall.events.onShowNewItemInCartText,{status:!0,msg:n.PopupText}),PubSub.publish(mcWeb.cartsmall.events.onUpdateCart),PubSub.publish(mcWeb.freeShippingTxt.events.onUpdateFreeShipping),n.Redirect!=null&&n.Redirect==="[REFRESH]"&&location.reload()):alert("Beklager produktet er ikke tilgjengelig for salg!");PubSub.publish(mcWeb.lightbox.events.onHideSpinicon)})}};mcWeb.EdmRegistration=new function(){var n=this;this.events={onInOutChange:"mcWeb.EdmRegistration.events.onInOutChange",onEdmRegistrationSuccess:"mcWeb.EdmRegistration.events.onEdmRegistrationSuccess",onEdmRegistrationTBFocus:"mcWeb.EdmRegistration.events.onEdmRegistrationTBFocus"};this.vm=function(n){var r=jQuery,t=this;t.langService=new LanguageService;this.id="#"+n;this.isInnmelding=ko.observable(!0);t.emailAddress=ko.observable();this.service=new WebApiService("EdmRegistration");this.conditionsService=new WebApiService("Conditions");this.conditionVM=new mcWeb.conditions.vm(t.id);this.conditionsStatus={isFunctionalConditionAccepted:ko.observable(!1),acceptDocuments:ko.observableArray([]),usageArea:4};this.load=function(){t.conditionVM.load(null,{usageArea:4,forUnknownUser:!0,functionName:"EDM",status:t.conditionsStatus})};this.onEDMChange=function(n,i,u){this.isInnmelding(u);PubSub.publish(mcWeb.EdmRegistration.events.onInOutChange,u);var f=r(t.id+" .ErrorInfo").find("[id*='LabelInfo']");f!=null&&f.text("")};this.onEmailFocus=function(){PubSub.publish(mcWeb.EdmRegistration.events.onEdmRegistrationTBFocus,{hasFocus:!0,isIn:t.isInnmelding()});var n=r(t.id+" .ErrorInfo").find("[id*='LabelInfo']");n!=null&&n.text("")};this.onClickRegisterEmail=function(){var u=r(t.id+" [id*='RadioButtonUt']").is(":checked"),f,n,e,o;if(u||t.conditionsStatus.isFunctionalConditionAccepted())console.log("Required terms accepted");else{console.log("Required terms not accepted");t.langService.getValue("NEWS_SUBSCRIPTION","EmailTermsNotAccepted").done(function(n){var i=r(t.id+" .ErrorInfo").find("[id*='LabelInfo']");i!=null&&i.text(n)});return}if(f=r(t.id+" [id*='TextBoxEmail']").val(),t.conditionsStatus.acceptDocuments!==undefined&&t.conditionsStatus.acceptDocuments!=null&&t.conditionsStatus.acceptDocuments().length>0){var l=0,s=t.conditionsStatus.acceptDocuments(),a=s.length,h=!1,c=!1;for(i=0;i<a;i++)if(n=s[i],n!==null){if(e=n.Accepted,!e&&!n.TermRequiredForFunction)continue;if(u&&(e=!1),o={Accept:e,DocUsageId:n.DocUsageID,RevDataId:n.RevDataID,AvsAdresseID:null,KndKontaktId:null,DomainId:null,EmailAddress:f,ReferenceString:n.FunctionReferenceString},u&&n.FunctionReferenceString!="EDM")continue;else u&&n.FunctionReferenceString=="EDM"&&(o.Accept=!1);h=h||!u&&n.FunctionReferenceString=="EDM"&&n.Accepted;n.FunctionReferenceString=="EDM"&&(c=!0);t.conditionsService.PostAction("RegisterTermAcceptance",o).done(function(n){n&&l++;n.DoRegisterEdm==!0&&t.ShowEmailRegresult(n.Accept,n.EdmRegistrationResult)})}c||t.RegisterEmail(f,u)}else t.RegisterEmail(f,u)};this.ShowEmailRegresult=function(n,i){var u=jQuery.parseJSON(i),f=r(t.id+" .ErrorInfo").find("[id*='LabelInfo']");u.ok==="True"||u.ok==="true"?n?(t.langService.getValue("NEWS_SUBSCRIPTION","EmailSubscribe").done(function(n){f.text(n)}),PubSub.publish(mcWeb.EdmRegistration.events.onEdmRegistrationSuccess,!0)):u.foundAddress==="True"||u.foundAddress==="true"?t.langService.getValue("NEWS_SUBSCRIPTION","EmailCancel").done(function(n){f.text(n)}):t.langService.getValue("NEWS_SUBSCRIPTION","EmailNotFound").done(function(n){f.text(n)}):n?t.langService.getValue("NEWS_SUBSCRIPTION","EmailFailedToSubscribe").done(function(n){f.text(n)}):t.langService.getValue("NEWS_SUBSCRIPTION","EmailFailedToCancel").done(function(n){f.text(n)});u.ok==="False"&&u.foundAddress==="False"&&t.langService.getValue("NEWS_SUBSCRIPTION","EmailNotValid").done(function(n){f.text(n)})};this.RegisterEmail=function(n,i){t.isRegistering=!i;t.service.GetAction("RegisterEmail",{email:n,unregister:i}).done(function(n){t.ShowEmailRegresult(t.isRegistering,n)})}}}(jQuery);mc=mc||{};mc.s=new function(n){"use strict";var t=this;t.buy=function(n,t,i){mcWeb.productlist.buy.buy(n,t,i)};t.buy_l=function(t,i){mcWeb.productlist.buy.buy(t,i,n("#qu"+i).val(),!1)};t.buy_all=function(n,t,i){mcWeb.productlist.buy.buyAll(n,t,i)};t.qu=function(t){var i=n(t);mcWeb.productlist.qt.change(t,i.data("plid"),i.data("min"),i.data("inc"),i.data("max"),i.data("des"))};t.qsu=function(t){var i=n(t);mcWeb.productlist.qt.change(t,i.data("plid"),i.data("min"),i.data("inc"),i.data("max"),i.data("des"));mcWeb.productVariantMatrix.updateQuantitySum(i)};t.qu_key=function(n,t){var i=typeof t.which=="number"?t.which:t.keyCode;mcWeb.productlist.qt.keyPressed(n,i)==!1&&t.preventDefault()};t.qu_less=function(t,i,r){var u=n(r)[0];u.oldValue=u.value;mcWeb.productlist.qt.keyPressed(u,40)==!1&&i.preventDefault()};t.qu_more=function(t,i,r){var u=n(r)[0];u.oldValue=u.value;mcWeb.productlist.qt.keyPressed(u,38)==!1&&i.preventDefault()};t.fav=function(t,i,r){mcWeb.productlist.fav.addUsingPopup!=undefined?mcWeb.productlist.fav.addUsingPopup(t,i,r,!1,!1,!1):(n(t).find(".heart-empty").hide(),n(t).find(".heart-full").show(),mcWeb.productlist.fav.add(t,i,r))};t.fav_r=function(n,t){mcWeb.productlist.fav.remove(n,t,!1,!0)};t.selectAll=function(n){n.setSelectionRange(0,n.value.length)};t.onEnterBlur=function(n){var t=n.which?n.which:n.keyCode;return t==13?(document.activeElement.blur(),!1):!0}}(jQuery);mcWeb.currentUser=new function(){var t=jQuery,n=this;this.StorageService=window.StorageService;this.service=new WebApiService("Login");this.doSecuritySofteningLogin=function(t){var i,r;(t===undefined||t===null)&&n.getHasTriedSecSoftLogin()||(n.setHasTriedSecSoftLogin(!0),i=n.getUser(),t!==undefined&&t!==null&&t.length>0&&(i=t),r={WebBrukerId:i,AuthenticationGUID:n.getAuthenticationGUID()},n.service.PostAction("SecuritySofteningLogin",r).done(function(n){if(n.Success)if(window.location.href.indexOf("#")>=0){var t=window.location.href.substr(0,window.location.href.indexOf("#"));window.location.href=t}else window.location.reload(!0)}))};this.getAuthenticationGUID=function(){return n.StorageService.localStorage.getItem("authenticatedGuid")};this.setHasTriedSecSoftLogin=function(t){return n.StorageService.sessionStorage.setItem("hasTriedSecSoftLogin",t)};this.getHasTriedSecSoftLogin=function(){return n.StorageService.sessionStorage.getItem("hasTriedSecSoftLogin")};this.getUser=function(){return n.StorageService.localStorage.getItem("user")};this.setUser=function(n){t("#CurrentUserData").length>0&&t("#CurrentUserData").attr("data-WebBrukerID",n)};this.setAuthenticationGUID=function(n){t("#CurrentUserData").length>0&&t("#CurrentUserData").attr("data-authGUID",n)}}