/* Minification failed. Returning unminified contents.
(5341,8891-8892): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: i
(5341,8914-8915): run-time error JS1294: Strict-mode does not allow ++ or -- on certain objects: i
 */
/*!
 * Bootstrap v3.3.4 (http://getbootstrap.com)
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.4",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.4",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active"));a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.4",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.4",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=c(d),f={relatedTarget:this};e.hasClass("open")&&(e.trigger(b=a.Event("hide.bs.dropdown",f)),b.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger("hidden.bs.dropdown",f)))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.4",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27|32)/.test(b.which)&&!/input|textarea/i.test(b.target.tagName)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g&&27!=b.which||g&&27==b.which)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(b.target);38==b.which&&j>0&&j--,40==b.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="menu"]',g.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="listbox"]',g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.4",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.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"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in").attr("aria-hidden",!1),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a('<div class="modal-backdrop '+e+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.3.4",c.TRANSITION_DURATION=150,c.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}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport),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(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c&&c.$tip&&c.$tip.is(":visible")?void(c.hoverState="in"):(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.options.container?a(this.options.container):this.$element.parent(),p=this.getPosition(o);h="bottom"==h&&k.bottom+m>p.bottom?"top":"top"==h&&k.top-m<p.top?"bottom":"right"==h&&k.right+l>p.width?"left":"left"==h&&k.left-l<p.left?"right":h,f.removeClass(n).addClass(h)}var q=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(q,h);var r=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",r).emulateTransitionEnd(c.TRANSITION_DURATION):r()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);return this.$element.trigger(g),g.isDefaultPrevented()?void 0:(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type)})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.4",c.DEFAULTS=a.extend({},a.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>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.4",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.4",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){
var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.4",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=a(document.body).height();"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);;
/*!
 * Knockout JavaScript library v3.3.0
 * (c) Steven Sanderson - http://knockoutjs.com/
 * License: MIT (http://www.opensource.org/licenses/mit-license.php)
 */

(function() {
	(function(p) {
		var y = this || (0, eval)("this"), w = y.document, M = y.navigator, u = y.jQuery, E = y.JSON;
		(function(p) { "function" === typeof define && define.amd ? define(["exports", "require"], p) : "function" === typeof require && "object" === typeof exports && "object" === typeof module ? p(module.exports || exports) : p(y.ko = {}); })(function(N, O) {
			function J(a, d) { return null === a || typeof a in Q ? a === d : !1; }

			function R(a, d) {
				var c;
				return function() {
					c || (c = setTimeout(function() {
						c = p;
						a();
					}, d));
				};
			}

			function S(a, d) {
				var c;
				return function() {
					clearTimeout(c);
					c = setTimeout(a, d);
				};
			}

			function K(b, d, c, e) {
				a.d[b] = {
					init: function(b, k, h, l, g) {
						var m, x;
						a.w(function() {
							var q = a.a.c(k()), n = !c !== !q, r = !x;
							if (r || d || n !== m) {
								r && a.Z.oa() && (x = a.a.la(a.e.childNodes(b), !0)), n ? (r || a.e.T(b, a.a.la(x)), a.Ja(e ? e(g, q) : g, b)) : a.e.ma(b), m = n;
							}
						}, null, { q: b });
						return { controlsDescendantBindings: !0 };
					}
				};
				a.h.ka[b] = !1;
				a.e.R[b] = !0;
			}

			var a = "undefined" !== typeof N ? N : {};
			a.b = function(b, d) {
				for (var c = b.split("."), e = a, f = 0; f < c.length - 1; f++) {
					e = e[c[f]];
				}
				e[c[c.length - 1]] = d;
			};
			a.D = function(a, d, c) { a[d] = c; };
			a.version = "3.3.0";
			a.b("version", a.version);
			a.a = function() {
				function b(a, b) {
					for (var c in a) {
						a.hasOwnProperty(c) && b(c, a[c]);
					}
				}

				function d(a, b) {
					if (b) {
						for (var c in b) {
							b.hasOwnProperty(c) && (a[c] = b[c]);
						}
					}
					return a;
				}

				function c(a, b) {
					a.__proto__ = b;
					return a;
				}

				function e(b, c, g, d) {
					var e = b[c].match(m) || [];
					a.a.o(g.match(m), function(b) { a.a.ga(e, b, d); });
					b[c] = e.join(" ");
				}

				var f = { __proto__: [] } instanceof Array, k = {}, h = {};
				k[M && /Firefox\/2/i.test(M.userAgent) ? "KeyboardEvent" : "UIEvents"] = ["keyup", "keydown", "keypress"];
				k.MouseEvents = "click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");
				b(k, function(a, b) {
					if (b.length) {
						for (var c = 0, g = b.length; c < g; c++) {
							h[b[c]] = a;
						}
					}
				});
				var l = { propertychange: !0 },
					g = w && function() {
						for (var a = 3, b = w.createElement("div"), c = b.getElementsByTagName("i"); b.innerHTML = "\x3c!--[if gt IE " + ++a + "]><i></i><![endif]--\x3e", c[0];) {
							;
						}
						return 4 < a ? a : p;
					}(),
					m = /\S+/g;
				return {
					Bb: ["authenticity_token", /^__RequestVerificationToken(_.*)?$/],
					o: function(a, b) {
						for (var c = 0, g = a.length; c < g; c++) {
							b(a[c], c);
						}
					},
					m: function(a, b) {
						if ("function" == typeof Array.prototype.indexOf) {
							return Array.prototype.indexOf.call(a,
								b);
						}
						for (var c = 0, g = a.length; c < g; c++) {
							if (a[c] === b) {
								return c;
							}
						}
						return -1;
					},
					vb: function(a, b, c) {
						for (var g = 0, d = a.length; g < d; g++) {
							if (b.call(c, a[g], g)) {
								return a[g];
							}
						}
						return null;
					},
					ya: function(b, c) {
						var g = a.a.m(b, c);
						0 < g ? b.splice(g, 1) : 0 === g && b.shift();
					},
					wb: function(b) {
						b = b || [];
						for (var c = [], g = 0, d = b.length; g < d; g++) {
							0 > a.a.m(c, b[g]) && c.push(b[g]);
						}
						return c;
					},
					Ka: function(a, b) {
						a = a || [];
						for (var c = [], g = 0, d = a.length; g < d; g++) {
							c.push(b(a[g], g));
						}
						return c;
					},
					xa: function(a, b) {
						a = a || [];
						for (var c = [], g = 0, d = a.length; g < d; g++) {
							b(a[g], g) && c.push(a[g]);
						}
						return c;
					},
					ia: function(a, b) {
						if (b instanceof Array) {
							a.push.apply(a, b);
						} else {
							for (var c = 0, g = b.length; c < g; c++) {
								a.push(b[c]);
							}
						}
						return a;
					},
					ga: function(b, c, g) {
						var d = a.a.m(a.a.cb(b), c);
						0 > d ? g && b.push(c) : g || b.splice(d, 1);
					},
					za: f,
					extend: d,
					Fa: c,
					Ga: f ? c : d,
					A: b,
					pa: function(a, b) {
						if (!a) {
							return a;
						}
						var c = {}, g;
						for (g in a) {
							a.hasOwnProperty(g) && (c[g] = b(a[g], g, a));
						}
						return c;
					},
					Ra: function(b) {
						for (; b.firstChild;) {
							a.removeNode(b.firstChild);
						}
					},
					Jb: function(b) {
						b = a.a.O(b);
						for (var c = (b[0] && b[0].ownerDocument || w).createElement("div"), g = 0, d = b.length; g <
							d; g++) {
							c.appendChild(a.S(b[g]));
						}
						return c;
					},
					la: function(b, c) {
						for (var g = 0, d = b.length, e = []; g < d; g++) {
							var m = b[g].cloneNode(!0);
							e.push(c ? a.S(m) : m);
						}
						return e;
					},
					T: function(b, c) {
						a.a.Ra(b);
						if (c) {
							for (var g = 0, d = c.length; g < d; g++) {
								b.appendChild(c[g]);
							}
						}
					},
					Qb: function(b, c) {
						var g = b.nodeType ? [b] : b;
						if (0 < g.length) {
							for (var d = g[0], e = d.parentNode, m = 0, f = c.length; m < f; m++) {
								e.insertBefore(c[m], d);
							}
							m = 0;
							for (f = g.length; m < f; m++) {
								a.removeNode(g[m]);
							}
						}
					},
					na: function(a, b) {
						if (a.length) {
							for (b = 8 === b.nodeType && b.parentNode || b; a.length && a[0].parentNode !==
								b;) {
								a.splice(0, 1);
							}
							if (1 < a.length) {
								var c = a[0], g = a[a.length - 1];
								for (a.length = 0; c !== g;) {
									if (a.push(c), c = c.nextSibling, !c) {
										return;
									}
								}
								a.push(g);
							}
						}
						return a;
					},
					Sb: function(a, b) { 7 > g ? a.setAttribute("selected", b) : a.selected = b; },
					ib: function(a) { return null === a || a === p ? "" : a.trim ? a.trim() : a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, ""); },
					Dc: function(a, b) {
						a = a || "";
						return b.length > a.length ? !1 : a.substring(0, b.length) === b;
					},
					jc: function(a, b) {
						if (a === b) {
							return !0;
						}
						if (11 === a.nodeType) {
							return !1;
						}
						if (b.contains) {
							return b.contains(3 === a.nodeType ?
								a.parentNode : a);
						}
						if (b.compareDocumentPosition) {
							return 16 == (b.compareDocumentPosition(a) & 16);
						}
						for (; a && a != b;) {
							a = a.parentNode;
						}
						return !!a;
					},
					Qa: function(b) { return a.a.jc(b, b.ownerDocument.documentElement); },
					tb: function(b) { return !!a.a.vb(b, a.a.Qa); },
					v: function(a) { return a && a.tagName && a.tagName.toLowerCase(); },
					n: function(b, c, d) {
						var m = g && l[c];
						if (!m && u) {
							u(b).bind(c, d);
						} else if (m || "function" != typeof b.addEventListener) {
							if ("undefined" != typeof b.attachEvent) {
								var e = function(a) { d.call(b, a); }, f = "on" + c;
								b.attachEvent(f, e);
								a.a.C.fa(b,
									function() { b.detachEvent(f, e); });
							} else {
								throw Error("Browser doesn't support addEventListener or attachEvent");
							}
						} else {
							b.addEventListener(c, d, !1);
						}
					},
					qa: function(b, c) {
						if (!b || !b.nodeType) {
							throw Error("element must be a DOM node when calling triggerEvent");
						}
						var g;
						"input" === a.a.v(b) && b.type && "click" == c.toLowerCase() ? (g = b.type, g = "checkbox" == g || "radio" == g) : g = !1;
						if (u && !g) {
							u(b).trigger(c);
						} else if ("function" == typeof w.createEvent) {
							if ("function" == typeof b.dispatchEvent) {
								g = w.createEvent(h[c] || "HTMLEvents"), g.initEvent(c,
									!0, !0, y, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, b), b.dispatchEvent(g);
							} else {
								throw Error("The supplied element doesn't support dispatchEvent");
							}
						} else if (g && b.click) {
							b.click();
						} else if ("undefined" != typeof b.fireEvent) {
							b.fireEvent("on" + c);
						} else {
							throw Error("Browser doesn't support triggering events");
						}
					},
					c: function(b) { return a.F(b) ? b() : b; },
					cb: function(b) { return a.F(b) ? b.B() : b; },
					Ia: function(b, c, g) {
						var d;
						c && ("object" === typeof b.classList ? (d = b.classList[g ? "add" : "remove"], a.a.o(c.match(m), function(a) { d.call(b.classList, a); })) : "string" ===
							typeof b.className.baseVal ? e(b.className, "baseVal", c, g) : e(b, "className", c, g));
					},
					Ha: function(b, c) {
						var g = a.a.c(c);
						if (null === g || g === p) {
							g = "";
						}
						var d = a.e.firstChild(b);
						!d || 3 != d.nodeType || a.e.nextSibling(d) ? a.e.T(b, [b.ownerDocument.createTextNode(g)]) : d.data = g;
						a.a.mc(b);
					},
					Rb: function(a, b) {
						a.name = b;
						if (7 >= g) {
							try {
								a.mergeAttributes(w.createElement("<input name='" + a.name + "'/>"), !1);
							} catch (c) {
							}
						}
					},
					mc: function(a) { 9 <= g && (a = 1 == a.nodeType ? a : a.parentNode, a.style && (a.style.zoom = a.style.zoom)); },
					kc: function(a) {
						if (g) {
							var b = a.style.width;
							a.style.width = 0;
							a.style.width = b;
						}
					},
					Bc: function(b, c) {
						b = a.a.c(b);
						c = a.a.c(c);
						for (var g = [], d = b; d <= c; d++) {
							g.push(d);
						}
						return g;
					},
					O: function(a) {
						for (var b = [], c = 0, g = a.length; c < g; c++) {
							b.push(a[c]);
						}
						return b;
					},
					Hc: 6 === g,
					Ic: 7 === g,
					M: g,
					Db: function(b, c) {
						for (var g = a.a.O(b.getElementsByTagName("input")).concat(a.a.O(b.getElementsByTagName("textarea"))), d = "string" == typeof c ? function(a) { return a.name === c; } : function(a) { return c.test(a.name); }, m = [], e = g.length - 1; 0 <= e; e--) {
							d(g[e]) && m.push(g[e]);
						}
						return m;
					},
					yc: function(b) {
						return "string" ==
							typeof b && (b = a.a.ib(b)) ? E && E.parse ? E.parse(b) : (new Function("return " + b))() : null;
					},
					jb: function(b, c, g) {
						if (!E || !E.stringify) {
							throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");
						}
						return E.stringify(a.a.c(b), c, g);
					},
					zc: function(c, g, d) {
						d = d || {};
						var m = d.params || {}, e = d.includeFields || this.Bb, f = c;
						if ("object" == typeof c && "form" === a.a.v(c)) {
							for (var f = c.action,
									l = e.length - 1; 0 <= l; l--) {
								for (var k = a.a.Db(c, e[l]), h = k.length - 1; 0 <= h; h--) {
									m[k[h].name] = k[h].value;
								}
							}
						}
						g = a.a.c(g);
						var s = w.createElement("form");
						s.style.display = "none";
						s.action = f;
						s.method = "post";
						for (var p in g) {
							c = w.createElement("input"), c.type = "hidden", c.name = p, c.value = a.a.jb(a.a.c(g[p])), s.appendChild(c);
						}
						b(m, function(a, b) {
							var c = w.createElement("input");
							c.type = "hidden";
							c.name = a;
							c.value = b;
							s.appendChild(c);
						});
						w.body.appendChild(s);
						d.submitter ? d.submitter(s) : s.submit();
						setTimeout(function() { s.parentNode.removeChild(s); },
							0);
					}
				};
			}();
			a.b("utils", a.a);
			a.b("utils.arrayForEach", a.a.o);
			a.b("utils.arrayFirst", a.a.vb);
			a.b("utils.arrayFilter", a.a.xa);
			a.b("utils.arrayGetDistinctValues", a.a.wb);
			a.b("utils.arrayIndexOf", a.a.m);
			a.b("utils.arrayMap", a.a.Ka);
			a.b("utils.arrayPushAll", a.a.ia);
			a.b("utils.arrayRemoveItem", a.a.ya);
			a.b("utils.extend", a.a.extend);
			a.b("utils.fieldsIncludedWithJsonPost", a.a.Bb);
			a.b("utils.getFormFields", a.a.Db);
			a.b("utils.peekObservable", a.a.cb);
			a.b("utils.postJson", a.a.zc);
			a.b("utils.parseJson", a.a.yc);
			a.b("utils.registerEventHandler",
				a.a.n);
			a.b("utils.stringifyJson", a.a.jb);
			a.b("utils.range", a.a.Bc);
			a.b("utils.toggleDomNodeCssClass", a.a.Ia);
			a.b("utils.triggerEvent", a.a.qa);
			a.b("utils.unwrapObservable", a.a.c);
			a.b("utils.objectForEach", a.a.A);
			a.b("utils.addOrRemoveItem", a.a.ga);
			a.b("utils.setTextContent", a.a.Ha);
			a.b("unwrap", a.a.c);
			Function.prototype.bind || (Function.prototype.bind = function(a) {
				var d = this;
				if (1 === arguments.length) {
					return function() { return d.apply(a, arguments); };
				}
				var c = Array.prototype.slice.call(arguments, 1);
				return function() {
					var e =
						c.slice(0);
					e.push.apply(e, arguments);
					return d.apply(a, e);
				};
			});
			a.a.f = new function() {
				function a(b, k) {
					var h = b[c];
					if (!h || "null" === h || !e[h]) {
						if (!k) {
							return p;
						}
						h = b[c] = "ko" + d++;
						e[h] = {};
					}
					return e[h];
				}

				var d = 0, c = "__ko__" + (new Date).getTime(), e = {};
				return {
					get: function(c, d) {
						var e = a(c, !1);
						return e === p ? p : e[d];
					},
					set: function(c, d, e) {
						if (e !== p || a(c, !1) !== p) {
							a(c, !0)[d] = e;
						}
					},
					clear: function(a) {
						var b = a[c];
						return b ? (delete e[b], a[c] = null, !0) : !1;
					},
					I: function() { return d++ + c; }
				};
			};
			a.b("utils.domData", a.a.f);
			a.b("utils.domData.clear", a.a.f.clear);
			a.a.C = new function() {
				function b(b, d) {
					var e = a.a.f.get(b, c);
					e === p && d && (e = [], a.a.f.set(b, c, e));
					return e;
				}

				function d(c) {
					var e = b(c, !1);
					if (e) {
						for (var e = e.slice(0), l = 0; l < e.length; l++) {
							e[l](c);
						}
					}
					a.a.f.clear(c);
					a.a.C.cleanExternalData(c);
					if (f[c.nodeType]) {
						for (e = c.firstChild; c = e;) {
							e = c.nextSibling, 8 === c.nodeType && d(c);
						}
					}
				}

				var c = a.a.f.I(), e = { 1: !0, 8: !0, 9: !0 }, f = { 1: !0, 9: !0 };
				return {
					fa: function(a, c) {
						if ("function" != typeof c) {
							throw Error("Callback must be a function");
						}
						b(a, !0).push(c);
					},
					Pb: function(d, e) {
						var f = b(d, !1);
						f && (a.a.ya(f,
							e), 0 == f.length && a.a.f.set(d, c, p));
					},
					S: function(b) {
						if (e[b.nodeType] && (d(b), f[b.nodeType])) {
							var c = [];
							a.a.ia(c, b.getElementsByTagName("*"));
							for (var l = 0, g = c.length; l < g; l++) {
								d(c[l]);
							}
						}
						return b;
					},
					removeNode: function(b) {
						a.S(b);
						b.parentNode && b.parentNode.removeChild(b);
					},
					cleanExternalData: function(a) { u && "function" == typeof u.cleanData && u.cleanData([a]); }
				};
			};
			a.S = a.a.C.S;
			a.removeNode = a.a.C.removeNode;
			a.b("cleanNode", a.S);
			a.b("removeNode", a.removeNode);
			a.b("utils.domNodeDisposal", a.a.C);
			a.b("utils.domNodeDisposal.addDisposeCallback",
				a.a.C.fa);
			a.b("utils.domNodeDisposal.removeDisposeCallback", a.a.C.Pb);
			(function() {
				a.a.ca = function(b, d) {
					var c;
					if (u) {
						if (u.parseHTML) {
							c = u.parseHTML(b, d) || [];
						} else {
							if ((c = u.clean([b], d)) && c[0]) {
								for (var e = c[0]; e.parentNode && 11 !== e.parentNode.nodeType;) {
									e = e.parentNode;
								}
								e.parentNode && e.parentNode.removeChild(e);
							}
						}
					} else {
						(e = d) || (e = w);
						c = e.parentWindow || e.defaultView || y;
						var f = a.a.ib(b).toLowerCase(),
							e = e.createElement("div"),
							f = f.match(/^<(thead|tbody|tfoot)/) && [1, "<table>", "</table>"] || !f.indexOf("<tr") && [
								2, "<table><tbody>",
								"</tbody></table>"
							] || (!f.indexOf("<td") || !f.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] || [0, "", ""],
							k = "ignored<div>" + f[1] + b + f[2] + "</div>";
						for ("function" == typeof c.innerShiv ? e.appendChild(c.innerShiv(k)) : e.innerHTML = k; f[0]--;) {
							e = e.lastChild;
						}
						c = a.a.O(e.lastChild.childNodes);
					}
					return c;
				};
				a.a.gb = function(b, d) {
					a.a.Ra(b);
					d = a.a.c(d);
					if (null !== d && d !== p) {
						if ("string" != typeof d && (d = d.toString()), u) {
							u(b).html(d);
						} else {
							for (var c = a.a.ca(d, b.ownerDocument), e = 0; e < c.length; e++) {
								b.appendChild(c[e]);
							}
						}
					}
				};
			})();
			a.b("utils.parseHtmlFragment", a.a.ca);
			a.b("utils.setHtml", a.a.gb);
			a.H = function() {
				function b(c, d) {
					if (c) {
						if (8 == c.nodeType) {
							var f = a.H.Lb(c.nodeValue);
							null != f && d.push({ ic: c, wc: f });
						} else if (1 == c.nodeType) {
							for (var f = 0, k = c.childNodes, h = k.length; f < h; f++) {
								b(k[f], d);
							}
						}
					}
				}

				var d = {};
				return {
					$a: function(a) {
						if ("function" != typeof a) {
							throw Error("You can only pass a function to ko.memoization.memoize()");
						}
						var b = (4294967296 * (1 + Math.random()) | 0).toString(16).substring(1) + (4294967296 * (1 + Math.random()) | 0).toString(16).substring(1);
						d[b] = a;
						return "\x3c!--[ko_memo:" + b + "]--\x3e";
					},
					Wb: function(a, b) {
						var f = d[a];
						if (f === p) {
							throw Error("Couldn't find any memo with ID " + a + ". Perhaps it's already been unmemoized.");
						}
						try {
							return f.apply(null, b || []), !0;
						} finally {
							delete d[a];
						}
					},
					Xb: function(c, d) {
						var f = [];
						b(c, f);
						for (var k = 0, h = f.length; k < h; k++) {
							var l = f[k].ic, g = [l];
							d && a.a.ia(g, d);
							a.H.Wb(f[k].wc, g);
							l.nodeValue = "";
							l.parentNode && l.parentNode.removeChild(l);
						}
					},
					Lb: function(a) { return (a = a.match(/^\[ko_memo\:(.*?)\]$/)) ? a[1] : null; }
				};
			}();
			a.b("memoization", a.H);
			a.b("memoization.memoize", a.H.$a);
			a.b("memoization.unmemoize", a.H.Wb);
			a.b("memoization.parseMemoText", a.H.Lb);
			a.b("memoization.unmemoizeDomNodeAndDescendants", a.H.Xb);
			a.Sa = {
				throttle: function(b, d) {
					b.throttleEvaluation = d;
					var c = null;
					return a.j({
						read: b,
						write: function(a) {
							clearTimeout(c);
							c = setTimeout(function() { b(a); }, d);
						}
					});
				},
				rateLimit: function(a, d) {
					var c, e, f;
					"number" == typeof d ? c = d : (c = d.timeout, e = d.method);
					f = "notifyWhenChangesStop" == e ? S : R;
					a.Za(function(a) { return f(a, c); });
				},
				notify: function(a, d) {
					a.equalityComparer =
						"always" == d ? null : J;
				}
			};
			var Q = { undefined: 1, "boolean": 1, number: 1, string: 1 };
			a.b("extenders", a.Sa);
			a.Ub = function(b, d, c) {
				this.da = b;
				this.La = d;
				this.hc = c;
				this.Gb = !1;
				a.D(this, "dispose", this.p);
			};
			a.Ub.prototype.p = function() {
				this.Gb = !0;
				this.hc();
			};
			a.Q = function() {
				a.a.Ga(this, a.Q.fn);
				this.G = {};
				this.rb = 1;
			};
			var z = {
				U: function(b, d, c) {
					var e = this;
					c = c || "change";
					var f = new a.Ub(e, d ? b.bind(d) : b, function() {
						a.a.ya(e.G[c], f);
						e.ua && e.ua(c);
					});
					e.ja && e.ja(c);
					e.G[c] || (e.G[c] = []);
					e.G[c].push(f);
					return f;
				},
				notifySubscribers: function(b,
											d) {
					d = d || "change";
					"change" === d && this.Yb();
					if (this.Ba(d)) {
						try {
							a.k.xb();
							for (var c = this.G[d].slice(0), e = 0, f; f = c[e]; ++e) {
								f.Gb || f.La(b);
							}
						} finally {
							a.k.end();
						}
					}
				},
				Aa: function() { return this.rb; },
				pc: function(a) { return this.Aa() !== a; },
				Yb: function() { ++this.rb; },
				Za: function(b) {
					var d = this, c = a.F(d), e, f, k;
					d.ta || (d.ta = d.notifySubscribers, d.notifySubscribers = function(a, b) { b && "change" !== b ? "beforeChange" === b ? d.pb(a) : d.ta(a, b) : d.qb(a); });
					var h = b(function() {
						c && k === d && (k = d());
						e = !1;
						d.Wa(f, k) && d.ta(f = k);
					});
					d.qb = function(a) {
						e = !0;
						k = a;
						h();
					};
					d.pb = function(a) { e || (f = a, d.ta(a, "beforeChange")); };
				},
				Ba: function(a) { return this.G[a] && this.G[a].length; },
				nc: function(b) {
					if (b) {
						return this.G[b] && this.G[b].length || 0;
					}
					var d = 0;
					a.a.A(this.G, function(a, b) { d += b.length; });
					return d;
				},
				Wa: function(a, d) { return !this.equalityComparer || !this.equalityComparer(a, d); },
				extend: function(b) {
					var d = this;
					b && a.a.A(b, function(b, e) {
						var f = a.Sa[b];
						"function" == typeof f && (d = f(d, e) || d);
					});
					return d;
				}
			};
			a.D(z, "subscribe", z.U);
			a.D(z, "extend", z.extend);
			a.D(z, "getSubscriptionsCount", z.nc);
			a.a.za && a.a.Fa(z, Function.prototype);
			a.Q.fn = z;
			a.Hb = function(a) { return null != a && "function" == typeof a.U && "function" == typeof a.notifySubscribers; };
			a.b("subscribable", a.Q);
			a.b("isSubscribable", a.Hb);
			a.Z = a.k = function() {
				function b(a) {
					c.push(e);
					e = a;
				}

				function d() { e = c.pop(); }

				var c = [], e, f = 0;
				return {
					xb: b,
					end: d,
					Ob: function(b) {
						if (e) {
							if (!a.Hb(b)) {
								throw Error("Only subscribable things can act as dependencies");
							}
							e.La(b, b.ac || (b.ac = ++f));
						}
					},
					u: function(a, c, e) {
						try {
							return b(), a.apply(c, e || []);
						} finally {
							d();
						}
					},
					oa: function() {
						if (e) {
							return e.w.oa();
						}
					},
					Ca: function() {
						if (e) {
							return e.Ca;
						}
					}
				};
			}();
			a.b("computedContext", a.Z);
			a.b("computedContext.getDependenciesCount", a.Z.oa);
			a.b("computedContext.isInitial", a.Z.Ca);
			a.b("computedContext.isSleeping", a.Z.Jc);
			a.b("ignoreDependencies", a.Gc = a.k.u);
			a.r = function(b) {
				function d() {
					if (0 < arguments.length) {
						return d.Wa(c, arguments[0]) && (d.X(), c = arguments[0], d.W()), this;
					}
					a.k.Ob(d);
					return c;
				}

				var c = b;
				a.Q.call(d);
				a.a.Ga(d, a.r.fn);
				d.B = function() { return c; };
				d.W = function() { d.notifySubscribers(c); };
				d.X = function() {
					d.notifySubscribers(c,
						"beforeChange");
				};
				a.D(d, "peek", d.B);
				a.D(d, "valueHasMutated", d.W);
				a.D(d, "valueWillMutate", d.X);
				return d;
			};
			a.r.fn = { equalityComparer: J };
			var H = a.r.Ac = "__ko_proto__";
			a.r.fn[H] = a.r;
			a.a.za && a.a.Fa(a.r.fn, a.Q.fn);
			a.Ta = function(b, d) { return null === b || b === p || b[H] === p ? !1 : b[H] === d ? !0 : a.Ta(b[H], d); };
			a.F = function(b) { return a.Ta(b, a.r); };
			a.Da = function(b) { return "function" == typeof b && b[H] === a.r || "function" == typeof b && b[H] === a.j && b.qc ? !0 : !1; };
			a.b("observable", a.r);
			a.b("isObservable", a.F);
			a.b("isWriteableObservable", a.Da);
			a.b("isWritableObservable", a.Da);
			a.ba = function(b) {
				b = b || [];
				if ("object" != typeof b || !("length" in b)) {
					throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
				}
				b = a.r(b);
				a.a.Ga(b, a.ba.fn);
				return b.extend({ trackArrayChanges: !0 });
			};
			a.ba.fn = {
				remove: function(b) {
					for (var d = this.B(), c = [], e = "function" != typeof b || a.F(b) ? function(a) { return a === b; } : b, f = 0; f < d.length; f++) {
						var k = d[f];
						e(k) && (0 === c.length && this.X(), c.push(k), d.splice(f, 1), f--);
					}
					c.length && this.W();
					return c;
				},
				removeAll: function(b) {
					if (b === p) {
						var d = this.B(), c = d.slice(0);
						this.X();
						d.splice(0, d.length);
						this.W();
						return c;
					}
					return b ? this.remove(function(c) { return 0 <= a.a.m(b, c); }) : [];
				},
				destroy: function(b) {
					var d = this.B(), c = "function" != typeof b || a.F(b) ? function(a) { return a === b; } : b;
					this.X();
					for (var e = d.length - 1; 0 <= e; e--) {
						c(d[e]) && (d[e]._destroy = !0);
					}
					this.W();
				},
				destroyAll: function(b) { return b === p ? this.destroy(function() { return !0; }) : b ? this.destroy(function(d) { return 0 <= a.a.m(b, d); }) : []; },
				indexOf: function(b) {
					var d = this();
					return a.a.m(d,
						b);
				},
				replace: function(a, d) {
					var c = this.indexOf(a);
					0 <= c && (this.X(), this.B()[c] = d, this.W());
				}
			};
			a.a.o("pop push reverse shift sort splice unshift".split(" "), function(b) {
				a.ba.fn[b] = function() {
					var a = this.B();
					this.X();
					this.yb(a, b, arguments);
					a = a[b].apply(a, arguments);
					this.W();
					return a;
				};
			});
			a.a.o(["slice"], function(b) {
				a.ba.fn[b] = function() {
					var a = this();
					return a[b].apply(a, arguments);
				};
			});
			a.a.za && a.a.Fa(a.ba.fn, a.r.fn);
			a.b("observableArray", a.ba);
			a.Sa.trackArrayChanges = function(b) {
				function d() {
					if (!c) {
						c = !0;
						var g =
							b.notifySubscribers;
						b.notifySubscribers = function(a, b) {
							b && "change" !== b || ++k;
							return g.apply(this, arguments);
						};
						var d = [].concat(b.B() || []);
						e = null;
						f = b.U(function(c) {
							c = [].concat(c || []);
							if (b.Ba("arrayChange")) {
								var g;
								if (!e || 1 < k) {
									e = a.a.Ma(d, c, { sparse: !0 });
								}
								g = e;
							}
							d = c;
							e = null;
							k = 0;
							g && g.length && b.notifySubscribers(g, "arrayChange");
						});
					}
				}

				if (!b.yb) {
					var c = !1, e = null, f, k = 0, h = b.ja, l = b.ua;
					b.ja = function(a) {
						h && h.call(b, a);
						"arrayChange" === a && d();
					};
					b.ua = function(a) {
						l && l.call(b, a);
						"arrayChange" !== a || b.Ba("arrayChange") || (f.p(), c = !1);
					};
					b.yb = function(b, d, f) {
						function l(a, b, c) { return h[h.length] = { status: a, value: b, index: c }; }

						if (c && !k) {
							var h = [], r = b.length, v = f.length, t = 0;
							switch (d) {
								case "push":
									t = r;
								case "unshift":
									for (d = 0; d < v; d++) {
										l("added", f[d], t + d);
									}
									break;
								case "pop":
									t = r - 1;
								case "shift":
									r && l("deleted", b[t], t);
									break;
								case "splice":
									d = Math.min(Math.max(0, 0 > f[0] ? r + f[0] : f[0]), r);
									for (var r = 1 === v ? r : Math.min(d + (f[1] || 0), r), v = d + v - 2, t = Math.max(r, v), G = [], A = [], p = 2; d < t; ++d, ++p) {
										d < r && A.push(l("deleted", b[d], d)), d < v && G.push(l("added", f[p], d));
									}
									a.a.Cb(A, G);
									break;
								default:
									return;
							}
							e = h;
						}
					};
				}
			};
			a.w = a.j = function(b, d, c) {
				function e(a, b, c) {
					if (I && b === g) {
						throw Error("A 'pure' computed must not be called recursively");
					}
					B[a] = c;
					c.sa = F++;
					c.ea = b.Aa();
				}

				function f() {
					var a, b;
					for (a in B) {
						if (B.hasOwnProperty(a) && (b = B[a], b.da.pc(b.ea))) {
							return !0;
						}
					}
				}

				function k() {
					!s && B && a.a.A(B, function(a, b) { b.p && b.p(); });
					B = null;
					F = 0;
					G = !0;
					s = r = !1;
				}

				function h() {
					var a = g.throttleEvaluation;
					a && 0 <= a ? (clearTimeout(z), z = setTimeout(function() { l(!0); }, a)) : g.nb ? g.nb() : l(!0);
				}

				function l(b) {
					if (!v && !G) {
						if (y && y()) {
							if (!t) {
								w();
								return;
							}
						} else {
							t =
								!1;
						}
						v = !0;
						try {
							var c = B, m = F, f = I ? p : !F;
							a.k.xb({ La: function(a, b) { G || (m && c[b] ? (e(b, a, c[b]), delete c[b], --m) : B[b] || e(b, a, s ? { da: a } : a.U(h))); }, w: g, Ca: f });
							B = {};
							F = 0;
							try {
								var l = d ? A.call(d) : A();
							} finally {
								a.k.end(), m && !s && a.a.A(c, function(a, b) { b.p && b.p(); }), r = !1;
							}
							g.Wa(n, l) && (s || q(n, "beforeChange"), n = l, s ? g.Yb() : b && q(n));
							f && q(n, "awake");
						} finally {
							v = !1;
						}
						F || w();
					}
				}

				function g() {
					if (0 < arguments.length) {
						if ("function" === typeof C) {
							C.apply(d, arguments);
						} else {
							throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
						}
						return this;
					}
					a.k.Ob(g);
					(r || s && f()) && l();
					return n;
				}

				function m() {
					(r && !F || s && f()) && l();
					return n;
				}

				function x() { return r || 0 < F; }

				function q(a, b) { g.notifySubscribers(a, b); }

				var n, r = !0, v = !1, t = !1, G = !1, A = b, I = !1, s = !1;
				A && "object" == typeof A ? (c = A, A = c.read) : (c = c || {}, A || (A = c.read));
				if ("function" != typeof A) {
					throw Error("Pass a function that returns the value of the ko.computed");
				}
				var C = c.write, D = c.disposeWhenNodeIsRemoved || c.q || null, u = c.disposeWhen || c.Pa, y = u, w = k, B = {}, F = 0, z = null;
				d || (d = c.owner);
				a.Q.call(g);
				a.a.Ga(g, a.j.fn);
				g.B = m;
				g.oa = function() { return F; };
				g.qc = "function" === typeof C;
				g.p = function() { w(); };
				g.$ = x;
				var T = g.Za;
				g.Za = function(a) {
					T.call(g, a);
					g.nb = function() {
						g.pb(n);
						r = !0;
						g.qb(g);
					};
				};
				c.pure ? (s = I = !0, g.ja = function(b) {
					if (!G && s && "change" == b) {
						s = !1;
						if (r || f()) {
							B = null, F = 0, r = !0, l();
						} else {
							var c = [];
							a.a.A(B, function(a, b) { c[b.sa] = a; });
							a.a.o(c, function(a, b) {
								var c = B[a], g = c.da.U(h);
								g.sa = b;
								g.ea = c.ea;
								B[a] = g;
							});
						}
						G || q(n, "awake");
					}
				}, g.ua = function(b) {
					G || "change" != b || g.Ba("change") || (a.a.A(B, function(a, b) { b.p && (B[a] = { da: b.da, sa: b.sa, ea: b.ea }, b.p()); }),
						s = !0, q(p, "asleep"));
				}, g.bc = g.Aa, g.Aa = function() {
					s && (r || f()) && l();
					return g.bc();
				}) : c.deferEvaluation && (g.ja = function(a) { "change" != a && "beforeChange" != a || m(); });
				a.D(g, "peek", g.B);
				a.D(g, "dispose", g.p);
				a.D(g, "isActive", g.$);
				a.D(g, "getDependenciesCount", g.oa);
				D && (t = !0, D.nodeType && (y = function() { return !a.a.Qa(D) || u && u(); }));
				s || c.deferEvaluation || l();
				D && x() && D.nodeType && (w = function() {
					a.a.C.Pb(D, w);
					k();
				}, a.a.C.fa(D, w));
				return g;
			};
			a.sc = function(b) { return a.Ta(b, a.j); };
			z = a.r.Ac;
			a.j[z] = a.r;
			a.j.fn = { equalityComparer: J };
			a.j.fn[z] = a.j;
			a.a.za && a.a.Fa(a.j.fn, a.Q.fn);
			a.b("dependentObservable", a.j);
			a.b("computed", a.j);
			a.b("isComputed", a.sc);
			a.Nb = function(b, d) {
				if ("function" === typeof b) {
					return a.w(b, d, { pure: !0 });
				}
				b = a.a.extend({}, b);
				b.pure = !0;
				return a.w(b, d);
			};
			a.b("pureComputed", a.Nb);
			(function() {
				function b(a, f, k) {
					k = k || new c;
					a = f(a);
					if ("object" != typeof a || null === a || a === p || a instanceof Date || a instanceof String || a instanceof Number || a instanceof Boolean) {
						return a;
					}
					var h = a instanceof Array ? [] : {};
					k.save(a, h);
					d(a, function(c) {
						var g =
							f(a[c]);
						switch (typeof g) {
							case "boolean":
							case "number":
							case "string":
							case "function":
								h[c] = g;
								break;
							case "object":
							case "undefined":
								var d = k.get(g);
								h[c] = d !== p ? d : b(g, f, k);
						}
					});
					return h;
				}

				function d(a, b) {
					if (a instanceof Array) {
						for (var c = 0; c < a.length; c++) {
							b(c);
						}
						"function" == typeof a.toJSON && b("toJSON");
					} else {
						for (c in a) {
							b(c);
						}
					}
				}

				function c() {
					this.keys = [];
					this.mb = [];
				}

				a.Vb = function(c) {
					if (0 == arguments.length) {
						throw Error("When calling ko.toJS, pass the object you want to convert.");
					}
					return b(c, function(b) {
						for (var c = 0; a.F(b) &&
							10 > c; c++) {
							b = b();
						}
						return b;
					});
				};
				a.toJSON = function(b, c, d) {
					b = a.Vb(b);
					return a.a.jb(b, c, d);
				};
				c.prototype = {
					save: function(b, c) {
						var d = a.a.m(this.keys, b);
						0 <= d ? this.mb[d] = c : (this.keys.push(b), this.mb.push(c));
					},
					get: function(b) {
						b = a.a.m(this.keys, b);
						return 0 <= b ? this.mb[b] : p;
					}
				};
			})();
			a.b("toJS", a.Vb);
			a.b("toJSON", a.toJSON);
			(function() {
				a.i = {
					s: function(b) {
						switch (a.a.v(b)) {
							case "option":
								return !0 === b.__ko__hasDomDataOptionValue__ ? a.a.f.get(b, a.d.options.ab) : 7 >= a.a.M ? b.getAttributeNode("value") && b.getAttributeNode("value").specified ?
									b.value : b.text : b.value;
							case "select":
								return 0 <= b.selectedIndex ? a.i.s(b.options[b.selectedIndex]) : p;
							default:
								return b.value;
						}
					},
					Y: function(b, d, c) {
						switch (a.a.v(b)) {
							case "option":
								switch (typeof d) {
									case "string":
										a.a.f.set(b, a.d.options.ab, p);
										"__ko__hasDomDataOptionValue__" in b && delete b.__ko__hasDomDataOptionValue__;
										b.value = d;
										break;
									default:
										a.a.f.set(b, a.d.options.ab, d), b.__ko__hasDomDataOptionValue__ = !0, b.value = "number" === typeof d ? d : "";
								}
								break;
							case "select":
								if ("" === d || null === d) {
									d = p;
								}
								for (var e = -1,
										f = 0,
										k = b.options.length,
										h; f < k; ++f) {
									if (h = a.i.s(b.options[f]), h == d || "" == h && d === p) {
										e = f;
										break;
									}
								}
								if (c || 0 <= e || d === p && 1 < b.size) {
									b.selectedIndex = e;
								}
								break;
							default:
								if (null === d || d === p) {
									d = "";
								}
								b.value = d;
						}
					}
				};
			})();
			a.b("selectExtensions", a.i);
			a.b("selectExtensions.readValue", a.i.s);
			a.b("selectExtensions.writeValue", a.i.Y);
			a.h = function() {
				function b(b) {
					b = a.a.ib(b);
					123 === b.charCodeAt(0) && (b = b.slice(1, -1));
					var c = [], d = b.match(e), x, h = [], n = 0;
					if (d) {
						d.push(",");
						for (var r = 0, v; v = d[r]; ++r) {
							var t = v.charCodeAt(0);
							if (44 === t) {
								if (0 >= n) {
									c.push(x && h.length ? {
										key: x,
										value: h.join("")
									} : { unknown: x || h.join("") });
									x = n = 0;
									h = [];
									continue;
								}
							} else if (58 === t) {
								if (!n && !x && 1 === h.length) {
									x = h.pop();
									continue;
								}
							} else {
								47 === t && r && 1 < v.length ? (t = d[r - 1].match(f)) && !k[t[0]] && (b = b.substr(b.indexOf(v) + 1), d = b.match(e), d.push(","), r = -1, v = "/") : 40 === t || 123 === t || 91 === t ? ++n : 41 === t || 125 === t || 93 === t ? --n : x || h.length || 34 !== t && 39 !== t || (v = v.slice(1, -1));
							}
							h.push(v);
						}
					}
					return c;
				}

				var d = ["true", "false", "null", "undefined"],
					c = /^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,
					e = RegExp("\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|/(?:[^/\\\\]|\\\\.)*/w*|[^\\s:,/][^,\"'{}()/:[\\]]*[^\\s,\"'{}()/:[\\]]|[^\\s]",
						"g"),
					f = /[\])"'A-Za-z0-9_$]+$/,
					k = { "in": 1, "return": 1, "typeof": 1 },
					h = {};
				return {
					ka: [],
					V: h,
					bb: b,
					Ea: function(e, g) {
						function m(b, g) {
							var e;
							if (!r) {
								var l = a.getBindingHandler(b);
								if (l && l.preprocess && !(g = l.preprocess(g, b, m))) {
									return;
								}
								if (l = h[b]) {
									e = g, 0 <= a.a.m(d, e) ? e = !1 : (l = e.match(c), e = null === l ? !1 : l[1] ? "Object(" + l[1] + ")" + l[2] : e), l = e;
								}
								l && k.push("'" + b + "':function(_z){" + e + "=_z}");
							}
							n && (g = "function(){return " + g + " }");
							f.push("'" + b + "':" + g);
						}

						g = g || {};
						var f = [], k = [], n = g.valueAccessors, r = g.bindingParams, v = "string" === typeof e ? b(e) : e;
						a.a.o(v, function(a) { m(a.key || a.unknown, a.value); });
						k.length && m("_ko_property_writers", "{" + k.join(",") + " }");
						return f.join(",");
					},
					vc: function(a, b) {
						for (var c = 0; c < a.length; c++) {
							if (a[c].key == b) {
								return !0;
							}
						}
						return !1;
					},
					ra: function(b, c, d, e, f) {
						if (b && a.F(b)) {
							!a.Da(b) || f && b.B() === e || b(e);
						} else if ((b = c.get("_ko_property_writers")) && b[d]) {
							b[d](e);
						}
					}
				};
			}();
			a.b("expressionRewriting", a.h);
			a.b("expressionRewriting.bindingRewriteValidators", a.h.ka);
			a.b("expressionRewriting.parseObjectLiteral", a.h.bb);
			a.b("expressionRewriting.preProcessBindings",
				a.h.Ea);
			a.b("expressionRewriting._twoWayBindings", a.h.V);
			a.b("jsonExpressionRewriting", a.h);
			a.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson", a.h.Ea);
			(function() {
				function b(a) { return 8 == a.nodeType && k.test(f ? a.text : a.nodeValue); }

				function d(a) { return 8 == a.nodeType && h.test(f ? a.text : a.nodeValue); }

				function c(a, c) {
					for (var e = a, f = 1, l = []; e = e.nextSibling;) {
						if (d(e) && (f--, 0 === f)) {
							return l;
						}
						l.push(e);
						b(e) && f++;
					}
					if (!c) {
						throw Error("Cannot find closing comment tag to match: " + a.nodeValue);
					}
					return null;
				}

				function e(a,
							b) {
					var d = c(a, b);
					return d ? 0 < d.length ? d[d.length - 1].nextSibling : a.nextSibling : null;
				}

				var f = w && "\x3c!--test--\x3e" === w.createComment("test").text, k = f ? /^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/ : /^\s*ko(?:\s+([\s\S]+))?\s*$/, h = f ? /^\x3c!--\s*\/ko\s*--\x3e$/ : /^\s*\/ko\s*$/, l = { ul: !0, ol: !0 };
				a.e = {
					R: {},
					childNodes: function(a) { return b(a) ? c(a) : a.childNodes; },
					ma: function(c) {
						if (b(c)) {
							c = a.e.childNodes(c);
							for (var d = 0, e = c.length; d < e; d++) {
								a.removeNode(c[d]);
							}
						} else {
							a.a.Ra(c);
						}
					},
					T: function(c, d) {
						if (b(c)) {
							a.e.ma(c);
							for (var e = c.nextSibling,
									f = 0,
									l = d.length; f < l; f++) {
								e.parentNode.insertBefore(d[f], e);
							}
						} else {
							a.a.T(c, d);
						}
					},
					Mb: function(a, c) { b(a) ? a.parentNode.insertBefore(c, a.nextSibling) : a.firstChild ? a.insertBefore(c, a.firstChild) : a.appendChild(c); },
					Fb: function(c, d, e) { e ? b(c) ? c.parentNode.insertBefore(d, e.nextSibling) : e.nextSibling ? c.insertBefore(d, e.nextSibling) : c.appendChild(d) : a.e.Mb(c, d); },
					firstChild: function(a) { return b(a) ? !a.nextSibling || d(a.nextSibling) ? null : a.nextSibling : a.firstChild; },
					nextSibling: function(a) {
						b(a) && (a = e(a));
						return a.nextSibling &&
							d(a.nextSibling) ? null : a.nextSibling;
					},
					oc: b,
					Fc: function(a) { return (a = (f ? a.text : a.nodeValue).match(k)) ? a[1] : null; },
					Kb: function(c) {
						if (l[a.a.v(c)]) {
							var m = c.firstChild;
							if (m) {
								do {
									if (1 === m.nodeType) {
										var f;
										f = m.firstChild;
										var h = null;
										if (f) {
											do {
												if (h) {
													h.push(f);
												} else if (b(f)) {
													var k = e(f, !0);
													k ? f = k : h = [f];
												} else {
													d(f) && (h = [f]);
												}
											} while (f = f.nextSibling);
										}
										if (f = h) {
											for (h = m.nextSibling, k = 0; k < f.length; k++) {
												h ? c.insertBefore(f[k], h) : c.appendChild(f[k]);
											}
										}
									}
								} while (m = m.nextSibling);
							}
						}
					}
				};
			})();
			a.b("virtualElements", a.e);
			a.b("virtualElements.allowedBindings",
				a.e.R);
			a.b("virtualElements.emptyNode", a.e.ma);
			a.b("virtualElements.insertAfter", a.e.Fb);
			a.b("virtualElements.prepend", a.e.Mb);
			a.b("virtualElements.setDomNodeChildren", a.e.T);
			(function() {
				a.L = function() { this.ec = {}; };
				a.a.extend(a.L.prototype, {
					nodeHasBindings: function(b) {
						switch (b.nodeType) {
							case 1:
								return null != b.getAttribute("data-bind") || a.g.getComponentNameForNode(b);
							case 8:
								return a.e.oc(b);
							default:
								return !1;
						}
					},
					getBindings: function(b, d) {
						var c = this.getBindingsString(b, d),
							c = c ? this.parseBindingsString(c,
								d, b) : null;
						return a.g.sb(c, b, d, !1);
					},
					getBindingAccessors: function(b, d) {
						var c = this.getBindingsString(b, d), c = c ? this.parseBindingsString(c, d, b, { valueAccessors: !0 }) : null;
						return a.g.sb(c, b, d, !0);
					},
					getBindingsString: function(b) {
						switch (b.nodeType) {
							case 1:
								return b.getAttribute("data-bind");
							case 8:
								return a.e.Fc(b);
							default:
								return null;
						}
					},
					parseBindingsString: function(b, d, c, e) {
						try {
							var f = this.ec, k = b + (e && e.valueAccessors || ""), h;
							if (!(h = f[k])) {
								var l, g = "with($context){with($data||{}){return{" + a.h.Ea(b, e) + "}}}";
								l = new Function("$context",
									"$element", g);
								h = f[k] = l;
							}
							return h(d, c);
						} catch (m) {
							throw m.message = "Unable to parse bindings.\nBindings value: " + b + "\nMessage: " + m.message, m;
						}
					}
				});
				a.L.instance = new a.L;
			})();
			a.b("bindingProvider", a.L);
			(function() {
				function b(a) { return function() { return a; }; }

				function d(a) { return a(); }

				function c(b) { return a.a.pa(a.k.u(b), function(a, c) { return function() { return b()[c]; }; }); }

				function e(d, g, e) { return "function" === typeof d ? c(d.bind(null, g, e)) : a.a.pa(d, b); }

				function f(a, b) { return c(this.getBindings.bind(this, a, b)); }

				function k(b,
							c, d) {
					var g, e = a.e.firstChild(c), f = a.L.instance, m = f.preprocessNode;
					if (m) {
						for (; g = e;) {
							e = a.e.nextSibling(g), m.call(f, g);
						}
						e = a.e.firstChild(c);
					}
					for (; g = e;) {
						e = a.e.nextSibling(g), h(b, g, d);
					}
				}

				function h(b, c, d) {
					var e = !0, f = 1 === c.nodeType;
					f && a.e.Kb(c);
					if (f && d || a.L.instance.nodeHasBindings(c)) {
						e = g(c, null, b, d).shouldBindDescendants;
					}
					e && !x[a.a.v(c)] && k(b, c, !f);
				}

				function l(b) {
					var c = [], d = {}, g = [];
					a.a.A(b, function I(e) {
						if (!d[e]) {
							var f = a.getBindingHandler(e);
							f && (f.after && (g.push(e), a.a.o(f.after, function(c) {
								if (b[c]) {
									if (-1 !== a.a.m(g,
										c)) {
										throw Error("Cannot combine the following bindings, because they have a cyclic dependency: " + g.join(", "));
									}
									I(c);
								}
							}), g.length--), c.push({ key: e, Eb: f }));
							d[e] = !0;
						}
					});
					return c;
				}

				function g(b, c, g, e) {
					var m = a.a.f.get(b, q);
					if (!c) {
						if (m) {
							throw Error("You cannot apply bindings multiple times to the same element.");
						}
						a.a.f.set(b, q, !0);
					}
					!m && e && a.Tb(b, g);
					var h;
					if (c && "function" !== typeof c) {
						h = c;
					} else {
						var k = a.L.instance,
							x = k.getBindingAccessors || f,
							n = a.j(function() {
								(h = c ? c(g, b) : x.call(k, b, g)) && g.K && g.K();
								return h;
							}, null, { q: b });
						h && n.$() || (n = null);
					}
					var u;
					if (h) {
						var w = n ? function(a) { return function() { return d(n()[a]); }; } : function(a) { return h[a]; }, y = function() { return a.a.pa(n ? n() : h, d); };
						y.get = function(a) { return h[a] && d(w(a)); };
						y.has = function(a) { return a in h; };
						e = l(h);
						a.a.o(e, function(c) {
							var d = c.Eb.init, e = c.Eb.update, f = c.key;
							if (8 === b.nodeType && !a.e.R[f]) {
								throw Error("The binding '" + f + "' cannot be used with virtual elements");
							}
							try {
								"function" == typeof d && a.k.u(function() {
									var a = d(b, w(f), y, g.$data, g);
									if (a && a.controlsDescendantBindings) {
										if (u !==
											p) {
											throw Error("Multiple bindings (" + u + " and " + f + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
										}
										u = f;
									}
								}), "function" == typeof e && a.j(function() { e(b, w(f), y, g.$data, g); }, null, { q: b });
							} catch (m) {
								throw m.message = 'Unable to process binding "' + f + ": " + h[f] + '"\nMessage: ' + m.message, m;
							}
						});
					}
					return { shouldBindDescendants: u === p };
				}

				function m(b) { return b && b instanceof a.N ? b : new a.N(b); }

				a.d = {};
				var x = { script: !0, textarea: !0 };
				a.getBindingHandler = function(b) { return a.d[b]; };
				a.N = function(b, c, d, g) {
					var e = this,
						f = "function" == typeof b && !a.F(b),
						m,
						l = a.j(function() {
							var m = f ? b() : b, h = a.a.c(m);
							c ? (c.K && c.K(), a.a.extend(e, c), l && (e.K = l)) : (e.$parents = [], e.$root = h, e.ko = a);
							e.$rawData = m;
							e.$data = h;
							d && (e[d] = h);
							g && g(e, c, h);
							return e.$data;
						}, null, { Pa: function() { return m && !a.a.tb(m); }, q: !0 });
					l.$() && (e.K = l, l.equalityComparer = null, m = [], l.Zb = function(b) {
						m.push(b);
						a.a.C.fa(b, function(b) {
							a.a.ya(m, b);
							m.length || (l.p(), e.K = l = p);
						});
					});
				};
				a.N.prototype.createChildContext = function(b, c, d) {
					return new a.N(b, this,
						c, function(a, b) {
							a.$parentContext = b;
							a.$parent = b.$data;
							a.$parents = (b.$parents || []).slice(0);
							a.$parents.unshift(a.$parent);
							d && d(a);
						});
				};
				a.N.prototype.extend = function(b) {
					return new a.N(this.K || this.$data, this, null, function(c, d) {
						c.$rawData = d.$rawData;
						a.a.extend(c, "function" == typeof b ? b() : b);
					});
				};
				var q = a.a.f.I(), n = a.a.f.I();
				a.Tb = function(b, c) {
					if (2 == arguments.length) {
						a.a.f.set(b, n, c), c.K && c.K.Zb(b);
					} else {
						return a.a.f.get(b, n);
					}
				};
				a.va = function(b, c, d) {
					1 === b.nodeType && a.e.Kb(b);
					return g(b, c, m(d), !0);
				};
				a.cc = function(b,
								c, d) {
					d = m(d);
					return a.va(b, e(c, d, b), d);
				};
				a.Ja = function(a, b) { 1 !== b.nodeType && 8 !== b.nodeType || k(m(a), b, !0); };
				a.ub = function(a, b) {
					!u && y.jQuery && (u = y.jQuery);
					if (b && 1 !== b.nodeType && 8 !== b.nodeType) {
						throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");
					}
					b = b || y.document.body;
					h(m(a), b, !0);
				};
				a.Oa = function(b) {
					switch (b.nodeType) {
						case 1:
						case 8:
							var c = a.Tb(b);
							if (c) {
								return c;
							}
							if (b.parentNode) {
								return a.Oa(b.parentNode);
							}
					}
					return p;
				};
				a.gc = function(b) {
					return (b = a.Oa(b)) ?
						b.$data : p;
				};
				a.b("bindingHandlers", a.d);
				a.b("applyBindings", a.ub);
				a.b("applyBindingsToDescendants", a.Ja);
				a.b("applyBindingAccessorsToNode", a.va);
				a.b("applyBindingsToNode", a.cc);
				a.b("contextFor", a.Oa);
				a.b("dataFor", a.gc);
			})();
			(function(b) {
				function d(d, e) {
					var g = f.hasOwnProperty(d) ? f[d] : b, m;
					g ? g.U(e) : (g = f[d] = new a.Q, g.U(e), c(d, function(a, b) {
						var c = !(!b || !b.synchronous);
						k[d] = { definition: a, tc: c };
						delete f[d];
						m || c ? g.notifySubscribers(a) : setTimeout(function() { g.notifySubscribers(a); }, 0);
					}), m = !0);
				}

				function c(a, b) {
					e("getConfig",
					[a], function(c) { c ? e("loadComponent", [a, c], function(a) { b(a, c); }) : b(null, null); });
				}

				function e(c, d, g, f) {
					f || (f = a.g.loaders.slice(0));
					var k = f.shift();
					if (k) {
						var q = k[c];
						if (q) {
							var n = !1;
							if (q.apply(k, d.concat(function(a) { n ? g(null) : null !== a ? g(a) : e(c, d, g, f); })) !== b && (n = !0, !k.suppressLoaderExceptions)) {
								throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");
							}
						} else {
							e(c, d, g, f);
						}
					} else {
						g(null);
					}
				}

				var f = {}, k = {};
				a.g = {
					get: function(c, e) {
						var g = k.hasOwnProperty(c) ? k[c] :
							b;
						g ? g.tc ? a.k.u(function() { e(g.definition); }) : setTimeout(function() { e(g.definition); }, 0) : d(c, e);
					},
					zb: function(a) { delete k[a]; },
					ob: e
				};
				a.g.loaders = [];
				a.b("components", a.g);
				a.b("components.get", a.g.get);
				a.b("components.clearCachedDefinition", a.g.zb);
			})();
			(function() {
				function b(b, c, d, e) {
					function k() { 0 === --v && e(h); }

					var h = {}, v = 2, t = d.template;
					d = d.viewModel;
					t ? f(c, t, function(c) {
						a.g.ob("loadTemplate", [b, c], function(a) {
							h.template = a;
							k();
						});
					}) : k();
					d ? f(c, d, function(c) {
							a.g.ob("loadViewModel", [b, c], function(a) {
								h[l] = a;
								k();
							});
						}) :
						k();
				}

				function d(a, b, c) {
					if ("function" === typeof b) {
						c(function(a) { return new b(a); });
					} else if ("function" === typeof b[l]) {
						c(b[l]);
					} else if ("instance" in b) {
						var e = b.instance;
						c(function() { return e; });
					} else {
						"viewModel" in b ? d(a, b.viewModel, c) : a("Unknown viewModel value: " + b);
					}
				}

				function c(b) {
					switch (a.a.v(b)) {
						case "script":
							return a.a.ca(b.text);
						case "textarea":
							return a.a.ca(b.value);
						case "template":
							if (e(b.content)) {
								return a.a.la(b.content.childNodes);
							}
					}
					return a.a.la(b.childNodes);
				}

				function e(a) {
					return y.DocumentFragment ? a instanceof
						DocumentFragment : a && 11 === a.nodeType;
				}

				function f(a, b, c) { "string" === typeof b.require ? O || y.require ? (O || y.require)([b.require], c) : a("Uses require, but no AMD loader is present") : c(b); }

				function k(a) { return function(b) { throw Error("Component '" + a + "': " + b); }; }

				var h = {};
				a.g.register = function(b, c) {
					if (!c) {
						throw Error("Invalid configuration for " + b);
					}
					if (a.g.Xa(b)) {
						throw Error("Component " + b + " is already registered");
					}
					h[b] = c;
				};
				a.g.Xa = function(a) { return a in h; };
				a.g.Ec = function(b) {
					delete h[b];
					a.g.zb(b);
				};
				a.g.Ab = {
					getConfig: function(a,
										b) { b(h.hasOwnProperty(a) ? h[a] : null); },
					loadComponent: function(a, c, d) {
						var e = k(a);
						f(e, c, function(c) { b(a, e, c, d); });
					},
					loadTemplate: function(b, d, f) {
						b = k(b);
						if ("string" === typeof d) {
							f(a.a.ca(d));
						} else if (d instanceof Array) {
							f(d);
						} else if (e(d)) {
							f(a.a.O(d.childNodes));
						} else if (d.element) {
							if (d = d.element, y.HTMLElement ? d instanceof HTMLElement : d && d.tagName && 1 === d.nodeType) {
								f(c(d));
							} else if ("string" === typeof d) {
								var l = w.getElementById(d);
								l ? f(c(l)) : b("Cannot find element with ID " + d);
							} else {
								b("Unknown element type: " + d);
							}
						} else {
							b("Unknown template value: " +
								d);
						}
					},
					loadViewModel: function(a, b, c) { d(k(a), b, c); }
				};
				var l = "createViewModel";
				a.b("components.register", a.g.register);
				a.b("components.isRegistered", a.g.Xa);
				a.b("components.unregister", a.g.Ec);
				a.b("components.defaultLoader", a.g.Ab);
				a.g.loaders.push(a.g.Ab);
				a.g.$b = h;
			})();
			(function() {
				function b(b, e) {
					var f = b.getAttribute("params");
					if (f) {
						var f = d.parseBindingsString(f, e, b, { valueAccessors: !0, bindingParams: !0 }),
							f = a.a.pa(f, function(d) { return a.w(d, null, { q: b }); }),
							k = a.a.pa(f, function(d) {
								var e = d.B();
								return d.$() ? a.w({
									read: function() { return a.a.c(d()); },
									write: a.Da(e) && function(a) { d()(a); },
									q: b
								}) : e;
							});
						k.hasOwnProperty("$raw") || (k.$raw = f);
						return k;
					}
					return { $raw: {} };
				}

				a.g.getComponentNameForNode = function(b) {
					b = a.a.v(b);
					return a.g.Xa(b) && b;
				};
				a.g.sb = function(c, d, f, k) {
					if (1 === d.nodeType) {
						var h = a.g.getComponentNameForNode(d);
						if (h) {
							c = c || {};
							if (c.component) {
								throw Error('Cannot use the "component" binding on a custom element matching a component');
							}
							var l = { name: h, params: b(d, f) };
							c.component = k ? function() { return l; } : l;
						}
					}
					return c;
				};
				var d = new a.L;
				9 > a.a.M && (a.g.register = function(a) {
					return function(b) {
						w.createElement(b);
						return a.apply(this, arguments);
					};
				}(a.g.register), w.createDocumentFragment = function(b) {
					return function() {
						var d = b(), f = a.g.$b, k;
						for (k in f) {
							f.hasOwnProperty(k) && d.createElement(k);
						}
						return d;
					};
				}(w.createDocumentFragment));
			})();
			(function(b) {
				function d(b, c, d) {
					c = c.template;
					if (!c) {
						throw Error("Component '" + b + "' has no template");
					}
					b = a.a.la(c);
					a.e.T(d, b);
				}

				function c(a, b, c, d) {
					var e = a.createViewModel;
					return e ? e.call(a, d, { element: b, templateNodes: c }) : d;
				}

				var e = 0;
				a.d.component = {
					init: function(f, k, h, l, g) {
						function m() {
							var a = x &&
								x.dispose;
							"function" === typeof a && a.call(x);
							q = null;
						}

						var x, q, n = a.a.O(a.e.childNodes(f));
						a.a.C.fa(f, m);
						a.w(function() {
							var l = a.a.c(k()), h, t;
							"string" === typeof l ? h = l : (h = a.a.c(l.name), t = a.a.c(l.params));
							if (!h) {
								throw Error("No component name specified");
							}
							var p = q = ++e;
							a.g.get(h, function(e) {
								if (q === p) {
									m();
									if (!e) {
										throw Error("Unknown component '" + h + "'");
									}
									d(h, e, f);
									var l = c(e, f, n, t);
									e = g.createChildContext(l, b, function(a) {
										a.$component = l;
										a.$componentTemplateNodes = n;
									});
									x = l;
									a.Ja(e, f);
								}
							});
						}, null, { q: f });
						return { controlsDescendantBindings: !0 };
					}
				};
				a.e.R.component = !0;
			})();
			var P = { "class": "className", "for": "htmlFor" };
			a.d.attr = {
				update: function(b, d) {
					var c = a.a.c(d()) || {};
					a.a.A(c, function(c, d) {
						d = a.a.c(d);
						var k = !1 === d || null === d || d === p;
						k && b.removeAttribute(c);
						8 >= a.a.M && c in P ? (c = P[c], k ? b.removeAttribute(c) : b[c] = d) : k || b.setAttribute(c, d.toString());
						"name" === c && a.a.Rb(b, k ? "" : d.toString());
					});
				}
			};
			(function() {
				a.d.checked = {
					after: ["value", "attr"],
					init: function(b, d, c) {
						function e() {
							var e = b.checked, f = x ? k() : e;
							if (!a.Z.Ca() && (!l || e)) {
								var h = a.k.u(d);
								g ? m !== f ? (e && (a.a.ga(h,
									f, !0), a.a.ga(h, m, !1)), m = f) : a.a.ga(h, f, e) : a.h.ra(h, c, "checked", f, !0);
							}
						}

						function f() {
							var c = a.a.c(d());
							b.checked = g ? 0 <= a.a.m(c, k()) : h ? c : k() === c;
						}

						var k = a.Nb(function() { return c.has("checkedValue") ? a.a.c(c.get("checkedValue")) : c.has("value") ? a.a.c(c.get("value")) : b.value; }), h = "checkbox" == b.type, l = "radio" == b.type;
						if (h || l) {
							var g = h && a.a.c(d()) instanceof Array, m = g ? k() : p, x = l || g;
							l && !b.name && a.d.uniqueName.init(b, function() { return !0; });
							a.w(e, null, { q: b });
							a.a.n(b, "click", e);
							a.w(f, null, { q: b });
						}
					}
				};
				a.h.V.checked = !0;
				a.d.checkedValue =
				{ update: function(b, d) { b.value = a.a.c(d()); } };
			})();
			a.d.css = {
				update: function(b, d) {
					var c = a.a.c(d());
					null !== c && "object" == typeof c ? a.a.A(c, function(c, d) {
						d = a.a.c(d);
						a.a.Ia(b, c, d);
					}) : (c = String(c || ""), a.a.Ia(b, b.__ko__cssValue, !1), b.__ko__cssValue = c, a.a.Ia(b, c, !0));
				}
			};
			a.d.enable = {
				update: function(b, d) {
					var c = a.a.c(d());
					c && b.disabled ? b.removeAttribute("disabled") : c || b.disabled || (b.disabled = !0);
				}
			};
			a.d.disable = { update: function(b, d) { a.d.enable.update(b, function() { return !a.a.c(d()); }); } };
			a.d.event = {
				init: function(b, d, c,
								e, f) {
					var k = d() || {};
					a.a.A(k, function(h) {
						"string" == typeof h && a.a.n(b, h, function(b) {
							var g, m = d()[h];
							if (m) {
								try {
									var k = a.a.O(arguments);
									e = f.$data;
									k.unshift(e);
									g = m.apply(e, k);
								} finally {
									!0 !== g && (b.preventDefault ? b.preventDefault() : b.returnValue = !1);
								}
								!1 === c.get(h + "Bubble") && (b.cancelBubble = !0, b.stopPropagation && b.stopPropagation());
							}
						});
					});
				}
			};
			a.d.foreach = {
				Ib: function(b) {
					return function() {
						var d = b(), c = a.a.cb(d);
						if (!c || "number" == typeof c.length) {
							return { foreach: d, templateEngine: a.P.Va };
						}
						a.a.c(d);
						return {
							foreach: c.data,
							as: c.as,
							includeDestroyed: c.includeDestroyed,
							afterAdd: c.afterAdd,
							beforeRemove: c.beforeRemove,
							afterRender: c.afterRender,
							beforeMove: c.beforeMove,
							afterMove: c.afterMove,
							templateEngine: a.P.Va
						};
					};
				},
				init: function(b, d) { return a.d.template.init(b, a.d.foreach.Ib(d)); },
				update: function(b, d, c, e, f) { return a.d.template.update(b, a.d.foreach.Ib(d), c, e, f); }
			};
			a.h.ka.foreach = !1;
			a.e.R.foreach = !0;
			a.d.hasfocus = {
				init: function(b, d, c) {
					function e(e) {
						b.__ko_hasfocusUpdating = !0;
						var f = b.ownerDocument;
						if ("activeElement" in f) {
							var g;
							try {
								g = f.activeElement;
							} catch (m) {
								g =
									f.body;
							}
							e = g === b;
						}
						f = d();
						a.h.ra(f, c, "hasfocus", e, !0);
						b.__ko_hasfocusLastValue = e;
						b.__ko_hasfocusUpdating = !1;
					}

					var f = e.bind(null, !0), k = e.bind(null, !1);
					a.a.n(b, "focus", f);
					a.a.n(b, "focusin", f);
					a.a.n(b, "blur", k);
					a.a.n(b, "focusout", k);
				},
				update: function(b, d) {
					var c = !!a.a.c(d());
					b.__ko_hasfocusUpdating || b.__ko_hasfocusLastValue === c || (c ? b.focus() : b.blur(), a.k.u(a.a.qa, null, [b, c ? "focusin" : "focusout"]));
				}
			};
			a.h.V.hasfocus = !0;
			a.d.hasFocus = a.d.hasfocus;
			a.h.V.hasFocus = !0;
			a.d.html = {
				init: function() { return { controlsDescendantBindings: !0 }; },
				update: function(b, d) { a.a.gb(b, d()); }
			};
			K("if");
			K("ifnot", !1, !0);
			K("with", !0, !1, function(a, d) { return a.createChildContext(d); });
			var L = {};
			a.d.options = {
				init: function(b) {
					if ("select" !== a.a.v(b)) {
						throw Error("options binding applies only to SELECT elements");
					}
					for (; 0 < b.length;) {
						b.remove(0);
					}
					return { controlsDescendantBindings: !0 };
				},
				update: function(b, d, c) {
					function e() { return a.a.xa(b.options, function(a) { return a.selected; }); }

					function f(a, b, c) {
						var d = typeof b;
						return "function" == d ? b(a) : "string" == d ? a[b] : c;
					}

					function k(d, e) {
						if (r &&
							m) {
							a.i.Y(b, a.a.c(c.get("value")), !0);
						} else if (n.length) {
							var g = 0 <= a.a.m(n, a.i.s(e[0]));
							a.a.Sb(e[0], g);
							r && !g && a.k.u(a.a.qa, null, [b, "change"]);
						}
					}

					var h = b.multiple, l = 0 != b.length && h ? b.scrollTop : null, g = a.a.c(d()), m = c.get("valueAllowUnset") && c.has("value"), x = c.get("optionsIncludeDestroyed");
					d = {};
					var q, n = [];
					m || (h ? n = a.a.Ka(e(), a.i.s) : 0 <= b.selectedIndex && n.push(a.i.s(b.options[b.selectedIndex])));
					g && ("undefined" == typeof g.length && (g = [g]), q = a.a.xa(g, function(b) { return x || b === p || null === b || !a.a.c(b._destroy); }), c.has("optionsCaption") &&
					(g = a.a.c(c.get("optionsCaption")), null !== g && g !== p && q.unshift(L)));
					var r = !1;
					d.beforeRemove = function(a) { b.removeChild(a); };
					g = k;
					c.has("optionsAfterRender") && "function" == typeof c.get("optionsAfterRender") && (g = function(b, d) {
						k(0, d);
						a.k.u(c.get("optionsAfterRender"), null, [d[0], b !== L ? b : p]);
					});
					a.a.fb(b, q, function(d, e, g) {
						g.length && (n = !m && g[0].selected ? [a.i.s(g[0])] : [], r = !0);
						e = b.ownerDocument.createElement("option");
						d === L ? (a.a.Ha(e, c.get("optionsCaption")), a.i.Y(e, p)) : (g = f(d, c.get("optionsValue"), d), a.i.Y(e, a.a.c(g)),
							d = f(d, c.get("optionsText"), g), a.a.Ha(e, d));
						return [e];
					}, d, g);
					a.k.u(function() { m ? a.i.Y(b, a.a.c(c.get("value")), !0) : (h ? n.length && e().length < n.length : n.length && 0 <= b.selectedIndex ? a.i.s(b.options[b.selectedIndex]) !== n[0] : n.length || 0 <= b.selectedIndex) && a.a.qa(b, "change"); });
					a.a.kc(b);
					l && 20 < Math.abs(l - b.scrollTop) && (b.scrollTop = l);
				}
			};
			a.d.options.ab = a.a.f.I();
			a.d.selectedOptions = {
				after: ["options", "foreach"],
				init: function(b, d, c) {
					a.a.n(b, "change", function() {
						var e = d(), f = [];
						a.a.o(b.getElementsByTagName("option"),
							function(b) { b.selected && f.push(a.i.s(b)); });
						a.h.ra(e, c, "selectedOptions", f);
					});
				},
				update: function(b, d) {
					if ("select" != a.a.v(b)) {
						throw Error("values binding applies only to SELECT elements");
					}
					var c = a.a.c(d());
					c && "number" == typeof c.length && a.a.o(b.getElementsByTagName("option"), function(b) {
						var d = 0 <= a.a.m(c, a.i.s(b));
						a.a.Sb(b, d);
					});
				}
			};
			a.h.V.selectedOptions = !0;
			a.d.style = {
				update: function(b, d) {
					var c = a.a.c(d() || {});
					a.a.A(c, function(c, d) {
						d = a.a.c(d);
						if (null === d || d === p || !1 === d) {
							d = "";
						}
						b.style[c] = d;
					});
				}
			};
			a.d.submit = {
				init: function(b,
								d, c, e, f) {
					if ("function" != typeof d()) {
						throw Error("The value for a submit binding must be a function");
					}
					a.a.n(b, "submit", function(a) {
						var c, e = d();
						try {
							c = e.call(f.$data, b);
						} finally {
							!0 !== c && (a.preventDefault ? a.preventDefault() : a.returnValue = !1);
						}
					});
				}
			};
			a.d.text = { init: function() { return { controlsDescendantBindings: !0 }; }, update: function(b, d) { a.a.Ha(b, d()); } };
			a.e.R.text = !0;
			(function() {
				if (y && y.navigator) {
					var b = function(a) {
							if (a) {
								return parseFloat(a[1]);
							}
						},
						d = y.opera && y.opera.version && parseInt(y.opera.version()),
						c = y.navigator.userAgent,
						e = b(c.match(/^(?:(?!chrome).)*version\/([^ ]*) safari/i)),
						f = b(c.match(/Firefox\/([^ ]*)/));
				}
				if (10 > a.a.M) {
					var k = a.a.f.I(),
						h = a.a.f.I(),
						l = function(b) {
							var c = this.activeElement;
							(c = c && a.a.f.get(c, h)) && c(b);
						},
						g = function(b, c) {
							var d = b.ownerDocument;
							a.a.f.get(d, k) || (a.a.f.set(d, k, !0), a.a.n(d, "selectionchange", l));
							a.a.f.set(b, h, c);
						};
				}
				a.d.textInput = {
					init: function(b, c, l) {
						function h(c, d) { a.a.n(b, c, d); }

						function k() {
							var d = a.a.c(c());
							if (null === d || d === p) {
								d = "";
							}
							w !== p && d === w ? setTimeout(k, 4) : b.value !== d && (u = d, b.value = d);
						}

						function v() {
							A ||
							(w = b.value, A = setTimeout(t, 4));
						}

						function t() {
							clearTimeout(A);
							w = A = p;
							var d = b.value;
							u !== d && (u = d, a.h.ra(c(), l, "textInput", d));
						}

						var u = b.value, A, w;
						10 > a.a.M ? (h("propertychange", function(a) { "value" === a.propertyName && t(); }), 8 == a.a.M && (h("keyup", t), h("keydown", t)), 8 <= a.a.M && (g(b, t), h("dragend", v))) : (h("input", t), 5 > e && "textarea" === a.a.v(b) ? (h("keydown", v), h("paste", v), h("cut", v)) : 11 > d ? h("keydown", v) : 4 > f && (h("DOMAutoComplete", t), h("dragdrop", t), h("drop", t)));
						h("change", t);
						a.w(k, null, { q: b });
					}
				};
				a.h.V.textInput = !0;
				a.d.textinput =
				{ preprocess: function(a, b, c) { c("textInput", a); } };
			})();
			a.d.uniqueName = {
				init: function(b, d) {
					if (d()) {
						var c = "ko_unique_" + ++a.d.uniqueName.fc;
						a.a.Rb(b, c);
					}
				}
			};
			a.d.uniqueName.fc = 0;
			a.d.value = {
				after: ["options", "foreach"],
				init: function(b, d, c) {
					if ("input" != b.tagName.toLowerCase() || "checkbox" != b.type && "radio" != b.type) {
						var e = ["change"], f = c.get("valueUpdate"), k = !1, h = null;
						f && ("string" == typeof f && (f = [f]), a.a.ia(e, f), e = a.a.wb(e));
						var l = function() {
							h = null;
							k = !1;
							var e = d(), g = a.i.s(b);
							a.h.ra(e, c, "value", g);
						};
						!a.a.M || "input" !=
							b.tagName.toLowerCase() || "text" != b.type || "off" == b.autocomplete || b.form && "off" == b.form.autocomplete || -1 != a.a.m(e, "propertychange") || (a.a.n(b, "propertychange", function() { k = !0; }), a.a.n(b, "focus", function() { k = !1; }), a.a.n(b, "blur", function() { k && l(); }));
						a.a.o(e, function(c) {
							var d = l;
							a.a.Dc(c, "after") && (d = function() {
								h = a.i.s(b);
								setTimeout(l, 0);
							}, c = c.substring(5));
							a.a.n(b, c, d);
						});
						var g = function() {
							var e = a.a.c(d()), f = a.i.s(b);
							if (null !== h && e === h) {
								setTimeout(g, 0);
							} else if (e !== f) {
								if ("select" === a.a.v(b)) {
									var l = c.get("valueAllowUnset"),
										f = function() { a.i.Y(b, e, l); };
									f();
									l || e === a.i.s(b) ? setTimeout(f, 0) : a.k.u(a.a.qa, null, [b, "change"]);
								} else {
									a.i.Y(b, e);
								}
							}
						};
						a.w(g, null, { q: b });
					} else {
						a.va(b, { checkedValue: d });
					}
				},
				update: function() {}
			};
			a.h.V.value = !0;
			a.d.visible = {
				update: function(b, d) {
					var c = a.a.c(d()), e = "none" != b.style.display;
					c && !e ? b.style.display = "" : !c && e && (b.style.display = "none");
				}
			};
			(function(b) {
				a.d[b] = {
					init: function(d, c, e, f, k) {
						return a.d.event.init.call(this, d, function() {
							var a = {};
							a[b] = c();
							return a;
						}, e, f, k);
					}
				};
			})("click");
			a.J = function() {};
			a.J.prototype.renderTemplateSource =
				function() { throw Error("Override renderTemplateSource"); };
			a.J.prototype.createJavaScriptEvaluatorBlock = function() { throw Error("Override createJavaScriptEvaluatorBlock"); };
			a.J.prototype.makeTemplateSource = function(b, d) {
				if ("string" == typeof b) {
					d = d || w;
					var c = d.getElementById(b);
					if (!c) {
						throw Error("Cannot find template with ID " + b);
					}
					return new a.t.l(c);
				}
				if (1 == b.nodeType || 8 == b.nodeType) {
					return new a.t.ha(b);
				}
				throw Error("Unknown template type: " + b);
			};
			a.J.prototype.renderTemplate = function(a, d, c, e) {
				a = this.makeTemplateSource(a,
					e);
				return this.renderTemplateSource(a, d, c, e);
			};
			a.J.prototype.isTemplateRewritten = function(a, d) { return !1 === this.allowTemplateRewriting ? !0 : this.makeTemplateSource(a, d).data("isRewritten"); };
			a.J.prototype.rewriteTemplate = function(a, d, c) {
				a = this.makeTemplateSource(a, c);
				d = d(a.text());
				a.text(d);
				a.data("isRewritten", !0);
			};
			a.b("templateEngine", a.J);
			a.kb = function() {
				function b(b, c, d, h) {
					b = a.h.bb(b);
					for (var l = a.h.ka, g = 0; g < b.length; g++) {
						var m = b[g].key;
						if (l.hasOwnProperty(m)) {
							var x = l[m];
							if ("function" === typeof x) {
								if (m =
									x(b[g].value)) {
									throw Error(m);
								}
							} else if (!x) {
								throw Error("This template engine does not support the '" + m + "' binding within its templates");
							}
						}
					}
					d = "ko.__tr_ambtns(function($context,$element){return(function(){return{ " + a.h.Ea(b, { valueAccessors: !0 }) + " } })()},'" + d.toLowerCase() + "')";
					return h.createJavaScriptEvaluatorBlock(d) + c;
				}

				var d = /(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi, c = /\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;
				return {
					lc: function(b,
								c, d) { c.isTemplateRewritten(b, d) || c.rewriteTemplate(b, function(b) { return a.kb.xc(b, c); }, d); },
					xc: function(a, f) { return a.replace(d, function(a, c, d, e, m) { return b(m, c, d, f); }).replace(c, function(a, c) { return b(c, "\x3c!-- ko --\x3e", "#comment", f); }); },
					dc: function(b, c) {
						return a.H.$a(function(d, h) {
							var l = d.nextSibling;
							l && l.nodeName.toLowerCase() === c && a.va(l, b, h);
						});
					}
				};
			}();
			a.b("__tr_ambtns", a.kb.dc);
			(function() {
				a.t = {};
				a.t.l = function(a) { this.l = a; };
				a.t.l.prototype.text = function() {
					var b = a.a.v(this.l),
						b = "script" === b ? "text" :
							"textarea" === b ? "value" : "innerHTML";
					if (0 == arguments.length) {
						return this.l[b];
					}
					var d = arguments[0];
					"innerHTML" === b ? a.a.gb(this.l, d) : this.l[b] = d;
				};
				var b = a.a.f.I() + "_";
				a.t.l.prototype.data = function(c) {
					if (1 === arguments.length) {
						return a.a.f.get(this.l, b + c);
					}
					a.a.f.set(this.l, b + c, arguments[1]);
				};
				var d = a.a.f.I();
				a.t.ha = function(a) { this.l = a; };
				a.t.ha.prototype = new a.t.l;
				a.t.ha.prototype.text = function() {
					if (0 == arguments.length) {
						var b = a.a.f.get(this.l, d) || {};
						b.lb === p && b.Na && (b.lb = b.Na.innerHTML);
						return b.lb;
					}
					a.a.f.set(this.l,
						d, { lb: arguments[0] });
				};
				a.t.l.prototype.nodes = function() {
					if (0 == arguments.length) {
						return (a.a.f.get(this.l, d) || {}).Na;
					}
					a.a.f.set(this.l, d, { Na: arguments[0] });
				};
				a.b("templateSources", a.t);
				a.b("templateSources.domElement", a.t.l);
				a.b("templateSources.anonymousTemplate", a.t.ha);
			})();
			(function() {
				function b(b, c, d) {
					var e;
					for (c = a.e.nextSibling(c); b && (e = b) !== c;) {
						b = a.e.nextSibling(e), d(e, b);
					}
				}

				function d(c, d) {
					if (c.length) {
						var e = c[0], f = c[c.length - 1], h = e.parentNode, k = a.L.instance, r = k.preprocessNode;
						if (r) {
							b(e, f, function(a,
											b) {
								var c = a.previousSibling, d = r.call(k, a);
								d && (a === e && (e = d[0] || b), a === f && (f = d[d.length - 1] || c));
							});
							c.length = 0;
							if (!e) {
								return;
							}
							e === f ? c.push(e) : (c.push(e, f), a.a.na(c, h));
						}
						b(e, f, function(b) { 1 !== b.nodeType && 8 !== b.nodeType || a.ub(d, b); });
						b(e, f, function(b) { 1 !== b.nodeType && 8 !== b.nodeType || a.H.Xb(b, [d]); });
						a.a.na(c, h);
					}
				}

				function c(a) { return a.nodeType ? a : 0 < a.length ? a[0] : null; }

				function e(b, e, f, h, q) {
					q = q || {};
					var n = (b && c(b) || f || {}).ownerDocument, r = q.templateEngine || k;
					a.kb.lc(f, r, n);
					f = r.renderTemplate(f, h, q, n);
					if ("number" !=
						typeof f.length || 0 < f.length && "number" != typeof f[0].nodeType) {
						throw Error("Template engine must return an array of DOM nodes");
					}
					n = !1;
					switch (e) {
						case "replaceChildren":
							a.e.T(b, f);
							n = !0;
							break;
						case "replaceNode":
							a.a.Qb(b, f);
							n = !0;
							break;
						case "ignoreTargetNode":
							break;
						default:
							throw Error("Unknown renderMode: " + e);
					}
					n && (d(f, h), q.afterRender && a.k.u(q.afterRender, null, [f, h.$data]));
					return f;
				}

				function f(b, c, d) { return a.F(b) ? b() : "function" === typeof b ? b(c, d) : b; }

				var k;
				a.hb = function(b) {
					if (b != p && !(b instanceof a.J)) {
						throw Error("templateEngine must inherit from ko.templateEngine");
					}
					k = b;
				};
				a.eb = function(b, d, h, x, q) {
					h = h || {};
					if ((h.templateEngine || k) == p) {
						throw Error("Set a template engine before calling renderTemplate");
					}
					q = q || "replaceChildren";
					if (x) {
						var n = c(x);
						return a.j(function() {
							var k = d && d instanceof a.N ? d : new a.N(a.a.c(d)), p = f(b, k.$data, k), k = e(x, q, p, k, h);
							"replaceNode" == q && (x = k, n = c(x));
						}, null, { Pa: function() { return !n || !a.a.Qa(n); }, q: n && "replaceNode" == q ? n.parentNode : n });
					}
					return a.H.$a(function(c) { a.eb(b, d, h, c, "replaceNode"); });
				};
				a.Cc = function(b, c, h, k, q) {
					function n(a, b) {
						d(b, v);
						h.afterRender &&
							h.afterRender(b, a);
						v = null;
					}

					function r(a, c) {
						v = q.createChildContext(a, h.as, function(a) { a.$index = c; });
						var d = f(b, a, v);
						return e(null, "ignoreTargetNode", d, v, h);
					}

					var v;
					return a.j(function() {
						var b = a.a.c(c) || [];
						"undefined" == typeof b.length && (b = [b]);
						b = a.a.xa(b, function(b) { return h.includeDestroyed || b === p || null === b || !a.a.c(b._destroy); });
						a.k.u(a.a.fb, null, [k, b, r, h, n]);
					}, null, { q: k });
				};
				var h = a.a.f.I();
				a.d.template = {
					init: function(b, c) {
						var d = a.a.c(c());
						if ("string" == typeof d || d.name) {
							a.e.ma(b);
						} else {
							if ("nodes" in d) {
								if (d =
									d.nodes || [], a.F(d)) {
									throw Error('The "nodes" option must be a plain, non-observable array.');
								}
							} else {
								d = a.e.childNodes(b);
							}
							d = a.a.Jb(d);
							(new a.t.ha(b)).nodes(d);
						}
						return { controlsDescendantBindings: !0 };
					},
					update: function(b, c, d, e, f) {
						var k = c(), r;
						c = a.a.c(k);
						d = !0;
						e = null;
						"string" == typeof c ? c = {} : (k = c.name, "if" in c && (d = a.a.c(c["if"])), d && "ifnot" in c && (d = !a.a.c(c.ifnot)), r = a.a.c(c.data));
						"foreach" in c ? e = a.Cc(k || b, d && c.foreach || [], c, b, f) : d ? (f = "data" in c ? f.createChildContext(r, c.as) : f, e = a.eb(k || b, f, c, b)) : a.e.ma(b);
						f =
							e;
						(r = a.a.f.get(b, h)) && "function" == typeof r.p && r.p();
						a.a.f.set(b, h, f && f.$() ? f : p);
					}
				};
				a.h.ka.template = function(b) {
					b = a.h.bb(b);
					return 1 == b.length && b[0].unknown || a.h.vc(b, "name") ? null : "This template engine does not support anonymous templates nested within its templates";
				};
				a.e.R.template = !0;
			})();
			a.b("setTemplateEngine", a.hb);
			a.b("renderTemplate", a.eb);
			a.a.Cb = function(a, d, c) {
				if (a.length && d.length) {
					var e, f, k, h, l;
					for (e = f = 0; (!c || e < c) && (h = a[f]); ++f) {
						for (k = 0; l = d[k]; ++k) {
							if (h.value === l.value) {
								h.moved = l.index;
								l.moved =
									h.index;
								d.splice(k, 1);
								e = k = 0;
								break;
							}
						}
						e += k;
					}
				}
			};
			a.a.Ma = function() {
				function b(b, c, e, f, k) {
					var h = Math.min, l = Math.max, g = [], m, p = b.length, q, n = c.length, r = n - p || 1, v = p + n + 1, t, u, w;
					for (m = 0; m <= p; m++) {
						for (u = t, g.push(t = []), w = h(n, m + r), q = l(0, m - 1); q <= w; q++) {
							t[q] = q ? m ? b[m - 1] === c[q - 1] ? u[q - 1] : h(u[q] || v, t[q - 1] || v) + 1 : q + 1 : m + 1;
						}
					}
					h = [];
					l = [];
					r = [];
					m = p;
					for (q = n; m || q;) {
						n = g[m][q] - 1, q && n === g[m][q - 1] ? l.push(h[h.length] = { status: e, value: c[--q], index: q }) : m && n === g[m - 1][q] ? r.push(h[h.length] = { status: f, value: b[--m], index: m }) : (--q, --m, k.sparse || h.push({
							status: "retained",
							value: c[q]
						}));
					}
					a.a.Cb(l, r, 10 * p);
					return h.reverse();
				}

				return function(a, c, e) {
					e = "boolean" === typeof e ? { dontLimitMoves: e } : e || {};
					a = a || [];
					c = c || [];
					return a.length <= c.length ? b(a, c, "added", "deleted", e) : b(c, a, "deleted", "added", e);
				};
			}();
			a.b("utils.compareArrays", a.a.Ma);
			(function() {
				function b(b, d, f, k, h) {
					var l = [],
						g = a.j(function() {
							var g = d(f, h, a.a.na(l, b)) || [];
							0 < l.length && (a.a.Qb(l, g), k && a.k.u(k, null, [f, g, h]));
							l.length = 0;
							a.a.ia(l, g);
						}, null, { q: b, Pa: function() { return !a.a.tb(l); } });
					return { aa: l, j: g.$() ? g : p };
				}

				var d = a.a.f.I();
				a.a.fb = function(c, e, f, k, h) {
					function l(b, d) {
						s = u[d];
						t !== d && (z[b] = s);
						s.Ua(t++);
						a.a.na(s.aa, c);
						r.push(s);
						y.push(s);
					}

					function g(b, c) {
						if (b) {
							for (var d = 0, e = c.length; d < e; d++) {
								c[d] && a.a.o(c[d].aa, function(a) { b(a, d, c[d].wa); });
							}
						}
					}

					e = e || [];
					k = k || {};
					var m = a.a.f.get(c, d) === p, u = a.a.f.get(c, d) || [], q = a.a.Ka(u, function(a) { return a.wa; }), n = a.a.Ma(q, e, k.dontLimitMoves), r = [], v = 0, t = 0, w = [], y = [];
					e = [];
					for (var z = [], q = [], s, C = 0, D, E; D = n[C]; C++) {
						switch (E = D.moved, D.status) {
							case "deleted":
								E === p && (s = u[v], s.j && s.j.p(), w.push.apply(w, a.a.na(s.aa,
									c)), k.beforeRemove && (e[C] = s, y.push(s)));
								v++;
								break;
							case "retained":
								l(C, v++);
								break;
							case "added":
								E !== p ? l(C, E) : (s = { wa: D.value, Ua: a.r(t++) }, r.push(s), y.push(s), m || (q[C] = s));
						}
					}
					g(k.beforeMove, z);
					a.a.o(w, k.beforeRemove ? a.S : a.removeNode);
					for (var C = 0, m = a.e.firstChild(c), H; s = y[C]; C++) {
						s.aa || a.a.extend(s, b(c, f, s.wa, h, s.Ua));
						for (v = 0; n = s.aa[v]; m = n.nextSibling, H = n, v++) {
							n !== m && a.e.Fb(c, n, H);
						}
						!s.rc && h && (h(s.wa, s.aa, s.Ua), s.rc = !0);
					}
					g(k.beforeRemove, e);
					g(k.afterMove, z);
					g(k.afterAdd, q);
					a.a.f.set(c, d, r);
				};
			})();
			a.b("utils.setDomNodeChildrenFromArrayMapping",
				a.a.fb);
			a.P = function() { this.allowTemplateRewriting = !1; };
			a.P.prototype = new a.J;
			a.P.prototype.renderTemplateSource = function(b, d, c, e) {
				if (d = (9 > a.a.M ? 0 : b.nodes) ? b.nodes() : null) {
					return a.a.O(d.cloneNode(!0).childNodes);
				}
				b = b.text();
				return a.a.ca(b, e);
			};
			a.P.Va = new a.P;
			a.hb(a.P.Va);
			a.b("nativeTemplateEngine", a.P);
			(function() {
				a.Ya = function() {
					var a = this.uc = function() {
						if (!u || !u.tmpl) {
							return 0;
						}
						try {
							if (0 <= u.tmpl.tag.tmpl.open.toString().indexOf("__")) {
								return 2;
							}
						} catch (a) {
						}
						return 1;
					}();
					this.renderTemplateSource = function(b,
														e, f, k) {
						k = k || w;
						f = f || {};
						if (2 > a) {
							throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");
						}
						var h = b.data("precompiled");
						h || (h = b.text() || "", h = u.template(null, "{{ko_with $item.koBindingContext}}" + h + "{{/ko_with}}"), b.data("precompiled", h));
						b = [e.$data];
						e = u.extend({ koBindingContext: e }, f.templateOptions);
						e = u.tmpl(h, b, e);
						e.appendTo(k.createElement("div"));
						u.fragments = {};
						return e;
					};
					this.createJavaScriptEvaluatorBlock = function(a) {
						return "{{ko_code ((function() { return " +
							a + " })()) }}";
					};
					this.addTemplate = function(a, b) { w.write("<script type='text/html' id='" + a + "'>" + b + "\x3c/script>"); };
					0 < a && (u.tmpl.tag.ko_code = { open: "__.push($1 || '');" }, u.tmpl.tag.ko_with = { open: "with($1) {", close: "} " });
				};
				a.Ya.prototype = new a.J;
				var b = new a.Ya;
				0 < b.uc && a.hb(b);
				a.b("jqueryTmplTemplateEngine", a.Ya);
			})();
		});
	})();
})();;
(function (a) { if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { a(require("knockout"), exports) } else { if (typeof define === "function" && define.amd) { define(["knockout", "exports"], a) } else { a(ko, ko.mapping = {}) } } }(function (b, B) { var d = true; var n = "__ko_mapping__"; var i = b.dependentObservable; var q = 0; var m; var v; var a = ["create", "update", "key", "arrayChanged"]; var r = {}; var h = { include: ["_destroy"], ignore: [], copy: [], observe: [] }; var w = h; function o(C, H) { var G = {}; for (var F = C.length - 1; F >= 0; --F) { G[C[F]] = C[F] } for (var F = H.length - 1; F >= 0; --F) { G[H[F]] = H[F] } var E = []; for (var D in G) { E.push(G[D]) } return E } function p(C, F) { var G; for (var D in F) { if (F.hasOwnProperty(D) && F[D]) { G = B.getType(C[D]); if (D && C[D] && G !== "array" && G !== "string") { p(C[D], F[D]) } else { var E = B.getType(C[D]) === "array" && B.getType(F[D]) === "array"; if (E) { C[D] = o(C[D], F[D]) } else { C[D] = F[D] } } } } } function g(E, D) { var C = {}; p(C, E); p(C, D); return C } B.isMapped = function (D) { var C = b.utils.unwrapObservable(D); return C && C[n] }; B.fromJS = function (D) { if (arguments.length == 0) { throw new Error("When calling ko.fromJS, pass the object you want to convert.") } try { if (!q++) { m = []; v = new c() } var F; var H; if (arguments.length == 2) { if (arguments[1][n]) { H = arguments[1] } else { F = arguments[1] } } if (arguments.length == 3) { F = arguments[1]; H = arguments[2] } if (H) { F = g(F, H[n]) } F = s(F); var C = x(H, D, F); if (H) { C = H } if (!--q) { while (m.length) { var E = m.pop(); if (E) { E(); E.__DO.throttleEvaluation = E.throttleEvaluation } } } C[n] = g(C[n], F); return C } catch (G) { q = 0; throw G } }; B.fromJSON = function (D) { var C = b.utils.parseJson(D); arguments[0] = C; return B.fromJS.apply(this, arguments) }; B.updateFromJS = function (C) { throw new Error("ko.mapping.updateFromJS, use ko.mapping.fromJS instead. Please note that the order of parameters is different!") }; B.updateFromJSON = function (C) { throw new Error("ko.mapping.updateFromJSON, use ko.mapping.fromJSON instead. Please note that the order of parameters is different!") }; B.toJS = function (D, C) { if (!w) { B.resetDefaultOptions() } if (arguments.length == 0) { throw new Error("When calling ko.mapping.toJS, pass the object you want to convert.") } if (B.getType(w.ignore) !== "array") { throw new Error("ko.mapping.defaultOptions().ignore should be an array.") } if (B.getType(w.include) !== "array") { throw new Error("ko.mapping.defaultOptions().include should be an array.") } if (B.getType(w.copy) !== "array") { throw new Error("ko.mapping.defaultOptions().copy should be an array.") } C = s(C, D[n]); return B.visitModel(D, function (E) { return b.utils.unwrapObservable(E) }, C) }; B.toJSON = function (E, C) { var D = B.toJS(E, C); return b.utils.stringifyJson(D) }; B.defaultOptions = function () { if (arguments.length > 0) { w = arguments[0] } else { return w } }; B.resetDefaultOptions = function () { w = { include: h.include.slice(0), ignore: h.ignore.slice(0), copy: h.copy.slice(0) } }; B.getType = function (C) { if ((C) && (typeof (C) === "object")) { if (C.constructor === Date) { return "date" } if (C.constructor === Array) { return "array" } } return typeof C }; function s(F, C) { var D = g({}, F); for (var E = a.length - 1; E >= 0; E--) { var G = a[E]; if (!D[G]) { continue } if (!(D[""] instanceof Object)) { D[""] = {} } D[""][G] = D[G]; delete D[G] } if (C) { D.ignore = k(C.ignore, D.ignore); D.include = k(C.include, D.include); D.copy = k(C.copy, D.copy); D.observe = k(C.observe, D.observe) } D.ignore = k(D.ignore, w.ignore); D.include = k(D.include, w.include); D.copy = k(D.copy, w.copy); D.observe = k(D.observe, w.observe); D.mappedProperties = D.mappedProperties || {}; D.copiedProperties = D.copiedProperties || {}; return D } function k(D, C) { if (B.getType(D) !== "array") { if (B.getType(D) === "undefined") { D = [] } else { D = [D] } } if (B.getType(C) !== "array") { if (B.getType(C) === "undefined") { C = [] } else { C = [C] } } return b.utils.arrayGetDistinctValues(D.concat(C)) } function f(D, F) { var E = b.dependentObservable; b.dependentObservable = function (M, G, J) { J = J || {}; if (M && typeof M == "object") { J = M } var I = J.deferEvaluation; var H = false; var L = function (N) { var P = b.dependentObservable; b.dependentObservable = i; var Q = b.isWriteableObservable(N); b.dependentObservable = P; var O = i({ read: function () { if (!H) { b.utils.arrayRemoveItem(D, N); H = true } return N.apply(N, arguments) }, write: Q && function (R) { return N(R) }, deferEvaluation: true }); if (d) { O._wrapper = true } O.__DO = N; return O }; J.deferEvaluation = true; var K = new i(M, G, J); if (!I) { K = L(K); D.push(K) } return K }; b.dependentObservable.fn = i.fn; b.computed = b.dependentObservable; var C = F(); b.dependentObservable = E; b.computed = b.dependentObservable; return C } function x(ai, E, T, aj, H, C, al) { var S = B.getType(b.utils.unwrapObservable(E)) === "array"; C = C || ""; if (B.isMapped(ai)) { var G = b.utils.unwrapObservable(ai)[n]; T = g(G, T) } var ae = { data: E, parent: al || H }; var R = function () { return T[aj] && T[aj].create instanceof Function }; var J = function (an) { return f(m, function () { if (b.utils.unwrapObservable(H) instanceof Array) { return T[aj].create({ data: an || ae.data, parent: ae.parent, skip: r }) } else { return T[aj].create({ data: an || ae.data, parent: ae.parent }) } }) }; var aa = function () { return T[aj] && T[aj].update instanceof Function }; var P = function (ao, an) { var ap = { data: an || ae.data, parent: ae.parent, target: b.utils.unwrapObservable(ao) }; if (b.isWriteableObservable(ao)) { ap.observable = ao } return T[aj].update(ap) }; var Y = v.get(E); if (Y) { return Y } aj = aj || ""; if (!S) { if (!t(E)) { switch (B.getType(E)) { case "function": if (aa()) { if (b.isWriteableObservable(E)) { E(P(E)); ai = E } else { ai = P(E) } } else { ai = E } break; default: if (b.isWriteableObservable(ai)) { if (aa()) { var V = P(ai); ai(V); return V } else { var V = b.utils.unwrapObservable(E); ai(V); return V } } else { var ab = R() || aa(); if (R()) { ai = J() } else { ai = b.observable(b.utils.unwrapObservable(E)) } if (aa()) { ai(P(ai)) } if (ab) { return ai } } } } else { ai = b.utils.unwrapObservable(ai); if (!ai) { if (R()) { var N = J(); if (aa()) { N = P(N) } return N } else { if (aa()) { return P(N) } ai = {} } } if (aa()) { ai = P(ai) } v.save(E, ai); if (aa()) { return ai } z(E, function (ao) { var ar = C.length ? C + "." + ao : ao; if (b.utils.arrayIndexOf(T.ignore, ar) != -1) { return } if (b.utils.arrayIndexOf(T.copy, ar) != -1) { ai[ao] = E[ao]; return } if (typeof E[ao] != "object" && typeof E[ao] != "array" && T.observe.length > 0 && b.utils.arrayIndexOf(T.observe, ar) == -1) { ai[ao] = E[ao]; T.copiedProperties[ar] = true; return } var aq = v.get(E[ao]); var an = x(ai[ao], E[ao], T, ao, ai, ar, ai); var ap = aq || an; if (T.observe.length > 0 && b.utils.arrayIndexOf(T.observe, ar) == -1) { ai[ao] = ap(); T.copiedProperties[ar] = true; return } if (b.isWriteableObservable(ai[ao])) { ap = b.utils.unwrapObservable(ap); if (ai[ao]() !== ap) { ai[ao](ap) } } else { ap = ai[ao] === undefined ? ap : b.utils.unwrapObservable(ap); ai[ao] = ap } T.mappedProperties[ar] = true }) } } else { var O = []; var L = false; var U = function (an) { return an }; if (T[aj] && T[aj].key) { U = T[aj].key; L = true } if (!b.isObservable(ai)) { ai = b.observableArray([]); ai.mappedRemove = function (ao) { var an = typeof ao == "function" ? ao : function (ap) { return ap === U(ao) }; return ai.remove(function (ap) { return an(U(ap)) }) }; ai.mappedRemoveAll = function (ao) { var an = u(ao, U); return ai.remove(function (ap) { return b.utils.arrayIndexOf(an, U(ap)) != -1 }) }; ai.mappedDestroy = function (ao) { var an = typeof ao == "function" ? ao : function (ap) { return ap === U(ao) }; return ai.destroy(function (ap) { return an(U(ap)) }) }; ai.mappedDestroyAll = function (ao) { var an = u(ao, U); return ai.destroy(function (ap) { return b.utils.arrayIndexOf(an, U(ap)) != -1 }) }; ai.mappedIndexOf = function (ap) { var ao = u(ai(), U); var an = U(ap); return b.utils.arrayIndexOf(ao, an) }; ai.mappedGet = function (an) { return ai()[ai.mappedIndexOf(an)] }; ai.mappedCreate = function (ao) { if (ai.mappedIndexOf(ao) !== -1) { throw new Error("There already is an object with the key that you specified.") } var an = R() ? J(ao) : ao; if (aa()) { var ap = P(an, ao); if (b.isWriteableObservable(an)) { an(ap) } else { an = ap } } ai.push(an); return an } } var W = u(b.utils.unwrapObservable(ai), U).sort(); var K = u(E, U); if (L) { K.sort() } var ac = b.utils.compareArrays(W, K); var am = {}; var ah, ag; var F = b.utils.unwrapObservable(E); var Q = {}; var ad = true; for (ah = 0, ag = F.length; ah < ag; ah++) { var M = U(F[ah]); if (M === undefined || M instanceof Object) { ad = false; break } Q[M] = F[ah] } var ak = []; var I = 0; for (ah = 0, ag = ac.length; ah < ag; ah++) { var M = ac[ah]; var D; var af = C + "[" + ah + "]"; switch (M.status) { case "added": var X = ad ? Q[M.value] : l(b.utils.unwrapObservable(E), M.value, U); D = x(undefined, X, T, aj, ai, af, H); if (!R()) { D = b.utils.unwrapObservable(D) } var Z = y(b.utils.unwrapObservable(E), X, am); if (D === r) { I++ } else { ak[Z - I] = D } am[Z] = true; break; case "retained": var X = ad ? Q[M.value] : l(b.utils.unwrapObservable(E), M.value, U); D = l(ai, M.value, U); x(D, X, T, aj, ai, af, H); var Z = y(b.utils.unwrapObservable(E), X, am); ak[Z] = D; am[Z] = true; break; case "deleted": D = l(ai, M.value, U); break } O.push({ event: M.status, item: D }) } ai(ak); if (T[aj] && T[aj].arrayChanged) { b.utils.arrayForEach(O, function (an) { T[aj].arrayChanged(an.event, an.item) }) } } return ai } function y(G, F, E) { for (var D = 0, C = G.length; D < C; D++) { if (E[D] === true) { continue } if (G[D] === F) { return D } } return null } function e(C, E) { var D; if (E) { D = E(C) } if (B.getType(D) === "undefined") { D = C } return b.utils.unwrapObservable(D) } function l(H, E, G) { H = b.utils.unwrapObservable(H); for (var D = 0, C = H.length; D < C; D++) { var F = H[D]; if (e(F, G) === E) { return F } } throw new Error("When calling ko.update*, the key '" + E + "' was not found!") } function u(D, C) { return b.utils.arrayMap(b.utils.unwrapObservable(D), function (E) { if (C) { return e(E, C) } else { return E } }) } function z(E, F) { if (B.getType(E) === "array") { for (var D = 0; D < E.length; D++) { F(D) } } else { for (var C in E) { F(C) } } } function t(C) { var D = B.getType(C); return ((D === "object") || (D === "array")) && (C !== null) } function j(F, E, D) { var C = F || ""; if (B.getType(E) === "array") { if (F) { C += "[" + D + "]" } } else { if (F) { C += "." } C += D } return C } B.visitModel = function (F, H, D) { D = D || {}; D.visitedObjects = D.visitedObjects || new c(); var G; var C = b.utils.unwrapObservable(F); if (!t(C)) { return H(F, D.parentName) } else { D = s(D, C[n]); H(F, D.parentName); G = B.getType(C) === "array" ? [] : {} } D.visitedObjects.save(F, G); var E = D.parentName; z(C, function (K) { if (D.ignore && b.utils.arrayIndexOf(D.ignore, K) != -1) { return } var I = C[K]; D.parentName = j(E, C, K); if (b.utils.arrayIndexOf(D.copy, K) === -1) { if (b.utils.arrayIndexOf(D.include, K) === -1) { if (C[n] && C[n].mappedProperties && !C[n].mappedProperties[K] && C[n].copiedProperties && !C[n].copiedProperties[K] && !(B.getType(C) === "array")) { return } } } var J; switch (B.getType(b.utils.unwrapObservable(I))) { case "object": case "array": case "undefined": var L = D.visitedObjects.get(I); G[K] = (B.getType(L) !== "undefined") ? L : B.visitModel(I, H, D); break; default: G[K] = H(I, D.parentName) } }); return G }; function A() { var D = []; var C = []; this.save = function (F, G) { var E = b.utils.arrayIndexOf(D, F); if (E >= 0) { C[E] = G } else { D.push(F); C.push(G) } }; this.get = function (F) { var E = b.utils.arrayIndexOf(D, F); var G = (E >= 0) ? C[E] : undefined; return G } } function c() { var C = {}; var D = function (F) { var E; try { E = F } catch (G) { E = "$$$" } var H = C[E]; if (H === undefined) { H = new A(); C[E] = H } return H }; this.save = function (E, F) { D(E).save(E, F) }; this.get = function (E) { return D(E).get(E) } } }));;
/*
Copyright (c) 2014, Made By Made Ltd
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the "Made By Made Ltd" nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MADE BY MADE LTD BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

(function(){(function(a,b){b.navobile=function(d,f){var e,c;e=this;e.$el=b(d);e.el=d;e.$el.data("navobile",e);e.attach=function(){var g;e.$el.data({open:false});e.$content.data({drag:false});e.bindTap(e.$cta,e.$nav,e.$content,(b("html").hasClass("touch")?"touchend":"click"));if(typeof Hammer==="function"&&(e.options.bindSwipe||e.options.bindDrag)){g=Hammer(e.$content,e.options.hammerOptions);if(e.options.bindSwipe){e.bindSwipe(e.$nav,e.$content)}if(e.options.bindDrag){return e.bindDrag(e.$nav,e.$content)}}};e.bindTap=function(i,g,h,j){return i.on(j,function(k){k.preventDefault();k.stopPropagation();if(!e.isMobile()){return false}if(g.data("open")){e.slideContentIn(g,h)}else{e.slideContentOut(g,h)}return false})};e.bindSwipe=function(g,j){var h,i;h=e.showOnRight?"right":"left";i=e.showOnRight?"left":"right";j.on("swipe"+h,function(k){if(!e.isMobile()){return false}if(j.data("drag")){e.removeInlineStyles(g,j);j.data("drag",false)}e.slideContentIn(g,j);k.gesture.preventDefault();return k.stopPropagation()});return j.on("swipe"+i,function(k){if(!e.isMobile()){return false}if(j.data("drag")){e.removeInlineStyles(g,j);j.data("drag",false)}e.slideContentOut(g,j);k.gesture.preventDefault();return k.stopPropagation()})};e.bindDrag=function(g,j){var h,i;h=e.showOnRight?"right":"left";i=e.showOnRight?"left":"right";return j.on("dragstart drag dragend release",function(k){var m,l;if(!e.isMobile()){return false}if(k.type==="release"){e.removeInlineStyles(g,j);return false}if(k.direction===h){if(!j.hasClass("navobile-content-hidden")){return false}else{e.slideContentIn(g,j)}}if(k.direction===i){if(k.type==="dragend"){if(k.distance>60){e.slideContentOut(g,j)}else{e.slideContentIn(g,j)}e.removeInlineStyles(g,j);return false}if(k.type==="dragstart"){j.data("drag",true)}m=k.position.x;l=Math.ceil(e.calculateTranslate(m));if(l>80||l<0){return false}if(b("html").hasClass("csstransforms3d")){return j.css("transform","translate3d("+l+"%, 0, 0)")}else{if(b("html").hasClass("csstransforms")){return j.css("transform","translateX("+l+"%)")}}}})};e.animateContent=function(j,g,i){var h;if(!e.canUseCssTransforms()){h=e.showOnRight?{right:j}:{left:j};i.animate(h,100,e.options.easing,(function(k){return function(){var l;l=j==="0%"?"closed":"opened";return e.triggerEvent(l)}})(this))}else{if(j==="0%"){e.transitionEndEvents(i,"closed");i.removeClass("navobile-content-hidden")}else{e.transitionEndEvents(i,"opened");i.addClass("navobile-content-hidden")}}if(j==="0%"){g.removeClass("navobile-navigation-visible")}else{g.addClass("navobile-navigation-visible")}return e.removeInlineStyles(g,i)};e.slideContentIn=function(g,h){e.triggerEvent("close");g.data("open",false);return e.animateContent("0%",g,h)};e.slideContentOut=function(g,h){e.triggerEvent("open");g.data("open",true);return e.animateContent(e.options.openOffset,g,h)};e.showOnRight=function(){return e.options.direction==="rtl"};e.canUseCssTransforms=function(){return b("html").hasClass("csstransforms3d")||b("html").hasClass("csstransforms")};e.calculateTranslate=function(g){return(g/b(document).width())*100};e.isMobile=function(){return b("#navobile-device-pixel").width()>0};e.removeInlineStyles=function(g,h){return h.css("transform","")};e.triggerEvent=function(g){return b(document).trigger("navobile:"+g)};e.transitionEndEvents=function(h,g){return h.one("webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd",(function(i){return function(){return e.triggerEvent(g)}})(this))};c={init:function(h){var g;if(b("body").hasClass("navobile-bound")){return}e.options=b.extend({},b.navobile.settings,h);e.$cta=b(e.options.cta);e.$content=b(e.options.content);e.$nav=e.options.changeDOM?e.$el.clone(e.options.copyBoundEvents):e.$el;e.$content.addClass("navobile-content navobile-content--"+e.options.direction);if(b("#navobile-device-pixel").length===0){b("body").append('<div id="navobile-device-pixel" />')}b("body").addClass("navobile-bound");if(e.options.changeDOM){e.$el.addClass("navobile-desktop-only");e.$nav.addClass("navobile-mobile-only");g=e.$nav.attr("id");e.$nav.attr("id","navobile-"+g);e.$content.before(e.$nav)}e.$nav.addClass("navobile-navigation navobile-navigation--"+e.options.direction);return e.attach()}};if(c[f]){return c[f].apply(this,Array.prototype.slice.call(argument,1))}else{if(typeof f==="object"||!f){return c.init(f)}else{return b.error("Method "+f+" does not exist on jQuery.navobile")}}};b.navobile.settings={cta:"#show-navigation",content:"#content",direction:"ltr",easing:"linear",changeDOM:false,copyBoundEvents:false,bindSwipe:false,bindDrag:false,openOffset:"80%",hammerOptions:{}};return b.fn.navobile=function(c){return this.each(function(){return new b.navobile(this,c)})}})(window,jQuery)}).call(this);;
/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
(function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&E(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},w=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20,
width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},
keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+
(I?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,
openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,
isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k,
c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&&
k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current||
b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer=
setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,p.bind({"onCancel.player beforeClose.player":c,"onUpdate.player":e,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(q(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},prev:function(a){var d=b.current;
d&&(q(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d=
a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")),
b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><div></div></div>').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(),
y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHeight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement;
if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==v)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&"hidden"===h[0].style.overflow)&&
(h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0,
{},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,
mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=
!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");
"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload=
this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);
f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,
e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,
outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case "image":e=a.tpl.image.replace("{href}",
g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll":
"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside?
h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth||
h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),c<m&&(c=m,j=l(c/D)),j<u&&(j=u,c=l(j*D))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&&
"iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,p)));if(h.fitToView)if(g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height(),h.aspectRatio)for(;(a>z||y>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(p,j-10)),c=l(j*D),c<m&&(c=m,j=l(c/D)),c>n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&j<A&&c+x+q<z)&&(c+=q);g.width(c).height(j);e.width(c+x);a=e.width();
y=e.height();e=(a>z||y>r)&&c>m&&j>u;c=h.aspectRatio?c<F&&j<B&&c<C&&j<A:(c<F||j<B)&&(c<C||j<A);f.extend(h,{dim:{width:w(a),height:w(y)},origWidth:C,origHeight:A,canShrink:e,canExpand:c,wPadding:x,hPadding:v,wrapSpace:y-k.outerHeight(!0),skinSpace:k.height()-j});!H&&(h.autoHeight&&j>u&&j<p&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",top:c[0],left:c[3]};d.autoCenter&&d.fixed&&
!a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=w(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=w(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&(d.preventDefault(),
b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a=
a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())):
(c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:w(c.top-h*a.topRatio),left:w(c.left-j*a.leftRatio),width:w(f+j),height:w(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"===
f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c,
{duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=w(l(e[g])-200),c[g]="+=200px"):(e[g]=w(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a=
b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,el:f("html"),create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay=
f('<div class="fancybox-overlay"></div>').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive?
b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth),
p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"===
f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=
b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,
e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+
":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body");var e=20===
d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("<style type='text/css'>.fancybox-margin{margin-right:"+(d-a)+"px;}</style>").appendTo("head")})})(window,document,jQuery);;
/*!
 * typeahead.js 0.11.1
 * https://github.com/twitter/typeahead.js
 * Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
 */

(function(root, factory) {
    if (typeof define === "function" && define.amd) {
        define([ "jquery" ], function(a0) {
            return root["Bloodhound"] = factory(a0);
        });
    } else if (typeof exports === "object") {
        module.exports = factory(require("jquery"));
    } else {
        root["Bloodhound"] = factory(jQuery);
    }
})(this, function($) {
    var _ = function() {
        "use strict";
        return {
            isMsie: function() {
                return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false;
            },
            isBlankString: function(str) {
                return !str || /^\s*$/.test(str);
            },
            escapeRegExChars: function(str) {
                return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
            },
            isString: function(obj) {
                return typeof obj === "string";
            },
            isNumber: function(obj) {
                return typeof obj === "number";
            },
            isArray: $.isArray,
            isFunction: $.isFunction,
            isObject: $.isPlainObject,
            isUndefined: function(obj) {
                return typeof obj === "undefined";
            },
            isElement: function(obj) {
                return !!(obj && obj.nodeType === 1);
            },
            isJQuery: function(obj) {
                return obj instanceof $;
            },
            toStr: function toStr(s) {
                return _.isUndefined(s) || s === null ? "" : s + "";
            },
            bind: $.proxy,
            each: function(collection, cb) {
                $.each(collection, reverseArgs);
                function reverseArgs(index, value) {
                    return cb(value, index);
                }
            },
            map: $.map,
            filter: $.grep,
            every: function(obj, test) {
                var result = true;
                if (!obj) {
                    return result;
                }
                $.each(obj, function(key, val) {
                    if (!(result = test.call(null, val, key, obj))) {
                        return false;
                    }
                });
                return !!result;
            },
            some: function(obj, test) {
                var result = false;
                if (!obj) {
                    return result;
                }
                $.each(obj, function(key, val) {
                    if (result = test.call(null, val, key, obj)) {
                        return false;
                    }
                });
                return !!result;
            },
            mixin: $.extend,
            identity: function(x) {
                return x;
            },
            clone: function(obj) {
                return $.extend(true, {}, obj);
            },
            getIdGenerator: function() {
                var counter = 0;
                return function() {
                    return counter++;
                };
            },
            templatify: function templatify(obj) {
                return $.isFunction(obj) ? obj : template;
                function template() {
                    return String(obj);
                }
            },
            defer: function(fn) {
                setTimeout(fn, 0);
            },
            debounce: function(func, wait, immediate) {
                var timeout, result;
                return function() {
                    var context = this, args = arguments, later, callNow;
                    later = function() {
                        timeout = null;
                        if (!immediate) {
                            result = func.apply(context, args);
                        }
                    };
                    callNow = immediate && !timeout;
                    clearTimeout(timeout);
                    timeout = setTimeout(later, wait);
                    if (callNow) {
                        result = func.apply(context, args);
                    }
                    return result;
                };
            },
            throttle: function(func, wait) {
                var context, args, timeout, result, previous, later;
                previous = 0;
                later = function() {
                    previous = new Date();
                    timeout = null;
                    result = func.apply(context, args);
                };
                return function() {
                    var now = new Date(), remaining = wait - (now - previous);
                    context = this;
                    args = arguments;
                    if (remaining <= 0) {
                        clearTimeout(timeout);
                        timeout = null;
                        previous = now;
                        result = func.apply(context, args);
                    } else if (!timeout) {
                        timeout = setTimeout(later, remaining);
                    }
                    return result;
                };
            },
            stringify: function(val) {
                return _.isString(val) ? val : JSON.stringify(val);
            },
            noop: function() {}
        };
    }();
    var VERSION = "0.11.1";
    var tokenizers = function() {
        "use strict";
        return {
            nonword: nonword,
            whitespace: whitespace,
            obj: {
                nonword: getObjTokenizer(nonword),
                whitespace: getObjTokenizer(whitespace)
            }
        };
        function whitespace(str) {
            str = _.toStr(str);
            return str ? str.split(/\s+/) : [];
        }
        function nonword(str) {
            str = _.toStr(str);
            return str ? str.split(/\W+/) : [];
        }
        function getObjTokenizer(tokenizer) {
            return function setKey(keys) {
                keys = _.isArray(keys) ? keys : [].slice.call(arguments, 0);
                return function tokenize(o) {
                    var tokens = [];
                    _.each(keys, function(k) {
                        tokens = tokens.concat(tokenizer(_.toStr(o[k])));
                    });
                    return tokens;
                };
            };
        }
    }();
    var LruCache = function() {
        "use strict";
        function LruCache(maxSize) {
            this.maxSize = _.isNumber(maxSize) ? maxSize : 100;
            this.reset();
            if (this.maxSize <= 0) {
                this.set = this.get = $.noop;
            }
        }
        _.mixin(LruCache.prototype, {
            set: function set(key, val) {
                var tailItem = this.list.tail, node;
                if (this.size >= this.maxSize) {
                    this.list.remove(tailItem);
                    delete this.hash[tailItem.key];
                    this.size--;
                }
                if (node = this.hash[key]) {
                    node.val = val;
                    this.list.moveToFront(node);
                } else {
                    node = new Node(key, val);
                    this.list.add(node);
                    this.hash[key] = node;
                    this.size++;
                }
            },
            get: function get(key) {
                var node = this.hash[key];
                if (node) {
                    this.list.moveToFront(node);
                    return node.val;
                }
            },
            reset: function reset() {
                this.size = 0;
                this.hash = {};
                this.list = new List();
            }
        });
        function List() {
            this.head = this.tail = null;
        }
        _.mixin(List.prototype, {
            add: function add(node) {
                if (this.head) {
                    node.next = this.head;
                    this.head.prev = node;
                }
                this.head = node;
                this.tail = this.tail || node;
            },
            remove: function remove(node) {
                node.prev ? node.prev.next = node.next : this.head = node.next;
                node.next ? node.next.prev = node.prev : this.tail = node.prev;
            },
            moveToFront: function(node) {
                this.remove(node);
                this.add(node);
            }
        });
        function Node(key, val) {
            this.key = key;
            this.val = val;
            this.prev = this.next = null;
        }
        return LruCache;
    }();
    var PersistentStorage = function() {
        "use strict";
        var LOCAL_STORAGE;
        try {
            LOCAL_STORAGE = window.localStorage;
            LOCAL_STORAGE.setItem("~~~", "!");
            LOCAL_STORAGE.removeItem("~~~");
        } catch (err) {
            LOCAL_STORAGE = null;
        }
        function PersistentStorage(namespace, override) {
            this.prefix = [ "__", namespace, "__" ].join("");
            this.ttlKey = "__ttl__";
            this.keyMatcher = new RegExp("^" + _.escapeRegExChars(this.prefix));
            this.ls = override || LOCAL_STORAGE;
            !this.ls && this._noop();
        }
        _.mixin(PersistentStorage.prototype, {
            _prefix: function(key) {
                return this.prefix + key;
            },
            _ttlKey: function(key) {
                return this._prefix(key) + this.ttlKey;
            },
            _noop: function() {
                this.get = this.set = this.remove = this.clear = this.isExpired = _.noop;
            },
            _safeSet: function(key, val) {
                try {
                    this.ls.setItem(key, val);
                } catch (err) {
                    if (err.name === "QuotaExceededError") {
                        this.clear();
                        this._noop();
                    }
                }
            },
            get: function(key) {
                if (this.isExpired(key)) {
                    this.remove(key);
                }
                return decode(this.ls.getItem(this._prefix(key)));
            },
            set: function(key, val, ttl) {
                if (_.isNumber(ttl)) {
                    this._safeSet(this._ttlKey(key), encode(now() + ttl));
                } else {
                    this.ls.removeItem(this._ttlKey(key));
                }
                return this._safeSet(this._prefix(key), encode(val));
            },
            remove: function(key) {
                this.ls.removeItem(this._ttlKey(key));
                this.ls.removeItem(this._prefix(key));
                return this;
            },
            clear: function() {
                var i, keys = gatherMatchingKeys(this.keyMatcher);
                for (i = keys.length; i--; ) {
                    this.remove(keys[i]);
                }
                return this;
            },
            isExpired: function(key) {
                var ttl = decode(this.ls.getItem(this._ttlKey(key)));
                return _.isNumber(ttl) && now() > ttl ? true : false;
            }
        });
        return PersistentStorage;
        function now() {
            return new Date().getTime();
        }
        function encode(val) {
            return JSON.stringify(_.isUndefined(val) ? null : val);
        }
        function decode(val) {
            return $.parseJSON(val);
        }
        function gatherMatchingKeys(keyMatcher) {
            var i, key, keys = [], len = LOCAL_STORAGE.length;
            for (i = 0; i < len; i++) {
                if ((key = LOCAL_STORAGE.key(i)).match(keyMatcher)) {
                    keys.push(key.replace(keyMatcher, ""));
                }
            }
            return keys;
        }
    }();
    var Transport = function() {
        "use strict";
        var pendingRequestsCount = 0, pendingRequests = {}, maxPendingRequests = 6, sharedCache = new LruCache(10);
        function Transport(o) {
            o = o || {};
            this.cancelled = false;
            this.lastReq = null;
            this._send = o.transport;
            this._get = o.limiter ? o.limiter(this._get) : this._get;
            this._cache = o.cache === false ? new LruCache(0) : sharedCache;
        }
        Transport.setMaxPendingRequests = function setMaxPendingRequests(num) {
            maxPendingRequests = num;
        };
        Transport.resetCache = function resetCache() {
            sharedCache.reset();
        };
        _.mixin(Transport.prototype, {
            _fingerprint: function fingerprint(o) {
                o = o || {};
                return o.url + o.type + $.param(o.data || {});
            },
            _get: function(o, cb) {
                var that = this, fingerprint, jqXhr;
                fingerprint = this._fingerprint(o);
                if (this.cancelled || fingerprint !== this.lastReq) {
                    return;
                }
                if (jqXhr = pendingRequests[fingerprint]) {
                    jqXhr.done(done).fail(fail);
                } else if (pendingRequestsCount < maxPendingRequests) {
                    pendingRequestsCount++;
                    pendingRequests[fingerprint] = this._send(o).done(done).fail(fail).always(always);
                } else {
                    this.onDeckRequestArgs = [].slice.call(arguments, 0);
                }
                function done(resp) {
                    cb(null, resp);
                    that._cache.set(fingerprint, resp);
                }
                function fail() {
                    cb(true);
                }
                function always() {
                    pendingRequestsCount--;
                    delete pendingRequests[fingerprint];
                    if (that.onDeckRequestArgs) {
                        that._get.apply(that, that.onDeckRequestArgs);
                        that.onDeckRequestArgs = null;
                    }
                }
            },
            get: function(o, cb) {
                var resp, fingerprint;
                cb = cb || $.noop;
                o = _.isString(o) ? {
                    url: o
                } : o || {};
                fingerprint = this._fingerprint(o);
                this.cancelled = false;
                this.lastReq = fingerprint;
                if (resp = this._cache.get(fingerprint)) {
                    cb(null, resp);
                } else {
                    this._get(o, cb);
                }
            },
            cancel: function() {
                this.cancelled = true;
            }
        });
        return Transport;
    }();
    var SearchIndex = window.SearchIndex = function() {
        "use strict";
        var CHILDREN = "c", IDS = "i";
        function SearchIndex(o) {
            o = o || {};
            if (!o.datumTokenizer || !o.queryTokenizer) {
                $.error("datumTokenizer and queryTokenizer are both required");
            }
            this.identify = o.identify || _.stringify;
            this.datumTokenizer = o.datumTokenizer;
            this.queryTokenizer = o.queryTokenizer;
            this.matchAnyQueryToken = o.matchAnyQueryToken;
            this.reset();
        }
        _.mixin(SearchIndex.prototype, {
            bootstrap: function bootstrap(o) {
                this.datums = o.datums;
                this.trie = o.trie;
            },
            add: function(data) {
                var that = this;
                data = _.isArray(data) ? data : [ data ];
                _.each(data, function(datum) {
                    var id, tokens;
                    that.datums[id = that.identify(datum)] = datum;
                    tokens = normalizeTokens(that.datumTokenizer(datum));
                    _.each(tokens, function(token) {
                        var node, chars, ch;
                        node = that.trie;
                        chars = token.split("");
                        while (ch = chars.shift()) {
                            node = node[CHILDREN][ch] || (node[CHILDREN][ch] = newNode());
                            node[IDS].push(id);
                        }
                    });
                });
            },
            get: function get(ids) {
                var that = this;
                return _.map(ids, function(id) {
                    return that.datums[id];
                });
            },
            search: function search(query) {
                var that = this, tokens, matches;
                tokens = normalizeTokens(this.queryTokenizer(query));
                _.each(tokens, function(token) {
                    var node, chars, ch, ids;
                    if (matches && matches.length === 0 && !that.matchAnyQueryToken) {
                        return false;
                    }
                    node = that.trie;
                    chars = token.split("");
                    while (node && (ch = chars.shift())) {
                        node = node[CHILDREN][ch];
                    }
                    if (node && chars.length === 0) {
                        ids = node[IDS].slice(0);
                        matches = matches ? getIntersection(matches, ids) : ids;
                    } else {
                        if (!that.matchAnyQueryToken) {
                            matches = [];
                            return false;
                        }
                    }
                });
                return matches ? _.map(unique(matches), function(id) {
                    return that.datums[id];
                }) : [];
            },
            all: function all() {
                var values = [];
                for (var key in this.datums) {
                    values.push(this.datums[key]);
                }
                return values;
            },
            reset: function reset() {
                this.datums = {};
                this.trie = newNode();
            },
            serialize: function serialize() {
                return {
                    datums: this.datums,
                    trie: this.trie
                };
            }
        });
        return SearchIndex;
        function normalizeTokens(tokens) {
            tokens = _.filter(tokens, function(token) {
                return !!token;
            });
            tokens = _.map(tokens, function(token) {
                return token.toLowerCase();
            });
            return tokens;
        }
        function newNode() {
            var node = {};
            node[IDS] = [];
            node[CHILDREN] = {};
            return node;
        }
        function unique(array) {
            var seen = {}, uniques = [];
            for (var i = 0, len = array.length; i < len; i++) {
                if (!seen[array[i]]) {
                    seen[array[i]] = true;
                    uniques.push(array[i]);
                }
            }
            return uniques;
        }
        function getIntersection(arrayA, arrayB) {
            var ai = 0, bi = 0, intersection = [];
            arrayA = arrayA.sort();
            arrayB = arrayB.sort();
            var lenArrayA = arrayA.length, lenArrayB = arrayB.length;
            while (ai < lenArrayA && bi < lenArrayB) {
                if (arrayA[ai] < arrayB[bi]) {
                    ai++;
                } else if (arrayA[ai] > arrayB[bi]) {
                    bi++;
                } else {
                    intersection.push(arrayA[ai]);
                    ai++;
                    bi++;
                }
            }
            return intersection;
        }
    }();
    var Prefetch = function() {
        "use strict";
        var keys;
        keys = {
            data: "data",
            protocol: "protocol",
            thumbprint: "thumbprint"
        };
        function Prefetch(o) {
            this.url = o.url;
            this.ttl = o.ttl;
            this.cache = o.cache;
            this.prepare = o.prepare;
            this.transform = o.transform;
            this.transport = o.transport;
            this.thumbprint = o.thumbprint;
            this.storage = new PersistentStorage(o.cacheKey);
        }
        _.mixin(Prefetch.prototype, {
            _settings: function settings() {
                return {
                    url: this.url,
                    type: "GET",
                    dataType: "json"
                };
            },
            store: function store(data) {
                if (!this.cache) {
                    return;
                }
                this.storage.set(keys.data, data, this.ttl);
                this.storage.set(keys.protocol, location.protocol, this.ttl);
                this.storage.set(keys.thumbprint, this.thumbprint, this.ttl);
            },
            fromCache: function fromCache() {
                var stored = {}, isExpired;
                if (!this.cache) {
                    return null;
                }
                stored.data = this.storage.get(keys.data);
                stored.protocol = this.storage.get(keys.protocol);
                stored.thumbprint = this.storage.get(keys.thumbprint);
                isExpired = stored.thumbprint !== this.thumbprint || stored.protocol !== location.protocol;
                return stored.data && !isExpired ? stored.data : null;
            },
            fromNetwork: function(cb) {
                var that = this, settings;
                if (!cb) {
                    return;
                }
                settings = this.prepare(this._settings());
                this.transport(settings).fail(onError).done(onResponse);
                function onError() {
                    cb(true);
                }
                function onResponse(resp) {
                    cb(null, that.transform(resp));
                }
            },
            clear: function clear() {
                this.storage.clear();
                return this;
            }
        });
        return Prefetch;
    }();
    var Remote = function() {
        "use strict";
        function Remote(o) {
            this.url = o.url;
            this.prepare = o.prepare;
            this.transform = o.transform;
            this.indexResponse = o.indexResponse;
            this.transport = new Transport({
                cache: o.cache,
                limiter: o.limiter,
                transport: o.transport
            });
        }
        _.mixin(Remote.prototype, {
            _settings: function settings() {
                return {
                    url: this.url,
                    type: "GET",
                    dataType: "json"
                };
            },
            get: function get(query, cb) {
                var that = this, settings;
                if (!cb) {
                    return;
                }
                query = query || "";
                settings = this.prepare(query, this._settings());
                return this.transport.get(settings, onResponse);
                function onResponse(err, resp) {
                    err ? cb([]) : cb(that.transform(resp));
                }
            },
            cancelLastRequest: function cancelLastRequest() {
                this.transport.cancel();
            }
        });
        return Remote;
    }();
    var oParser = function() {
        "use strict";
        return function parse(o) {
            var defaults, sorter;
            defaults = {
                initialize: true,
                identify: _.stringify,
                datumTokenizer: null,
                queryTokenizer: null,
                matchAnyQueryToken: false,
                sufficient: 5,
                indexRemote: false,
                sorter: null,
                local: [],
                prefetch: null,
                remote: null
            };
            o = _.mixin(defaults, o || {});
            !o.datumTokenizer && $.error("datumTokenizer is required");
            !o.queryTokenizer && $.error("queryTokenizer is required");
            sorter = o.sorter;
            o.sorter = sorter ? function(x) {
                return x.sort(sorter);
            } : _.identity;
            o.local = _.isFunction(o.local) ? o.local() : o.local;
            o.prefetch = parsePrefetch(o.prefetch);
            o.remote = parseRemote(o.remote);
            return o;
        };
        function parsePrefetch(o) {
            var defaults;
            if (!o) {
                return null;
            }
            defaults = {
                url: null,
                ttl: 24 * 60 * 60 * 1e3,
                cache: true,
                cacheKey: null,
                thumbprint: "",
                prepare: _.identity,
                transform: _.identity,
                transport: null
            };
            o = _.isString(o) ? {
                url: o
            } : o;
            o = _.mixin(defaults, o);
            !o.url && $.error("prefetch requires url to be set");
            o.transform = o.filter || o.transform;
            o.cacheKey = o.cacheKey || o.url;
            o.thumbprint = VERSION + o.thumbprint;
            o.transport = o.transport ? callbackToDeferred(o.transport) : $.ajax;
            return o;
        }
        function parseRemote(o) {
            var defaults;
            if (!o) {
                return;
            }
            defaults = {
                url: null,
                cache: true,
                prepare: null,
                replace: null,
                wildcard: null,
                limiter: null,
                rateLimitBy: "debounce",
                rateLimitWait: 300,
                transform: _.identity,
                transport: null
            };
            o = _.isString(o) ? {
                url: o
            } : o;
            o = _.mixin(defaults, o);
            !o.url && $.error("remote requires url to be set");
            o.transform = o.filter || o.transform;
            o.prepare = toRemotePrepare(o);
            o.limiter = toLimiter(o);
            o.transport = o.transport ? callbackToDeferred(o.transport) : $.ajax;
            delete o.replace;
            delete o.wildcard;
            delete o.rateLimitBy;
            delete o.rateLimitWait;
            return o;
        }
        function toRemotePrepare(o) {
            var prepare, replace, wildcard;
            prepare = o.prepare;
            replace = o.replace;
            wildcard = o.wildcard;
            if (prepare) {
                return prepare;
            }
            if (replace) {
                prepare = prepareByReplace;
            } else if (o.wildcard) {
                prepare = prepareByWildcard;
            } else {
                prepare = idenityPrepare;
            }
            return prepare;
            function prepareByReplace(query, settings) {
                settings.url = replace(settings.url, query);
                return settings;
            }
            function prepareByWildcard(query, settings) {
                settings.url = settings.url.replace(wildcard, encodeURIComponent(query));
                return settings;
            }
            function idenityPrepare(query, settings) {
                return settings;
            }
        }
        function toLimiter(o) {
            var limiter, method, wait;
            limiter = o.limiter;
            method = o.rateLimitBy;
            wait = o.rateLimitWait;
            if (!limiter) {
                limiter = /^throttle$/i.test(method) ? throttle(wait) : debounce(wait);
            }
            return limiter;
            function debounce(wait) {
                return function debounce(fn) {
                    return _.debounce(fn, wait);
                };
            }
            function throttle(wait) {
                return function throttle(fn) {
                    return _.throttle(fn, wait);
                };
            }
        }
        function callbackToDeferred(fn) {
            return function wrapper(o) {
                var deferred = $.Deferred();
                fn(o, onSuccess, onError);
                return deferred;
                function onSuccess(resp) {
                    _.defer(function() {
                        deferred.resolve(resp);
                    });
                }
                function onError(err) {
                    _.defer(function() {
                        deferred.reject(err);
                    });
                }
            };
        }
    }();
    var Bloodhound = function() {
        "use strict";
        var old;
        old = window && window.Bloodhound;
        function Bloodhound(o) {
            o = oParser(o);
            this.sorter = o.sorter;
            this.identify = o.identify;
            this.sufficient = o.sufficient;
            this.indexRemote = o.indexRemote;
            this.local = o.local;
            this.remote = o.remote ? new Remote(o.remote) : null;
            this.prefetch = o.prefetch ? new Prefetch(o.prefetch) : null;
            this.index = new SearchIndex({
                identify: this.identify,
                datumTokenizer: o.datumTokenizer,
                queryTokenizer: o.queryTokenizer
            });
            o.initialize !== false && this.initialize();
        }
        Bloodhound.noConflict = function noConflict() {
            window && (window.Bloodhound = old);
            return Bloodhound;
        };
        Bloodhound.tokenizers = tokenizers;
        _.mixin(Bloodhound.prototype, {
            __ttAdapter: function ttAdapter() {
                var that = this;
                return this.remote ? withAsync : withoutAsync;
                function withAsync(query, sync, async) {
                    return that.search(query, sync, async);
                }
                function withoutAsync(query, sync) {
                    return that.search(query, sync);
                }
            },
            _loadPrefetch: function loadPrefetch() {
                var that = this, deferred, serialized;
                deferred = $.Deferred();
                if (!this.prefetch) {
                    deferred.resolve();
                } else if (serialized = this.prefetch.fromCache()) {
                    this.index.bootstrap(serialized);
                    deferred.resolve();
                } else {
                    this.prefetch.fromNetwork(done);
                }
                return deferred.promise();
                function done(err, data) {
                    if (err) {
                        return deferred.reject();
                    }
                    that.add(data);
                    that.prefetch.store(that.index.serialize());
                    deferred.resolve();
                }
            },
            _initialize: function initialize() {
                var that = this, deferred;
                this.clear();
                (this.initPromise = this._loadPrefetch()).done(addLocalToIndex);
                return this.initPromise;
                function addLocalToIndex() {
                    that.add(that.local);
                }
            },
            initialize: function initialize(force) {
                return !this.initPromise || force ? this._initialize() : this.initPromise;
            },
            add: function add(data) {
                this.index.add(data);
                return this;
            },
            get: function get(ids) {
                ids = _.isArray(ids) ? ids : [].slice.call(arguments);
                return this.index.get(ids);
            },
            search: function search(query, sync, async) {
                var that = this, local;
                sync = sync || _.noop;
                async = async || _.noop;
                local = this.sorter(this.index.search(query));
                sync(this.remote ? local.slice() : local);
                if (this.remote && local.length < this.sufficient) {
                    this.remote.get(query, processRemote);
                } else if (this.remote) {
                    this.remote.cancelLastRequest();
                }
                return this;
                function processRemote(remote) {
                    var nonDuplicates = [];
                    _.each(remote, function(r) {
                        !_.some(local, function(l) {
                            return that.identify(r) === that.identify(l);
                        }) && nonDuplicates.push(r);
                    });
                    that.indexRemote && that.add(nonDuplicates);
                    async(nonDuplicates);
                }
            },
            all: function all() {
                return this.index.all();
            },
            clear: function clear() {
                this.index.reset();
                return this;
            },
            clearPrefetchCache: function clearPrefetchCache() {
                this.prefetch && this.prefetch.clear();
                return this;
            },
            clearRemoteCache: function clearRemoteCache() {
                Transport.resetCache();
                return this;
            },
            ttAdapter: function ttAdapter() {
                return this.__ttAdapter();
            }
        });
        return Bloodhound;
    }();
    return Bloodhound;
});

(function(root, factory) {
    if (typeof define === "function" && define.amd) {
        define([ "jquery" ], function(a0) {
            return factory(a0);
        });
    } else if (typeof exports === "object") {
        module.exports = factory(require("jquery"));
    } else {
        factory(jQuery);
    }
})(this, function($) {
    var _ = function() {
        "use strict";
        return {
            isMsie: function() {
                return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false;
            },
            isBlankString: function(str) {
                return !str || /^\s*$/.test(str);
            },
            escapeRegExChars: function(str) {
                return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
            },
            isString: function(obj) {
                return typeof obj === "string";
            },
            isNumber: function(obj) {
                return typeof obj === "number";
            },
            isArray: $.isArray,
            isFunction: $.isFunction,
            isObject: $.isPlainObject,
            isUndefined: function(obj) {
                return typeof obj === "undefined";
            },
            isElement: function(obj) {
                return !!(obj && obj.nodeType === 1);
            },
            isJQuery: function(obj) {
                return obj instanceof $;
            },
            toStr: function toStr(s) {
                return _.isUndefined(s) || s === null ? "" : s + "";
            },
            bind: $.proxy,
            each: function(collection, cb) {
                $.each(collection, reverseArgs);
                function reverseArgs(index, value) {
                    return cb(value, index);
                }
            },
            map: $.map,
            filter: $.grep,
            every: function(obj, test) {
                var result = true;
                if (!obj) {
                    return result;
                }
                $.each(obj, function(key, val) {
                    if (!(result = test.call(null, val, key, obj))) {
                        return false;
                    }
                });
                return !!result;
            },
            some: function(obj, test) {
                var result = false;
                if (!obj) {
                    return result;
                }
                $.each(obj, function(key, val) {
                    if (result = test.call(null, val, key, obj)) {
                        return false;
                    }
                });
                return !!result;
            },
            mixin: $.extend,
            identity: function(x) {
                return x;
            },
            clone: function(obj) {
                return $.extend(true, {}, obj);
            },
            getIdGenerator: function() {
                var counter = 0;
                return function() {
                    return counter++;
                };
            },
            templatify: function templatify(obj) {
                return $.isFunction(obj) ? obj : template;
                function template() {
                    return String(obj);
                }
            },
            defer: function(fn) {
                setTimeout(fn, 0);
            },
            debounce: function(func, wait, immediate) {
                var timeout, result;
                return function() {
                    var context = this, args = arguments, later, callNow;
                    later = function() {
                        timeout = null;
                        if (!immediate) {
                            result = func.apply(context, args);
                        }
                    };
                    callNow = immediate && !timeout;
                    clearTimeout(timeout);
                    timeout = setTimeout(later, wait);
                    if (callNow) {
                        result = func.apply(context, args);
                    }
                    return result;
                };
            },
            throttle: function(func, wait) {
                var context, args, timeout, result, previous, later;
                previous = 0;
                later = function() {
                    previous = new Date();
                    timeout = null;
                    result = func.apply(context, args);
                };
                return function() {
                    var now = new Date(), remaining = wait - (now - previous);
                    context = this;
                    args = arguments;
                    if (remaining <= 0) {
                        clearTimeout(timeout);
                        timeout = null;
                        previous = now;
                        result = func.apply(context, args);
                    } else if (!timeout) {
                        timeout = setTimeout(later, remaining);
                    }
                    return result;
                };
            },
            stringify: function(val) {
                return _.isString(val) ? val : JSON.stringify(val);
            },
            noop: function() {}
        };
    }();
    var WWW = function() {
        "use strict";
        var defaultClassNames = {
            wrapper: "twitter-typeahead",
            input: "tt-input",
            hint: "tt-hint",
            menu: "tt-menu",
            dataset: "tt-dataset",
            suggestion: "tt-suggestion",
            selectable: "tt-selectable",
            empty: "tt-empty",
            open: "tt-open",
            cursor: "tt-cursor",
            highlight: "tt-highlight"
        };
        return build;
        function build(o) {
            var www, classes;
            classes = _.mixin({}, defaultClassNames, o);
            www = {
                css: buildCss(),
                classes: classes,
                html: buildHtml(classes),
                selectors: buildSelectors(classes)
            };
            return {
                css: www.css,
                html: www.html,
                classes: www.classes,
                selectors: www.selectors,
                mixin: function(o) {
                    _.mixin(o, www);
                }
            };
        }
        function buildHtml(c) {
            return {
                wrapper: '<span class="' + c.wrapper + '"></span>',
                menu: '<div class="' + c.menu + '"></div>'
            };
        }
        function buildSelectors(classes) {
            var selectors = {};
            _.each(classes, function(v, k) {
                selectors[k] = "." + v;
            });
            return selectors;
        }
        function buildCss() {
            var css = {
                wrapper: {
                    position: "relative",
                    display: "inline-block"
                },
                hint: {
                    position: "absolute",
                    top: "0",
                    left: "0",
                    borderColor: "transparent",
                    boxShadow: "none",
                    opacity: "1"
                },
                input: {
                    position: "relative",
                    verticalAlign: "top",
                    backgroundColor: "transparent"
                },
                inputWithNoHint: {
                    position: "relative",
                    verticalAlign: "top"
                },
                menu: {
                    position: "absolute",
                    top: "100%",
                    left: "0",
                    zIndex: "100",
                    display: "none"
                },
                ltr: {
                    left: "0",
                    right: "auto"
                },
                rtl: {
                    left: "auto",
                    right: " 0"
                }
            };
            if (_.isMsie()) {
                _.mixin(css.input, {
                    backgroundImage: "url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"
                });
            }
            return css;
        }
    }();
    var EventBus = function() {
        "use strict";
        var namespace, deprecationMap;
        namespace = "typeahead:";
        deprecationMap = {
            render: "rendered",
            cursorchange: "cursorchanged",
            select: "selected",
            autocomplete: "autocompleted"
        };
        function EventBus(o) {
            if (!o || !o.el) {
                $.error("EventBus initialized without el");
            }
            this.$el = $(o.el);
        }
        _.mixin(EventBus.prototype, {
            _trigger: function(type, args) {
                var $e;
                $e = $.Event(namespace + type);
                (args = args || []).unshift($e);
                this.$el.trigger.apply(this.$el, args);
                return $e;
            },
            before: function(type) {
                var args, $e;
                args = [].slice.call(arguments, 1);
                $e = this._trigger("before" + type, args);
                return $e.isDefaultPrevented();
            },
            trigger: function(type) {
                var deprecatedType;
                this._trigger(type, [].slice.call(arguments, 1));
                if (deprecatedType = deprecationMap[type]) {
                    this._trigger(deprecatedType, [].slice.call(arguments, 1));
                }
            }
        });
        return EventBus;
    }();
    var EventEmitter = function() {
        "use strict";
        var splitter = /\s+/, nextTick = getNextTick();
        return {
            onSync: onSync,
            onAsync: onAsync,
            off: off,
            trigger: trigger
        };
        function on(method, types, cb, context) {
            var type;
            if (!cb) {
                return this;
            }
            types = types.split(splitter);
            cb = context ? bindContext(cb, context) : cb;
            this._callbacks = this._callbacks || {};
            while (type = types.shift()) {
                this._callbacks[type] = this._callbacks[type] || {
                    sync: [],
                    async: []
                };
                this._callbacks[type][method].push(cb);
            }
            return this;
        }
        function onAsync(types, cb, context) {
            return on.call(this, "async", types, cb, context);
        }
        function onSync(types, cb, context) {
            return on.call(this, "sync", types, cb, context);
        }
        function off(types) {
            var type;
            if (!this._callbacks) {
                return this;
            }
            types = types.split(splitter);
            while (type = types.shift()) {
                delete this._callbacks[type];
            }
            return this;
        }
        function trigger(types) {
            var type, callbacks, args, syncFlush, asyncFlush;
            if (!this._callbacks) {
                return this;
            }
            types = types.split(splitter);
            args = [].slice.call(arguments, 1);
            while ((type = types.shift()) && (callbacks = this._callbacks[type])) {
                syncFlush = getFlush(callbacks.sync, this, [ type ].concat(args));
                asyncFlush = getFlush(callbacks.async, this, [ type ].concat(args));
                syncFlush() && nextTick(asyncFlush);
            }
            return this;
        }
        function getFlush(callbacks, context, args) {
            return flush;
            function flush() {
                var cancelled;
                for (var i = 0, len = callbacks.length; !cancelled && i < len; i += 1) {
                    cancelled = callbacks[i].apply(context, args) === false;
                }
                return !cancelled;
            }
        }
        function getNextTick() {
            var nextTickFn;
            if (window.setImmediate) {
                nextTickFn = function nextTickSetImmediate(fn) {
                    setImmediate(function() {
                        fn();
                    });
                };
            } else {
                nextTickFn = function nextTickSetTimeout(fn) {
                    setTimeout(function() {
                        fn();
                    }, 0);
                };
            }
            return nextTickFn;
        }
        function bindContext(fn, context) {
            return fn.bind ? fn.bind(context) : function() {
                fn.apply(context, [].slice.call(arguments, 0));
            };
        }
    }();
    var highlight = function(doc) {
        "use strict";
        var defaults = {
            node: null,
            pattern: null,
            tagName: "strong",
            className: null,
            wordsOnly: false,
            caseSensitive: false
        };
        return function hightlight(o) {
            var regex;
            o = _.mixin({}, defaults, o);
            if (!o.node || !o.pattern) {
                return;
            }
            o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ];
            regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly);
            traverse(o.node, hightlightTextNode);
            function hightlightTextNode(textNode) {
                var match, patternNode, wrapperNode;
                if (match = regex.exec(textNode.data)) {
                    wrapperNode = doc.createElement(o.tagName);
                    o.className && (wrapperNode.className = o.className);
                    patternNode = textNode.splitText(match.index);
                    patternNode.splitText(match[0].length);
                    wrapperNode.appendChild(patternNode.cloneNode(true));
                    textNode.parentNode.replaceChild(wrapperNode, patternNode);
                }
                return !!match;
            }
            function traverse(el, hightlightTextNode) {
                var childNode, TEXT_NODE_TYPE = 3;
                for (var i = 0; i < el.childNodes.length; i++) {
                    childNode = el.childNodes[i];
                    if (childNode.nodeType === TEXT_NODE_TYPE) {
                        i += hightlightTextNode(childNode) ? 1 : 0;
                    } else {
                        traverse(childNode, hightlightTextNode);
                    }
                }
            }
        };
        function getRegex(patterns, caseSensitive, wordsOnly) {
            var escapedPatterns = [], regexStr;
            for (var i = 0, len = patterns.length; i < len; i++) {
                escapedPatterns.push(_.escapeRegExChars(patterns[i]));
            }
            regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")";
            return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i");
        }
    }(window.document);
    var Input = function() {
        "use strict";
        var specialKeyCodeMap;
        specialKeyCodeMap = {
            9: "tab",
            27: "esc",
            37: "left",
            39: "right",
            13: "enter",
            38: "up",
            40: "down"
        };
        function Input(o, www) {
            o = o || {};
            if (!o.input) {
                $.error("input is missing");
            }
            www.mixin(this);
            this.$hint = $(o.hint);
            this.$input = $(o.input);
            this.query = this.$input.val();
            this.queryWhenFocused = this.hasFocus() ? this.query : null;
            this.$overflowHelper = buildOverflowHelper(this.$input);
            this._checkLanguageDirection();
            if (this.$hint.length === 0) {
                this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop;
            }
        }
        Input.normalizeQuery = function(str) {
            return _.toStr(str).replace(/^\s*/g, "").replace(/\s{2,}/g, " ");
        };
        _.mixin(Input.prototype, EventEmitter, {
            _onBlur: function onBlur() {
                this.resetInputValue();
                this.trigger("blurred");
            },
            _onFocus: function onFocus() {
                this.queryWhenFocused = this.query;
                this.trigger("focused");
            },
            _onKeydown: function onKeydown($e) {
                var keyName = specialKeyCodeMap[$e.which || $e.keyCode];
                this._managePreventDefault(keyName, $e);
                if (keyName && this._shouldTrigger(keyName, $e)) {
                    this.trigger(keyName + "Keyed", $e);
                }
            },
            _onInput: function onInput() {
                this._setQuery(this.getInputValue());
                this.clearHintIfInvalid();
                this._checkLanguageDirection();
            },
            _managePreventDefault: function managePreventDefault(keyName, $e) {
                var preventDefault;
                switch (keyName) {
                  case "up":
                  case "down":
                    preventDefault = !withModifier($e);
                    break;

                  default:
                    preventDefault = false;
                }
                preventDefault && $e.preventDefault();
            },
            _shouldTrigger: function shouldTrigger(keyName, $e) {
                var trigger;
                switch (keyName) {
                  case "tab":
                    trigger = !withModifier($e);
                    break;

                  default:
                    trigger = true;
                }
                return trigger;
            },
            _checkLanguageDirection: function checkLanguageDirection() {
                var dir = (this.$input.css("direction") || "ltr").toLowerCase();
                if (this.dir !== dir) {
                    this.dir = dir;
                    this.$hint.attr("dir", dir);
                    this.trigger("langDirChanged", dir);
                }
            },
            _setQuery: function setQuery(val, silent) {
                var areEquivalent, hasDifferentWhitespace;
                areEquivalent = areQueriesEquivalent(val, this.query);
                hasDifferentWhitespace = areEquivalent ? this.query.length !== val.length : false;
                this.query = val;
                if (!silent && !areEquivalent) {
                    this.trigger("queryChanged", this.query);
                } else if (!silent && hasDifferentWhitespace) {
                    this.trigger("whitespaceChanged", this.query);
                }
            },
            bind: function() {
                var that = this, onBlur, onFocus, onKeydown, onInput;
                onBlur = _.bind(this._onBlur, this);
                onFocus = _.bind(this._onFocus, this);
                onKeydown = _.bind(this._onKeydown, this);
                onInput = _.bind(this._onInput, this);
                this.$input.on("blur.tt", onBlur).on("focus.tt", onFocus).on("keydown.tt", onKeydown);
                if (!_.isMsie() || _.isMsie() > 9) {
                    this.$input.on("input.tt", onInput);
                } else {
                    this.$input.on("keydown.tt keypress.tt cut.tt paste.tt", function($e) {
                        if (specialKeyCodeMap[$e.which || $e.keyCode]) {
                            return;
                        }
                        _.defer(_.bind(that._onInput, that, $e));
                    });
                }
                return this;
            },
            focus: function focus() {
                this.$input.focus();
            },
            blur: function blur() {
                this.$input.blur();
            },
            getLangDir: function getLangDir() {
                return this.dir;
            },
            getQuery: function getQuery() {
                return this.query || "";
            },
            setQuery: function setQuery(val, silent) {
                this.setInputValue(val);
                this._setQuery(val, silent);
            },
            hasQueryChangedSinceLastFocus: function hasQueryChangedSinceLastFocus() {
                return this.query !== this.queryWhenFocused;
            },
            getInputValue: function getInputValue() {
                return this.$input.val();
            },
            setInputValue: function setInputValue(value) {
                this.$input.val(value);
                this.clearHintIfInvalid();
                this._checkLanguageDirection();
            },
            resetInputValue: function resetInputValue() {
                this.setInputValue(this.query);
            },
            getHint: function getHint() {
                return this.$hint.val();
            },
            setHint: function setHint(value) {
                this.$hint.val(value);
            },
            clearHint: function clearHint() {
                this.setHint("");
            },
            clearHintIfInvalid: function clearHintIfInvalid() {
                var val, hint, valIsPrefixOfHint, isValid;
                val = this.getInputValue();
                hint = this.getHint();
                valIsPrefixOfHint = val !== hint && hint.indexOf(val) === 0;
                isValid = val !== "" && valIsPrefixOfHint && !this.hasOverflow();
                !isValid && this.clearHint();
            },
            hasFocus: function hasFocus() {
                return this.$input.is(":focus");
            },
            hasOverflow: function hasOverflow() {
                var constraint = this.$input.width() - 2;
                this.$overflowHelper.text(this.getInputValue());
                return this.$overflowHelper.width() >= constraint;
            },
            isCursorAtEnd: function() {
                var valueLength, selectionStart, range;
                valueLength = this.$input.val().length;
                selectionStart = this.$input[0].selectionStart;
                if (_.isNumber(selectionStart)) {
                    return selectionStart === valueLength;
                } else if (document.selection) {
                    range = document.selection.createRange();
                    range.moveStart("character", -valueLength);
                    return valueLength === range.text.length;
                }
                return true;
            },
            destroy: function destroy() {
                this.$hint.off(".tt");
                this.$input.off(".tt");
                this.$overflowHelper.remove();
                this.$hint = this.$input = this.$overflowHelper = $("<div>");
            }
        });
        return Input;
        function buildOverflowHelper($input) {
            return $('<pre aria-hidden="true"></pre>').css({
                position: "absolute",
                visibility: "hidden",
                whiteSpace: "pre",
                fontFamily: $input.css("font-family"),
                fontSize: $input.css("font-size"),
                fontStyle: $input.css("font-style"),
                fontVariant: $input.css("font-variant"),
                fontWeight: $input.css("font-weight"),
                wordSpacing: $input.css("word-spacing"),
                letterSpacing: $input.css("letter-spacing"),
                textIndent: $input.css("text-indent"),
                textRendering: $input.css("text-rendering"),
                textTransform: $input.css("text-transform")
            }).insertAfter($input);
        }
        function areQueriesEquivalent(a, b) {
            return Input.normalizeQuery(a) === Input.normalizeQuery(b);
        }
        function withModifier($e) {
            return $e.altKey || $e.ctrlKey || $e.metaKey || $e.shiftKey;
        }
    }();
    var Dataset = function() {
        "use strict";
        var keys, nameGenerator;
        keys = {
            val: "tt-selectable-display",
            obj: "tt-selectable-object"
        };
        nameGenerator = _.getIdGenerator();
        function Dataset(o, www) {
            o = o || {};
            o.templates = o.templates || {};
            o.templates.notFound = o.templates.notFound || o.templates.empty;
            if (!o.source) {
                $.error("missing source");
            }
            if (!o.node) {
                $.error("missing node");
            }
            if (o.name && !isValidName(o.name)) {
                $.error("invalid dataset name: " + o.name);
            }
            www.mixin(this);
            this.highlight = !!o.highlight;
            this.name = o.name || nameGenerator();
            this.limit = o.limit || 5;
            this.displayFn = getDisplayFn(o.display || o.displayKey);
            this.templates = getTemplates(o.templates, this.displayFn);
            this.source = o.source.__ttAdapter ? o.source.__ttAdapter() : o.source;
            this.async = _.isUndefined(o.async) ? this.source.length > 2 : !!o.async;
            this._resetLastSuggestion();
            this.$el = $(o.node).addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
        }
        Dataset.extractData = function extractData(el) {
            var $el = $(el);
            if ($el.data(keys.obj)) {
                return {
                    val: $el.data(keys.val) || "",
                    obj: $el.data(keys.obj) || null
                };
            }
            return null;
        };
        _.mixin(Dataset.prototype, EventEmitter, {
            _overwrite: function overwrite(query, suggestions) {
                suggestions = suggestions || [];
                if (suggestions.length) {
                    this._renderSuggestions(query, suggestions);
                } else if (this.async && this.templates.pending) {
                    this._renderPending(query);
                } else if (!this.async && this.templates.notFound) {
                    this._renderNotFound(query);
                } else {
                    this._empty();
                }
                this.trigger("rendered", this.name, suggestions, false);
            },
            _append: function append(query, suggestions) {
                suggestions = suggestions || [];
                if (suggestions.length && this.$lastSuggestion.length) {
                    this._appendSuggestions(query, suggestions);
                } else if (suggestions.length) {
                    this._renderSuggestions(query, suggestions);
                } else if (!this.$lastSuggestion.length && this.templates.notFound) {
                    this._renderNotFound(query);
                }
                this.trigger("rendered", this.name, suggestions, true);
            },
            _renderSuggestions: function renderSuggestions(query, suggestions) {
                var $fragment;
                $fragment = this._getSuggestionsFragment(query, suggestions);
                this.$lastSuggestion = $fragment.children().last();
                this.$el.html($fragment).prepend(this._getHeader(query, suggestions)).append(this._getFooter(query, suggestions));
            },
            _appendSuggestions: function appendSuggestions(query, suggestions) {
                var $fragment, $lastSuggestion;
                $fragment = this._getSuggestionsFragment(query, suggestions);
                $lastSuggestion = $fragment.children().last();
                this.$lastSuggestion.after($fragment);
                this.$lastSuggestion = $lastSuggestion;
            },
            _renderPending: function renderPending(query) {
                var template = this.templates.pending;
                this._resetLastSuggestion();
                template && this.$el.html(template({
                    query: query,
                    dataset: this.name
                }));
            },
            _renderNotFound: function renderNotFound(query) {
                var template = this.templates.notFound;
                this._resetLastSuggestion();
                template && this.$el.html(template({
                    query: query,
                    dataset: this.name
                }));
            },
            _empty: function empty() {
                this.$el.empty();
                this._resetLastSuggestion();
            },
            _getSuggestionsFragment: function getSuggestionsFragment(query, suggestions) {
                var that = this, fragment;
                fragment = document.createDocumentFragment();
                _.each(suggestions, function getSuggestionNode(suggestion) {
                    var $el, context;
                    context = that._injectQuery(query, suggestion);
                    $el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
                    fragment.appendChild($el[0]);
                });
                this.highlight && highlight({
                    className: this.classes.highlight,
                    node: fragment,
                    pattern: query
                });
                return $(fragment);
            },
            _getFooter: function getFooter(query, suggestions) {
                return this.templates.footer ? this.templates.footer({
                    query: query,
                    suggestions: suggestions,
                    dataset: this.name
                }) : null;
            },
            _getHeader: function getHeader(query, suggestions) {
                return this.templates.header ? this.templates.header({
                    query: query,
                    suggestions: suggestions,
                    dataset: this.name
                }) : null;
            },
            _resetLastSuggestion: function resetLastSuggestion() {
                this.$lastSuggestion = $();
            },
            _injectQuery: function injectQuery(query, obj) {
                return _.isObject(obj) ? _.mixin({
                    _query: query
                }, obj) : obj;
            },
            update: function update(query) {
                var that = this, canceled = false, syncCalled = false, rendered = 0;
                this.cancel();
                this.cancel = function cancel() {
                    canceled = true;
                    that.cancel = $.noop;
                    that.async && that.trigger("asyncCanceled", query);
                };
                this.source(query, sync, async);
                !syncCalled && sync([]);
                function sync(suggestions) {
                    if (syncCalled) {
                        return;
                    }
                    syncCalled = true;
                    suggestions = (suggestions || []).slice(0, that.limit);
                    rendered = suggestions.length;
                    that._overwrite(query, suggestions);
                    if (rendered < that.limit && that.async) {
                        that.trigger("asyncRequested", query);
                    }
                }
                function async(suggestions) {
                    suggestions = suggestions || [];
                    if (!canceled && rendered < that.limit) {
                        that.cancel = $.noop;
                        that._append(query, suggestions.slice(0, that.limit - rendered));
                        rendered += suggestions.length;
                        that.async && that.trigger("asyncReceived", query);
                    }
                }
            },
            cancel: $.noop,
            clear: function clear() {
                this._empty();
                this.cancel();
                this.trigger("cleared");
            },
            isEmpty: function isEmpty() {
                return this.$el.is(":empty");
            },
            destroy: function destroy() {
                this.$el = $("<div>");
            }
        });
        return Dataset;
        function getDisplayFn(display) {
            display = display || _.stringify;
            return _.isFunction(display) ? display : displayFn;
            function displayFn(obj) {
                return obj[display];
            }
        }
        function getTemplates(templates, displayFn) {
            return {
                notFound: templates.notFound && _.templatify(templates.notFound),
                pending: templates.pending && _.templatify(templates.pending),
                header: templates.header && _.templatify(templates.header),
                footer: templates.footer && _.templatify(templates.footer),
                suggestion: templates.suggestion || suggestionTemplate
            };
            function suggestionTemplate(context) {
                return $("<div>").text(displayFn(context));
            }
        }
        function isValidName(str) {
            return /^[_a-zA-Z0-9-]+$/.test(str);
        }
    }();
    var Menu = function() {
        "use strict";
        function Menu(o, www) {
            var that = this;
            o = o || {};
            if (!o.node) {
                $.error("node is required");
            }
            www.mixin(this);
            this.$node = $(o.node);
            this.query = null;
            this.datasets = _.map(o.datasets, initializeDataset);
            function initializeDataset(oDataset) {
                var node = that.$node.find(oDataset.node).first();
                oDataset.node = node.length ? node : $("<div>").appendTo(that.$node);
                return new Dataset(oDataset, www);
            }
        }
        _.mixin(Menu.prototype, EventEmitter, {
            _onSelectableClick: function onSelectableClick($e) {
                this.trigger("selectableClicked", $($e.currentTarget));
            },
            _onRendered: function onRendered(type, dataset, suggestions, async) {
                this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty());
                this.trigger("datasetRendered", dataset, suggestions, async);
            },
            _onCleared: function onCleared() {
                this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty());
                this.trigger("datasetCleared");
            },
            _propagate: function propagate() {
                this.trigger.apply(this, arguments);
            },
            _allDatasetsEmpty: function allDatasetsEmpty() {
                return _.every(this.datasets, isDatasetEmpty);
                function isDatasetEmpty(dataset) {
                    return dataset.isEmpty();
                }
            },
            _getSelectables: function getSelectables() {
                return this.$node.find(this.selectors.selectable);
            },
            _removeCursor: function _removeCursor() {
                var $selectable = this.getActiveSelectable();
                $selectable && $selectable.removeClass(this.classes.cursor);
            },
            _ensureVisible: function ensureVisible($el) {
                var elTop, elBottom, nodeScrollTop, nodeHeight;
                elTop = $el.position().top;
                elBottom = elTop + $el.outerHeight(true);
                nodeScrollTop = this.$node.scrollTop();
                nodeHeight = this.$node.height() + parseInt(this.$node.css("paddingTop"), 10) + parseInt(this.$node.css("paddingBottom"), 10);
                if (elTop < 0) {
                    this.$node.scrollTop(nodeScrollTop + elTop);
                } else if (nodeHeight < elBottom) {
                    this.$node.scrollTop(nodeScrollTop + (elBottom - nodeHeight));
                }
            },
            bind: function() {
                var that = this, onSelectableClick;
                onSelectableClick = _.bind(this._onSelectableClick, this);
                this.$node.on("click.tt", this.selectors.selectable, onSelectableClick);
                this.$node.on("mouseover", this.selectors.selectable, function() {
                    that.setCursor($(this));
                });
                _.each(this.datasets, function(dataset) {
                    dataset.onSync("asyncRequested", that._propagate, that).onSync("asyncCanceled", that._propagate, that).onSync("asyncReceived", that._propagate, that).onSync("rendered", that._onRendered, that).onSync("cleared", that._onCleared, that);
                });
                return this;
            },
            isOpen: function isOpen() {
                return this.$node.hasClass(this.classes.open);
            },
            open: function open() {
                this.$node.scrollTop(0);
                this.$node.addClass(this.classes.open);
            },
            close: function close() {
                this.$node.removeClass(this.classes.open);
                this._removeCursor();
            },
            setLanguageDirection: function setLanguageDirection(dir) {
                this.$node.attr("dir", dir);
            },
            selectableRelativeToCursor: function selectableRelativeToCursor(delta) {
                var $selectables, $oldCursor, oldIndex, newIndex;
                $oldCursor = this.getActiveSelectable();
                $selectables = this._getSelectables();
                oldIndex = $oldCursor ? $selectables.index($oldCursor) : -1;
                newIndex = oldIndex + delta;
                newIndex = (newIndex + 1) % ($selectables.length + 1) - 1;
                newIndex = newIndex < -1 ? $selectables.length - 1 : newIndex;
                return newIndex === -1 ? null : $selectables.eq(newIndex);
            },
            setCursor: function setCursor($selectable) {
                this._removeCursor();
                if ($selectable = $selectable && $selectable.first()) {
                    $selectable.addClass(this.classes.cursor);
                    this._ensureVisible($selectable);
                }
            },
            getSelectableData: function getSelectableData($el) {
                return $el && $el.length ? Dataset.extractData($el) : null;
            },
            getActiveSelectable: function getActiveSelectable() {
                var $selectable = this._getSelectables().filter(this.selectors.cursor).first();
                return $selectable.length ? $selectable : null;
            },
            getTopSelectable: function getTopSelectable() {
                var $selectable = this._getSelectables().first();
                return $selectable.length ? $selectable : null;
            },
            update: function update(query) {
                var isValidUpdate = query !== this.query;
                if (isValidUpdate) {
                    this.query = query;
                    _.each(this.datasets, updateDataset);
                }
                return isValidUpdate;
                function updateDataset(dataset) {
                    dataset.update(query);
                }
            },
            empty: function empty() {
                _.each(this.datasets, clearDataset);
                this.query = null;
                this.$node.addClass(this.classes.empty);
                function clearDataset(dataset) {
                    dataset.clear();
                }
            },
            destroy: function destroy() {
                this.$node.off(".tt");
                this.$node = $("<div>");
                _.each(this.datasets, destroyDataset);
                function destroyDataset(dataset) {
                    dataset.destroy();
                }
            }
        });
        return Menu;
    }();
    var DefaultMenu = function() {
        "use strict";
        var s = Menu.prototype;
        function DefaultMenu() {
            Menu.apply(this, [].slice.call(arguments, 0));
        }
        _.mixin(DefaultMenu.prototype, Menu.prototype, {
            open: function open() {
                !this._allDatasetsEmpty() && this._show();
                return s.open.apply(this, [].slice.call(arguments, 0));
            },
            close: function close() {
                this._hide();
                return s.close.apply(this, [].slice.call(arguments, 0));
            },
            _onRendered: function onRendered() {
                if (this._allDatasetsEmpty()) {
                    this._hide();
                } else {
                    this.isOpen() && this._show();
                }
                return s._onRendered.apply(this, [].slice.call(arguments, 0));
            },
            _onCleared: function onCleared() {
                if (this._allDatasetsEmpty()) {
                    this._hide();
                } else {
                    this.isOpen() && this._show();
                }
                return s._onCleared.apply(this, [].slice.call(arguments, 0));
            },
            setLanguageDirection: function setLanguageDirection(dir) {
                this.$node.css(dir === "ltr" ? this.css.ltr : this.css.rtl);
                return s.setLanguageDirection.apply(this, [].slice.call(arguments, 0));
            },
            _hide: function hide() {
                this.$node.hide();
            },
            _show: function show() {
                this.$node.css("display", "block");
            }
        });
        return DefaultMenu;
    }();
    var Typeahead = function() {
        "use strict";
        function Typeahead(o, www) {
            var onFocused, onBlurred, onEnterKeyed, onTabKeyed, onEscKeyed, onUpKeyed, onDownKeyed, onLeftKeyed, onRightKeyed, onQueryChanged, onWhitespaceChanged;
            o = o || {};
            if (!o.input) {
                $.error("missing input");
            }
            if (!o.menu) {
                $.error("missing menu");
            }
            if (!o.eventBus) {
                $.error("missing event bus");
            }
            www.mixin(this);
            this.eventBus = o.eventBus;
            this.minLength = _.isNumber(o.minLength) ? o.minLength : 1;
            this.input = o.input;
            this.menu = o.menu;
            this.enabled = true;
            this.active = false;
            this.input.hasFocus() && this.activate();
            this.dir = this.input.getLangDir();
            this._hacks();
            this.menu.bind().onSync("selectableClicked", this._onSelectableClicked, this).onSync("asyncRequested", this._onAsyncRequested, this).onSync("asyncCanceled", this._onAsyncCanceled, this).onSync("asyncReceived", this._onAsyncReceived, this).onSync("datasetRendered", this._onDatasetRendered, this).onSync("datasetCleared", this._onDatasetCleared, this);
            onFocused = c(this, "activate", "open", "_onFocused");
            onBlurred = c(this, "deactivate", "_onBlurred");
            onEnterKeyed = c(this, "isActive", "isOpen", "_onEnterKeyed");
            onTabKeyed = c(this, "isActive", "isOpen", "_onTabKeyed");
            onEscKeyed = c(this, "isActive", "_onEscKeyed");
            onUpKeyed = c(this, "isActive", "open", "_onUpKeyed");
            onDownKeyed = c(this, "isActive", "open", "_onDownKeyed");
            onLeftKeyed = c(this, "isActive", "isOpen", "_onLeftKeyed");
            onRightKeyed = c(this, "isActive", "isOpen", "_onRightKeyed");
            onQueryChanged = c(this, "_openIfActive", "_onQueryChanged");
            onWhitespaceChanged = c(this, "_openIfActive", "_onWhitespaceChanged");
            this.input.bind().onSync("focused", onFocused, this).onSync("blurred", onBlurred, this).onSync("enterKeyed", onEnterKeyed, this).onSync("tabKeyed", onTabKeyed, this).onSync("escKeyed", onEscKeyed, this).onSync("upKeyed", onUpKeyed, this).onSync("downKeyed", onDownKeyed, this).onSync("leftKeyed", onLeftKeyed, this).onSync("rightKeyed", onRightKeyed, this).onSync("queryChanged", onQueryChanged, this).onSync("whitespaceChanged", onWhitespaceChanged, this).onSync("langDirChanged", this._onLangDirChanged, this);
        }
        _.mixin(Typeahead.prototype, {
            _hacks: function hacks() {
                var $input, $menu;
                $input = this.input.$input || $("<div>");
                $menu = this.menu.$node || $("<div>");
                $input.on("blur.tt", function($e) {
                    var active, isActive, hasActive;
                    active = document.activeElement;
                    isActive = $menu.is(active);
                    hasActive = $menu.has(active).length > 0;
                    if (_.isMsie() && (isActive || hasActive)) {
                        $e.preventDefault();
                        $e.stopImmediatePropagation();
                        _.defer(function() {
                            $input.focus();
                        });
                    }
                });
                $menu.on("mousedown.tt", function($e) {
                    $e.preventDefault();
                });
            },
            _onSelectableClicked: function onSelectableClicked(type, $el) {
                this.select($el);
            },
            _onDatasetCleared: function onDatasetCleared() {
                this._updateHint();
            },
            _onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async) {
                this._updateHint();
                this.eventBus.trigger("render", suggestions, async, dataset);
            },
            _onAsyncRequested: function onAsyncRequested(type, dataset, query) {
                this.eventBus.trigger("asyncrequest", query, dataset);
            },
            _onAsyncCanceled: function onAsyncCanceled(type, dataset, query) {
                this.eventBus.trigger("asynccancel", query, dataset);
            },
            _onAsyncReceived: function onAsyncReceived(type, dataset, query) {
                this.eventBus.trigger("asyncreceive", query, dataset);
            },
            _onFocused: function onFocused() {
                this._minLengthMet() && this.menu.update(this.input.getQuery());
            },
            _onBlurred: function onBlurred() {
                if (this.input.hasQueryChangedSinceLastFocus()) {
                    this.eventBus.trigger("change", this.input.getQuery());
                }
            },
            _onEnterKeyed: function onEnterKeyed(type, $e) {
                var $selectable;
                if ($selectable = this.menu.getActiveSelectable()) {
                    this.select($selectable) && $e.preventDefault();
                }
            },
            _onTabKeyed: function onTabKeyed(type, $e) {
                var $selectable;
                if ($selectable = this.menu.getActiveSelectable()) {
                    this.select($selectable) && $e.preventDefault();
                } else if ($selectable = this.menu.getTopSelectable()) {
                    this.autocomplete($selectable) && $e.preventDefault();
                }
            },
            _onEscKeyed: function onEscKeyed() {
                this.close();
            },
            _onUpKeyed: function onUpKeyed() {
                this.moveCursor(-1);
            },
            _onDownKeyed: function onDownKeyed() {
                this.moveCursor(+1);
            },
            _onLeftKeyed: function onLeftKeyed() {
                if (this.dir === "rtl" && this.input.isCursorAtEnd()) {
                    this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
                }
            },
            _onRightKeyed: function onRightKeyed() {
                if (this.dir === "ltr" && this.input.isCursorAtEnd()) {
                    this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
                }
            },
            _onQueryChanged: function onQueryChanged(e, query) {
                this._minLengthMet(query) ? this.menu.update(query) : this.menu.empty();
            },
            _onWhitespaceChanged: function onWhitespaceChanged() {
                this._updateHint();
            },
            _onLangDirChanged: function onLangDirChanged(e, dir) {
                if (this.dir !== dir) {
                    this.dir = dir;
                    this.menu.setLanguageDirection(dir);
                }
            },
            _openIfActive: function openIfActive() {
                this.isActive() && this.open();
            },
            _minLengthMet: function minLengthMet(query) {
                query = _.isString(query) ? query : this.input.getQuery() || "";
                return query.length >= this.minLength;
            },
            _updateHint: function updateHint() {
                var $selectable, data, val, query, escapedQuery, frontMatchRegEx, match;
                $selectable = this.menu.getTopSelectable();
                data = this.menu.getSelectableData($selectable);
                val = this.input.getInputValue();
                if (data && !_.isBlankString(val) && !this.input.hasOverflow()) {
                    query = Input.normalizeQuery(val);
                    escapedQuery = _.escapeRegExChars(query);
                    frontMatchRegEx = new RegExp("^(?:" + escapedQuery + ")(.+$)", "i");
                    match = frontMatchRegEx.exec(data.val);
                    match && this.input.setHint(val + match[1]);
                } else {
                    this.input.clearHint();
                }
            },
            isEnabled: function isEnabled() {
                return this.enabled;
            },
            enable: function enable() {
                this.enabled = true;
            },
            disable: function disable() {
                this.enabled = false;
            },
            isActive: function isActive() {
                return this.active;
            },
            activate: function activate() {
                if (this.isActive()) {
                    return true;
                } else if (!this.isEnabled() || this.eventBus.before("active")) {
                    return false;
                } else {
                    this.active = true;
                    this.eventBus.trigger("active");
                    return true;
                }
            },
            deactivate: function deactivate() {
                if (!this.isActive()) {
                    return true;
                } else if (this.eventBus.before("idle")) {
                    return false;
                } else {
                    this.active = false;
                    this.close();
                    this.eventBus.trigger("idle");
                    return true;
                }
            },
            isOpen: function isOpen() {
                return this.menu.isOpen();
            },
            open: function open() {
                if (!this.isOpen() && !this.eventBus.before("open")) {
                    this.menu.open();
                    this._updateHint();
                    this.eventBus.trigger("open");
                }
                return this.isOpen();
            },
            close: function close() {
                if (this.isOpen() && !this.eventBus.before("close")) {
                    this.menu.close();
                    this.input.clearHint();
                    this.input.resetInputValue();
                    this.eventBus.trigger("close");
                }
                return !this.isOpen();
            },
            setVal: function setVal(val) {
                this.input.setQuery(_.toStr(val));
            },
            getVal: function getVal() {
                return this.input.getQuery();
            },
            select: function select($selectable) {
                var data = this.menu.getSelectableData($selectable);
                if (data && !this.eventBus.before("select", data.obj)) {
                    this.input.setQuery(data.val, true);
                    this.eventBus.trigger("select", data.obj);
                    this.close();
                    return true;
                }
                return false;
            },
            autocomplete: function autocomplete($selectable) {
                var query, data, isValid;
                query = this.input.getQuery();
                data = this.menu.getSelectableData($selectable);
                isValid = data && query !== data.val;
                if (isValid && !this.eventBus.before("autocomplete", data.obj)) {
                    this.input.setQuery(data.val);
                    this.eventBus.trigger("autocomplete", data.obj);
                    return true;
                }
                return false;
            },
            moveCursor: function moveCursor(delta) {
                var query, $candidate, data, payload, cancelMove;
                query = this.input.getQuery();
                $candidate = this.menu.selectableRelativeToCursor(delta);
                data = this.menu.getSelectableData($candidate);
                payload = data ? data.obj : null;
                cancelMove = this._minLengthMet() && this.menu.update(query);
                if (!cancelMove && !this.eventBus.before("cursorchange", payload)) {
                    this.menu.setCursor($candidate);
                    if (data) {
                        this.input.setInputValue(data.val);
                    } else {
                        this.input.resetInputValue();
                        this._updateHint();
                    }
                    this.eventBus.trigger("cursorchange", payload);
                    return true;
                }
                return false;
            },
            destroy: function destroy() {
                this.input.destroy();
                this.menu.destroy();
            }
        });
        return Typeahead;
        function c(ctx) {
            var methods = [].slice.call(arguments, 1);
            return function() {
                var args = [].slice.call(arguments);
                _.each(methods, function(method) {
                    return ctx[method].apply(ctx, args);
                });
            };
        }
    }();
    (function() {
        "use strict";
        var old, keys, methods;
        old = $.fn.typeahead;
        keys = {
            www: "tt-www",
            attrs: "tt-attrs",
            typeahead: "tt-typeahead"
        };
        methods = {
            initialize: function initialize(o, datasets) {
                var www;
                datasets = _.isArray(datasets) ? datasets : [].slice.call(arguments, 1);
                o = o || {};
                www = WWW(o.classNames);
                return this.each(attach);
                function attach() {
                    var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, typeahead, MenuConstructor;
                    _.each(datasets, function(d) {
                        d.highlight = !!o.highlight;
                    });
                    $input = $(this);
                    $wrapper = $(www.html.wrapper);
                    $hint = $elOrNull(o.hint);
                    $menu = $elOrNull(o.menu);
                    defaultHint = o.hint !== false && !$hint;
                    defaultMenu = o.menu !== false && !$menu;
                    defaultHint && ($hint = buildHintFromInput($input, www));
                    defaultMenu && ($menu = $(www.html.menu).css(www.css.menu));
                    $hint && $hint.val("");
                    $input = prepInput($input, www);
                    if (defaultHint || defaultMenu) {
                        $wrapper.css(www.css.wrapper);
                        $input.css(defaultHint ? www.css.input : www.css.inputWithNoHint);
                        $input.wrap($wrapper).parent().prepend(defaultHint ? $hint : null).append(defaultMenu ? $menu : null);
                    }
                    MenuConstructor = defaultMenu ? DefaultMenu : Menu;
                    eventBus = new EventBus({
                        el: $input
                    });
                    input = new Input({
                        hint: $hint,
                        input: $input
                    }, www);
                    menu = new MenuConstructor({
                        node: $menu,
                        datasets: datasets
                    }, www);
                    typeahead = new Typeahead({
                        input: input,
                        menu: menu,
                        eventBus: eventBus,
                        minLength: o.minLength
                    }, www);
                    $input.data(keys.www, www);
                    $input.data(keys.typeahead, typeahead);
                }
            },
            isEnabled: function isEnabled() {
                var enabled;
                ttEach(this.first(), function(t) {
                    enabled = t.isEnabled();
                });
                return enabled;
            },
            enable: function enable() {
                ttEach(this, function(t) {
                    t.enable();
                });
                return this;
            },
            disable: function disable() {
                ttEach(this, function(t) {
                    t.disable();
                });
                return this;
            },
            isActive: function isActive() {
                var active;
                ttEach(this.first(), function(t) {
                    active = t.isActive();
                });
                return active;
            },
            activate: function activate() {
                ttEach(this, function(t) {
                    t.activate();
                });
                return this;
            },
            deactivate: function deactivate() {
                ttEach(this, function(t) {
                    t.deactivate();
                });
                return this;
            },
            isOpen: function isOpen() {
                var open;
                ttEach(this.first(), function(t) {
                    open = t.isOpen();
                });
                return open;
            },
            open: function open() {
                ttEach(this, function(t) {
                    t.open();
                });
                return this;
            },
            close: function close() {
                ttEach(this, function(t) {
                    t.close();
                });
                return this;
            },
            select: function select(el) {
                var success = false, $el = $(el);
                ttEach(this.first(), function(t) {
                    success = t.select($el);
                });
                return success;
            },
            autocomplete: function autocomplete(el) {
                var success = false, $el = $(el);
                ttEach(this.first(), function(t) {
                    success = t.autocomplete($el);
                });
                return success;
            },
            moveCursor: function moveCursoe(delta) {
                var success = false;
                ttEach(this.first(), function(t) {
                    success = t.moveCursor(delta);
                });
                return success;
            },
            val: function val(newVal) {
                var query;
                if (!arguments.length) {
                    ttEach(this.first(), function(t) {
                        query = t.getVal();
                    });
                    return query;
                } else {
                    ttEach(this, function(t) {
                        t.setVal(_.toStr(newVal));
                    });
                    return this;
                }
            },
            destroy: function destroy() {
                ttEach(this, function(typeahead, $input) {
                    revert($input);
                    typeahead.destroy();
                });
                return this;
            }
        };
        $.fn.typeahead = function(method) {
            if (methods[method]) {
                return methods[method].apply(this, [].slice.call(arguments, 1));
            } else {
                return methods.initialize.apply(this, arguments);
            }
        };
        $.fn.typeahead.noConflict = function noConflict() {
            $.fn.typeahead = old;
            return this;
        };
        function ttEach($els, fn) {
            $els.each(function() {
                var $input = $(this), typeahead;
                (typeahead = $input.data(keys.typeahead)) && fn(typeahead, $input);
            });
        }
        function buildHintFromInput($input, www) {
            return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop("readonly", true).removeAttr("id name placeholder required").attr({
                autocomplete: "off",
                spellcheck: "false",
                tabindex: -1
            });
        }
        function prepInput($input, www) {
            $input.data(keys.attrs, {
                dir: $input.attr("dir"),
                autocomplete: $input.attr("autocomplete"),
                spellcheck: $input.attr("spellcheck"),
                style: $input.attr("style")
            });
            $input.addClass(www.classes.input).attr({
                autocomplete: "off",
                spellcheck: false
            });
            try {
                !$input.attr("dir") && $input.attr("dir", "auto");
            } catch (e) {}
            return $input;
        }
        function getBackgroundStyles($el) {
            return {
                backgroundAttachment: $el.css("background-attachment"),
                backgroundClip: $el.css("background-clip"),
                backgroundColor: $el.css("background-color"),
                backgroundImage: $el.css("background-image"),
                backgroundOrigin: $el.css("background-origin"),
                backgroundPosition: $el.css("background-position"),
                backgroundRepeat: $el.css("background-repeat"),
                backgroundSize: $el.css("background-size")
            };
        }
        function revert($input) {
            var www, $wrapper;
            www = $input.data(keys.www);
            $wrapper = $input.parent().filter(www.selectors.wrapper);
            _.each($input.data(keys.attrs), function(val, key) {
                _.isUndefined(val) ? $input.removeAttr(key) : $input.attr(key, val);
            });
            $input.removeData(keys.typeahead).removeData(keys.www).removeData(keys.attr).removeClass(www.classes.input);
            if ($wrapper.length) {
                $input.detach().insertAfter($wrapper);
                $wrapper.remove();
            }
        }
        function $elOrNull(obj) {
            var isValid, $el;
            isValid = _.isJQuery(obj) || _.isElement(obj);
            $el = isValid ? $(obj).first() : [];
            return $el.length ? $el : null;
        }
    })();
});;
/*! noUiSlider - 8.0.1 - 2015-06-29 19:11:22 */

!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a(require("jquery")):window.noUiSlider=a()}(function(){"use strict";function a(a){return a.filter(function(a){return this[a]?!1:this[a]=!0},{})}function b(a,b){return Math.round(a/b)*b}function c(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.defaultView||c.parentWindow,e=c.documentElement,f=d.pageXOffset;return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f=0),{top:b.top+d.pageYOffset-e.clientTop,left:b.left+f-e.clientLeft}}function d(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function e(a){var b=Math.pow(10,7);return Number((Math.round(a*b)/b).toFixed(7))}function f(a,b,c){k(a,b),setTimeout(function(){l(a,b)},c)}function g(a){return Math.max(Math.min(a,100),0)}function h(a){return Array.isArray(a)?a:[a]}function j(a){var b=a.split(".");return b.length>1?b[1].length:0}function k(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function l(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function m(a,b){a.classList?a.classList.contains(b):new RegExp("(^| )"+b+"( |$)","gi").test(a.className)}function n(a,b){return 100/(b-a)}function o(a,b){return 100*b/(a[1]-a[0])}function p(a,b){return o(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function q(a,b){return b*(a[1]-a[0])/100+a[0]}function r(a,b){for(var c=1;a>=b[c];)c+=1;return c}function s(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=r(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+p([d,e],c)/n(f,g)}function t(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=r(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],q([d,e],(c-f)*n(f,g))}function u(a,c,d,e){if(100===e)return e;var f,g,h=r(e,a);return d?(f=a[h-1],g=a[h],e-f>(g-f)/2?g:f):c[h-1]?a[h-1]+b(e-a[h-1],c[h-1]):e}function v(a,b,c){var e;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider: 'range' contains invalid value.");if(e="min"===a?0:"max"===a?100:parseFloat(a),!d(e)||!d(b[0]))throw new Error("noUiSlider: 'range' value isn't numeric.");c.xPct.push(e),c.xVal.push(b[0]),e?c.xSteps.push(isNaN(b[1])?!1:b[1]):isNaN(b[1])||(c.xSteps[0]=b[1])}function w(a,b,c){return b?void(c.xSteps[a]=o([c.xVal[a],c.xVal[a+1]],b)/n(c.xPct[a],c.xPct[a+1])):!0}function x(a,b,c,d){this.xPct=[],this.xVal=[],this.xSteps=[d||!1],this.xNumSteps=[!1],this.snap=b,this.direction=c;var e,f=[];for(e in a)a.hasOwnProperty(e)&&f.push([a[e],e]);for(f.sort(function(a,b){return a[0]-b[0]}),e=0;e<f.length;e++)v(f[e][1],f[e][0],this);for(this.xNumSteps=this.xSteps.slice(0),e=0;e<this.xNumSteps.length;e++)w(e,this.xNumSteps[e],this)}function y(a,b){if(!d(b))throw new Error("noUiSlider: 'step' is not numeric.");a.singleStep=b}function z(a,b){if("object"!=typeof b||Array.isArray(b))throw new Error("noUiSlider: 'range' is not an object.");if(void 0===b.min||void 0===b.max)throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'.");a.spectrum=new x(b,a.snap,a.dir,a.singleStep)}function A(a,b){if(b=h(b),!Array.isArray(b)||!b.length||b.length>2)throw new Error("noUiSlider: 'start' option is incorrect.");a.handles=b.length,a.start=b}function B(a,b){if(a.snap=b,"boolean"!=typeof b)throw new Error("noUiSlider: 'snap' option must be a boolean.")}function C(a,b){if(a.animate=b,"boolean"!=typeof b)throw new Error("noUiSlider: 'animate' option must be a boolean.")}function D(a,b){if("lower"===b&&1===a.handles)a.connect=1;else if("upper"===b&&1===a.handles)a.connect=2;else if(b===!0&&2===a.handles)a.connect=3;else{if(b!==!1)throw new Error("noUiSlider: 'connect' option doesn't match handle count.");a.connect=0}}function E(a,b){switch(b){case"horizontal":a.ort=0;break;case"vertical":a.ort=1;break;default:throw new Error("noUiSlider: 'orientation' option is invalid.")}}function F(a,b){if(!d(b))throw new Error("noUiSlider: 'margin' option must be numeric.");if(a.margin=a.spectrum.getMargin(b),!a.margin)throw new Error("noUiSlider: 'margin' option is only supported on linear sliders.")}function G(a,b){if(!d(b))throw new Error("noUiSlider: 'limit' option must be numeric.");if(a.limit=a.spectrum.getMargin(b),!a.limit)throw new Error("noUiSlider: 'limit' option is only supported on linear sliders.")}function H(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1,a.connect=[0,2,1,3][a.connect];break;default:throw new Error("noUiSlider: 'direction' option was not recognized.")}}function I(a,b){if("string"!=typeof b)throw new Error("noUiSlider: 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0;a.events={tap:c||f,drag:d,fixed:e,snap:f}}function J(a,b){if(a.format=b,"function"==typeof b.to&&"function"==typeof b.from)return!0;throw new Error("noUiSlider: 'format' requires 'to' and 'from' methods.")}function K(a){var b,c={margin:0,limit:0,animate:!0,format:V};b={step:{r:!1,t:y},start:{r:!0,t:A},connect:{r:!0,t:D},direction:{r:!0,t:H},snap:{r:!1,t:B},animate:{r:!1,t:C},range:{r:!0,t:z},orientation:{r:!1,t:E},margin:{r:!1,t:F},limit:{r:!1,t:G},behaviour:{r:!0,t:I},format:{r:!1,t:J}};var d={connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal"};return Object.keys(d).forEach(function(b){void 0===a[b]&&(a[b]=d[b])}),Object.keys(b).forEach(function(d){var e=b[d];if(void 0===a[d]){if(e.r)throw new Error("noUiSlider: '"+d+"' is required.");return!0}e.t(c,a[d])}),c.pips=a.pips,c.style=c.ort?"top":"left",c}function L(a,b,c){var d=a+b[0],e=a+b[1];return c?(0>d&&(e+=Math.abs(d)),e>100&&(d-=e-100),[g(d),g(e)]):[d,e]}function M(a){a.preventDefault();var b,c,d=0===a.type.indexOf("touch"),e=0===a.type.indexOf("mouse"),f=0===a.type.indexOf("pointer"),g=a;return 0===a.type.indexOf("MSPointer")&&(f=!0),d&&(b=a.changedTouches[0].pageX,c=a.changedTouches[0].pageY),(e||f)&&(b=a.clientX+window.pageXOffset,c=a.clientY+window.pageYOffset),g.points=[b,c],g.cursor=e||f,g}function N(a,b){var c=document.createElement("div"),d=document.createElement("div"),e=["-lower","-upper"];return a&&e.reverse(),k(d,U[3]),k(d,U[3]+e[b]),k(c,U[2]),c.appendChild(d),c}function O(a,b,c){switch(a){case 1:k(b,U[7]),k(c[0],U[6]);break;case 3:k(c[1],U[6]);case 2:k(c[0],U[7]);case 0:k(b,U[6])}}function P(a,b,c){var d,e=[];for(d=0;a>d;d+=1)e.push(c.appendChild(N(b,d)));return e}function Q(a,b,c){k(c,U[0]),k(c,U[8+a]),k(c,U[4+b]);var d=document.createElement("div");return k(d,U[1]),c.appendChild(d),d}function R(b,d){function e(a,b,c){if("range"===a||"steps"===a)return N.xVal;if("count"===a){var d,e=100/(b-1),f=0;for(b=[];(d=f++*e)<=100;)b.push(d);a="positions"}return"positions"===a?b.map(function(a){return N.fromStepping(c?N.getStep(a):a)}):"values"===a?c?b.map(function(a){return N.fromStepping(N.getStep(N.toStepping(a)))}):b:void 0}function n(b,c,d){var e=N.direction,f={},g=N.xVal[0],h=N.xVal[N.xVal.length-1],i=!1,j=!1,k=0;return N.direction=0,d=a(d.slice().sort(function(a,b){return a-b})),d[0]!==g&&(d.unshift(g),i=!0),d[d.length-1]!==h&&(d.push(h),j=!0),d.forEach(function(a,e){var g,h,l,m,n,o,p,q,r,s,t=a,u=d[e+1];if("steps"===c&&(g=N.xNumSteps[e]),g||(g=u-t),t!==!1&&void 0!==u)for(h=t;u>=h;h+=g){for(m=N.toStepping(h),n=m-k,q=n/b,r=Math.round(q),s=n/r,l=1;r>=l;l+=1)o=k+l*s,f[o.toFixed(5)]=["x",0];p=d.indexOf(h)>-1?1:"steps"===c?2:0,!e&&i&&(p=0),h===u&&j||(f[m.toFixed(5)]=[h,p]),k=m}}),N.direction=e,f}function o(a,b,c){function e(a){return["-normal","-large","-sub"][a]}function f(a,b,c){return'class="'+b+" "+b+"-"+h+" "+b+e(c[1],c[0])+'" style="'+d.style+": "+a+'%"'}function g(a,d){N.direction&&(a=100-a),d[1]=d[1]&&b?b(d[0],d[1]):d[1],i.innerHTML+="<div "+f(a,"noUi-marker",d)+"></div>",d[1]&&(i.innerHTML+="<div "+f(a,"noUi-value",d)+">"+c.to(d[0])+"</div>")}var h=["horizontal","vertical"][d.ort],i=document.createElement("div");return k(i,"noUi-pips"),k(i,"noUi-pips-"+h),Object.keys(a).forEach(function(b){g(b,a[b])}),i}function p(a){var b=a.mode,c=a.density||1,d=a.filter||!1,f=a.values||!1,g=a.stepped||!1,h=e(b,f,g),i=n(c,b,h),j=a.format||{to:Math.round};return J.appendChild(o(i,d,j))}function q(){return H["offset"+["Width","Height"][d.ort]]}function r(a,b){void 0!==b&&(b=Math.abs(b-d.dir)),Object.keys(S).forEach(function(c){var d=c.split(".")[0];a===d&&S[c].forEach(function(a){a(h(C()),b,s(Array.prototype.slice.call(R)))})})}function s(a){return 1===a.length?a[0]:d.dir?a.reverse():a}function t(a,b,c,e){var f=function(b){return J.hasAttribute("disabled")?!1:m(J,U[14])?!1:(b=M(b),a===T.start&&void 0!==b.buttons&&b.buttons>1?!1:(b.calcPoint=b.points[d.ort],void c(b,e)))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!1),g.push([a,f])}),g}function u(a,b){var c,d=b.handles||I,e=!1,f=100*(a.calcPoint-b.start)/q(),g=d[0]===I[0]?0:1;if(c=L(f,b.positions,d.length>1),e=z(d[0],c[g],1===d.length),d.length>1){if(e=z(d[1],c[g?0:1],!1)||e)for(i=0;i<b.handles.length;i++)r("slide",i)}else e&&r("slide",g)}function v(a,b){var c=H.getElementsByClassName(U[15]),d=b.handles[0]===I[0]?0:1;c.length&&l(c[0],U[15]),a.cursor&&(document.body.style.cursor="",document.body.removeEventListener("selectstart",document.body.noUiListener));var e=document.documentElement;e.noUiListeners.forEach(function(a){e.removeEventListener(a[0],a[1])}),l(J,U[12]),r("set",d),r("change",d)}function w(a,b){var c=document.documentElement;if(1===b.handles.length&&(k(b.handles[0].children[0],U[15]),b.handles[0].hasAttribute("disabled")))return!1;a.stopPropagation();var d=t(T.move,c,u,{start:a.calcPoint,handles:b.handles,positions:[K[0],K[I.length-1]]}),e=t(T.end,c,v,{handles:b.handles});if(c.noUiListeners=d.concat(e),a.cursor){document.body.style.cursor=getComputedStyle(a.target).cursor,I.length>1&&k(J,U[12]);var f=function(){return!1};document.body.noUiListener=f,document.body.addEventListener("selectstart",f,!1)}}function x(a){var b,e,g=a.calcPoint,h=0;return a.stopPropagation(),I.forEach(function(a){h+=c(a)[d.style]}),b=h/2>g||1===I.length?0:1,g-=c(H)[d.style],e=100*g/q(),d.events.snap||f(J,U[14],300),I[b].hasAttribute("disabled")?!1:(z(I[b],e),r("slide",b),r("set",b),r("change",b),void(d.events.snap&&w(a,{handles:[I[h]]})))}function y(a){var b,c;if(!a.fixed)for(b=0;b<I.length;b+=1)t(T.start,I[b].children[0],w,{handles:[I[b]]});a.tap&&t(T.start,H,x,{handles:I}),a.drag&&(c=[H.getElementsByClassName(U[7])[0]],k(c[0],U[10]),a.fixed&&c.push(I[c[0]===I[0]?1:0].children[0]),c.forEach(function(a){t(T.start,a,w,{handles:I})}))}function z(a,b,c){var e=a!==I[0]?1:0,f=K[0]+d.margin,h=K[1]-d.margin,i=K[0]+d.limit,j=K[1]-d.limit;return I.length>1&&(b=e?Math.max(b,f):Math.min(b,h)),c!==!1&&d.limit&&I.length>1&&(b=e?Math.min(b,i):Math.max(b,j)),b=N.getStep(b),b=g(parseFloat(b.toFixed(7))),b===K[e]?!1:(a.style[d.style]=b+"%",a.previousSibling||(l(a,U[17]),b>50&&k(a,U[17])),K[e]=b,R[e]=N.fromStepping(b),r("update",e),!0)}function A(a,b){var c,e,f;for(d.limit&&(a+=1),c=0;a>c;c+=1)e=c%2,f=b[e],null!==f&&f!==!1&&("number"==typeof f&&(f=String(f)),f=d.format.from(f),(f===!1||isNaN(f)||z(I[e],N.toStepping(f),c===3-d.dir)===!1)&&r("update",e))}function B(a){var b,c,e=h(a);for(d.dir&&d.handles>1&&e.reverse(),d.animate&&-1!==K[0]&&f(J,U[14],300),b=I.length>1?3:1,1===e.length&&(b=1),A(b,e),c=0;c<I.length;c++)r("set",c)}function C(){var a,b=[];for(a=0;a<d.handles;a+=1)b[a]=d.format.to(R[a]);return s(b)}function D(){U.forEach(function(a){a&&l(J,a)}),J.innerHTML="",delete J.noUiSlider}function E(){var a=K.map(function(a,b){var c=N.getApplicableStep(a),d=j(String(c[2])),e=R[b],f=100===a?null:c[2],g=Number((e-c[2]).toFixed(d)),h=0===a?null:g>=c[1]?c[2]:c[0]||!1;return[h,f]});return s(a)}function F(a,b){S[a]=S[a]||[],S[a].push(b),"update"===a.split(".")[0]&&I.forEach(function(a,b){r("update",b)})}function G(a){var b=a.split(".")[0],c=a.substring(b.length);Object.keys(S).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete S[a]})}var H,I,J=b,K=[-1,-1],N=d.spectrum,R=[],S={};if(J.noUiSlider)throw new Error("Slider was already initialized.");return H=Q(d.dir,d.ort,J),I=P(d.handles,d.dir,H),O(d.connect,J,I),y(d.events),d.pips&&p(d.pips),{destroy:D,steps:E,on:F,off:G,get:C,set:B}}function S(a,b){if(!a.nodeName)throw new Error("noUiSlider.create requires a single element.");var c=K(b,a),d=R(a,c);d.set(c.start),a.noUiSlider=d}var T=window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"},U=["noUi-target","noUi-base","noUi-origin","noUi-handle","noUi-horizontal","noUi-vertical","noUi-background","noUi-connect","noUi-ltr","noUi-rtl","noUi-dragable","","noUi-state-drag","","noUi-state-tap","noUi-active","","noUi-stacking"];x.prototype.getMargin=function(a){return 2===this.xPct.length?o(this.xVal,a):!1},x.prototype.toStepping=function(a){return a=s(this.xVal,this.xPct,a),this.direction&&(a=100-a),a},x.prototype.fromStepping=function(a){return this.direction&&(a=100-a),e(t(this.xVal,this.xPct,a))},x.prototype.getStep=function(a){return this.direction&&(a=100-a),a=u(this.xPct,this.xSteps,this.snap,a),this.direction&&(a=100-a),a},x.prototype.getApplicableStep=function(a){var b=r(a,this.xPct),c=100===a?2:1;return[this.xNumSteps[b-2],this.xVal[b-c],this.xNumSteps[b-c]]},x.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var V={to:function(a){return a.toFixed(2)},from:Number};return{create:S}});;
!function(e){e(["jquery"],function(e){return function(){function t(e,t,n){return g({type:O.error,iconClass:m().iconClasses.error,message:e,optionsOverride:n,title:t})}function n(t,n){return t||(t=m()),v=e("#"+t.containerId),v.length?v:(n&&(v=u(t)),v)}function i(e,t,n){return g({type:O.info,iconClass:m().iconClasses.info,message:e,optionsOverride:n,title:t})}function o(e){w=e}function s(e,t,n){return g({type:O.success,iconClass:m().iconClasses.success,message:e,optionsOverride:n,title:t})}function a(e,t,n){return g({type:O.warning,iconClass:m().iconClasses.warning,message:e,optionsOverride:n,title:t})}function r(e,t){var i=m();v||n(i),l(e,i,t)||d(i)}function c(t){var i=m();return v||n(i),t&&0===e(":focus",t).length?void h(t):void(v.children().length&&v.remove())}function d(t){for(var n=v.children(),i=n.length-1;i>=0;i--)l(e(n[i]),t)}function l(t,n,i){var o=i&&i.force?i.force:!1;return t&&(o||0===e(":focus",t).length)?(t[n.hideMethod]({duration:n.hideDuration,easing:n.hideEasing,complete:function(){h(t)}}),!0):!1}function u(t){return v=e("<div/>").attr("id",t.containerId).addClass(t.positionClass).attr("aria-live","polite").attr("role","alert"),v.appendTo(e(t.target)),v}function p(){return{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'<button type="button">&times;</button>',newestOnTop:!0,preventDuplicates:!1,progressBar:!1}}function f(e){w&&w(e)}function g(t){function i(e){return null==e&&(e=""),new String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function o(){r(),d(),l(),u(),p(),c()}function s(){y.hover(b,O),!x.onclick&&x.tapToDismiss&&y.click(w),x.closeButton&&k&&k.click(function(e){e.stopPropagation?e.stopPropagation():void 0!==e.cancelBubble&&e.cancelBubble!==!0&&(e.cancelBubble=!0),w(!0)}),x.onclick&&y.click(function(e){x.onclick(e),w()})}function a(){y.hide(),y[x.showMethod]({duration:x.showDuration,easing:x.showEasing,complete:x.onShown}),x.timeOut>0&&(H=setTimeout(w,x.timeOut),q.maxHideTime=parseFloat(x.timeOut),q.hideEta=(new Date).getTime()+q.maxHideTime,x.progressBar&&(q.intervalId=setInterval(D,10)))}function r(){t.iconClass&&y.addClass(x.toastClass).addClass(E)}function c(){x.newestOnTop?v.prepend(y):v.append(y)}function d(){t.title&&(I.append(x.escapeHtml?i(t.title):t.title).addClass(x.titleClass),y.append(I))}function l(){t.message&&(M.append(x.escapeHtml?i(t.message):t.message).addClass(x.messageClass),y.append(M))}function u(){x.closeButton&&(k.addClass("toast-close-button").attr("role","button"),y.prepend(k))}function p(){x.progressBar&&(B.addClass("toast-progress"),y.prepend(B))}function g(e,t){if(e.preventDuplicates){if(t.message===C)return!0;C=t.message}return!1}function w(t){var n=t&&x.closeMethod!==!1?x.closeMethod:x.hideMethod,i=t&&x.closeDuration!==!1?x.closeDuration:x.hideDuration,o=t&&x.closeEasing!==!1?x.closeEasing:x.hideEasing;return!e(":focus",y).length||t?(clearTimeout(q.intervalId),y[n]({duration:i,easing:o,complete:function(){h(y),x.onHidden&&"hidden"!==j.state&&x.onHidden(),j.state="hidden",j.endTime=new Date,f(j)}})):void 0}function O(){(x.timeOut>0||x.extendedTimeOut>0)&&(H=setTimeout(w,x.extendedTimeOut),q.maxHideTime=parseFloat(x.extendedTimeOut),q.hideEta=(new Date).getTime()+q.maxHideTime)}function b(){clearTimeout(H),q.hideEta=0,y.stop(!0,!0)[x.showMethod]({duration:x.showDuration,easing:x.showEasing})}function D(){var e=(q.hideEta-(new Date).getTime())/q.maxHideTime*100;B.width(e+"%")}var x=m(),E=t.iconClass||x.iconClass;if("undefined"!=typeof t.optionsOverride&&(x=e.extend(x,t.optionsOverride),E=t.optionsOverride.iconClass||E),!g(x,t)){T++,v=n(x,!0);var H=null,y=e("<div/>"),I=e("<div/>"),M=e("<div/>"),B=e("<div/>"),k=e(x.closeHtml),q={intervalId:null,hideEta:null,maxHideTime:null},j={toastId:T,state:"visible",startTime:new Date,options:x,map:t};return o(),a(),s(),f(j),x.debug&&console&&console.log(j),y}}function m(){return e.extend({},p(),b.options)}function h(e){v||(v=n()),e.is(":visible")||(e.remove(),e=null,0===v.children().length&&(v.remove(),C=void 0))}var v,w,C,T=0,O={error:"error",info:"info",success:"success",warning:"warning"},b={clear:r,remove:c,error:t,getContainer:n,info:i,options:{},subscribe:o,success:s,version:"2.1.2",warning:a};return b}()})}("function"==typeof define&&define.amd?define:function(e,t){"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):window.toastr=t(window.jQuery)});
;
/*! jquery.flipster, built 2015-03-06 */
!function(a){a.fn.flipster=function(b){var c="string"==typeof b?!0:!1;if(c)var d=b,e=Array.prototype.slice.call(arguments,1);else var f={itemContainer:"ul",itemSelector:"li",style:"coverflow",start:"center",enableKeyboard:!0,enableMousewheel:!0,enableTouch:!0,onItemSwitch:a.noop,disableRotation:!1,enableNav:!1,navPosition:"before",enableNavButtons:!1,prevText:"Previous",nextText:"Next"},g=a.extend({},f,b),h=a(window);return this.each(function(){function b(){z=0}function f(){r.height(i()),q.css("height","auto"),"carousel"===g.style&&r.width(s.width())}function i(){var b=0;return s.each(function(){a(this).height()>b&&(b=a(this).height())}),b}function j(){if(g.enableNav&&s.length>1){var b=[],c=[],d=[];s.each(function(){var e=a(this).data("flip-category"),f=a(this).attr("id"),g=a(this).attr("title");if("undefined"!=typeof e&&a.inArray(e,b)<0&&(b.push(e),d[e]='<li class="flip-nav-category"><a href="#" class="flip-nav-category-link" data-flip-category="'+e+'">'+e+'</a>\n<ul class="flip-nav-items">\n'),a.inArray(f,c)<0){c.push(f);var h='<a href="#'+f+'" class="flip-nav-item-link">'+g+"</a></li>\n";"undefined"!=typeof e?d[e]=d[e]+'<li class="flip-nav-item">'+h:d[f]='<li class="flip-nav-item no-category">'+h}});var e='<ul class="flipster-nav">\n';for(var f in b)d[b[f]]=d[b[f]]+"</ul>\n</li>\n";for(var h in d)e+=d[h];e+="</ul>",t="after"!=g.navPosition.toLowerCase()?a(e).prependTo(q):a(e).appendTo(q),u=t.find("a").on("click",function(b){var c;c=a(this).hasClass("flip-nav-category-link")?s.filter("[data-flip-category='"+a(this).data("flip-category")+"']"):a(this.hash),c.length&&(n(c),b.preventDefault())})}}function k(){if(g.enableNav&&s.length>1){var b=a(s[x]);t.find(".flip-nav-current").removeClass("flip-nav-current"),u.filter("[href='#"+b.attr("id")+"']").addClass("flip-nav-current"),u.filter("[data-flip-category='"+b.data("flip-category")+"']").parent().addClass("flip-nav-current")}}function l(){g.enableNavButtons&&s.length>1&&(q.find(".flipto-prev, .flipto-next").remove(),q.append("<a href='#' class='flipto-prev'>"+g.prevText+"</a> <a href='#' class='flipto-next'>"+g.nextText+"</a>"),q.children(".flipto-prev").on("click",function(a){n("left"),a.preventDefault()}),q.children(".flipto-next").on("click",function(a){n("right"),a.preventDefault()}))}function m(){var b=a(s[x]).addClass("flip-current");if(s.removeClass("flip-prev flip-next flip-current flip-past flip-future no-transition"),"carousel"===g.style){s.addClass("flip-hidden");var c=a(s[x+1]),d=a(s[x+2]),e=a(s[x-1]),h=a(s[x-2]);0===x?(e=s.last(),h=e.prev()):1===x?h=s.last():x===s.length-2?d=s.first():x===s.length-1&&(c=s.first(),d=a(s[1])),d.removeClass("flip-hidden").addClass("flip-future"),h.removeClass("flip-hidden").addClass("flip-past"),c.removeClass("flip-hidden").addClass("flip-next"),e.removeClass("flip-hidden").addClass("flip-prev")}else{var i=b.outerWidth()/2,j=0,l=r.width(),m=b.outerWidth(),n=s.index(b)*m/2+i/2;s.removeClass("flip-hidden");for(var o=0;o<s.length;o++){var p=a(s[o]),q=p.outerWidth();x>o?p.addClass("flip-past").css({"z-index":o,left:o*q/2+"px"}):o>x&&p.addClass("flip-future").css({"z-index":s.length-o,left:o*q/2+i+"px"})}b.css({"z-index":s.length+1,left:n+"px"}),j=n+m/2-l/2;var t=-1*j+"px";if(w){var u=a(".flip-past"),v=a(".flip-future");for(a(".flip-current").css("zoom","1.0"),o=0;o<u.length;o++)a(u[o]).css("zoom",100-5*(u.length-o)+"%");for(o=0;o<v.length;o++)a(v[o]).css("zoom",100-5*(o+1)+"%");r.animate({left:t},333)}else r.css("left",t)}b.addClass("flip-current").removeClass("flip-prev flip-next flip-past flip-future flip-hidden"),f(),k(),g.onItemSwitch.call(this)}function n(a){s.length>1&&("left"===a?x>0?x--:x=s.length-1:"right"===a?x<s.length-1?x++:x=0:x="number"==typeof a?a:s.index(a),m())}function o(){q.addClass("flipster flipster-active flipster-"+g.style).css("visibility","hidden"),g.disableRotation&&q.addClass("no-rotate"),r=q.find(g.itemContainer).addClass("flip-items"),s=r.find(g.itemSelector).addClass("flip-item flip-hidden").wrapInner("<div class='flip-content' />");var c=!1,d=document.createElement("b");d.innerHTML="<!--[if IE 9]><i></i><![endif]-->";var e=1===d.getElementsByTagName("i").length;(c||e)&&(w=!0,r.addClass("compatibility")),j(),l(),g.start&&s.length>1&&(x="center"===g.start?!s.length%2?s.length/2+1:Math.floor(s.length/2):g.start),f(),q.hide().css("visibility","visible").fadeIn(400,function(){m()}),h.on("resize.flipster",function(){f(),m()}),s.on("click",function(b){a(this).hasClass("flip-current")||b.preventDefault(),n(s.index(this))}),g.enableKeyboard&&s.length>1&&(h.on("keydown.flipster",function(a){if(z++,z%7===0||1===z){var b=a.which;37===b?(a.preventDefault(),n("left")):39===b&&(a.preventDefault(),n("right"))}}),h.on("keyup.flipster",function(){z=0})),g.enableMousewheel&&s.length>1&&q.on("mousewheel.flipster",function(a){v=window.setTimeout(b,500),z++,(z%4===0||1===z)&&(window.clearTimeout(v),n(a.originalEvent.wheelDelta/120>0?"left":"right"),a.preventDefault())}),g.enableTouch&&s.length>1&&(q.on("touchstart.flipster",function(a){y=a.originalEvent.targetTouches[0].screenX}),q.on("touchmove.flipster",function(a){a.preventDefault();var b=a.originalEvent.targetTouches[0].screenX,c=b-y;c>s[0].clientWidth/1.75?(n("left"),y=b):c<-1*(s[0].clientWidth/1.75)&&(n("right"),y=b)}),q.on("touchend.flipster",function(){y=0}))}var p,q=a(this);if(c)return p=q.data("methods"),p[d].apply(this,e);var r,s,t,u,v,w,x=0,y=0,z=0;p={jump:n},q.data("methods",p),q.hasClass("flipster-active")||o()})}}(jQuery);;
/*
     _ _      _       _
 ___| (_) ___| | __  (_)___
/ __| | |/ __| |/ /  | / __|
\__ \ | | (__|   < _ | \__ \
|___/_|_|\___|_|\_(_)/ |___/
                   |__/

 Version: 1.6.0
  Author: Ken Wheeler
 Website: http://kenwheeler.github.io
    Docs: http://kenwheeler.github.io/slick
    Repo: http://github.com/kenwheeler/slick
  Issues: http://github.com/kenwheeler/slick/issues

 */
/* global window, document, define, jQuery, setInterval, clearInterval */
; (function (factory) {
    'use strict';
    if (typeof define === 'function' && define.amd) {
        define(['jquery'], factory);
    } else if (typeof exports !== 'undefined') {
        module.exports = factory(require('jquery'));
    } else {
        factory(jQuery);
    }

}(function ($) {
    'use strict';
    var Slick = window.Slick || {};

    Slick = (function () {

        var instanceUid = 0;

        function Slick(element, settings) {

            var _ = this, dataSettings;

            _.defaults = {
                accessibility: true,
                adaptiveHeight: false,
                appendArrows: $(element),
                appendDots: $(element),
                arrows: true,
                asNavFor: null,
                prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>',
                nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>',
                autoplay: false,
                autoplaySpeed: 3000,
                centerMode: false,
                centerPadding: '50px',
                cssEase: 'ease',
                customPaging: function (slider, i) {
                    return $('<button type="button" data-role="none" role="button" tabindex="0" />').text(i + 1);
                },
                dots: false,
                dotsClass: 'slick-dots',
                draggable: true,
                easing: 'linear',
                edgeFriction: 0.35,
                fade: false,
                focusOnSelect: false,
                infinite: true,
                initialSlide: 0,
                lazyLoad: 'ondemand',
                mobileFirst: false,
                pauseOnHover: true,
                pauseOnFocus: true,
                pauseOnDotsHover: false,
                respondTo: 'window',
                responsive: null,
                rows: 1,
                rtl: false,
                slide: '',
                slidesPerRow: 1,
                slidesToShow: 1,
                slidesToScroll: 1,
                speed: 500,
                swipe: true,
                swipeToSlide: false,
                touchMove: true,
                touchThreshold: 5,
                useCSS: true,
                useTransform: true,
                variableWidth: false,
                vertical: false,
                verticalSwiping: false,
                waitForAnimate: true,
                zIndex: 1000
            };

            _.initials = {
                animating: false,
                dragging: false,
                autoPlayTimer: null,
                currentDirection: 0,
                currentLeft: null,
                currentSlide: 0,
                direction: 1,
                $dots: null,
                listWidth: null,
                listHeight: null,
                loadIndex: 0,
                $nextArrow: null,
                $prevArrow: null,
                scrolling: false,
                slideCount: null,
                slideWidth: null,
                $slideTrack: null,
                $slides: null,
                sliding: false,
                slideOffset: 0,
                swipeLeft: null,
                swiping: false,
                $list: null,
                touchObject: {},
                transformsEnabled: false,
                unslicked: false
            };

            $.extend(_, _.initials);

            _.activeBreakpoint = null;
            _.animType = null;
            _.animProp = null;
            _.breakpoints = [];
            _.breakpointSettings = [];
            _.cssTransitions = false;
            _.focussed = false;
            _.interrupted = false;
            _.hidden = 'hidden';
            _.paused = true;
            _.positionProp = null;
            _.respondTo = null;
            _.rowCount = 1;
            _.shouldClick = true;
            _.$slider = $(element);
            _.$slidesCache = null;
            _.transformType = null;
            _.transitionType = null;
            _.visibilityChange = 'visibilitychange';
            _.windowWidth = 0;
            _.windowTimer = null;

            dataSettings = $(element).data('slick') || {};

            _.options = $.extend({}, _.defaults, settings, dataSettings);

            _.currentSlide = _.options.initialSlide;

            _.originalSettings = _.options;

            if (typeof document.mozHidden !== 'undefined') {
                _.hidden = 'mozHidden';
                _.visibilityChange = 'mozvisibilitychange';
            } else if (typeof document.webkitHidden !== 'undefined') {
                _.hidden = 'webkitHidden';
                _.visibilityChange = 'webkitvisibilitychange';
            }

            _.autoPlay = $.proxy(_.autoPlay, _);
            _.autoPlayClear = $.proxy(_.autoPlayClear, _);
            _.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
            _.changeSlide = $.proxy(_.changeSlide, _);
            _.clickHandler = $.proxy(_.clickHandler, _);
            _.selectHandler = $.proxy(_.selectHandler, _);
            _.setPosition = $.proxy(_.setPosition, _);
            _.swipeHandler = $.proxy(_.swipeHandler, _);
            _.dragHandler = $.proxy(_.dragHandler, _);
            _.keyHandler = $.proxy(_.keyHandler, _);

            _.instanceUid = instanceUid++;

            // A simple way to check for HTML strings
            // Strict HTML recognition (must start with <)
            // Extracted from jQuery v1.11 source
            _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;


            _.registerBreakpoints();
            _.init(true);

        }

        return Slick;

    }());

    Slick.prototype.activateADA = function () {
        var _ = this;

        _.$slideTrack.find('.slick-active').attr({
            'aria-hidden': 'false'
        }).find('a, input, button, select').attr({
            'tabindex': '0'
        });

    };

    Slick.prototype.addSlide = Slick.prototype.slickAdd = function (markup, index, addBefore) {

        var _ = this;

        if (typeof (index) === 'boolean') {
            addBefore = index;
            index = null;
        } else if (index < 0 || (index >= _.slideCount)) {
            return false;
        }

        _.unload();

        if (typeof (index) === 'number') {
            if (index === 0 && _.$slides.length === 0) {
                $(markup).appendTo(_.$slideTrack);
            } else if (addBefore) {
                $(markup).insertBefore(_.$slides.eq(index));
            } else {
                $(markup).insertAfter(_.$slides.eq(index));
            }
        } else {
            if (addBefore === true) {
                $(markup).prependTo(_.$slideTrack);
            } else {
                $(markup).appendTo(_.$slideTrack);
            }
        }

        _.$slides = _.$slideTrack.children(this.options.slide);

        _.$slideTrack.children(this.options.slide).detach();

        _.$slideTrack.append(_.$slides);

        _.$slides.each(function (index, element) {
            $(element).attr('data-slick-index', index);
        });

        _.$slidesCache = _.$slides;

        _.reinit();

    };

    Slick.prototype.animateHeight = function () {
        var _ = this;
        if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
            var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
            _.$list.animate({
                height: targetHeight
            }, _.options.speed);
        }
    };

    Slick.prototype.animateSlide = function (targetLeft, callback) {

        var animProps = {},
            _ = this;

        _.animateHeight();

        if (_.options.rtl === true && _.options.vertical === false) {
            targetLeft = -targetLeft;
        }
        if (_.transformsEnabled === false) {
            if (_.options.vertical === false) {
                _.$slideTrack.animate({
                    left: targetLeft
                }, _.options.speed, _.options.easing, callback);
            } else {
                _.$slideTrack.animate({
                    top: targetLeft
                }, _.options.speed, _.options.easing, callback);
            }

        } else {

            if (_.cssTransitions === false) {
                if (_.options.rtl === true) {
                    _.currentLeft = -(_.currentLeft);
                }
                $({
                    animStart: _.currentLeft
                }).animate({
                    animStart: targetLeft
                }, {
                    duration: _.options.speed,
                    easing: _.options.easing,
                    step: function (now) {
                        now = Math.ceil(now);
                        if (_.options.vertical === false) {
                            animProps[_.animType] = 'translate(' +
                                now + 'px, 0px)';
                            _.$slideTrack.css(animProps);
                        } else {
                            animProps[_.animType] = 'translate(0px,' +
                                now + 'px)';
                            _.$slideTrack.css(animProps);
                        }
                    },
                    complete: function () {
                        if (callback) {
                            callback.call();
                        }
                    }
                });

            } else {

                _.applyTransition();
                targetLeft = Math.ceil(targetLeft);

                if (_.options.vertical === false) {
                    animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
                } else {
                    animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
                }
                _.$slideTrack.css(animProps);

                if (callback) {
                    setTimeout(function () {

                        _.disableTransition();

                        callback.call();
                    }, _.options.speed);
                }

            }

        }

    };

    Slick.prototype.getNavTarget = function () {

        var _ = this,
            asNavFor = _.options.asNavFor;

        if (asNavFor && asNavFor !== null) {
            asNavFor = $(asNavFor).not(_.$slider);
        }

        return asNavFor;

    };

    Slick.prototype.asNavFor = function (index) {

        var _ = this,
            asNavFor = _.getNavTarget();

        if (asNavFor !== null && typeof asNavFor === 'object') {
            asNavFor.each(function () {
                var target = $(this).slick('getSlick');
                if (!target.unslicked) {
                    target.slideHandler(index, true);
                }
            });
        }

    };

    Slick.prototype.applyTransition = function (slide) {

        var _ = this,
            transition = {};

        if (_.options.fade === false) {
            transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
        } else {
            transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
        }

        if (_.options.fade === false) {
            _.$slideTrack.css(transition);
        } else {
            _.$slides.eq(slide).css(transition);
        }

    };

    Slick.prototype.autoPlay = function () {

        var _ = this;

        _.autoPlayClear();

        if (_.slideCount > _.options.slidesToShow) {
            _.autoPlayTimer = setInterval(_.autoPlayIterator, _.options.autoplaySpeed);
        }

    };

    Slick.prototype.autoPlayClear = function () {

        var _ = this;

        if (_.autoPlayTimer) {
            clearInterval(_.autoPlayTimer);
        }

    };

    Slick.prototype.autoPlayIterator = function () {

        var _ = this,
            slideTo = _.currentSlide + _.options.slidesToScroll;

        if (!_.paused && !_.interrupted && !_.focussed) {

            if (_.options.infinite === false) {

                if (_.direction === 1 && (_.currentSlide + 1) === (_.slideCount - 1)) {
                    _.direction = 0;
                }

                else if (_.direction === 0) {

                    slideTo = _.currentSlide - _.options.slidesToScroll;

                    if (_.currentSlide - 1 === 0) {
                        _.direction = 1;
                    }

                }

            }

            _.slideHandler(slideTo);

        }

    };

    Slick.prototype.buildArrows = function () {

        var _ = this;

        if (_.options.arrows === true) {

            _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow');
            _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow');

            if (_.slideCount > _.options.slidesToShow) {

                _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
                _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');

                if (_.htmlExpr.test(_.options.prevArrow)) {
                    _.$prevArrow.prependTo(_.options.appendArrows);
                }

                if (_.htmlExpr.test(_.options.nextArrow)) {
                    _.$nextArrow.appendTo(_.options.appendArrows);
                }

                if (_.options.infinite !== true) {
                    _.$prevArrow
                        .addClass('slick-disabled')
                        .attr('aria-disabled', 'true');
                }

            } else {

                _.$prevArrow.add(_.$nextArrow)

                    .addClass('slick-hidden')
                    .attr({
                        'aria-disabled': 'true',
                        'tabindex': '-1'
                    });

            }

        }

    };

    Slick.prototype.buildDots = function () {

        var _ = this,
            i, dot;

        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {

            _.$slider.addClass('slick-dotted');

            dot = $('<ul />').addClass(_.options.dotsClass);

            for (i = 0; i <= _.getDotCount() ; i += 1) {
                dot.append($('<li />').append(_.options.customPaging.call(this, _, i)));
            }

            _.$dots = dot.appendTo(_.options.appendDots);

            _.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false');

        }

    };

    Slick.prototype.buildOut = function () {

        var _ = this;

        _.$slides =
            _.$slider
                .children(_.options.slide + ':not(.slick-cloned)')
                .addClass('slick-slide');

        _.slideCount = _.$slides.length;

        _.$slides.each(function (index, element) {
            $(element)
                .attr('data-slick-index', index)
                .data('originalStyling', $(element).attr('style') || '');
        });

        _.$slider.addClass('slick-slider');

        _.$slideTrack = (_.slideCount === 0) ?
            $('<div class="slick-track"/>').appendTo(_.$slider) :
            _.$slides.wrapAll('<div class="slick-track"/>').parent();

        _.$list = _.$slideTrack.wrap(
            '<div aria-live="polite" class="slick-list"/>').parent();
        _.$slideTrack.css('opacity', 0);

        if (_.options.centerMode === true || _.options.swipeToSlide === true) {
            _.options.slidesToScroll = 1;
        }

        $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');

        _.setupInfinite();

        _.buildArrows();

        _.buildDots();

        _.updateDots();


        _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);

        if (_.options.draggable === true) {
            _.$list.addClass('draggable');
        }

    };

    Slick.prototype.buildRows = function () {

        var _ = this, a, b, c, newSlides, numOfSlides, originalSlides, slidesPerSection;

        newSlides = document.createDocumentFragment();
        originalSlides = _.$slider.children();

        if (_.options.rows > 1) {

            slidesPerSection = _.options.slidesPerRow * _.options.rows;
            numOfSlides = Math.ceil(
                originalSlides.length / slidesPerSection
            );

            for (a = 0; a < numOfSlides; a++) {
                var slide = document.createElement('div');
                for (b = 0; b < _.options.rows; b++) {
                    var row = document.createElement('div');
                    for (c = 0; c < _.options.slidesPerRow; c++) {
                        var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
                        if (originalSlides.get(target)) {
                            row.appendChild(originalSlides.get(target));
                        }
                    }
                    slide.appendChild(row);
                }
                newSlides.appendChild(slide);
            }

            _.$slider.empty().append(newSlides);
            _.$slider.children().children().children()
                .css({
                    'width': (100 / _.options.slidesPerRow) + '%',
                    'display': 'inline-block'
                });

        }

    };

    Slick.prototype.checkResponsive = function (initial, forceUpdate) {

        var _ = this,
            breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
        var sliderWidth = _.$slider.width();
        var windowWidth = window.innerWidth || $(window).width();

        if (_.respondTo === 'window') {
            respondToWidth = windowWidth;
        } else if (_.respondTo === 'slider') {
            respondToWidth = sliderWidth;
        } else if (_.respondTo === 'min') {
            respondToWidth = Math.min(windowWidth, sliderWidth);
        }

        if (_.options.responsive &&
            _.options.responsive.length &&
            _.options.responsive !== null) {

            targetBreakpoint = null;

            for (breakpoint in _.breakpoints) {
                if (_.breakpoints.hasOwnProperty(breakpoint)) {
                    if (_.originalSettings.mobileFirst === false) {
                        if (respondToWidth < _.breakpoints[breakpoint]) {
                            targetBreakpoint = _.breakpoints[breakpoint];
                        }
                    } else {
                        if (respondToWidth > _.breakpoints[breakpoint]) {
                            targetBreakpoint = _.breakpoints[breakpoint];
                        }
                    }
                }
            }

            if (targetBreakpoint !== null) {
                if (_.activeBreakpoint !== null) {
                    if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) {
                        _.activeBreakpoint =
                            targetBreakpoint;
                        if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
                            _.unslick(targetBreakpoint);
                        } else {
                            _.options = $.extend({}, _.originalSettings,
                                _.breakpointSettings[
                                    targetBreakpoint]);
                            if (initial === true) {
                                _.currentSlide = _.options.initialSlide;
                            }
                            _.refresh(initial);
                        }
                        triggerBreakpoint = targetBreakpoint;
                    }
                } else {
                    _.activeBreakpoint = targetBreakpoint;
                    if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
                        _.unslick(targetBreakpoint);
                    } else {
                        _.options = $.extend({}, _.originalSettings,
                            _.breakpointSettings[
                                targetBreakpoint]);
                        if (initial === true) {
                            _.currentSlide = _.options.initialSlide;
                        }
                        _.refresh(initial);
                    }
                    triggerBreakpoint = targetBreakpoint;
                }
            } else {
                if (_.activeBreakpoint !== null) {
                    _.activeBreakpoint = null;
                    _.options = _.originalSettings;
                    if (initial === true) {
                        _.currentSlide = _.options.initialSlide;
                    }
                    _.refresh(initial);
                    triggerBreakpoint = targetBreakpoint;
                }
            }

            // only trigger breakpoints during an actual break. not on initialize.
            if (!initial && triggerBreakpoint !== false) {
                _.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
            }
        }

    };

    Slick.prototype.changeSlide = function (event, dontAnimate) {

        var _ = this,
            $target = $(event.currentTarget),
            indexOffset, slideOffset, unevenOffset;

        // If target is a link, prevent default action.
        if ($target.is('a')) {
            event.preventDefault();
        }

        // If target is not the <li> element (ie: a child), find the <li>.
        if (!$target.is('li')) {
            $target = $target.closest('li');
        }

        unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
        indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;

        switch (event.data.message) {

            case 'previous':
                slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
                if (_.slideCount > _.options.slidesToShow) {
                    _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
                }
                break;

            case 'next':
                slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
                if (_.slideCount > _.options.slidesToShow) {
                    _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
                }
                break;

            case 'index':
                var index = event.data.index === 0 ? 0 :
                    event.data.index || $target.index() * _.options.slidesToScroll;

                _.slideHandler(_.checkNavigable(index), false, dontAnimate);
                $target.children().trigger('focus');
                break;

            default:
                return;
        }

    };

    Slick.prototype.checkNavigable = function (index) {

        var _ = this,
            navigables, prevNavigable;

        navigables = _.getNavigableIndexes();
        prevNavigable = 0;
        if (index > navigables[navigables.length - 1]) {
            index = navigables[navigables.length - 1];
        } else {
            for (var n in navigables) {
                if (index < navigables[n]) {
                    index = prevNavigable;
                    break;
                }
                prevNavigable = navigables[n];
            }
        }

        return index;
    };

    Slick.prototype.cleanUpEvents = function () {

        var _ = this;

        if (_.options.dots && _.$dots !== null) {

            $('li', _.$dots)
                .off('click.slick', _.changeSlide)
                .off('mouseenter.slick', $.proxy(_.interrupt, _, true))
                .off('mouseleave.slick', $.proxy(_.interrupt, _, false));

        }

        _.$slider.off('focus.slick blur.slick');

        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
            _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
            _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
        }

        _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
        _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
        _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
        _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);

        _.$list.off('click.slick', _.clickHandler);

        $(document).off(_.visibilityChange, _.visibility);

        _.cleanUpSlideEvents();

        if (_.options.accessibility === true) {
            _.$list.off('keydown.slick', _.keyHandler);
        }

        if (_.options.focusOnSelect === true) {
            $(_.$slideTrack).children().off('click.slick', _.selectHandler);
        }

        $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);

        $(window).off('resize.slick.slick-' + _.instanceUid, _.resize);

        $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);

        $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);

    };

    Slick.prototype.cleanUpSlideEvents = function () {

        var _ = this;

        _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true));
        _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false));

    };

    Slick.prototype.cleanUpRows = function () {

        var _ = this, originalSlides;

        if (_.options.rows > 1) {
            originalSlides = _.$slides.children().children();
            originalSlides.removeAttr('style');
            _.$slider.empty().append(originalSlides);
        }

    };

    Slick.prototype.clickHandler = function (event) {

        var _ = this;

        if (_.shouldClick === false) {
            event.stopImmediatePropagation();
            event.stopPropagation();
            event.preventDefault();
        }

    };

    Slick.prototype.destroy = function (refresh) {

        var _ = this;

        _.autoPlayClear();

        _.touchObject = {};

        _.cleanUpEvents();

        $('.slick-cloned', _.$slider).detach();

        if (_.$dots) {
            _.$dots.remove();
        }

        if (_.$prevArrow && _.$prevArrow.length) {

            _.$prevArrow
                .removeClass('slick-disabled slick-arrow slick-hidden')
                .removeAttr('aria-hidden aria-disabled tabindex')
                .css('display', '');

            if (_.htmlExpr.test(_.options.prevArrow)) {
                _.$prevArrow.remove();
            }
        }

        if (_.$nextArrow && _.$nextArrow.length) {

            _.$nextArrow
                .removeClass('slick-disabled slick-arrow slick-hidden')
                .removeAttr('aria-hidden aria-disabled tabindex')
                .css('display', '');

            if (_.htmlExpr.test(_.options.nextArrow)) {
                _.$nextArrow.remove();
            }
        }


        if (_.$slides) {

            _.$slides
                .removeClass('slick-slide slick-active slick-center slick-visible slick-current')
                .removeAttr('aria-hidden')
                .removeAttr('data-slick-index')
                .each(function () {
                    $(this).attr('style', $(this).data('originalStyling'));
                });

            _.$slideTrack.children(this.options.slide).detach();

            _.$slideTrack.detach();

            _.$list.detach();

            _.$slider.append(_.$slides);
        }

        _.cleanUpRows();

        _.$slider.removeClass('slick-slider');
        _.$slider.removeClass('slick-initialized');
        _.$slider.removeClass('slick-dotted');

        _.unslicked = true;

        if (!refresh) {
            _.$slider.trigger('destroy', [_]);
        }

    };

    Slick.prototype.disableTransition = function (slide) {

        var _ = this,
            transition = {};

        transition[_.transitionType] = '';

        if (_.options.fade === false) {
            _.$slideTrack.css(transition);
        } else {
            _.$slides.eq(slide).css(transition);
        }

    };

    Slick.prototype.fadeSlide = function (slideIndex, callback) {

        var _ = this;

        if (_.cssTransitions === false) {

            _.$slides.eq(slideIndex).css({
                zIndex: _.options.zIndex
            });

            _.$slides.eq(slideIndex).animate({
                opacity: 1
            }, _.options.speed, _.options.easing, callback);

        } else {

            _.applyTransition(slideIndex);

            _.$slides.eq(slideIndex).css({
                opacity: 1,
                zIndex: _.options.zIndex
            });

            if (callback) {
                setTimeout(function () {

                    _.disableTransition(slideIndex);

                    callback.call();
                }, _.options.speed);
            }

        }

    };

    Slick.prototype.fadeSlideOut = function (slideIndex) {

        var _ = this;

        if (_.cssTransitions === false) {

            _.$slides.eq(slideIndex).animate({
                opacity: 0,
                zIndex: _.options.zIndex - 2
            }, _.options.speed, _.options.easing);

        } else {

            _.applyTransition(slideIndex);

            _.$slides.eq(slideIndex).css({
                opacity: 0,
                zIndex: _.options.zIndex - 2
            });

        }

    };

    Slick.prototype.filterSlides = Slick.prototype.slickFilter = function (filter) {

        var _ = this;

        if (filter !== null) {

            _.$slidesCache = _.$slides;

            _.unload();

            _.$slideTrack.children(this.options.slide).detach();

            _.$slidesCache.filter(filter).appendTo(_.$slideTrack);

            _.reinit();

        }

    };

    Slick.prototype.focusHandler = function () {

        var _ = this;

        _.$slider
            .off('focus.slick blur.slick')
            .on('focus.slick blur.slick',
                '*:not(.slick-arrow)', function (event) {

                    event.stopImmediatePropagation();
                    var $sf = $(this);

                    setTimeout(function () {

                        if (_.options.pauseOnFocus) {
                            _.focussed = $sf.is(':focus');
                            _.autoPlay();
                        }

                    }, 0);

                });
    };

    Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function () {

        var _ = this;
        return _.currentSlide;

    };

    Slick.prototype.getDotCount = function () {

        var _ = this;

        var breakPoint = 0;
        var counter = 0;
        var pagerQty = 0;

        if (_.options.infinite === true) {
            while (breakPoint < _.slideCount) {
                ++pagerQty;
                breakPoint = counter + _.options.slidesToScroll;
                counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
            }
        } else if (_.options.centerMode === true) {
            pagerQty = _.slideCount;
        } else if (!_.options.asNavFor) {
            pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll);
        } else {
            while (breakPoint < _.slideCount) {
                ++pagerQty;
                breakPoint = counter + _.options.slidesToScroll;
                counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
            }
        }

        return pagerQty - 1;

    };

    Slick.prototype.getLeft = function (slideIndex) {

        var _ = this,
            targetLeft,
            verticalHeight,
            verticalOffset = 0,
            targetSlide;

        _.slideOffset = 0;
        verticalHeight = _.$slides.first().outerHeight(true);

        if (_.options.infinite === true) {
            if (_.slideCount > _.options.slidesToShow) {
                _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
                verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
            }
            if (_.slideCount % _.options.slidesToScroll !== 0) {
                if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
                    if (slideIndex > _.slideCount) {
                        _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1;
                        verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
                    } else {
                        _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1;
                        verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1;
                    }
                }
            }
        } else {
            if (slideIndex + _.options.slidesToShow > _.slideCount) {
                _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
                verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
            }
        }

        if (_.slideCount <= _.options.slidesToShow) {
            _.slideOffset = 0;
            verticalOffset = 0;
        }

        if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) {
            _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2);
        } else if (_.options.centerMode === true && _.options.infinite === true) {
            _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
        } else if (_.options.centerMode === true) {
            _.slideOffset = 0;
            _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
        }

        if (_.options.vertical === false) {
            targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
        } else {
            targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
        }

        if (_.options.variableWidth === true) {

            if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
                targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
            } else {
                targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
            }

            if (_.options.rtl === true) {
                if (targetSlide[0]) {
                    targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
                } else {
                    targetLeft = 0;
                }
            } else {
                targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
            }

            if (_.options.centerMode === true) {
                if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
                    targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
                } else {
                    targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
                }

                if (_.options.rtl === true) {
                    if (targetSlide[0]) {
                        targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
                    } else {
                        targetLeft = 0;
                    }
                } else {
                    targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
                }

                targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
            }
        }

        return targetLeft;

    };

    Slick.prototype.getOption = Slick.prototype.slickGetOption = function (option) {

        var _ = this;

        return _.options[option];

    };

    Slick.prototype.getNavigableIndexes = function () {

        var _ = this,
            breakPoint = 0,
            counter = 0,
            indexes = [],
            max;

        if (_.options.infinite === false) {
            max = _.slideCount;
        } else {
            breakPoint = _.options.slidesToScroll * -1;
            counter = _.options.slidesToScroll * -1;
            max = _.slideCount * 2;
        }

        while (breakPoint < max) {
            indexes.push(breakPoint);
            breakPoint = counter + _.options.slidesToScroll;
            counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
        }

        return indexes;

    };

    Slick.prototype.getSlick = function () {

        return this;

    };

    Slick.prototype.getSlideCount = function () {

        var _ = this,
            slidesTraversed, swipedSlide, centerOffset;

        centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;

        if (_.options.swipeToSlide === true) {
            _.$slideTrack.find('.slick-slide').each(function (index, slide) {
                if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
                    swipedSlide = slide;
                    return false;
                }
            });

            slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;

            return slidesTraversed;

        } else {
            return _.options.slidesToScroll;
        }

    };

    Slick.prototype.goTo = Slick.prototype.slickGoTo = function (slide, dontAnimate) {

        var _ = this;

        _.changeSlide({
            data: {
                message: 'index',
                index: parseInt(slide)
            }
        }, dontAnimate);

    };

    Slick.prototype.init = function (creation) {

        var _ = this;

        if (!$(_.$slider).hasClass('slick-initialized')) {

            $(_.$slider).addClass('slick-initialized');

            _.buildRows();
            _.buildOut();
            _.setProps();
            _.startLoad();
            _.loadSlider();
            _.initializeEvents();
            _.updateArrows();
            _.updateDots();
            _.checkResponsive(true);
            _.focusHandler();

        }

        if (creation) {
            _.$slider.trigger('init', [_]);
        }

        if (_.options.accessibility === true) {
            _.initADA();
        }

        if (_.options.autoplay) {

            _.paused = false;
            _.autoPlay();

        }

    };

    Slick.prototype.initADA = function () {
        var _ = this;
        _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
            'aria-hidden': 'true',
            'tabindex': '-1'
        }).find('a, input, button, select').attr({
            'tabindex': '-1'
        });

        _.$slideTrack.attr('role', 'listbox');

        _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function (i) {
            $(this).attr('role', 'option');

            //Evenly distribute aria-describedby tags through available dots.
            var describedBySlideId = _.options.centerMode ? i : Math.floor(i / _.options.slidesToShow);

            if (_.options.dots === true) {
                $(this).attr('aria-describedby', 'slick-slide' + _.instanceUid + describedBySlideId + '');
            }
        });

        if (_.$dots !== null) {
            _.$dots.attr('role', 'tablist').find('li').each(function (i) {
                $(this).attr({
                    'role': 'presentation',
                    'aria-selected': 'false',
                    'aria-controls': 'navigation' + _.instanceUid + i + '',
                    'id': 'slick-slide' + _.instanceUid + i + ''
                });
            })
                .first().attr('aria-selected', 'true').end()
                .find('button').attr('role', 'button').end()
                .closest('div').attr('role', 'toolbar');
        }
        _.activateADA();

    };

    Slick.prototype.initArrowEvents = function () {

        var _ = this;

        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
            _.$prevArrow
               .off('click.slick')
               .on('click.slick', {
                message: 'previous'
               }, _.changeSlide);
            _.$nextArrow
               .off('click.slick')
               .on('click.slick', {
                message: 'next'
               }, _.changeSlide);
        }

    };

    Slick.prototype.initDotEvents = function () {

        var _ = this;

        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
            $('li', _.$dots).on('click.slick', {
                message: 'index'
            }, _.changeSlide);
        }

        if (_.options.dots === true && _.options.pauseOnDotsHover === true) {

            $('li', _.$dots)
                .on('mouseenter.slick', $.proxy(_.interrupt, _, true))
                .on('mouseleave.slick', $.proxy(_.interrupt, _, false));

        }

    };

    Slick.prototype.initSlideEvents = function () {

        var _ = this;

        if (_.options.pauseOnHover) {

            _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true));
            _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false));

        }

    };

    Slick.prototype.initializeEvents = function () {

        var _ = this;

        _.initArrowEvents();

        _.initDotEvents();
        _.initSlideEvents();

        _.$list.on('touchstart.slick mousedown.slick', {
            action: 'start'
        }, _.swipeHandler);
        _.$list.on('touchmove.slick mousemove.slick', {
            action: 'move'
        }, _.swipeHandler);
        _.$list.on('touchend.slick mouseup.slick', {
            action: 'end'
        }, _.swipeHandler);
        _.$list.on('touchcancel.slick mouseleave.slick', {
            action: 'end'
        }, _.swipeHandler);

        _.$list.on('click.slick', _.clickHandler);

        $(document).on(_.visibilityChange, $.proxy(_.visibility, _));

        if (_.options.accessibility === true) {
            _.$list.on('keydown.slick', _.keyHandler);
        }

        if (_.options.focusOnSelect === true) {
            $(_.$slideTrack).children().on('click.slick', _.selectHandler);
        }

        $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _));

        $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _));

        $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);

        $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
        $(_.setPosition);

    };

    Slick.prototype.initUI = function () {

        var _ = this;

        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {

            _.$prevArrow.show();
            _.$nextArrow.show();

        }

        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {

            _.$dots.show();

        }

    };

    Slick.prototype.keyHandler = function (event) {

        var _ = this;
        //Dont slide if the cursor is inside the form fields and arrow keys are pressed
        if (!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
            if (event.keyCode === 37 && _.options.accessibility === true) {
                _.changeSlide({
                    data: {
                        message: _.options.rtl === true ? 'next' : 'previous'
                    }
                });
            } else if (event.keyCode === 39 && _.options.accessibility === true) {
                _.changeSlide({
                    data: {
                        message: _.options.rtl === true ? 'previous' : 'next'
                    }
                });
            }
        }

    };

    Slick.prototype.lazyLoad = function () {

        var _ = this,
            loadRange, cloneRange, rangeStart, rangeEnd;

        function loadImages(imagesScope) {

            $('img[data-lazy]', imagesScope).each(function () {

                var image = $(this),
                    imageSource = $(this).attr('data-lazy'),
                    imageSrcSet = $(this).attr('data-srcset'),
                    imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'),
                    imageToLoad = document.createElement('img');

                imageToLoad.onload = function () {

                    image
                        .animate({ opacity: 0 }, 100, function () {

                            if (imageSrcSet) {
                                image
                                    .attr('srcset', imageSrcSet);

                                if (imageSizes) {
                                    image
                                        .attr('sizes', imageSizes);
                                }
                            }

                            image
                                .attr('src', imageSource)
                                .animate({ opacity: 1 }, 200, function () {
                                    image
                                        .removeAttr('data-lazy data-srcset data-sizes')
                                        .removeClass('slick-loading');
                                });
                            _.$slider.trigger('lazyLoaded', [_, image, imageSource]);
                        });

                };

                imageToLoad.onerror = function () {

                    image
                        .removeAttr('data-lazy')
                        .removeClass('slick-loading')
                        .addClass('slick-lazyload-error');

                    _.$slider.trigger('lazyLoadError', [_, image, imageSource]);

                };

                imageToLoad.src = imageSource;

            });

        }

        if (_.options.centerMode === true) {
            if (_.options.infinite === true) {
                rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
                rangeEnd = rangeStart + _.options.slidesToShow + 2;
            } else {
                rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
                rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
            }
        } else {
            rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
            rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow);
            if (_.options.fade === true) {
                if (rangeStart > 0) rangeStart--;
                if (rangeEnd <= _.slideCount) rangeEnd++;
            }
        }

        loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);

        if (_.options.lazyLoad === 'anticipated') {
            var prevSlide = rangeStart - 1,
                nextSlide = rangeEnd,
                $slides = _.$slider.find('.slick-slide');

            for (var i = 0; i < _.options.slidesToScroll; i++) {
                if (prevSlide < 0) prevSlide = _.slideCount - 1;
                loadRange = loadRange.add($slides.eq(prevSlide));
                loadRange = loadRange.add($slides.eq(nextSlide));
                prevSlide--;
                nextSlide++;
            }
        }

        loadImages(loadRange);

        if (_.slideCount <= _.options.slidesToShow) {
            cloneRange = _.$slider.find('.slick-slide');
            loadImages(cloneRange);
        } else
            if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
                cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
                loadImages(cloneRange);
            } else if (_.currentSlide === 0) {
                cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
                loadImages(cloneRange);
            }

    };

    Slick.prototype.loadSlider = function () {

        var _ = this;

        _.setPosition();

        _.$slideTrack.css({
            opacity: 1
        });

        _.$slider.removeClass('slick-loading');

        _.initUI();

        if (_.options.lazyLoad === 'progressive') {
            _.progressiveLazyLoad();
        }

    };

    Slick.prototype.next = Slick.prototype.slickNext = function () {

        var _ = this;

        _.changeSlide({
            data: {
                message: 'next'
            }
        });

    };

    Slick.prototype.orientationChange = function () {

        var _ = this;

        _.checkResponsive();
        _.setPosition();

    };

    Slick.prototype.pause = Slick.prototype.slickPause = function () {

        var _ = this;

        _.autoPlayClear();
        _.paused = true;

    };

    Slick.prototype.play = Slick.prototype.slickPlay = function () {

        var _ = this;

        _.autoPlay();
        _.options.autoplay = true;
        _.paused = false;
        _.focussed = false;
        _.interrupted = false;

    };

    Slick.prototype.postSlide = function (index) {

        var _ = this;

        if (!_.unslicked) {

            _.$slider.trigger('afterChange', [_, index]);

            _.animating = false;

            _.setPosition();

            _.swipeLeft = null;

            if (_.options.autoplay) {
                _.autoPlay();
            }

            if (_.options.accessibility === true) {
                _.initADA();
            }

        }

    };

    Slick.prototype.prev = Slick.prototype.slickPrev = function () {

        var _ = this;

        _.changeSlide({
            data: {
                message: 'previous'
            }
        });

    };

    Slick.prototype.preventDefault = function (event) {

        event.preventDefault();

    };

    Slick.prototype.progressiveLazyLoad = function (tryCount) {

        tryCount = tryCount || 1;

        var _ = this,
            $imgsToLoad = $('img[data-lazy]', _.$slider),
            image,
            imageSource,
            imageSrcSet,
            imageSizes,
            imageToLoad;

        if ($imgsToLoad.length) {

            image = $imgsToLoad.first();
            imageSource = image.attr('data-lazy');
            imageSrcSet = image.attr('data-srcset');
            imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes');
            imageToLoad = document.createElement('img');

            imageToLoad.onload = function () {

                if (imageSrcSet) {
                    image
                        .attr('srcset', imageSrcSet);

                    if (imageSizes) {
                        image
                            .attr('sizes', imageSizes);
                    }
                }

                image
                    .attr('src', imageSource)
                    .removeAttr('data-lazy data-srcset data-sizes')
                    .removeClass('slick-loading');

                if (_.options.adaptiveHeight === true) {
                    _.setPosition();
                }

                _.$slider.trigger('lazyLoaded', [_, image, imageSource]);
                _.progressiveLazyLoad();

            };

            imageToLoad.onerror = function () {

                if (tryCount < 3) {

                    /**
                     * try to load the image 3 times,
                     * leave a slight delay so we don't get
                     * servers blocking the request.
                     */
                    setTimeout(function () {
                        _.progressiveLazyLoad(tryCount + 1);
                    }, 500);

                } else {

                    image
                        .removeAttr('data-lazy')
                        .removeClass('slick-loading')
                        .addClass('slick-lazyload-error');

                    _.$slider.trigger('lazyLoadError', [_, image, imageSource]);

                    _.progressiveLazyLoad();

                }

            };

            imageToLoad.src = imageSource;

        } else {

            _.$slider.trigger('allImagesLoaded', [_]);

        }

    };

    Slick.prototype.refresh = function (initializing) {

        var _ = this, currentSlide, lastVisibleIndex;

        lastVisibleIndex = _.slideCount - _.options.slidesToShow;

        // in non-infinite sliders, we don't want to go past the
        // last visible index.
        if (!_.options.infinite && (_.currentSlide > lastVisibleIndex)) {
            _.currentSlide = lastVisibleIndex;
        }

        // if less slides than to show, go to start.
        if (_.slideCount <= _.options.slidesToShow) {
            _.currentSlide = 0;

        }

        currentSlide = _.currentSlide;

        _.destroy(true);

        $.extend(_, _.initials, { currentSlide: currentSlide });

        _.init();

        if (!initializing) {

            _.changeSlide({
                data: {
                    message: 'index',
                    index: currentSlide
                }
            }, false);

        }

    };

    Slick.prototype.registerBreakpoints = function () {

        var _ = this, breakpoint, currentBreakpoint, l,
            responsiveSettings = _.options.responsive || null;

        if ($.type(responsiveSettings) === 'array' && responsiveSettings.length) {

            _.respondTo = _.options.respondTo || 'window';

            for (breakpoint in responsiveSettings) {

                l = _.breakpoints.length - 1;

                if (responsiveSettings.hasOwnProperty(breakpoint)) {
                    currentBreakpoint = responsiveSettings[breakpoint].breakpoint;

                    // loop through the breakpoints and cut out any existing
                    // ones with the same breakpoint number, we don't want dupes.
                    while (l >= 0) {
                        if (_.breakpoints[l] && _.breakpoints[l] === currentBreakpoint) {
                            _.breakpoints.splice(l, 1);
                        }
                        l--;
                    }

                    _.breakpoints.push(currentBreakpoint);
                    _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings;

                }

            }

            _.breakpoints.sort(function (a, b) {
                return (_.options.mobileFirst) ? a - b : b - a;
            });

        }

    };

    Slick.prototype.reinit = function () {

        var _ = this;

        _.$slides =
            _.$slideTrack
                .children(_.options.slide)
                .addClass('slick-slide');

        _.slideCount = _.$slides.length;

        if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
            _.currentSlide = _.currentSlide - _.options.slidesToScroll;
        }

        if (_.slideCount <= _.options.slidesToShow) {
            _.currentSlide = 0;
        }

        _.registerBreakpoints();

        _.setProps();
        _.setupInfinite();
        _.buildArrows();
        _.updateArrows();
        _.initArrowEvents();
        _.buildDots();
        _.updateDots();
        _.initDotEvents();
        _.cleanUpSlideEvents();
        _.initSlideEvents();

        _.checkResponsive(false, true);

        if (_.options.focusOnSelect === true) {
            $(_.$slideTrack).children().on('click.slick', _.selectHandler);
        }

        _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);

        _.setPosition();
        _.focusHandler();

        _.paused = !_.options.autoplay;
        _.autoPlay();

        _.$slider.trigger('reInit', [_]);

    };

    Slick.prototype.resize = function () {

        var _ = this;

        if ($(window).width() !== _.windowWidth) {
            clearTimeout(_.windowDelay);
            _.windowDelay = window.setTimeout(function () {
                _.windowWidth = $(window).width();
                _.checkResponsive();
                if (!_.unslicked) { _.setPosition(); }
            }, 50);
        }
    };

    Slick.prototype.removeSlide = Slick.prototype.slickRemove = function (index, removeBefore, removeAll) {

        var _ = this;

        if (typeof (index) === 'boolean') {
            removeBefore = index;
            index = removeBefore === true ? 0 : _.slideCount - 1;
        } else {
            index = removeBefore === true ? --index : index;
        }

        if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
            return false;
        }

        _.unload();

        if (removeAll === true) {
            _.$slideTrack.children().remove();
        } else {
            _.$slideTrack.children(this.options.slide).eq(index).remove();
        }

        _.$slides = _.$slideTrack.children(this.options.slide);

        _.$slideTrack.children(this.options.slide).detach();

        _.$slideTrack.append(_.$slides);

        _.$slidesCache = _.$slides;

        _.reinit();

    };

    Slick.prototype.setCSS = function (position) {

        var _ = this,
            positionProps = {},
            x, y;

        if (_.options.rtl === true) {
            position = -position;
        }
        x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px';
        y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px';

        positionProps[_.positionProp] = position;

        if (_.transformsEnabled === false) {
            _.$slideTrack.css(positionProps);
        } else {
            positionProps = {};
            if (_.cssTransitions === false) {
                positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
                _.$slideTrack.css(positionProps);
            } else {
                positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
                _.$slideTrack.css(positionProps);
            }
        }

    };

    Slick.prototype.setDimensions = function () {

        var _ = this;

        if (_.options.vertical === false) {
            if (_.options.centerMode === true) {
                _.$list.css({
                    padding: ('0px ' + _.options.centerPadding)
                });
            }
        } else {
            _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
            if (_.options.centerMode === true) {
                _.$list.css({
                    padding: (_.options.centerPadding + ' 0px')
                });
            }
        }

        _.listWidth = _.$list.width();
        _.listHeight = _.$list.height();


        if (_.options.vertical === false && _.options.variableWidth === false) {
            _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
            _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));

        } else if (_.options.variableWidth === true) {
            _.$slideTrack.width(5000 * _.slideCount);
        } else {
            _.slideWidth = Math.ceil(_.listWidth);
            _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
        }

        var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
        if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);

    };

    Slick.prototype.setFade = function () {

        var _ = this,
            targetLeft;

        _.$slides.each(function (index, element) {
            targetLeft = (_.slideWidth * index) * -1;
            if (_.options.rtl === true) {
                $(element).css({
                    position: 'relative',
                    right: targetLeft,
                    top: 0,
                    zIndex: _.options.zIndex - 2,
                    opacity: 0
                });
            } else {
                $(element).css({
                    position: 'relative',
                    left: targetLeft,
                    top: 0,
                    zIndex: _.options.zIndex - 2,
                    opacity: 0
                });
            }
        });

        _.$slides.eq(_.currentSlide).css({
            zIndex: _.options.zIndex - 1,
            opacity: 1
        });

    };

    Slick.prototype.setHeight = function () {

        var _ = this;

        if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
            var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
            _.$list.css('height', targetHeight);
        }

    };

    Slick.prototype.setOption =
    Slick.prototype.slickSetOption = function () {

        /**
         * accepts arguments in format of:
         *
         *  - for changing a single option's value:
         *     .slick("setOption", option, value, refresh )
         *
         *  - for changing a set of responsive options:
         *     .slick("setOption", 'responsive', [{}, ...], refresh )
         *
         *  - for updating multiple values at once (not responsive)
         *     .slick("setOption", { 'option': value, ... }, refresh )
         */

        var _ = this, l, item, option, value, refresh = false, type;

        if ($.type(arguments[0]) === 'object') {

            option = arguments[0];
            refresh = arguments[1];
            type = 'multiple';

        } else if ($.type(arguments[0]) === 'string') {

            option = arguments[0];
            value = arguments[1];
            refresh = arguments[2];

            if (arguments[0] === 'responsive' && $.type(arguments[1]) === 'array') {

                type = 'responsive';

            } else if (typeof arguments[1] !== 'undefined') {

                type = 'single';

            }

        }

        if (type === 'single') {

            _.options[option] = value;


        } else if (type === 'multiple') {

            $.each(option, function (opt, val) {

                _.options[opt] = val;

            });


        } else if (type === 'responsive') {

            for (item in value) {

                if ($.type(_.options.responsive) !== 'array') {

                    _.options.responsive = [value[item]];

                } else {

                    l = _.options.responsive.length - 1;

                    // loop through the responsive object and splice out duplicates.
                    while (l >= 0) {

                        if (_.options.responsive[l].breakpoint === value[item].breakpoint) {

                            _.options.responsive.splice(l, 1);

                        }

                        l--;

                    }

                    _.options.responsive.push(value[item]);

                }

            }

        }

        if (refresh) {

            _.unload();
            _.reinit();

        }

    };

    Slick.prototype.setPosition = function () {

        var _ = this;

        _.setDimensions();

        _.setHeight();

        if (_.options.fade === false) {
            _.setCSS(_.getLeft(_.currentSlide));
        } else {
            _.setFade();
        }

        _.$slider.trigger('setPosition', [_]);

    };

    Slick.prototype.setProps = function () {

        var _ = this,
            bodyStyle = document.body.style;

        _.positionProp = _.options.vertical === true ? 'top' : 'left';

        if (_.positionProp === 'top') {
            _.$slider.addClass('slick-vertical');
        } else {
            _.$slider.removeClass('slick-vertical');
        }

        if (bodyStyle.WebkitTransition !== undefined ||
            bodyStyle.MozTransition !== undefined ||
            bodyStyle.msTransition !== undefined) {
            if (_.options.useCSS === true) {
                _.cssTransitions = true;
            }
        }

        if (_.options.fade) {
            if (typeof _.options.zIndex === 'number') {
                if (_.options.zIndex < 3) {
                    _.options.zIndex = 3;
                }
            } else {
                _.options.zIndex = _.defaults.zIndex;
            }
        }

        if (bodyStyle.OTransform !== undefined) {
            _.animType = 'OTransform';
            _.transformType = '-o-transform';
            _.transitionType = 'OTransition';
            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
        }
        if (bodyStyle.MozTransform !== undefined) {
            _.animType = 'MozTransform';
            _.transformType = '-moz-transform';
            _.transitionType = 'MozTransition';
            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
        }
        if (bodyStyle.webkitTransform !== undefined) {
            _.animType = 'webkitTransform';
            _.transformType = '-webkit-transform';
            _.transitionType = 'webkitTransition';
            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
        }
        if (bodyStyle.msTransform !== undefined) {
            _.animType = 'msTransform';
            _.transformType = '-ms-transform';
            _.transitionType = 'msTransition';
            if (bodyStyle.msTransform === undefined) _.animType = false;
        }
        if (bodyStyle.transform !== undefined && _.animType !== false) {
            _.animType = 'transform';
            _.transformType = 'transform';
            _.transitionType = 'transition';
        }
        _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false);
    };


    Slick.prototype.setSlideClasses = function (index) {

        var _ = this,
            centerOffset, allSlides, indexOffset, remainder;

        allSlides = _.$slider
            .find('.slick-slide')
            .removeClass('slick-active slick-center slick-current')
            .attr('aria-hidden', 'true');

        _.$slides
            .eq(index)
            .addClass('slick-current');

        if (_.options.centerMode === true) {

            centerOffset = Math.floor(_.options.slidesToShow / 2);

            if (_.options.infinite === true) {

                if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {

                    _.$slides
                        .slice(index - centerOffset, index + centerOffset + 1)
                        .addClass('slick-active')
                        .attr('aria-hidden', 'false');

                } else {

                    indexOffset = _.options.slidesToShow + index;
                    allSlides
                        .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2)
                        .addClass('slick-active')
                        .attr('aria-hidden', 'false');

                }

                if (index === 0) {

                    allSlides
                        .eq(allSlides.length - 1 - _.options.slidesToShow)
                        .addClass('slick-center');

                } else if (index === _.slideCount - 1) {

                    allSlides
                        .eq(_.options.slidesToShow)
                        .addClass('slick-center');

                }

            }

            _.$slides
                .eq(index)
                .addClass('slick-center');

        } else {

            if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {

                _.$slides
                    .slice(index, index + _.options.slidesToShow)
                    .addClass('slick-active')
                    .attr('aria-hidden', 'false');

            } else if (allSlides.length <= _.options.slidesToShow) {

                allSlides
                    .addClass('slick-active')
                    .attr('aria-hidden', 'false');

            } else {

                remainder = _.slideCount % _.options.slidesToShow;
                indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;

                if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {

                    allSlides
                        .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
                        .addClass('slick-active')
                        .attr('aria-hidden', 'false');

                } else {

                    allSlides
                        .slice(indexOffset, indexOffset + _.options.slidesToShow)
                        .addClass('slick-active')
                        .attr('aria-hidden', 'false');

                }

            }

        }

        if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') {
            _.lazyLoad();
        }
    };

    Slick.prototype.setupInfinite = function () {

        var _ = this,
            i, slideIndex, infiniteCount;

        if (_.options.fade === true) {
            _.options.centerMode = false;
        }

        if (_.options.infinite === true && _.options.fade === false) {

            slideIndex = null;

            if (_.slideCount > _.options.slidesToShow) {

                if (_.options.centerMode === true) {
                    infiniteCount = _.options.slidesToShow + 1;
                } else {
                    infiniteCount = _.options.slidesToShow;
                }

                for (i = _.slideCount; i > (_.slideCount -
                        infiniteCount) ; i -= 1) {
                    slideIndex = i - 1;
                    $(_.$slides[slideIndex]).clone(true).attr('id', '')
                        .attr('data-slick-index', slideIndex - _.slideCount)
                        .prependTo(_.$slideTrack).addClass('slick-cloned');
                }
                for (i = 0; i < infiniteCount; i += 1) {
                    slideIndex = i;
                    $(_.$slides[slideIndex]).clone(true).attr('id', '')
                        .attr('data-slick-index', slideIndex + _.slideCount)
                        .appendTo(_.$slideTrack).addClass('slick-cloned');
                }
                _.$slideTrack.find('.slick-cloned').find('[id]').each(function () {
                    $(this).attr('id', '');
                });

            }

        }

    };

    Slick.prototype.interrupt = function (toggle) {

        var _ = this;

        if (!toggle) {
            _.autoPlay();
        }
        _.interrupted = toggle;

    };

    Slick.prototype.selectHandler = function (event) {

        var _ = this;

        var targetElement =
            $(event.target).is('.slick-slide') ?
                $(event.target) :
                $(event.target).parents('.slick-slide');

        var index = parseInt(targetElement.attr('data-slick-index'));

        if (!index) index = 0;

        if (_.slideCount <= _.options.slidesToShow) {

            _.setSlideClasses(index);
            _.asNavFor(index);
            return;

        }

        _.slideHandler(index);

    };

    Slick.prototype.slideHandler = function (index, sync, dontAnimate) {

        var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
            _ = this, navTarget;

        sync = sync || false;

        if (_.animating === true && _.options.waitForAnimate === true) {
            return;
        }

        if (_.options.fade === true && _.currentSlide === index) {
            return;
        }

        if (_.slideCount <= _.options.slidesToShow) {
            return;
        }

        if (sync === false) {
            _.asNavFor(index);
        }

        targetSlide = index;
        targetLeft = _.getLeft(targetSlide);
        slideLeft = _.getLeft(_.currentSlide);

        _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;

        if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
            if (_.options.fade === false) {
                targetSlide = _.currentSlide;
                if (dontAnimate !== true) {
                    _.animateSlide(slideLeft, function () {
                        _.postSlide(targetSlide);
                    });
                } else {
                    _.postSlide(targetSlide);
                }
            }
            return;
        } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
            if (_.options.fade === false) {
                targetSlide = _.currentSlide;
                if (dontAnimate !== true) {
                    _.animateSlide(slideLeft, function () {
                        _.postSlide(targetSlide);
                    });
                } else {
                    _.postSlide(targetSlide);
                }
            }
            return;
        }

        if (_.options.autoplay) {
            clearInterval(_.autoPlayTimer);
        }

        if (targetSlide < 0) {
            if (_.slideCount % _.options.slidesToScroll !== 0) {
                animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
            } else {
                animSlide = _.slideCount + targetSlide;
            }
        } else if (targetSlide >= _.slideCount) {
            if (_.slideCount % _.options.slidesToScroll !== 0) {
                animSlide = 0;
            } else {
                animSlide = targetSlide - _.slideCount;
            }
        } else {
            animSlide = targetSlide;
        }

        _.animating = true;

        _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);

        oldSlide = _.currentSlide;
        _.currentSlide = animSlide;

        _.setSlideClasses(_.currentSlide);

        if (_.options.asNavFor) {

            navTarget = _.getNavTarget();
            navTarget = navTarget.slick('getSlick');

            if (navTarget.slideCount <= navTarget.options.slidesToShow) {
                navTarget.setSlideClasses(_.currentSlide);
            }

        }

        _.updateDots();
        _.updateArrows();

        if (_.options.fade === true) {
            if (dontAnimate !== true) {

                _.fadeSlideOut(oldSlide);

                _.fadeSlide(animSlide, function () {
                    _.postSlide(animSlide);
                });

            } else {
                _.postSlide(animSlide);
            }
            _.animateHeight();
            return;
        }

        if (dontAnimate !== true) {
            _.animateSlide(targetLeft, function () {
                _.postSlide(animSlide);
            });
        } else {
            _.postSlide(animSlide);
        }

    };

    Slick.prototype.startLoad = function () {

        var _ = this;

        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {

            _.$prevArrow.hide();
            _.$nextArrow.hide();

        }

        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {

            _.$dots.hide();

        }

        _.$slider.addClass('slick-loading');

    };

    Slick.prototype.swipeDirection = function () {

        var xDist, yDist, r, swipeAngle, _ = this;

        xDist = _.touchObject.startX - _.touchObject.curX;
        yDist = _.touchObject.startY - _.touchObject.curY;
        r = Math.atan2(yDist, xDist);

        swipeAngle = Math.round(r * 180 / Math.PI);
        if (swipeAngle < 0) {
            swipeAngle = 360 - Math.abs(swipeAngle);
        }

        if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
            return (_.options.rtl === false ? 'left' : 'right');
        }
        if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
            return (_.options.rtl === false ? 'left' : 'right');
        }
        if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
            return (_.options.rtl === false ? 'right' : 'left');
        }
        if (_.options.verticalSwiping === true) {
            if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
                return 'down';
            } else {
                return 'up';
            }
        }

        return 'vertical';

    };

    Slick.prototype.swipeEnd = function (event) {

        var _ = this,
            slideCount,
            direction;

        _.dragging = false;
        _.swiping = false;

        if (_.scrolling) {
            _.scrolling = false;
            return false;
        }

        _.interrupted = false;
        _.shouldClick = (_.touchObject.swipeLength > 10) ? false : true;

        if (_.touchObject.curX === undefined) {
            return false;
        }

        if (_.touchObject.edgeHit === true) {
            _.$slider.trigger('edge', [_, _.swipeDirection()]);
        }

        if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {

            direction = _.swipeDirection();

            switch (direction) {

                case 'left':
                case 'down':

                    slideCount =
                        _.options.swipeToSlide ?
                            _.checkNavigable(_.currentSlide + _.getSlideCount()) :
                            _.currentSlide + _.getSlideCount();

                    _.currentDirection = 0;

                    break;

                case 'right':
                case 'up':

                    slideCount =
                        _.options.swipeToSlide ?
                            _.checkNavigable(_.currentSlide - _.getSlideCount()) :
                            _.currentSlide - _.getSlideCount();

                    _.currentDirection = 1;

                    break;

                default:


            }

            if (direction != 'vertical') {

                _.slideHandler(slideCount);
                _.touchObject = {};
                _.$slider.trigger('swipe', [_, direction]);

            }

        } else {

            if (_.touchObject.startX !== _.touchObject.curX) {

                _.slideHandler(_.currentSlide);
                _.touchObject = {};

            }

        }

    };

    Slick.prototype.swipeHandler = function (event) {

        var _ = this;

        if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
            return;
        } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
            return;
        }

        _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
            event.originalEvent.touches.length : 1;

        _.touchObject.minSwipe = _.listWidth / _.options
            .touchThreshold;

        if (_.options.verticalSwiping === true) {
            _.touchObject.minSwipe = _.listHeight / _.options
                .touchThreshold;
        }

        switch (event.data.action) {

            case 'start':
                _.swipeStart(event);
                break;

            case 'move':
                _.swipeMove(event);
                break;

            case 'end':
                _.swipeEnd(event);
                break;

        }

    };

    Slick.prototype.swipeMove = function (event) {

        var _ = this,
            edgeWasHit = false,
            curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength;

        touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;

        if (!_.dragging || _.scrolling || touches && touches.length !== 1) {
            return false;
        }

        curLeft = _.getLeft(_.currentSlide);

        _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
        _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;

        _.touchObject.swipeLength = Math.round(Math.sqrt(
            Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));

        verticalSwipeLength = Math.round(Math.sqrt(
            Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));

        if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) {
            _.scrolling = true;
            return false;
        }

        if (_.options.verticalSwiping === true) {
            _.touchObject.swipeLength = verticalSwipeLength;
        }

        swipeDirection = _.swipeDirection();

        if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
            _.swiping = true;
            event.preventDefault();
        }

        positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
        if (_.options.verticalSwiping === true) {
            positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
        }


        swipeLength = _.touchObject.swipeLength;

        _.touchObject.edgeHit = false;

        if (_.options.infinite === false) {
            if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
                swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
                _.touchObject.edgeHit = true;
            }
        }

        if (_.options.vertical === false) {
            _.swipeLeft = curLeft + swipeLength * positionOffset;
        } else {
            _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
        }
        if (_.options.verticalSwiping === true) {
            _.swipeLeft = curLeft + swipeLength * positionOffset;
        }

        if (_.options.fade === true || _.options.touchMove === false) {
            return false;
        }

        if (_.animating === true) {
            _.swipeLeft = null;
            return false;
        }

        _.setCSS(_.swipeLeft);

    };

    Slick.prototype.swipeStart = function (event) {

        var _ = this,
            touches;

        _.interrupted = true;

        if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
            _.touchObject = {};
            return false;
        }

        if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
            touches = event.originalEvent.touches[0];
        }

        _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
        _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;

        _.dragging = true;

    };

    Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function () {

        var _ = this;

        if (_.$slidesCache !== null) {

            _.unload();

            _.$slideTrack.children(this.options.slide).detach();

            _.$slidesCache.appendTo(_.$slideTrack);

            _.reinit();

        }

    };

    Slick.prototype.unload = function () {

        var _ = this;

        $('.slick-cloned', _.$slider).remove();

        if (_.$dots) {
            _.$dots.remove();
        }

        if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) {
            _.$prevArrow.remove();
        }

        if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) {
            _.$nextArrow.remove();
        }

        _.$slides
            .removeClass('slick-slide slick-active slick-visible slick-current')
            .attr('aria-hidden', 'true')
            .css('width', '');

    };

    Slick.prototype.unslick = function (fromBreakpoint) {

        var _ = this;
        _.$slider.trigger('unslick', [_, fromBreakpoint]);
        _.destroy();

    };

    Slick.prototype.updateArrows = function () {

        var _ = this,
            centerOffset;

        centerOffset = Math.floor(_.options.slidesToShow / 2);

        if (_.options.arrows === true &&
            _.slideCount > _.options.slidesToShow &&
            !_.options.infinite) {

            _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
            _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');

            if (_.currentSlide === 0) {

                _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
                _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');

            } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {

                _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
                _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');

            } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {

                _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
                _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');

            }

        }

    };

    Slick.prototype.updateDots = function () {

        var _ = this;

        if (_.$dots !== null) {

            _.$dots
                .find('li')
                .removeClass('slick-active')
                .attr('aria-hidden', 'true');

            _.$dots
                .find('li')
                .eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
                .addClass('slick-active')
                .attr('aria-hidden', 'false');

        }

    };

    Slick.prototype.visibility = function () {

        var _ = this;

        if (_.options.autoplay) {

            if (document[_.hidden]) {

                _.interrupted = true;

            } else {

                _.interrupted = false;

            }

        }

    };

    $.fn.slick = function () {
        var _ = this,
            opt = arguments[0],
            args = Array.prototype.slice.call(arguments, 1),
            l = _.length,
            i,
            ret;
        for (i = 0; i < l; i++) {
            if (typeof opt == 'object' || typeof opt == 'undefined')
                _[i].slick = new Slick(_[i], opt);
            else
                ret = _[i].slick[opt].apply(_[i].slick, args);
            if (typeof ret != 'undefined') return ret;
        }
        return _;
    };

}));;
/*!
 * JavaScript Cookie v2.0.3
 * https://github.com/js-cookie/js-cookie
 *
 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
 * Released under the MIT license
 */
(function (factory) {
	if (typeof define === 'function' && define.amd) {
		define(factory);
	} else if (typeof exports === 'object') {
		module.exports = factory();
	} else {
		var _OldCookies = window.Cookies;
		var api = window.Cookies = factory();
		api.noConflict = function () {
			window.Cookies = _OldCookies;
			return api;
		};
	}
}(function () {
	function extend () {
		var i = 0;
		var result = {};
		for (; i < arguments.length; i++) {
			var attributes = arguments[ i ];
			for (var key in attributes) {
				result[key] = attributes[key];
			}
		}
		return result;
	}

	function init (converter) {
		function api (key, value, attributes) {
			var result;

			// Write

			if (arguments.length > 1) {
				attributes = extend({
					path: '/'
				}, api.defaults, attributes);

				if (typeof attributes.expires === 'number') {
					var expires = new Date();
					expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
					attributes.expires = expires;
				}

				try {
					result = JSON.stringify(value);
					if (/^[\{\[]/.test(result)) {
						value = result;
					}
				} catch (e) {}

				value = encodeURIComponent(String(value));
				value = value.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);

				key = encodeURIComponent(String(key));
				key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
				key = key.replace(/[\(\)]/g, escape);

				return (document.cookie = [
					key, '=', value,
					attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE
					attributes.path    && '; path=' + attributes.path,
					attributes.domain  && '; domain=' + attributes.domain,
					attributes.secure ? '; secure' : ''
				].join(''));
			}

			// Read

			if (!key) {
				result = {};
			}

			// To prevent the for loop in the first place assign an empty array
			// in case there are no cookies at all. Also prevents odd result when
			// calling "get()"
			var cookies = document.cookie ? document.cookie.split('; ') : [];
			var rdecode = /(%[0-9A-Z]{2})+/g;
			var i = 0;

			for (; i < cookies.length; i++) {
				var parts = cookies[i].split('=');
				var name = parts[0].replace(rdecode, decodeURIComponent);
				var cookie = parts.slice(1).join('=');

				if (cookie.charAt(0) === '"') {
					cookie = cookie.slice(1, -1);
				}

				try {
					cookie = converter && converter(cookie, name) || cookie.replace(rdecode, decodeURIComponent);

					if (this.json) {
						try {
							cookie = JSON.parse(cookie);
						} catch (e) {}
					}

					if (key === name) {
						result = cookie;
						break;
					}

					if (!key) {
						result[name] = cookie;
					}
				} catch (e) {}
			}

			return result;
		}

		api.get = api.set = api;
		api.getJSON = function () {
			return api.apply({
				json: true
			}, [].slice.call(arguments));
		};
		api.defaults = {};

		api.remove = function (key, attributes) {
			api(key, '', extend(attributes, {
				expires: -1
			}));
		};

		api.withConverter = init;

		return api;
	}

	return init();
}));
;

$.validator.setDefaults({
    highlight: function (element) {
        $(element).closest('.form-group').addClass('has-error');
    },
    unhighlight: function (element) {
        $(element).closest('.form-group').removeClass('has-error');
    },
    errorElement: 'span',
    errorClass: 'text-danger',
    errorPlacement: function (error, element) {
        if (element.parent('.checkbox-inline, .radio-inline, .fileinput-button').length) {
            error.insertAfter(element.parent().parent());
        } else
            if (element.parent().parent('.checkbox, .radio').length) {
                error.insertAfter(element.parent().parent().parent());
            } else
                if (element.parent('.btn, .input-group').length) {
                    error.insertAfter(element.parent());
                } else {
                    error.insertAfter(element);
                }
    }
});


$.validator.addMethod('maxuploadsizevalidator', function (value, element, params) {
    var maxsize = params[0];
    var totalSize = 0;
    if (element.files) {
        for (i = 0; i < element.files.length; i++) {
            totalSize += element.files[i].size;
        }
    }
    return totalSize <= maxsize;
});

$.validator.addMethod('maxfilecountvalidator', function (value, element, maxfilecount) {
    var totalcount = 0;
    $(element).parents(".fileupload").find('input[type=file]').each(function () {
        if (this.files) {
            totalcount += this.files.length;
        }
        else if (this.value) {
            totalcount += 1;
        }
    });
    return totalcount <= maxfilecount;
});


$(function () {
    $('form.formbuilder').each(function () {
        $(this).validate();
    });


    $("form.formbuilder").on("submit", function (event) {

        if (!$("form.formbuilder").valid()) {
            event.preventDefault();
        }
        var totalUploadSize = 0;
        $(this).find('input[type=file]').each(function () {
            if (this.files) {
                for (i = 0; i < this.files.length; i++) {
                    totalUploadSize += this.files[i].size;
                }
            }
        });
        var maxUploadSize = $(this).attr('maxuploadsize');
        if (totalUploadSize > maxUploadSize) {
            alert($(this).attr('maxuploadsizemessage'));
            event.preventDefault();
        }
        return;
    });

    $('form.formbuilder input[maxuploadsize]').each(function () {
        var maxsize = $(this).attr('maxuploadsize');
        var maxsizemessage = $(this).attr('maxuploadsizemessage');

        $(this).rules('add', {
            maxuploadsizevalidator: [maxsize, maxsizemessage]
        });
    });

    $('form.formbuilder .fileupload[maxfilecount]').each(function () {
        var maxfilecount = $(this).attr('maxfilecount');
        var el = $(this).find("input[type=file]:first");
        el.rules('add', {
            maxfilecountvalidator: maxfilecount
        });
    });



    $('form.formbuilder .fileupload-required').each(function () {
        $(this).rules('add', {
            required: function (element) {
                var totalcount = 0;
                $(element).parents(".fileupload").find('input[type=file]').each(function () {
                    if (this.files) {
                        totalcount += this.files.length;
                    } else if (this.value) { // for IE9
                        totalcount += 1;
                    }
                });
                return totalcount == 0;
            }
        });
    });
});

function fileUpload_PreviewFileTemplate(o) {
    var rows = $();
    $.each(o.files, function (index, file) {
        var row = $('<tr class="template-upload fade">' +
            '<td><span class="preview"></span></td>' +
            '<td><p class="name"></p>' +
            '<p class="text-danger error"></p>' +
            '</td>' +
            '<td><p class="size"></p>' +
            '</td>' +
            '</tr>');
        row.find('.name').text(file.name);
        row.find('.size').text(o.formatFileSize(file.size));
        rows = rows.add(row);
    });
    return rows;
}

function fileUpload_DeletePreviewFileRows(clientid, leaveRowsCount) {
    leaveRowsCount = typeof leaveRowsCount !== 'undefined' ? leaveRowsCount : 1;
    var table = document.getElementById(clientid);
    while (table.rows.length > leaveRowsCount) {
        table.deleteRow(0);
    };
}

function fileUpload_resetFormElement(e) {
    e.wrap('<form>').closest('form').get(0).reset();
    e.unwrap();
}

function fileUpload_resetFormSimpleFileElement(e) {
    if (e[0].files && e[0].files.length == 1) {
        fileUpload_resetFormElement(e);
    }
}

function fileUpload_cancelSelection(clientID) {
    $('#files_' + clientID).html('');
    $('#cancel_' + clientID).hide();
    $('#inputFileds_' + clientID).html('');
};
/**
* showLoaderWhen replaces the content of a container with a loading spinner
* when the bound value is truthy.
* Styling requires the .loader class to be defined for the page as well as the loaderClass property 
* (or a default of .loader-dark)
*/
ko.bindingHandlers.showLoaderWhen = {
	init: function (element, valueAccessor, allBindingsAccessor) {
		var loaderClass = ko.utils.unwrapObservable(allBindingsAccessor()).loaderClass || "loader-white",
			hideChildren = ko.utils.unwrapObservable(allBindingsAccessor()).hideChildren || false,
			$element = $(element),
			currentPosition = $element.css("position"),
			$loader = $("<div>", { "class": loaderClass }).addClass("loader").hide();

		//add the loader
		$element.append($loader);
		$element.data('hide-children-on-loading', hideChildren);
		//make sure that we can absolutely position the loader against the original element
		if (currentPosition === "auto" || currentPosition === "static") {
			$element.css("position", "relative");
		}

		$element.css('min-height', '100px');
	},
	update: function (element, valueAccessor) {
		var isLoading = ko.utils.unwrapObservable(valueAccessor()),
			$element = $(element),
			hideChildren = $element.data('hie-children-on-loading'),
			$childrenToHide = $element.children(":not(div.loader)"),
			$loader = $element.find("div.loader");

		if (isLoading) {
			if (hideChildren) {
				$childrenToHide.css("visibility", "hidden").attr("disabled", "disabled");
			}
			$loader.show();
		}
		else {
			$loader.fadeOut("fast");
			if (hideChildren) {
				$childrenToHide.css("visibility", "visible").removeAttr("disabled");
			}
		}
	}
};;
ko.bindingHandlers.slider = {
	init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
		var $win = $(window);
		var $slider = $(element);
		var $input = $slider.siblings('input');
		
		var $baseContainer;
		var $activeArea;
		var slider;

		var oldSliderValue = -1;

		var args = ko.unwrap(valueAccessor());

		var usePips = args.usePips === undefined || args.usePips === null ? true : args.usePips;
		var fillSlider = args.fillSlider === undefined || args.fillSlider == null ? false : args.fillSlider;
		var uiSliderValue = args.sliderValue;
		var sliderDay     = {
			divisions           : createDayDivisionsArray(args.divisionsCount),
			start               : args.startIndex,
			step                : args.step,
			last                : args.divisionsCount,
			lastSelectableValue : args.divisionsCount - 1,
			handleOffset        : (100 / args.divisionsCount / 2).toString() + '%'
		};

		var onUserInteration = args.onUserInteraction;

		var sliderOptions = {
			start: sliderDay.start,
			range: {
				min: [0, sliderDay.step],
				max: sliderDay.last
			}
		};

		if (usePips) {
			sliderOptions.pips = {
				mode: 'values',
				values: sliderDay.divisions,
				format: {
					to: function(value) {
						var hour = parseInt((24 / sliderDay.last) * value * 10) / 10;
						return parseInt(hour).toString().length <= 1 ? ('0' + (hour).toString()) : hour;
					}
				}
			}
		}

		noUiSlider.create(element, sliderOptions);

		slider = element.noUiSlider;

		$baseContainer = $slider.find('.noUi-base');
		$baseContainer.css('margin-left', sliderDay.handleOffset);
		$slider.append('<div class="noUi-activearea"><div /></div>');
		$activeArea = $slider.find('.noUi-activearea');

		// -------------------

		slider.on('slide', function(value) {
			var sliderValue = Number(value);

			if(sliderValue > sliderDay.lastSelectableValue)
				slider.set(sliderDay.lastSelectableValue);

			onUserInteration();
		});

		slider.on('update', function(value) {
			var sliderValue = Number(value);

			if(sliderValue <= sliderDay.lastSelectableValue && sliderValue !== oldSliderValue) {
				$input.val(sliderValue);
				updateActiveArea(sliderValue);
				uiSliderValue(sliderValue);

				oldSliderValue = sliderValue;
			}
		});

		// -------------------

		function createDayDivisionsArray(dayPartsCount) {
			var dayPartsArray = [];

			for(var index = 0; index <= dayPartsCount; index++) {
				dayPartsArray.push(index);
			}

			return dayPartsArray;
		};

		function updateActiveArea(sliderValue) {
			var active = Number($input.val());
			var width = 100 / (sliderDay.last);
			var left = active * width;
			var right = 100 - width - left;

			$activeArea
				.removeClass('left right')
				.addClass(sliderValue > oldSliderValue ? 'right' : 'left')
				.css({
					left: left + '%',
					right: right + '%'
			});

			if (fillSlider) {
				var barWidth = width * sliderValue + width;
				$activeArea.css({
					left: 0,
					width: barWidth + '%'
				});
			}
		};
	},
	update: function(element, valueAccessor) {
		var slider = element.noUiSlider;
		var args   = ko.unwrap(valueAccessor());

		var uiSliderValue = args.sliderValue;

		slider.set(uiSliderValue());
	}
};;
ko.bindingHandlers.typeahead      = {
	init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
		var $typeahead       = $(element);
		var args             = ko.unwrap(valueAccessor());
		var url              = args.url;
		var onSelectCallback = args.onSelect;
		var format           = args.suggestionFormat || function(object) {
			return object.plz + ' ' + object.name;
		};

		$typeahead.typeahead({
			hint: true,
			highlight: true,
			minLength: 1
		},{
			name: 'places',
			display: format,
			source: new Bloodhound({
				datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
  				queryTokenizer: Bloodhound.tokenizers.whitespace,
				remote: {
					url: url,
					wildcard: '{suchbegriff}',
					transform: function(response) {
						return response.orte;
					}
				}
			})
		});

		$typeahead.on('typeahead:select', function(e, place) {
			$typeahead.blur().val('');
			onSelectCallback(place);
		});
	}
};;
// Registering new jQuery Contains (case insensitive) Method
jQuery.expr[':'].Contains = function(a, i, m) {
  return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
};

// Custom KnockoutJS Binding
ko.bindingHandlers.staticSearch = {
	init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
		var args  = ko.unwrap(valueAccessor());

		var $module = $(element);
		var $input  = $module.find(args.inputSelector);

		$input.on('keydown', function(e) {
			if(e.which === 13) {
				$input.get(0).blur();
			}
		});
	},
	update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
		var args  = ko.unwrap(valueAccessor());
		var input = args.input();

		var $module = $(element);
		var $input  = $module.find(args.inputSelector);
		var $items  = $module.find(args.itemSelector);
		var $teams = $module.find(args.teamSelector);
		
		$input.removeClass('no-results');
		$items.show();
		$teams.show();

		if(input !== '') {
			var $teamExcludes = $teams.not(':Contains(' + input + ')');
			var $itemExcludes = $items.not(':Contains(' + input + ')');

			// show all if found nothing
			if ($teamExcludes.length < $teams.length) {
				$teamExcludes.hide();

				if ($itemExcludes.length < $items.length) {
					$itemExcludes.hide();
				} else {
					$input.addClass('no-results');
				}
			} else {
				$input.addClass('no-results');
			}
		}
	}
};;
(function ($) {
	//Shortcut for fancyBox object
	var F = $.fancybox;

	//Add helper object
	F.helpers.landiThumbnails = {
		defaults: {
			source: function(item) { // function to obtain the URL of the thumbnail image
				var href;

				if (item.type === 'image' && item.href) {
					href = item.href;
				}

				return href;
			}
		},

		wrap: null,
		list: null,

		init: function (opts, obj) {
			var that = this;
			var list = '';
			var thumbSource = opts.source;

			for (var n = 0; n < obj.group.length; n++) {
				list += '<div class="thumb" data-index="' + n + '"><span><span><span><span><img src="' + thumbSource(obj.group[n]) + '" /></span></span></span></span></div>';
			}

			this.wrap = $('<div class="fancybox-thumbs"></div>');
			this.list = $('<div class="clearfix slick-thumbs">' + list + '</div>');

			$(window).on('resize', function() {
				$.fancybox.reposition();
			});
		},

		beforeLoad: function (opts, obj) {
			//Remove self if gallery do not have at least two items
			if (obj.group.length < 2) {
				obj.helpers.landiThumbnails = false;

				return;
			}
		},

		afterShow: function (opts, obj) {
			//Check if exists and create or update list
			if (!this.list) {
				this.init(opts, obj);
			}

			// Stop if there is no element in the list
			if (!this.list) {
				return;
			}

			// Append Thumbnails
			this.wrap.appendTo(obj.outer);
			this.list.appendTo(this.wrap);

			var $holder = $(obj.outer).find('.fancybox-thumbs');
			var $slick = $holder.find('.slick-thumbs');
			var isInitialized = $slick.find('.slick-slide').length > 0;

			if(isInitialized === true) {
				$slick.slick('unslick');
			}

			$slick.slick({
				centerMode: true,
				infinite: false,
				variableWidth: true,
				slidesToShow: 1,
				initialSlide: obj.index
			});

			$slick.find('[data-index]')
				.removeClass('thumb-current')
				.eq(obj.index).addClass('thumb-current');

			$slick.on('click', '[data-index]', function() {
				var index = Number($(this).data('index'));
				
				if(index !== undefined && index >= 0 && index < obj.group.length) {
					$.fancybox.jumpto(index);
				}
			});

			$.fancybox.update();
			$.fancybox.reposition();
		},

		onUpdate: function (opts, obj) {
			var $holder = $(obj.outer).find('.fancybox-thumbs');
			var $slick = $holder.find('.slick-thumbs');
			var isInitialized = $slick.find('.slick-slide').length > 0;

			if(isInitialized === true) {
				$slick.slick('setPosition');
			}
		},

		beforeClose: function () {
			if (this.wrap) {
				this.wrap.remove();
			}

			this.wrap = null;
			this.list = null;
		}
	}

}(jQuery));;

var Landi = Landi || {};

Landi.ImageLoadDependentInitializer = function(container, initializeFunction) {
	var images = container.find('img');
	if (images.length > 0) {
		var imagesToLoad = images.length;

		var imageLoadCompleted = function() {
			imagesToLoad--;
			if (imagesToLoad === 0) {
				initializeFunction();
			}
		}

		images.each(function (index) {
			$(this).load(imageLoadCompleted);
			if (this.complete) {
				$(this).load();
			}
		});
	} else {
		initializeFunction();
	}
};

var Landi = Landi || {};

Landi.MobileNavigation = function () {
	var mobileNavigation = $('.top-navigation').clone();
	var leftNavigation = $('.left-navigation').clone();

	if (mobileNavigation.length > 0) {
		mobileNavigation.removeClass('top-navigation hidden-xs').addClass('mobile-navigation').addClass('visible-xs');
		mobileNavigation.find('.megadropdown').remove();

		if (leftNavigation.length > 0) {
			leftNavigation.removeClass('hidden-sm hidden-xs');
			mobileNavigation.find('.active').append(leftNavigation);
		}
	} else {
		mobileNavigation = leftNavigation;
		mobileNavigation.removeClass('hidden-sm hidden-xs').addClass('mobile-navigation').addClass('visible-xs');
	}

	var logo = $('.logo-container').clone();
	var languageNavigation = $('.language-navigation').clone();
	var metaNavigation = $('.meta-navigation').clone();
	var mobileNavContainer = $('<div class="mobile-navigation-container">');

	metaNavigation.find('li:not(:last-child)').remove();

	var metaContainer = $('<div class="meta-container">');

	if (metaNavigation.find('#wishlistLink').length > 0) {
		metaContainer.append(metaNavigation);
	}

	metaContainer.append(languageNavigation);

	var navHeadContainer = $('<div class="mobile-navigation-head">')
		.addClass('clearfix')
		.append(logo)
		.append(metaContainer);

	mobileNavContainer
		.addClass('visible-xs')
		.append(navHeadContainer)
		.append(mobileNavigation);

	$('body').append(mobileNavContainer);

	$('.mobile-navigation-container').navobile({
		'cta': '.navbar-toggle',
		'content': '#PageContentContainer',
		'direction': 'rtl'
	});
};

var Landi = Landi || {};

Landi.EqualHeight = function (forceRefresh) {

	var containers = $('.equal-height-container');

	var processContainer = function(container, ignoreAlreadyProcessed) {
		if (!ignoreAlreadyProcessed && container.data('equal-height-processed')) {
			return;
		}

		container.data('equal-height-processed', true);

		var elementSelector = container.data('equal-height-itemselector') || '> .equal-height:visible';
		var elements = container.find(elementSelector);
		var lineSize = container.data('equal-height-linesize') || elements.length;
		
		elements.height('auto');
		elements.css('min-height', '');

		var currentLineElements = $(elements.splice(0, lineSize));

		while (currentLineElements.length > 0) {
			var currentHeight = 0;
			var containerWidth = container.outerWidth();
			var elementsToProcess = [];

			for (var index = 0; index < currentLineElements.length; index++) {
				var element = $(currentLineElements[index]);
				var elementWidth = element.outerWidth();

				if (containerWidth > elementWidth) {
					elementsToProcess.push(element);
				}
			}

			$.each(elementsToProcess, function () {
				// Bugfix: FF berechnet hier die Hoehe aus irgend einem Grund falsch.
				var elementHeight = this.outerHeight() + 1;
				if (currentHeight < elementHeight) {
					currentHeight = elementHeight;
				}
			});

			$.each(elementsToProcess, function () {
				this.css('height', '');
				this.css('min-height', currentHeight);
			});

			currentLineElements = $(elements.splice(0, lineSize));
		}
	}

	containers.sort(function(a, b) {
		return $(b).parents().length - $(a).parents().length;
	}).each(function() {
		var container = $(this);
		Landi.ImageLoadDependentInitializer(container, function() {
			processContainer(container, forceRefresh);
		});

		setTimeout(function() {
			processContainer(container, true);
		}, 500);
	});

	$(window).on('resize', function() {
		containers.each(function () {
			processContainer($(this), true);
		});
	});
};

jQuery(document).ready(function () {

	var megaDropdowns = [];

	var closeAllMegadropdowns = function() {
		$.each(megaDropdowns, function() {
			var megaDropdown = $(this);
			megaDropdown.parent().removeClass('hover');
			megaDropdown.hide();
			$(this).hide();
		});
	}
	
	var addHoverEffect = function(navItem, megaDropdown) {
		var hoverInTimeout = null;
		var hoverOutTimeout = null;

		navItem.on('mouseenter focusin', function () {
			clearTimeout(hoverOutTimeout);
			navItem.addClass('hover');

			hoverInTimeout = setTimeout(function () {
				closeAllMegadropdowns(megaDropdown);
				navItem.addClass('hover');
				megaDropdown.show();
			}, 250);
		}).on('mouseleave focusout', function () {
			clearTimeout(hoverInTimeout);

			hoverOutTimeout = setTimeout(function () {
				navItem.removeClass('hover');
				megaDropdown.hide();
			}, 500);
		});
	}

	$('.top-navigation .navigation-item-link, .tab-navigation .navigation-item-link').each(function() {
		var linkContainer = $(this);
		var link = linkContainer.find('a');
		var navItem = linkContainer.parent();
		var megaDropdown = navItem.find('.megadropdown');

		if (megaDropdown.length > 0) {
			megaDropdowns.push(megaDropdown);

			addHoverEffect(navItem, megaDropdown);

			navItem.on('touchstart', function (event) {
				event.stopPropagation();
				if (megaDropdown.is(':hidden')) {
					event.preventDefault();
					closeAllMegadropdowns();
					navItem.addClass('hover');
					megaDropdown.show();
				}
			});

			$('body').on('touchstart', function(event) {
				closeAllMegadropdowns();
			});
		} else {
			addHoverEffect(navItem, megaDropdown);
		}
	});
});;

var Landi = Landi || {};

Landi.Collapsible = function () {
	var constants = {
		headingCssClass: 'collapsible-heading',
		contentCssClass: 'collapsible-content',
		isOpenCssClass: 'collapsible-open'
	}
	var collapsibles = $('.collapsible');

	collapsibles.each(function() {
		var container = $(this);
		var heading = container.find('.' + constants.headingCssClass);
		var content = container.find('.' + constants.contentCssClass);
		var isOpen = container.is('.' + constants.isOpenCssClass);

		heading.click(function() {
			if (!isOpen) {
				content.slideDown(function() {
					container.addClass(constants.isOpenCssClass);
				});
				isOpen = true;
			} else {
				content.slideUp(function () {
					container.removeClass(constants.isOpenCssClass);
				});
				isOpen = false;
			}
		});
	});
};

var Landi = Landi || {};

Landi.ProductSlideshow = function () {
	var imageLinks = $('.product-slideshow a');
	imageLinks.fancybox({
		prevEffect: 'none',
		nextEffect: 'none',
		autoCenter: true,
		autoResize: true,
		fitToView: true,
		scrolling: 'false',
		helpers: {
			landiThumbnails: {},
			title: {
				type: 'inside'
			}
		}
	});
}

jQuery(document).ready(function () { Landi.ProductSlideshow(); });;

var Landi = Landi || {};

Landi.RandomlyVisible = function() {
	var randomlyVisibleGroups = {};
	$('.randomly-visible').each(function () {
		var element = $(this);
		var groupName = element.data('randomly-visible-group');
		
		if (randomlyVisibleGroups[groupName] === undefined) {
			randomlyVisibleGroups[groupName] = [];
		}

		randomlyVisibleGroups[groupName].push(element);
	});

	$.each(randomlyVisibleGroups, function() {
		var items = this;
		var randomIndex = Math.floor((Math.random() * items.length) + 1);
		$(items[randomIndex - 1]).addClass('visible');
	});
};
var Landi = Landi || {};

Landi.Search = function () {
	var responseObject;
	var $searchElement = $('#MainSearch');
	var form = $searchElement.closest('form');
	var language = form.data('language');

	/************* SEARCH RESULT URL *************/

	var searchResultUrl = $('#SearchForm').attr('action');

	/************* SEARCH RESULT URL *************/

	var productResponseObject = new Array();
	var placesResponseObject = new Array();
	var contentResponseObject = new Array();

	var productLimit = 6;
	var productLimitMin = 3;
	var placesLimit = 3;
	var contentLimit = 3;

	var productsLoading = false;
	var standorteLoading = false;
	var contentLoading = false;

	var $form = $searchElement.closest('form');

	var substringProductMatcher = new Bloodhound({
		datumTokenizer: Bloodhound.tokenizers.whitespace,
		queryTokenizer: Bloodhound.tokenizers.whitespace,
		identify: function (obj) { return obj.Sku; },
		prefetch: false,
		remote: {
			url: window.location.origin + '/api/' + language + '/search/product/%query%',
			transform: function (response) {
				productResponseObject = response;
				productsLoading = false;

				if (productResponseObject.length <= 0 && placesResponseObject.length <= 0 && contentResponseObject.length <= 0) {
					$(".tt-dataset-products").text(window.SearchResources.SearchNoResults);
				}

				if (!productsLoading && !standorteLoading && !contentLoading) {
					hideLoaderForElement();
				}

				return productResponseObject;
			},
			prepare: function (query, settings) {
				productsLoading = true;
				showLoaderForElement();

				settings.url = settings.url.replace("%query%", query.trim());
				return settings;
			}
		}
	});

	var substringPlacesMatcher = new Bloodhound({
		datumTokenizer: Bloodhound.tokenizers.whitespace,
		queryTokenizer: Bloodhound.tokenizers.whitespace,
		identify: function (obj) { return obj.Id; },
		prefetch: false,
		remote: {
			url: window.location.origin + '/api/' + language + '/search/standort/%query%',
			transform: function (response) {
				placesResponseObject = response;
				standorteLoading = false;

				$('.tt-dataset-products').removeClass('no-places');

				if (placesResponseObject.length <= 0) {
					$('.tt-dataset-products').addClass('no-places');
				}

				if (!productsLoading && !standorteLoading && !contentLoading) {
					hideLoaderForElement();
				}

				if (productResponseObject.length <= 0 && placesResponseObject.length <= 0 && contentResponseObject.length <= 0) {
					$(".tt-dataset-products").text(window.SearchResources.SearchNoResults);
				}

				return placesResponseObject;
			},
			prepare: function (query, settings) {
				showLoaderForElement();
				standorteLoading = true;

				settings.url = settings.url.replace("%query%", query.trim());
				return settings;
			}
		}
	});

	var substringContentMatcher = new Bloodhound({
		datumTokenizer: Bloodhound.tokenizers.whitespace,
		queryTokenizer: Bloodhound.tokenizers.whitespace,
		identify: function (obj) { return obj.Id; },
		prefetch: false,
		remote: {
			url: window.location.origin + '/api/' + language + '/search/content/' + form.data('portraitnodeid') + '/%query%',
			transform: function (response) {
				contentResponseObject = response;
				contentLoading = false;

				if (!productsLoading && !standorteLoading && !contentLoading) {
					hideLoaderForElement();
				}

				if (productResponseObject.length <= 0 && placesResponseObject.length <= 0 && contentResponseObject.length <= 0) {
					$(".tt-dataset-products").text(window.SearchResources.SearchNoResults);
				}

				return contentResponseObject;
			},
			prepare: function (query, settings) {
				showLoaderForElement();
				contentLoading = true;

				settings.url = settings.url.replace("%query%", query.trim());
				return settings;
			}
		}
	});

	substringProductMatcher.initialize();
	substringContentMatcher.initialize();
	substringPlacesMatcher.initialize();

	$searchElement.typeahead({
		hint: true,
		highlight: true,
		minLength: 1,
		async: true
	},
		{
			name: 'products',
			limit: productLimit,
			source: substringProductMatcher,
			display: function (object) { return object.name; },
			templates: {
				suggestion: function (object) {
					return '<a href="' + object.Url + '" target="_blank">' + object.Title + '</a>';
				},
				header: function (object) {
					return '<div class="heading">' + window.SearchResources.Products + '</div>';
				},
				footer: function (object) {
					if (productResponseObject.length > 0) {
						var url = searchResultUrl.replace('%query%', object.query);

						return '<a href="' + url + '#search-products" class="btn btn-primary search-footer btn-with-white-arrow">' + window.SearchResources.SearchProductsDropdownFooterText + '</div>';
					} else {
						return '';
					}
				}
			}
		},
		{
			name: 'places',
			limit: placesLimit,
			source: substringPlacesMatcher,
			display: function (object) { return object.Title; },
			templates: {
				suggestion: function (object) {
					return '<a href="' + object.Url + '" target="_blank">' + object.Title + '</a>';
				},
				header: function (object) {
					return '<div class="heading">' + window.SearchResources.Places + '</div>';
				},
				footer: function (object) {
					if (placesResponseObject.length > 0) {
						var url = searchResultUrl.replace('%query%', object.query);

						return '<a href="' + url + '#search-places" class="btn btn-primary search-footer btn-with-white-arrow">' + window.SearchResources.SearchPlacesDropdownFooterText + '</div>';
					} else {
						return '';
					}
				}
			}
		},
		{
			name: 'content',
			limit: contentLimit,
			source: substringContentMatcher,
			display: function (object) { return object.name; },
			templates: {
				suggestion: function (object) {
					return '<a href="' + object.Url.replace(/^#+/, '') + '">' + object.Title + '</a>';
				},
				header: function (object) {
					return '<div class="heading">' + window.SearchResources.WebPages + '</div>';
				},
				footer: function (object) {
					if (contentResponseObject.length > 0) {
						var url = searchResultUrl.replace('%query%', object.query);

						return '<a href="' + url + '#search-content" class="btn btn-primary footer btn-with-white-arrow">' + window.SearchResources.SearchWebPagesDropdownFooterText + '</div>';
					} else {
						return '';
					}
				}
			}
		});

	$('#SearchButton').on('click', function (event) {
		event.preventDefault();
		$(this).closest('.meta-container').addClass('with-open-searchbox');
		$('#MainSearch').focus();
	});

	$('#SearchClose').on('click', function (event) {
		event.preventDefault();
		$(this).closest('.meta-container').removeClass('with-open-searchbox');
	});

	$('#SearchSubmit').on('click', function (event) {
		event.preventDefault();
		$searchElement.typeahead('close');
		form.submit();
		$searchElement.val('');
	});

	function hideLoaderForElement() {
		$(".tt-menu").removeClass("loading");
	}

	function showLoaderForElement() {
		$(".tt-menu").addClass("loading");
	}
};

$(document).ready(function () {
	var hash = window.location.hash;
	hash && $('ul.tab-navigation a[href="' + hash + '"]').tab('show');

	$('.tab-navigation a').click(function (e) {
		$(this).tab('show');

		var scrollmem = $('body').scrollTop();
		window.location.hash = this.hash;
		$('html,body').scrollTop(scrollmem);
	});

	$('div#search-all a[href="#search-products"], div#search-all a[href="#search-content"], div#search-all a[href="#search-places"]').click(function (e) {
		e.preventDefault();

		var buttonHash = $(this).attr('href');
		buttonHash && $('ul.tab-navigation a[href="' + buttonHash + '"]').tab('show');

		var scrollmem = $('body').scrollTop();
		window.location.hash = this.hash;
		$('html,body').scrollTop(scrollmem);
	});
});;

var Landi = Landi || {};

Landi.AnalyticsTracking = function () {

	var isDebug = false;

	var gaEventLabel = "data-ga-eventlabel";
	var gaEventCategory = "data-ga-eventcategory";
	var gaTrackBreadcrump = "data-ga-trackbreadcrumb";
	var gaTrackIndex = "data-ga-trackindex";
	var gaIndexAnchor = "data-ga-indexanchor";
	var gaLabelAnchor =  "data-ga-labelanchor";
	var gaEventAction = "data-ga-eventaction";
	var gaFormMarker = "data-ga-formmarker";
	var breadCrumbDelimiter = " > ";

	var gaElements = $('[' + gaEventLabel + ']');

	// Traversieren durch alle Elemente mit ga Attribut
	$.each(gaElements, function () {

		var gaElement = $(this);
		var isFormMarker = gaElement.is('[' + gaFormMarker + '="true"]');
		if (isFormMarker) {
			var parentForm = gaElement.parents('form');
			parentForm.on('submit', function () {
				processTracking(true, gaElement);
			});
		} else {
			gaElement.on('click', function () {
				processTracking(false, this);
			});
		}
	});

	function  processTracking(isSubmit, element, callback) {

		// Source-Element und Root-Element suchen.
		var sourceElement = $(element);
		var rootActionElement = sourceElement.closest('[' + gaEventCategory + ']');

		// Wenn das Root-Element gefunden wurde => weiterfahren.
		if (rootActionElement != undefined && rootActionElement.length) {

			// EventValue definieren und Label und Action aus den Attributen ziehen.
			var eventLabel = '';
			var eventAction = rootActionElement.attr(gaEventAction);
			var eventCategory = rootActionElement.attr(gaEventCategory);

			// Einstellungen betreffend Breadcrumb und Index auslesen.
			var trackBreadcrumb = rootActionElement.is('[' + gaTrackBreadcrump + '="true"]');
			var trackIndex = rootActionElement.is('[' + gaTrackIndex + '="true"]');

			// Breadcrumb-Handling, falls definiert.
			if (trackBreadcrumb) {
				var breadcrumbList = [];
				var breadcrumbElement = sourceElement;

				// Solange die Breadcrumb-Elemente suchen, bis keines mehr gefunden wurde oder man beim Root-Element angelangt ist.
				while (breadcrumbElement !== null && breadcrumbElement !== undefined && breadcrumbElement.length > 0 && !breadcrumbElement.is(rootActionElement)) {
					breadcrumbList.push(breadcrumbElement);
					breadcrumbElement = getNextBreadCrumbElement(breadcrumbElement);
				}

				// Die EventValues der gefundenen Breadcrumb Elemente zusammensetzen.
				$.each(breadcrumbList, function(index, item) {
					eventLabel = getEventValueFromElement(item, trackIndex) + (eventLabel.length > 0 ? breadCrumbDelimiter + eventLabel : '');
				});
			} else {
				// Den EventValue des source-Elements auslesen.
				eventLabel = getEventValueFromElement(sourceElement, trackIndex);
			}

			// Zusammengesuchte Event-Daten an Tracking-script senden.
			gat(eventCategory, eventAction, eventLabel);
		}

		if (typeof (callback) == "function") {
			callback();
		}
	}

	// Liefert den zu trackenden Event-Value für das übergebene Element. Enthält auch das Index-Handling, um den für dieses Element gültigen Index herauszuziehen.
	function getEventValueFromElement(element, trackIndex) {
		var eventValue = element.attr(gaEventLabel);

		if (trackIndex) {
			var foundIndex = -1;
			var indexAnchorElement = element.closest('[' + gaIndexAnchor + ']');
			$.each(indexAnchorElement.children(), function (index, item) {
				if ($(item).has(element).length) {
					foundIndex = index;
					return false;
				}

				return true;
			});

			eventValue = foundIndex + ' ' + eventValue;
		}

		return eventValue;
	}

	// Liefert das nächst höhere Breadcrumb-Element des übergebenen Elements.
	function getNextBreadCrumbElement(element) {
		// .closest('value-anchor') gibt den Value-Anchor des aktuellen Elements zurück, desshalb vom gefundenen Value-Anchors aus den nächsthöheren suchen.
		var closestValueAnchor = element.closest('[' + gaLabelAnchor + ']').parent().closest('[' + gaLabelAnchor + ']');

		// Wenn der closest ValueAnchor direkt ein Event-Value Attribut hat, dieses zurückgeben, ansonsten das erste direkte Child mit Event-Value Attribut zurückgeben.
		return closestValueAnchor.is('[' + gaEventLabel + ']') ? closestValueAnchor : closestValueAnchor.find('> [' + gaEventLabel + ']:eq(0)');
	}

	function gat(category, action, label, value) {
		if (isDebug) {
			console.log('Category: ' + category);
			console.log('Action: ' + action);
			console.log('Label: ' + label);
			console.log('Value: ' + value);
		}

		ga('send', 'event', category, action, label, value, value);
	}
};;
var Landi = Landi || {};

Landi.AgronetGiftCard = function () {
	var errorMessageDiv = $('#errormessage');
	var balanceMessageDiv = $('#balanceMessage');

	function formatExpirationDate(result) {
		return ("0" + result.ExpirationMonth).slice(-2) + "/" + result.ExpirationYear;
	}

	function format(str, col) {

		col = typeof col === 'object' ? col : Array.prototype.slice.call(arguments, 1);
		return str.replace(/\{\{|\}\}|\{(\w+)\}/g, function (m, n) {
			if (m == "{{") { return "{"; }
			if (m == "}}") { return "}"; }
			return col[n];
		});
	}

	function resetState() {
		balanceMessageDiv.hide();
		balanceMessageDiv.removeClass('hidden');
		errorMessageDiv.hide();
		errorMessageDiv.removeClass('hidden');
		errorMessageDiv.children('#error-message-text').empty();
	}

	$('#GiftCardCheckForm').on('submit', function (event) {
		event.preventDefault();
		var self = $(this);
		var data = self.data();
		var url = data.agronetGiftUrl;
		var lang = data.agronetGiftLanguage;
		var giftCardNr = $('#itbCardNumber').val();
		if (giftCardNr.trim().length > 0) {
			$.ajax({
				url: url + "/" + lang + "/" + giftCardNr,
				method: "GET",
				dataType: "json",
				success: function (result) {
					resetState();
					if (result.HasError) {
						errorMessageDiv.children('#error-message-text').append(result.ErrorText);
						errorMessageDiv.show();
					} else {
						var translationText = balanceMessageDiv.data().translation;
						$('#Balance').text(result.BalanceInCardCurrency);
						$('#CardCurrencyISO').text(result.CardCurrencyISO);
						$('#ExpiryDate').text(formatExpirationDate(result));
						balanceMessageDiv.text(format(translationText, { Balance: result.BalanceInCardCurrency, ExpiryDate: formatExpirationDate(result), CardCurrencyISO: result.CardCurrencyISO }));
						balanceMessageDiv.show();
					}

				},
				error: function (error) {
					resetState();
					errorMessageDiv.children('#error-message-text').append(error.status + " : " + error.statusText);
					errorMessageDiv.show();
				},
				beforeSend:function() {
					$('#GiftCardCheckForm .loader').show();
				},
				complete:function() {
					$('#GiftCardCheckForm .loader').hide();
				}
			});
		}

	});
};;

var Landi = Landi || {};

Landi.ChallengeDialog = function (cookieName) {

	if ($('#CompositeC1FunctionPreview').length == 0 && !Cookies.get(cookieName)) {
		$('#challengeDialog').modal('show').on('hidden.bs.modal', function() {
			Cookies.set(cookieName, 'true', { expires: 7 });
		});
	}

};;

var Landi = Landi || {};

Landi.CarouselInitializer = function () {
	// Vars
	// ------------------------------------------------------

	var $carousel = $('.slick-carousel');

	if ($carousel.length === 0) {
		return;
	}

	$carousel.each(function () {
		var $slider = $(this);
		var isInitialized = $slider.data('initialized') === true;

		var slidesToShowDesktop = 1;
		var slidesToShowTablet = 1;
		var slidesToShowMobile = 1;

		if ($slider.hasClass('slick-carousel-lg-6')) {
			slidesToShowDesktop = 6;
			slidesToShowTablet = 6;
		}

		if ($slider.hasClass('slick-carousel-lg-3')) {
			slidesToShowDesktop = 3;
			slidesToShowTablet = 3;
		}

		if ($slider.hasClass('slick-carousel-sm-4')) {
			slidesToShowTablet = 4;
		}

		if ($slider.hasClass('slick-carousel-lg-2')) {
			slidesToShowDesktop = 2;
		}

		if ($slider.hasClass('slick-carousel-xs-2')) {
			slidesToShowMobile = 2;
		}

		if (!isInitialized) {
			createCarousel($slider, slidesToShowDesktop, slidesToShowTablet, slidesToShowMobile);
			$slider.data('initialized', true);
		}
	});

	// ----------------------------------------------------------

	function createCarousel($slick, slidesToShowDesktop, slidesToShowTablet, slidesToShowMobile) {
		// Slider Initializing
		// ------------------------------------------------------

		$slick.slick({
			autoplay: true,
			arrows: true,
			dots: true,
			infinite: true,
			slidesToShow: slidesToShowDesktop,
			slidesToScroll: slidesToShowDesktop,
			speed: 300,
			responsive: [
				{
					breakpoint: 1025,
					settings: {
						slidesToShow: slidesToShowTablet,
						slidesToScroll: slidesToShowTablet
					}
				},
				{
					breakpoint: 768,
					settings: {
						slidesToShow: slidesToShowMobile,
						slidesToScroll: slidesToShowMobile
					}
				}
			]
		});

		// Update Width after Image load
		Landi.ImageLoadDependentInitializer($slick, function () {
			$slick.slick('slickSetOption', null, null, true);
		});
	};
}

jQuery(document).ready(function ($) {
	Landi.CarouselInitializer();
});;
var Landi = Landi || {};

Landi.MinPageHeight = function () {
	var $win         = $(window);
	var $pageContent = $('#PageContentContainer');
	var $header      = $pageContent.find('> .header');
	var $content     = $pageContent.find('> .content-container');
	var $footer      = $pageContent.find('> .footer-container');


	$win.on('load resize', function() {
		var winHeight     = window.innerHeight;
		var headerHeight  = $header.outerHeight();
		var contentHeight = $content.outerHeight();
		var footerHeight  = $footer.outerHeight();

		$content.css({
			'min-height': winHeight - (headerHeight + footerHeight)
		});
	});
};;

jQuery(document).ready(function () {
	Landi.EqualHeight();
	Landi.MobileNavigation();
	Landi.Collapsible();
	Landi.RandomlyVisible();
	Landi.Search();
	Landi.AnalyticsTracking();
});;

jQuery(document).ready(function () {
	Landi.MinPageHeight();
});;
var Landi = Landi || {};
Landi.EmployeeGallery = Landi.EmployeeGallery || {};

Landi.EmployeeGallery.Initialize = function (inputOptions) {
	var vm = new Landi.EmployeeGallery.View(inputOptions);
	ko.applyBindings(vm, document.getElementById(inputOptions.mainElementId));
};

Landi.EmployeeGallery.View = function(inputOptions) {
	var self = this;

	var defaultOptions = {
		mainElementId: '',
		organisation: null,
		people: null
	};

	var options = $.extend({}, defaultOptions, inputOptions);

	expandEmployees();

	self.searchInput  = ko.observable('');
	self.teams    = ko.observableArray(options.teams);

	self.togglePortraitInfos = togglePortraitInfos;
	self.showPortraitInfos   = showPortraitInfos;
	self.hidePortraitInfos   = hidePortraitInfos;

	function getMax(arr, prop) {
		var max = 0;
		for (var i = 0 ; i < arr.length ; i++) {
			if (!max || parseInt(arr[i][prop]) > parseInt(max[prop]))
				max = arr[i][prop];
		}
		return max;
	}

	function expandEmployees() {
		if (options.teams) {
			options.teams.sort(function (a, b) {
				var maxA = getMax(a.employees, 'sortOrder');
				var maxB = getMax(b.employees, 'sortOrder');

				return parseInt(maxA) - parseInt(maxB);
			});

			$.each(options.teams, function (i, team) {
				team.employees = team.employees.sort(function (a, b) {
					return parseInt(a.sortOrder) - parseInt(b.sortOrder);
				});
			});
		}

		if (options.teams) {
			ko.utils.arrayForEach(options.teams, function (team) {
				if (team.employees) {
					ko.utils.arrayForEach(team.employees, function (epl) {
						epl.hasJobTitle = epl.jobTitle && epl.jobTitle !== '';
						epl.hasEmails = epl.emails && epl.emails.length > 0;
						epl.hasTelephones = epl.telephones && epl.telephones.length > 0;
						epl.showInfos = ko.observable(false);
						epl.fullName = epl.givenName + ' ' + epl.familyName;

						if (epl.emails) {
							ko.utils.arrayForEach(epl.emails, function (mail) {
								mail.href = 'mailto:' + mail.value;
							});
						}

						if (epl.telephones) {
							ko.utils.arrayForEach(epl.telephones, function (tel) {
								tel.itemprop = tel.type.toLowerCase() === 'fax' ? 'faxNumber' : 'telephone';
								tel.href = 'tel:' + tel.value;
								tel.icon = '';

								switch (tel.type.toLowerCase()) {
									case 'fax':
										tel.icon = 'glyphicon-print';
										break;
									case 'cell':
										tel.icon = 'glyphicon-phone';
										break;
									default:
										tel.icon = 'glyphicon-earphone';
								}
							});
						}
					});
				}
			});
		}
	};

	function togglePortraitInfos(employee) {
		employee.showInfos() === true ? hidePortraitInfos(employee) : showPortraitInfos(employee);
	};

	function showPortraitInfos(employee) {
		ko.utils.arrayForEach(self.teams(), function (team) {
			ko.utils.arrayForEach(team.employees, function(epl) {
				epl.showInfos(false);
			});
		});

		employee.showInfos(true);
	};

	function hidePortraitInfos(employee) {
		employee.showInfos(false);
	};
};;
var Landi = Landi || {};

Landi.EqualHeight = function () {
	// Set all Image Containers in the Gallery to equal (max) height.
	function equalizeImgContainerHeights() {
		var $window = $(window);
		var $imageGallery = $(this);
		var $imageContainer = $imageGallery.find('.equal-height-img-container');
		var $imageOverflows = $imageContainer.find('a span.image-overflow');

		var imagesLength = $imageContainer.length;
		var imagesLoaded = 0;
		var commonHeight = null;
		var imageContainerWidth = null;

		// get Image Dimensions
		// --------------------------------------------

		$imageContainer.each(function () {
			var $container = $(this);
			var img = new Image();
			img.onload = getDimensions;
			img.src = $container.find('img').attr('src');

			function getDimensions() {
				$container.data('dimensions', {
					w: img.width,
					h: img.height
				});

				imagesLoaded++;

				if (imagesLoaded === imagesLength) {
					$window.trigger('imageGalleryInit');
				}
			}
		});

		// Event Bindings
		// --------------------------------------------

		$window.on('imageGalleryInit resize', function (e) {
			if (window.innerWidth >= 767) {
				calculateImagesHeight();
			} else {
				$imageOverflows.height('auto');
			}
		});

		// Methods
		// --------------------------------------------

		function calculateImagesHeight() {
			commonHeight = 1000;
			imageContainerWidth = $imageOverflows.first().width();

			$imageContainer.each(function () {
				var imageDimensions = $(this).data('dimensions');
				var imageScaleFactor = imageContainerWidth / imageDimensions.w;
				var imageHeight = imageDimensions.h * imageScaleFactor;

				commonHeight = Math.floor(Math.min(commonHeight, imageHeight));
			});

			$imageOverflows.height(commonHeight);
		}
	}

	$(document).ready(function () {
		var $imageGallery = $('.image-gallery');

		$imageGallery.each(equalizeImgContainerHeights);
	});
};
;
var Landi = Landi || {};

Landi.ProductTeaserBy = {};
(function($, that) {

	function getAllProductTeaserBysOnPage() {
		return $("[landi-productteaserby--container]");
	}

	function initProductTeaserBy() {
		// Elements
		var $theProductTeaserBy = $(this);
		var $allElements = null;
		var $button = $theProductTeaserBy.find("[landi-productteaserby--loadmoretrigger]");

		// State
		var allProductIdsString = $theProductTeaserBy.find("[landi-productteaserby--product-ids]").attr("landi-productteaserby--product-ids");
		var allProductIds = allProductIdsString ? allProductIdsString.split(",") : [];
		var allElementsCount = allProductIds.length;
		var currentlyVisibleElementsCount = 0;
		var countOfElementsPerRow = 1;

		function calculateNumberOfElementsPerRow() {
			var containerWidth = $theProductTeaserBy.outerWidth();
			var minWidthProductItem = 240;
			for (var i = 4; i > 1; i--) {
				if (containerWidth >= i * minWidthProductItem) {
					countOfElementsPerRow = i;
					return;
				}
			}
			countOfElementsPerRow = 1;
		}

		/**
			Anzahl Produkte pro Zeile muss abhängig sein von Breite, welche dem Teaser tatsächlich zur Verfügung steht.
			Nicht von einer Media Query. (z.B. Layout mit oder ohne Spalte unterschiedlich).
			Ein Produkt sollte in einer Breite von min. 240px dargestellt werden. Dies entspricht aktuell der Darstellung auf einer Kategorie-Seite auf Desktop.
			Bei einer Breite des Containers von mind. 960px, werden 4 Produkte in einer Zeile dargestellt. (240*4 = 960)
			... 720px ... 3 Produkte ...
			... 480px ... 2 Produkte ...
			Darunter wird nur noch ein Produkt pro Zeile angezeigt.
			Class set via jQuery.
		*/
		function setProductItemWidth() {
			// Update state.
			calculateNumberOfElementsPerRow();
			findAllProductItems();

			var newProductItemWidth = 100 / countOfElementsPerRow + "%";
			$allElements.css("width", newProductItemWidth);
			$button.css("width", newProductItemWidth);
		}

		function findAllProductItems() {
			$allElements = $theProductTeaserBy.find("[landi-productteaserby--element]");
		}

		function insertProductItems(html) {
			$theProductTeaserBy.find("[landi-productteaserby--product-ids]").append(html);
		}

		function showNextSetOfElements() {
			// Update state.
			calculateNumberOfElementsPerRow();

			var countOfInvisibleElements = allElementsCount - currentlyVisibleElementsCount;
			var overflowDueToWindowResizing = currentlyVisibleElementsCount % countOfElementsPerRow;
			var countOfElementsToShowNext = Math.min(countOfInvisibleElements, countOfElementsPerRow) - overflowDueToWindowResizing;
			var productIdsToShow = allProductIds.slice(currentlyVisibleElementsCount, currentlyVisibleElementsCount + countOfElementsToShowNext);

			$.ajax({
				url: getApiBaseUrl() + "/catalog/portraitproductteaserby/" + productIdsToShow.join("-"),
				method: "GET",
				success: function(result) {
					insertProductItems(result);
					setProductItemWidth();
					currentlyVisibleElementsCount += countOfElementsToShowNext;
					// Hide button, if no more products.
					if (currentlyVisibleElementsCount === allElementsCount) {
						$button.css("display", "none");
					}
				},
				error: function(error) {
				}
			});
		}

		function bindLoadMoreButtonClick() {
			$button.on("click", showNextSetOfElements);
		}

		function bindWindowResize() {
			if (Landi.throttle) {
				$(window).resize(Landi.throttle(setProductItemWidth, 200));
			}
		}

		bindLoadMoreButtonClick();
		bindWindowResize();
		setProductItemWidth();
		showNextSetOfElements();
	}

	function initAllProductTeaserBys() {
		var $allPTBs = getAllProductTeaserBysOnPage();
		$allPTBs.each(initProductTeaserBy);
	}

	function getLng() {
		return $('meta[name=lng]').attr("content") || "de";
	};

	function getApiBaseUrl() {
		return "/api/" + getLng();
	}

	function init() {
		jQuery(document).ready(function () {
			initAllProductTeaserBys();
		});
	}

	init();

})(jQuery, Landi.ProductTeaserBy);;
