/* Minification failed. Returning unminified contents.
(535,138-139): run-time error JS1195: Expected expression: >
(535,271-272): run-time error JS1010: Expected identifier: [
(535,282-283): run-time error JS1007: Expected ']': ;
(535,402-403): run-time error JS1195: Expected expression: )
(535,404-405): run-time error JS1195: Expected expression: >
(535,618-619): run-time error JS1195: Expected expression: >
(535,675-676): run-time error JS1197: Too many errors. The file might not be a JavaScript file: ?
(535,475-490): run-time error JS1301: End of file encountered before function is properly closed: function p(e,t)
(535,687-688): run-time error JS1004: Expected ';': :
(535,688-689): run-time error JS1197: Too many errors. The file might not be a JavaScript file: e
(535,2-12): run-time error JS1301: End of file encountered before function is properly closed: function()
(535,698-699): run-time error JS1004: Expected ';': )
(535,699-700): run-time error JS1197: Too many errors. The file might not be a JavaScript file: ,
 */

// If CDN fails
if (typeof jQuery == 'undefined') {
    var e = document.createElement('script');
    e.src = '@Url.Content("~/Static/Scripts/jquery-2.1.4.min.js")';
    e.type = 'text/javascript';
    document.getElementsByTagName("head")[0].appendChild(e);
}
;
!function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this.drag=a.extend({},m),this.state=a.extend({},n),this.e=a.extend({},o),this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._invalidated={},this._pipe=[],a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a[0].toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Pipe,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}function f(a){if(a.touches!==d)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(a.touches===d){if(a.pageX!==d)return{x:a.pageX,y:a.pageY};if(a.pageX===d)return{x:a.clientX,y:a.clientY}}}function g(a){var b,d,e=c.createElement("div"),f=a;for(b in f)if(d=f[b],"undefined"!=typeof e.style[d])return e=null,[d,b];return[!1]}function h(){return g(["transition","WebkitTransition","MozTransition","OTransition"])[1]}function i(){return g(["transform","WebkitTransform","MozTransform","OTransform","msTransform"])[0]}function j(){return g(["perspective","webkitPerspective","MozPerspective","OPerspective","MsPerspective"])[0]}function k(){return"ontouchstart"in b||!!navigator.msMaxTouchPoints}function l(){return b.navigator.msPointerEnabled}var m,n,o;m={start:0,startX:0,startY:0,current:0,currentX:0,currentY:0,offsetX:0,offsetY:0,distance:null,startTime:0,endTime:0,updatedX:0,targetEl:null},n={isTouch:!1,isScrolling:!1,isSwiping:!1,direction:!1,inMotion:!1},o={_onDragStart:null,_onDragMove:null,_onDragEnd:null,_transitionEnd:null,_resizer:null,_responsiveCall:null,_goToLoop:null,_checkVisibile:null},e.Defaults={items:3,loop:!1,center:!1,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,responsiveClass:!1,fallbackEasing:"swing",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",themeClass:"owl-theme",baseClass:"owl-carousel",itemClass:"owl-item",centerClass:"center",activeClass:"active"},e.Width={Default:"default",Inner:"inner",Outer:"outer"},e.Plugins={},e.Pipe=[{filter:["width","items","settings"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){var a=this._clones,b=this.$stage.children(".cloned");(b.length!==a.length||!this.settings.loop&&a.length>0)&&(this.$stage.children(".cloned").remove(),this._clones=[])}},{filter:["items","settings"],run:function(){var a,b,c=this._clones,d=this._items,e=this.settings.loop?c.length-Math.max(2*this.settings.items,4):0;for(a=0,b=Math.abs(e/2);b>a;a++)e>0?(this.$stage.children().eq(d.length+c.length-1).remove(),c.pop(),this.$stage.children().eq(0).remove(),c.pop()):(c.push(c.length/2),this.$stage.append(d[c[c.length-1]].clone().addClass("cloned")),c.push(d.length-1-(c.length-1)/2),this.$stage.prepend(d[c[c.length-1]].clone().addClass("cloned")))}},{filter:["width","items","settings"],run:function(){var a,b,c,d=this.settings.rtl?1:-1,e=(this.width()/this.settings.items).toFixed(3),f=0;for(this._coordinates=[],b=0,c=this._clones.length+this._items.length;c>b;b++)a=this._mergers[this.relative(b)],a=this.settings.mergeFit&&Math.min(a,this.settings.items)||a,f+=(this.settings.autoWidth?this._items[this.relative(b)].width()+this.settings.margin:e*a)*d,this._coordinates.push(f)}},{filter:["width","items","settings"],run:function(){var b,c,d=(this.width()/this.settings.items).toFixed(3),e={width:Math.abs(this._coordinates[this._coordinates.length-1])+2*this.settings.stagePadding,"padding-left":this.settings.stagePadding||"","padding-right":this.settings.stagePadding||""};if(this.$stage.css(e),e={width:this.settings.autoWidth?"auto":d-this.settings.margin},e[this.settings.rtl?"margin-left":"margin-right"]=this.settings.margin,!this.settings.autoWidth&&a.grep(this._mergers,function(a){return a>1}).length>0)for(b=0,c=this._coordinates.length;c>b;b++)e.width=Math.abs(this._coordinates[b])-Math.abs(this._coordinates[b-1]||0)-this.settings.margin,this.$stage.children().eq(b).css(e);else this.$stage.children().css(e)}},{filter:["width","items","settings"],run:function(a){a.current&&this.reset(this.$stage.children().index(a.current))}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var a,b,c,d,e=this.settings.rtl?1:-1,f=2*this.settings.stagePadding,g=this.coordinates(this.current())+f,h=g+this.width()*e,i=[];for(c=0,d=this._coordinates.length;d>c;c++)a=this._coordinates[c-1]||0,b=Math.abs(this._coordinates[c])+f*e,(this.op(a,"<=",g)&&this.op(a,">",h)||this.op(b,"<",g)&&this.op(b,">",h))&&i.push(c);this.$stage.children("."+this.settings.activeClass).removeClass(this.settings.activeClass),this.$stage.children(":eq("+i.join("), :eq(")+")").addClass(this.settings.activeClass),this.settings.center&&(this.$stage.children("."+this.settings.centerClass).removeClass(this.settings.centerClass),this.$stage.children().eq(this.current()).addClass(this.settings.centerClass))}}],e.prototype.initialize=function(){if(this.trigger("initialize"),this.$element.addClass(this.settings.baseClass).addClass(this.settings.themeClass).toggleClass("owl-rtl",this.settings.rtl),this.browserSupport(),this.settings.autoWidth&&this.state.imagesLoaded!==!0){var b,c,e;if(b=this.$element.find("img"),c=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:d,e=this.$element.children(c).width(),b.length&&0>=e)return this.preloadAutoWidthImages(b),!1}this.$element.addClass("owl-loading"),this.$stage=a("<"+this.settings.stageElement+' class="owl-stage"/>').wrap('<div class="owl-stage-outer">'),this.$element.append(this.$stage.parent()),this.replace(this.$element.children().not(this.$stage.parent())),this._width=this.$element.width(),this.refresh(),this.$element.removeClass("owl-loading").addClass("owl-loaded"),this.eventsCall(),this.internalEvents(),this.addTriggerableEvents(),this.trigger("initialized")},e.prototype.setup=function(){var b=this.viewport(),c=this.options.responsive,d=-1,e=null;c?(a.each(c,function(a){b>=a&&a>d&&(d=Number(a))}),e=a.extend({},this.options,c[d]),delete e.responsive,e.responsiveClass&&this.$element.attr("class",function(a,b){return b.replace(/\b owl-responsive-\S+/g,"")}).addClass("owl-responsive-"+d)):e=a.extend({},this.options),(null===this.settings||this._breakpoint!==d)&&(this.trigger("change",{property:{name:"settings",value:e}}),this._breakpoint=d,this.settings=e,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}}))},e.prototype.optionsLogic=function(){this.$element.toggleClass("owl-center",this.settings.center),this.settings.loop&&this._items.length<this.settings.items&&(this.settings.loop=!1),this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},e.prototype.prepare=function(b){var c=this.trigger("prepare",{content:b});return c.data||(c.data=a("<"+this.settings.itemElement+"/>").addClass(this.settings.itemClass).append(b)),this.trigger("prepared",{content:c.data}),c.data},e.prototype.update=function(){for(var b=0,c=this._pipe.length,d=a.proxy(function(a){return this[a]},this._invalidated),e={};c>b;)(this._invalidated.all||a.grep(this._pipe[b].filter,d).length>0)&&this._pipe[b].run(e),b++;this._invalidated={}},e.prototype.width=function(a){switch(a=a||e.Width.Default){case e.Width.Inner:case e.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},e.prototype.refresh=function(){if(0===this._items.length)return!1;(new Date).getTime();this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$stage.addClass("owl-refresh"),this.update(),this.$stage.removeClass("owl-refresh"),this.state.orientation=b.orientation,this.watchVisibility(),this.trigger("refreshed")},e.prototype.eventsCall=function(){this.e._onDragStart=a.proxy(function(a){this.onDragStart(a)},this),this.e._onDragMove=a.proxy(function(a){this.onDragMove(a)},this),this.e._onDragEnd=a.proxy(function(a){this.onDragEnd(a)},this),this.e._onResize=a.proxy(function(a){this.onResize(a)},this),this.e._transitionEnd=a.proxy(function(a){this.transitionEnd(a)},this),this.e._preventClick=a.proxy(function(a){this.preventClick(a)},this)},e.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this.e._onResize,this.settings.responsiveRefreshRate)},e.prototype.onResize=function(){return this._items.length?this._width===this.$element.width()?!1:this.trigger("resize").isDefaultPrevented()?!1:(this._width=this.$element.width(),this.invalidate("width"),this.refresh(),void this.trigger("resized")):!1},e.prototype.eventsRouter=function(a){var b=a.type;"mousedown"===b||"touchstart"===b?this.onDragStart(a):"mousemove"===b||"touchmove"===b?this.onDragMove(a):"mouseup"===b||"touchend"===b?this.onDragEnd(a):"touchcancel"===b&&this.onDragEnd(a)},e.prototype.internalEvents=function(){var c=(k(),l());this.settings.mouseDrag?(this.$stage.on("mousedown",a.proxy(function(a){this.eventsRouter(a)},this)),this.$stage.on("dragstart",function(){return!1}),this.$stage.get(0).onselectstart=function(){return!1}):this.$element.addClass("owl-text-select-on"),this.settings.touchDrag&&!c&&this.$stage.on("touchstart touchcancel",a.proxy(function(a){this.eventsRouter(a)},this)),this.transitionEndVendor&&this.on(this.$stage.get(0),this.transitionEndVendor,this.e._transitionEnd,!1),this.settings.responsive!==!1&&this.on(b,"resize",a.proxy(this.onThrottledResize,this))},e.prototype.onDragStart=function(d){var e,g,h,i;if(e=d.originalEvent||d||b.event,3===e.which||this.state.isTouch)return!1;if("mousedown"===e.type&&this.$stage.addClass("owl-grab"),this.trigger("drag"),this.drag.startTime=(new Date).getTime(),this.speed(0),this.state.isTouch=!0,this.state.isScrolling=!1,this.state.isSwiping=!1,this.drag.distance=0,g=f(e).x,h=f(e).y,this.drag.offsetX=this.$stage.position().left,this.drag.offsetY=this.$stage.position().top,this.settings.rtl&&(this.drag.offsetX=this.$stage.position().left+this.$stage.width()-this.width()+this.settings.margin),this.state.inMotion&&this.support3d)i=this.getTransformProperty(),this.drag.offsetX=i,this.animate(i),this.state.inMotion=!0;else if(this.state.inMotion&&!this.support3d)return this.state.inMotion=!1,!1;this.drag.startX=g-this.drag.offsetX,this.drag.startY=h-this.drag.offsetY,this.drag.start=g-this.drag.startX,this.drag.targetEl=e.target||e.srcElement,this.drag.updatedX=this.drag.start,("IMG"===this.drag.targetEl.tagName||"A"===this.drag.targetEl.tagName)&&(this.drag.targetEl.draggable=!1),a(c).on("mousemove.owl.dragEvents mouseup.owl.dragEvents touchmove.owl.dragEvents touchend.owl.dragEvents",a.proxy(function(a){this.eventsRouter(a)},this))},e.prototype.onDragMove=function(a){var c,e,g,h,i,j;this.state.isTouch&&(this.state.isScrolling||(c=a.originalEvent||a||b.event,e=f(c).x,g=f(c).y,this.drag.currentX=e-this.drag.startX,this.drag.currentY=g-this.drag.startY,this.drag.distance=this.drag.currentX-this.drag.offsetX,this.drag.distance<0?this.state.direction=this.settings.rtl?"right":"left":this.drag.distance>0&&(this.state.direction=this.settings.rtl?"left":"right"),this.settings.loop?this.op(this.drag.currentX,">",this.coordinates(this.minimum()))&&"right"===this.state.direction?this.drag.currentX-=(this.settings.center&&this.coordinates(0))-this.coordinates(this._items.length):this.op(this.drag.currentX,"<",this.coordinates(this.maximum()))&&"left"===this.state.direction&&(this.drag.currentX+=(this.settings.center&&this.coordinates(0))-this.coordinates(this._items.length)):(h=this.coordinates(this.settings.rtl?this.maximum():this.minimum()),i=this.coordinates(this.settings.rtl?this.minimum():this.maximum()),j=this.settings.pullDrag?this.drag.distance/5:0,this.drag.currentX=Math.max(Math.min(this.drag.currentX,h+j),i+j)),(this.drag.distance>8||this.drag.distance<-8)&&(c.preventDefault!==d?c.preventDefault():c.returnValue=!1,this.state.isSwiping=!0),this.drag.updatedX=this.drag.currentX,(this.drag.currentY>16||this.drag.currentY<-16)&&this.state.isSwiping===!1&&(this.state.isScrolling=!0,this.drag.updatedX=this.drag.start),this.animate(this.drag.updatedX)))},e.prototype.onDragEnd=function(b){var d,e,f;if(this.state.isTouch){if("mouseup"===b.type&&this.$stage.removeClass("owl-grab"),this.trigger("dragged"),this.drag.targetEl.removeAttribute("draggable"),this.state.isTouch=!1,this.state.isScrolling=!1,this.state.isSwiping=!1,0===this.drag.distance&&this.state.inMotion!==!0)return this.state.inMotion=!1,!1;this.drag.endTime=(new Date).getTime(),d=this.drag.endTime-this.drag.startTime,e=Math.abs(this.drag.distance),(e>3||d>300)&&this.removeClick(this.drag.targetEl),f=this.closest(this.drag.updatedX),this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(f),this.invalidate("position"),this.update(),this.settings.pullDrag||this.drag.updatedX!==this.coordinates(f)||this.transitionEnd(),this.drag.distance=0,a(c).off(".owl.dragEvents")}},e.prototype.removeClick=function(c){this.drag.targetEl=c,a(c).on("click.preventClick",this.e._preventClick),b.setTimeout(function(){a(c).off("click.preventClick")},300)},e.prototype.preventClick=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1,b.stopPropagation&&b.stopPropagation(),a(b.target).off("click.preventClick")},e.prototype.getTransformProperty=function(){var a,c;return a=b.getComputedStyle(this.$stage.get(0),null).getPropertyValue(this.vendorName+"transform"),a=a.replace(/matrix(3d)?\(|\)/g,"").split(","),c=16===a.length,c!==!0?a[4]:a[12]},e.prototype.closest=function(b){var c=-1,d=30,e=this.width(),f=this.coordinates();return this.settings.freeDrag||a.each(f,a.proxy(function(a,g){return b>g-d&&g+d>b?c=a:this.op(b,"<",g)&&this.op(b,">",f[a+1]||g-e)&&(c="left"===this.state.direction?a+1:a),-1===c},this)),this.settings.loop||(this.op(b,">",f[this.minimum()])?c=b=this.minimum():this.op(b,"<",f[this.maximum()])&&(c=b=this.maximum())),c},e.prototype.animate=function(b){this.trigger("translate"),this.state.inMotion=this.speed()>0,this.support3d?this.$stage.css({transform:"translate3d("+b+"px,0px, 0px)",transition:this.speed()/1e3+"s"}):this.state.isTouch?this.$stage.css({left:b+"px"}):this.$stage.animate({left:b},this.speed()/1e3,this.settings.fallbackEasing,a.proxy(function(){this.state.inMotion&&this.transitionEnd()},this))},e.prototype.current=function(a){if(a===d)return this._current;if(0===this._items.length)return d;if(a=this.normalize(a),this._current!==a){var b=this.trigger("change",{property:{name:"position",value:a}});b.data!==d&&(a=this.normalize(b.data)),this._current=a,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current},e.prototype.invalidate=function(a){this._invalidated[a]=!0},e.prototype.reset=function(a){a=this.normalize(a),a!==d&&(this._speed=0,this._current=a,this.suppress(["translate","translated"]),this.animate(this.coordinates(a)),this.release(["translate","translated"]))},e.prototype.normalize=function(b,c){var e=c?this._items.length:this._items.length+this._clones.length;return!a.isNumeric(b)||1>e?d:b=this._clones.length?(b%e+e)%e:Math.max(this.minimum(c),Math.min(this.maximum(c),b))},e.prototype.relative=function(a){return a=this.normalize(a),a-=this._clones.length/2,this.normalize(a,!0)},e.prototype.maximum=function(a){var b,c,d,e=0,f=this.settings;if(a)return this._items.length-1;if(!f.loop&&f.center)b=this._items.length-1;else if(f.loop||f.center)if(f.loop||f.center)b=this._items.length+f.items;else{if(!f.autoWidth&&!f.merge)throw"Can not detect maximum absolute position.";for(revert=f.rtl?1:-1,c=this.$stage.width()-this.$element.width();(d=this.coordinates(e))&&!(d*revert>=c);)b=++e}else b=this._items.length-f.items;return b},e.prototype.minimum=function(a){return a?0:this._clones.length/2},e.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},e.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},e.prototype.clones=function(b){var c=this._clones.length/2,e=c+this._items.length,f=function(a){return a%2===0?e+a/2:c-(a+1)/2};return b===d?a.map(this._clones,function(a,b){return f(b)}):a.map(this._clones,function(a,c){return a===b?f(c):null})},e.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},e.prototype.coordinates=function(b){var c=null;return b===d?a.map(this._coordinates,a.proxy(function(a,b){return this.coordinates(b)},this)):(this.settings.center?(c=this._coordinates[b],c+=(this.width()-c+(this._coordinates[b-1]||0))/2*(this.settings.rtl?-1:1)):c=this._coordinates[b-1]||0,c)},e.prototype.duration=function(a,b,c){return Math.min(Math.max(Math.abs(b-a),1),6)*Math.abs(c||this.settings.smartSpeed)},e.prototype.to=function(c,d){if(this.settings.loop){var e=c-this.relative(this.current()),f=this.current(),g=this.current(),h=this.current()+e,i=0>g-h?!0:!1,j=this._clones.length+this._items.length;h<this.settings.items&&i===!1?(f=g+this._items.length,this.reset(f)):h>=j-this.settings.items&&i===!0&&(f=g-this._items.length,this.reset(f)),b.clearTimeout(this.e._goToLoop),this.e._goToLoop=b.setTimeout(a.proxy(function(){this.speed(this.duration(this.current(),f+e,d)),this.current(f+e),this.update()},this),30)}else this.speed(this.duration(this.current(),c,d)),this.current(c),this.update()},e.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},e.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},e.prototype.transitionEnd=function(a){return a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0))?!1:(this.state.inMotion=!1,void this.trigger("translated"))},e.prototype.viewport=function(){var d;if(this.options.responsiveBaseElement!==b)d=a(this.options.responsiveBaseElement).width();else if(b.innerWidth)d=b.innerWidth;else{if(!c.documentElement||!c.documentElement.clientWidth)throw"Can not detect viewport width.";d=c.documentElement.clientWidth}return d},e.prototype.replace=function(b){this.$stage.empty(),this._items=[],b&&(b=b instanceof jQuery?b:a(b)),this.settings.nestedItemSelector&&(b=b.find("."+this.settings.nestedItemSelector)),b.filter(function(){return 1===this.nodeType}).each(a.proxy(function(a,b){b=this.prepare(b),this.$stage.append(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").andSelf("[data-merge]").attr("data-merge")||1)},this)),this.reset(a.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},e.prototype.add=function(a,b){b=b===d?this._items.length:this.normalize(b,!0),this.trigger("add",{content:a,position:b}),0===this._items.length||b===this._items.length?(this.$stage.append(a),this._items.push(a),this._mergers.push(1*a.find("[data-merge]").andSelf("[data-merge]").attr("data-merge")||1)):(this._items[b].before(a),this._items.splice(b,0,a),this._mergers.splice(b,0,1*a.find("[data-merge]").andSelf("[data-merge]").attr("data-merge")||1)),this.invalidate("items"),this.trigger("added",{content:a,position:b})},e.prototype.remove=function(a){a=this.normalize(a,!0),a!==d&&(this.trigger("remove",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate("items"),this.trigger("removed",{content:null,position:a}))},e.prototype.addTriggerableEvents=function(){var b=a.proxy(function(b,c){return a.proxy(function(a){a.relatedTarget!==this&&(this.suppress([c]),b.apply(this,[].slice.call(arguments,1)),this.release([c]))},this)},this);a.each({next:this.next,prev:this.prev,to:this.to,destroy:this.destroy,refresh:this.refresh,replace:this.replace,add:this.add,remove:this.remove},a.proxy(function(a,c){this.$element.on(a+".owl.carousel",b(c,a+".owl.carousel"))},this))},e.prototype.watchVisibility=function(){function c(a){return a.offsetWidth>0&&a.offsetHeight>0}function d(){c(this.$element.get(0))&&(this.$element.removeClass("owl-hidden"),this.refresh(),b.clearInterval(this.e._checkVisibile))}c(this.$element.get(0))||(this.$element.addClass("owl-hidden"),b.clearInterval(this.e._checkVisibile),this.e._checkVisibile=b.setInterval(a.proxy(d,this),500))},e.prototype.preloadAutoWidthImages=function(b){var c,d,e,f;c=0,d=this,b.each(function(g,h){e=a(h),f=new Image,f.onload=function(){c++,e.attr("src",f.src),e.css("opacity",1),c>=b.length&&(d.state.imagesLoaded=!0,d.initialize())},f.src=e.attr("src")||e.attr("data-src")||e.attr("data-src-retina")})},e.prototype.destroy=function(){this.$element.hasClass(this.settings.themeClass)&&this.$element.removeClass(this.settings.themeClass),this.settings.responsive!==!1&&a(b).off("resize.owl.carousel"),this.transitionEndVendor&&this.off(this.$stage.get(0),this.transitionEndVendor,this.e._transitionEnd);for(var d in this._plugins)this._plugins[d].destroy();(this.settings.mouseDrag||this.settings.touchDrag)&&(this.$stage.off("mousedown touchstart touchcancel"),a(c).off(".owl.dragEvents"),this.$stage.get(0).onselectstart=function(){},this.$stage.off("dragstart",function(){return!1})),this.$element.off(".owl"),this.$stage.children(".cloned").remove(),this.e=null,this.$element.removeData("owlCarousel"),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.unwrap()},e.prototype.op=function(a,b,c){var d=this.settings.rtl;switch(b){case"<":return d?a>c:c>a;case">":return d?c>a:a>c;case">=":return d?c>=a:a>=c;case"<=":return d?a>=c:c>=a}},e.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},e.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)},e.prototype.trigger=function(b,c,d){var e={item:{count:this._items.length,index:this.current()}},f=a.camelCase(a.grep(["on",b,d],function(a){return a}).join("-").toLowerCase()),g=a.Event([b,"owl",d||"carousel"].join(".").toLowerCase(),a.extend({relatedTarget:this},e,c));return this._supress[b]||(a.each(this._plugins,function(a,b){b.onTrigger&&b.onTrigger(g)}),this.$element.trigger(g),this.settings&&"function"==typeof this.settings[f]&&this.settings[f].apply(this,g)),g},e.prototype.suppress=function(b){a.each(b,a.proxy(function(a,b){this._supress[b]=!0},this))},e.prototype.release=function(b){a.each(b,a.proxy(function(a,b){delete this._supress[b]},this))},e.prototype.browserSupport=function(){if(this.support3d=j(),this.support3d){this.transformVendor=i();var a=["transitionend","webkitTransitionEnd","transitionend","oTransitionEnd"];this.transitionEndVendor=a[h()],this.vendorName=this.transformVendor.replace(/Transform/i,""),this.vendorName=""!==this.vendorName?"-"+this.vendorName.toLowerCase()+"-":""}this.state.orientation=b.orientation},a.fn.owlCarousel=function(b){return this.each(function(){a(this).data("owlCarousel")||a(this).data("owlCarousel",new e(this,b))})},a.fn.owlCarousel.Constructor=e}(window.Zepto||window.jQuery,window,document),function(a,b){var c=function(b){this._core=b,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel":a.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&"position"==b.property.name||"initialized"==b.type))for(var c=this._core.settings,d=c.center&&Math.ceil(c.items/2)||c.items,e=c.center&&-1*d||0,f=(b.property&&b.property.value||this._core.current())+e,g=this._core.clones().length,h=a.proxy(function(a,b){this.load(b)},this);e++<d;)this.load(g/2+this._core.relative(f)),g&&a.each(this._core.clones(this._core.relative(f++)),h)},this)},this._core.options=a.extend({},c.Defaults,this._core.options),this._core.$element.on(this._handlers)};c.Defaults={lazyLoad:!1},c.prototype.load=function(c){var d=this._core.$stage.children().eq(c),e=d&&d.find(".owl-lazy");!e||a.inArray(d.get(0),this._loaded)>-1||(e.each(a.proxy(function(c,d){var e,f=a(d),g=b.devicePixelRatio>1&&f.attr("data-src-retina")||f.attr("data-src");this._core.trigger("load",{element:f,url:g},"lazy"),f.is("img")?f.one("load.owl.lazy",a.proxy(function(){f.css("opacity",1),this._core.trigger("loaded",{element:f,url:g},"lazy")},this)).attr("src",g):(e=new Image,e.onload=a.proxy(function(){f.css({"background-image":"url("+g+")",opacity:"1"}),this._core.trigger("loaded",{element:f,url:g},"lazy")},this),e.src=g)},this)),this._loaded.push(d.get(0)))},c.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Lazy=c}(window.Zepto||window.jQuery,window,document),function(a){var b=function(c){this._core=c,this._handlers={"initialized.owl.carousel":a.proxy(function(){this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":a.proxy(function(a){this._core.settings.autoHeight&&"position"==a.property.name&&this.update()},this),"loaded.owl.lazy":a.proxy(function(a){this._core.settings.autoHeight&&a.element.closest("."+this._core.settings.itemClass)===this._core.$stage.children().eq(this._core.current())&&this.update()},this)},this._core.options=a.extend({},b.Defaults,this._core.options),this._core.$element.on(this._handlers)};b.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},b.prototype.update=function(){this._core.$stage.parent().height(this._core.$stage.children().eq(this._core.current()).height()).addClass(this._core.settings.autoHeightClass)},b.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoHeight=b}(window.Zepto||window.jQuery,window,document),function(a,b,c){var d=function(b){this._core=b,this._videos={},this._playing=null,this._fullscreen=!1,this._handlers={"resize.owl.carousel":a.proxy(function(a){this._core.settings.video&&!this.isInFullScreen()&&a.preventDefault()},this),"refresh.owl.carousel changed.owl.carousel":a.proxy(function(){this._playing&&this.stop()},this),"prepared.owl.carousel":a.proxy(function(b){var c=a(b.content).find(".owl-video");c.length&&(c.css("display","none"),this.fetch(c,a(b.content)))},this)},this._core.options=a.extend({},d.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",a.proxy(function(a){this.play(a)},this))};d.Defaults={video:!1,videoHeight:!1,videoWidth:!1},d.prototype.fetch=function(a,b){var c=a.attr("data-vimeo-id")?"vimeo":"youtube",d=a.attr("data-vimeo-id")||a.attr("data-youtube-id"),e=a.attr("data-width")||this._core.settings.videoWidth,f=a.attr("data-height")||this._core.settings.videoHeight,g=a.attr("href");if(!g)throw new Error("Missing video URL.");if(d=g.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),d[3].indexOf("youtu")>-1)c="youtube";else{if(!(d[3].indexOf("vimeo")>-1))throw new Error("Video URL not supported.");c="vimeo"}d=d[6],this._videos[g]={type:c,id:d,width:e,height:f},b.attr("data-video",g),this.thumbnail(a,this._videos[g])},d.prototype.thumbnail=function(b,c){var d,e,f,g=c.width&&c.height?'style="width:'+c.width+"px;height:"+c.height+'px;"':"",h=b.find("img"),i="src",j="",k=this._core.settings,l=function(a){e='<div class="owl-video-play-icon"></div>',d=k.lazyLoad?'<div class="owl-video-tn '+j+'" '+i+'="'+a+'"></div>':'<div class="owl-video-tn" style="opacity:1;background-image:url('+a+')"></div>',b.after(d),b.after(e)};return b.wrap('<div class="owl-video-wrapper"'+g+"></div>"),this._core.settings.lazyLoad&&(i="data-src",j="owl-lazy"),h.length?(l(h.attr(i)),h.remove(),!1):void("youtube"===c.type?(f="http://img.youtube.com/vi/"+c.id+"/hqdefault.jpg",l(f)):"vimeo"===c.type&&a.ajax({type:"GET",url:"http://vimeo.com/api/v2/video/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a[0].thumbnail_large,l(f)}}))},d.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null},d.prototype.play=function(b){this._core.trigger("play",null,"video"),this._playing&&this.stop();var c,d,e=a(b.target||b.srcElement),f=e.closest("."+this._core.settings.itemClass),g=this._videos[f.attr("data-video")],h=g.width||"100%",i=g.height||this._core.$stage.height();"youtube"===g.type?c='<iframe width="'+h+'" height="'+i+'" src="http://www.youtube.com/embed/'+g.id+"?autoplay=1&v="+g.id+'" frameborder="0" allowfullscreen></iframe>':"vimeo"===g.type&&(c='<iframe src="http://player.vimeo.com/video/'+g.id+'?autoplay=1" width="'+h+'" height="'+i+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'),f.addClass("owl-video-playing"),this._playing=f,d=a('<div style="height:'+i+"px; width:"+h+'px" class="owl-video-frame">'+c+"</div>"),e.after(d)},d.prototype.isInFullScreen=function(){var d=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return d&&a(d).parent().hasClass("owl-video-frame")&&(this._core.speed(0),this._fullscreen=!0),d&&this._fullscreen&&this._playing?!1:this._fullscreen?(this._fullscreen=!1,!1):this._playing&&this._core.state.orientation!==b.orientation?(this._core.state.orientation=b.orientation,!1):!0},d.prototype.destroy=function(){var a,b;this._core.$element.off("click.owl.video");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Video=d}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={"change.owl.carousel":a.proxy(function(a){"position"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":a.proxy(function(a){this.swapping="translated"==a.type},this),"translate.owl.carousel":a.proxy(function(){this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&this.core.support3d){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.css({left:b+"px"}).addClass("animated owl-animated-out").addClass(g).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",c)),f&&e.addClass("animated owl-animated-in").addClass(f).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",c))}},e.prototype.clear=function(b){a(b.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.transitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c){var d=function(b){this.core=b,this.core.options=a.extend({},d.Defaults,this.core.options),this.handlers={"translated.owl.carousel refreshed.owl.carousel":a.proxy(function(){this.autoplay()
},this),"play.owl.autoplay":a.proxy(function(a,b,c){this.play(b,c)},this),"stop.owl.autoplay":a.proxy(function(){this.stop()},this),"mouseover.owl.autoplay":a.proxy(function(){this.core.settings.autoplayHoverPause&&this.pause()},this),"mouseleave.owl.autoplay":a.proxy(function(){this.core.settings.autoplayHoverPause&&this.autoplay()},this)},this.core.$element.on(this.handlers)};d.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},d.prototype.autoplay=function(){this.core.settings.autoplay&&!this.core.state.videoPlay?(b.clearInterval(this.interval),this.interval=b.setInterval(a.proxy(function(){this.play()},this),this.core.settings.autoplayTimeout)):b.clearInterval(this.interval)},d.prototype.play=function(){return c.hidden===!0||this.core.state.isTouch||this.core.state.isScrolling||this.core.state.isSwiping||this.core.state.inMotion?void 0:this.core.settings.autoplay===!1?void b.clearInterval(this.interval):void this.core.next(this.core.settings.autoplaySpeed)},d.prototype.stop=function(){b.clearInterval(this.interval)},d.prototype.pause=function(){b.clearInterval(this.interval)},d.prototype.destroy=function(){var a,c;b.clearInterval(this.interval);for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},a.fn.owlCarousel.Constructor.Plugins.autoplay=d}(window.Zepto||window.jQuery,window,document),function(a){"use strict";var b=function(c){this._core=c,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":a.proxy(function(b){this._core.settings.dotsData&&this._templates.push(a(b.content).find("[data-dot]").andSelf("[data-dot]").attr("data-dot"))},this),"add.owl.carousel":a.proxy(function(b){this._core.settings.dotsData&&this._templates.splice(b.position,0,a(b.content).find("[data-dot]").andSelf("[data-dot]").attr("data-dot"))},this),"remove.owl.carousel prepared.owl.carousel":a.proxy(function(a){this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),"change.owl.carousel":a.proxy(function(a){if("position"==a.property.name&&!this._core.state.revert&&!this._core.settings.loop&&this._core.settings.navRewind){var b=this._core.current(),c=this._core.maximum(),d=this._core.minimum();a.data=a.property.value>c?b>=c?d:c:a.property.value<d?c:a.property.value}},this),"changed.owl.carousel":a.proxy(function(a){"position"==a.property.name&&this.draw()},this),"refreshed.owl.carousel":a.proxy(function(){this._initialized||(this.initialize(),this._initialized=!0),this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation")},this)},this._core.options=a.extend({},b.Defaults,this._core.options),this.$element.on(this._handlers)};b.Defaults={nav:!1,navRewind:!0,navText:["prev","next"],navSpeed:!1,navElement:"div",navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotData:!1,dotsSpeed:!1,dotsContainer:!1,controlsClass:"owl-controls"},b.prototype.initialize=function(){var b,c,d=this._core.settings;d.dotsData||(this._templates=[a("<div>").addClass(d.dotClass).append(a("<span>")).prop("outerHTML")]),d.navContainer&&d.dotsContainer||(this._controls.$container=a("<div>").addClass(d.controlsClass).appendTo(this.$element)),this._controls.$indicators=d.dotsContainer?a(d.dotsContainer):a("<div>").hide().addClass(d.dotsClass).appendTo(this._controls.$container),this._controls.$indicators.on("click","div",a.proxy(function(b){var c=a(b.target).parent().is(this._controls.$indicators)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(c,d.dotsSpeed)},this)),b=d.navContainer?a(d.navContainer):a("<div>").addClass(d.navContainerClass).prependTo(this._controls.$container),this._controls.$next=a("<"+d.navElement+">"),this._controls.$previous=this._controls.$next.clone(),this._controls.$previous.addClass(d.navClass[0]).html(d.navText[0]).hide().prependTo(b).on("click",a.proxy(function(){this.prev(d.navSpeed)},this)),this._controls.$next.addClass(d.navClass[1]).html(d.navText[1]).hide().appendTo(b).on("click",a.proxy(function(){this.next(d.navSpeed)},this));for(c in this._overrides)this._core[c]=a.proxy(this[c],this)},b.prototype.destroy=function(){var a,b,c,d;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},b.prototype.update=function(){var a,b,c,d=this._core.settings,e=this._core.clones().length/2,f=e+this._core.items().length,g=d.center||d.autoWidth||d.dotData?1:d.dotsEach||d.items;if("page"!==d.slideBy&&(d.slideBy=Math.min(d.slideBy,d.items)),d.dots||"page"==d.slideBy)for(this._pages=[],a=e,b=0,c=0;f>a;a++)(b>=g||0===b)&&(this._pages.push({start:a-e,end:a-e+g-1}),b=0,++c),b+=this._core.mergers(this._core.relative(a))},b.prototype.draw=function(){var b,c,d="",e=this._core.settings,f=(this._core.$stage.children(),this._core.relative(this._core.current()));if(!e.nav||e.loop||e.navRewind||(this._controls.$previous.toggleClass("disabled",0>=f),this._controls.$next.toggleClass("disabled",f>=this._core.maximum())),this._controls.$previous.toggle(e.nav),this._controls.$next.toggle(e.nav),e.dots){if(b=this._pages.length-this._controls.$indicators.children().length,e.dotData&&0!==b){for(c=0;c<this._controls.$indicators.children().length;c++)d+=this._templates[this._core.relative(c)];this._controls.$indicators.html(d)}else b>0?(d=new Array(b+1).join(this._templates[0]),this._controls.$indicators.append(d)):0>b&&this._controls.$indicators.children().slice(b).remove();this._controls.$indicators.find(".active").removeClass("active"),this._controls.$indicators.children().eq(a.inArray(this.current(),this._pages)).addClass("active")}this._controls.$indicators.toggle(e.dots)},b.prototype.onTrigger=function(b){var c=this._core.settings;b.page={index:a.inArray(this.current(),this._pages),count:this._pages.length,size:c&&(c.center||c.autoWidth||c.dotData?1:c.dotsEach||c.items)}},b.prototype.current=function(){var b=this._core.relative(this._core.current());return a.grep(this._pages,function(a){return a.start<=b&&a.end>=b}).pop()},b.prototype.getPosition=function(b){var c,d,e=this._core.settings;return"page"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},b.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},b.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},b.prototype.to=function(b,c,d){var e;d?a.proxy(this._overrides.to,this._core)(b,c):(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c))},a.fn.owlCarousel.Constructor.Plugins.Navigation=b}(window.Zepto||window.jQuery,window,document),function(a,b){"use strict";var c=function(d){this._core=d,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":a.proxy(function(){"URLHash"==this._core.settings.startPosition&&a(b).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":a.proxy(function(b){var c=a(b.content).find("[data-hash]").andSelf("[data-hash]").attr("data-hash");this._hashes[c]=b.content},this)},this._core.options=a.extend({},c.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on("hashchange.owl.navigation",a.proxy(function(){var a=b.location.hash.substring(1),c=this._core.$stage.children(),d=this._hashes[a]&&c.index(this._hashes[a])||0;return a?void this._core.to(d,!1,!0):!1},this))};c.Defaults={URLhashListener:!1},c.prototype.destroy=function(){var c,d;a(b).off("hashchange.owl.navigation");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))"function"!=typeof this[d]&&(this[d]=null)},a.fn.owlCarousel.Constructor.Plugins.Hash=c}(window.Zepto||window.jQuery,window,document);;
var $ = jQuery;
$(window).load(function () {
/* Bildspelets inställningar */
    var isSliding = false;
    var buttonTriggered = false;
    var homeSlider = $("#home-slider .image-area .slider").owlCarousel({
        items: 1,
        loop: $("#home-slider .image-area .slider .slide").length > 1 ? true : false,
        nav: false,
        autoplay: $("#home-slider .image-area .slider .slide").length > 1 ? true : false,
        autoplayTimeout: 8000,
        mouseDrag: false,
        touchDrag: false,
        dots: true,
        autoWidth: false,
        smartSpeed: 400,
        animateOut: 'fadeOut',
        onTranslated: currentSlide
    }).on("translate.owl.carousel", function (e) {
        isSliding = true;
    }).on("translated.owl.carousel", function (e) {
        isSliding = false;
        if (buttonTriggered) {
            $('#home-slider .image-area .controls').click();
        }
    });
    $("#home-slider .navigation-area ul li:first-child").addClass("active");
    $('#home-slider .navigation-area ul li').click(function() {
        homeSlider.trigger('to.owl.carousel', $(this).data("slide-id"));
        $(this).siblings().removeClass("active");
        $(this).addClass("active");
        homeSlider.trigger('stop.autoplay.owl');
        $("#home-slider .image-area .controls").removeClass("paused");
    });
 
    function currentSlide(event) {
        var currentSlideid = $(homeSlider).find(".owl-item.active .slide").data("slide-id");
        $('#home-slider .navigation-area ul li').removeClass("active");
        $('#home-slider .navigation-area ul li[data-slide-id="' + currentSlideid + '"]').addClass("active");
    }
    $('#home-slider .image-area .controls').click(function () {
        if (isSliding) {
            buttonTriggered = true;
            return;
        }

        if($(this).hasClass("paused")) {
            $(this).removeClass("paused");
            homeSlider.trigger('play.autoplay.owl');
        } else {
            $(this).addClass("paused");
            homeSlider.trigger('stop.autoplay.owl');
        }
    });
    $('#home-slider .image-area .slider.owl-theme .owl-dots .owl-dot').click(function() {
               $("#home-slider .image-area .controls").removeClass("paused");
    });
    /* Slut på bildspelets inställningar */
    if (($("body").hasClass("home") && !$("body").hasClass("companypage")) || $("body").hasClass("search-results")) {
        $(".top-search").remove();
    }

    /* Bredd på översta menyitemsen IE */
    	
    if($('html').hasClass('no-flexbox flexboxtweener') || $('html').hasClass('no-flexbox no-flexboxtweener')) {
        var menuItems = $('#mainmenu .container > ul > li').length;
        var liWidth = (100/menuItems);
        var liWidth = Math.floor(liWidth);
        $('#mainmenu .container > ul > li').width(liWidth + "%");
    }
    	
    /* Slut på IE */
    	
});
$(document).ready(function () {

    $('#wrapper #content div > table').wrap('<div class="responsive-table fl100"></div>');

    $("#header .responsive-nav .menu").click(function () {
        $("#mainmenu").slideToggle(500);
    });
    $("#mainmenu ul li .toggle").click(function () {
        $(this).parent().toggleClass("open");
    });

    $('.meta .print').click(function () {
        window.print();
    });

    //$(".warning-section").click(function() {
    //   $(this).slideUp(250);
    //});

    $("#header .links ul li.search a, #mainmenu .responsive-links ul li.search a").click(function () {
        if (($("body").hasClass("home") && !$("body").hasClass("companypage")) || $("body").hasClass("search-results")) {
            $('html, body').animate({
                'scrollTop': $(".search-section").offset().top
            }, {
                duration: 1000,
                easing: 'easeInOutExpo'
            });
        }
        else {
            $(".top-search").slideToggle(250);
        }
        setTimeout(function () {
            $(".search-section .search-holder .search").focus();
        }, 250);
        return false;
    });
    /* För att slida undermenyn upp och ner */
    $("#wrapper #sidebar ul li.open > ul").show();
    $("#wrapper #sidebar .menu ul li.has-children .toggle").click(function() {
        $(this).parent().find(" > ul ").slideToggle(250);
        $(this).parent().toggleClass("open");
    });
    /* Slut på menyn */
    /* A-Ö */
    //$('#wrapper #content #a-o .boxes .box[data-letter-id="a"]').slideDown(250);
    //$("#a-o .letters span.selectable:first-child").addClass("active");
    $("#a-o .letters span.selectable").on('click keydown', function (event) {
        if (event.type === 'click' || (event.type === 'keydown' && event.key === 'Enter')) {
            $(this).siblings().removeClass("active");
            $(this).addClass("active");
            var boxID = $(this).data("letter-id");
            $('#wrapper #content #a-o .boxes .box').slideUp(250);
            setTimeout(function () {
                $('#wrapper #content #a-o .boxes .box[data-letter-id="' + boxID + '"]').slideDown(250);
            }, 500);
        }
    });
    /* Slut på A-Ö */

    if ($("html").hasClass("no-placeholder")) {
        $("input").each(
			function () {
			    if ($(this).val() == "" && $(this).attr("placeholder") != "") {
			        $(this).val($(this).attr("placeholder"));
			        $(this).focus(function () {
			            if ($(this).val() == $(this).attr("placeholder")) $(this).val("");
			        });
			        $(this).blur(function () {
			            if ($(this).val() == "") $(this).val($(this).attr("placeholder"));
			        });
			    }
			});
    }


});

$(window).load(onLoadAndResize);
$(window).on('resize', onLoadAndResize);

function onLoadAndResize() {
    var footerHeight = $("#footer").outerHeight();
    $(".sitewrapper").css("margin-bottom", -footerHeight);
    $(".footerpush").css("height", footerHeight);
}

/* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ */
jQuery.easing.jswing = jQuery.easing.swing; jQuery.extend(jQuery.easing, { def: "easeOutQuad", swing: function (e, f, a, h, g) { return jQuery.easing[jQuery.easing.def](e, f, a, h, g) }, easeInQuad: function (e, f, a, h, g) { return h * (f /= g) * f + a }, easeOutQuad: function (e, f, a, h, g) { return -h * (f /= g) * (f - 2) + a }, easeInOutQuad: function (e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f + a } return -h / 2 * ((--f) * (f - 2) - 1) + a }, easeInCubic: function (e, f, a, h, g) { return h * (f /= g) * f * f + a }, easeOutCubic: function (e, f, a, h, g) { return h * ((f = f / g - 1) * f * f + 1) + a }, easeInOutCubic: function (e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f * f + a } return h / 2 * ((f -= 2) * f * f + 2) + a }, easeInQuart: function (e, f, a, h, g) { return h * (f /= g) * f * f * f + a }, easeOutQuart: function (e, f, a, h, g) { return -h * ((f = f / g - 1) * f * f * f - 1) + a }, easeInOutQuart: function (e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f * f * f + a } return -h / 2 * ((f -= 2) * f * f * f - 2) + a }, easeInQuint: function (e, f, a, h, g) { return h * (f /= g) * f * f * f * f + a }, easeOutQuint: function (e, f, a, h, g) { return h * ((f = f / g - 1) * f * f * f * f + 1) + a }, easeInOutQuint: function (e, f, a, h, g) { if ((f /= g / 2) < 1) { return h / 2 * f * f * f * f * f + a } return h / 2 * ((f -= 2) * f * f * f * f + 2) + a }, easeInSine: function (e, f, a, h, g) { return -h * Math.cos(f / g * (Math.PI / 2)) + h + a }, easeOutSine: function (e, f, a, h, g) { return h * Math.sin(f / g * (Math.PI / 2)) + a }, easeInOutSine: function (e, f, a, h, g) { return -h / 2 * (Math.cos(Math.PI * f / g) - 1) + a }, easeInExpo: function (e, f, a, h, g) { return (f == 0) ? a : h * Math.pow(2, 10 * (f / g - 1)) + a }, easeOutExpo: function (e, f, a, h, g) { return (f == g) ? a + h : h * (-Math.pow(2, -10 * f / g) + 1) + a }, easeInOutExpo: function (e, f, a, h, g) { if (f == 0) { return a } if (f == g) { return a + h } if ((f /= g / 2) < 1) { return h / 2 * Math.pow(2, 10 * (f - 1)) + a } return h / 2 * (-Math.pow(2, -10 * --f) + 2) + a }, easeInCirc: function (e, f, a, h, g) { return -h * (Math.sqrt(1 - (f /= g) * f) - 1) + a }, easeOutCirc: function (e, f, a, h, g) { return h * Math.sqrt(1 - (f = f / g - 1) * f) + a }, easeInOutCirc: function (e, f, a, h, g) { if ((f /= g / 2) < 1) { return -h / 2 * (Math.sqrt(1 - f * f) - 1) + a } return h / 2 * (Math.sqrt(1 - (f -= 2) * f) + 1) + a }, easeInElastic: function (f, h, e, l, k) { var i = 1.70158; var j = 0; var g = l; if (h == 0) { return e } if ((h /= k) == 1) { return e + l } if (!j) { j = k * 0.3 } if (g < Math.abs(l)) { g = l; var i = j / 4 } else { var i = j / (2 * Math.PI) * Math.asin(l / g) } return -(g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e }, easeOutElastic: function (f, h, e, l, k) { var i = 1.70158; var j = 0; var g = l; if (h == 0) { return e } if ((h /= k) == 1) { return e + l } if (!j) { j = k * 0.3 } if (g < Math.abs(l)) { g = l; var i = j / 4 } else { var i = j / (2 * Math.PI) * Math.asin(l / g) } return g * Math.pow(2, -10 * h) * Math.sin((h * k - i) * (2 * Math.PI) / j) + l + e }, easeInOutElastic: function (f, h, e, l, k) { var i = 1.70158; var j = 0; var g = l; if (h == 0) { return e } if ((h /= k / 2) == 2) { return e + l } if (!j) { j = k * (0.3 * 1.5) } if (g < Math.abs(l)) { g = l; var i = j / 4 } else { var i = j / (2 * Math.PI) * Math.asin(l / g) } if (h < 1) { return -0.5 * (g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e } return g * Math.pow(2, -10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j) * 0.5 + l + e }, easeInBack: function (e, f, a, i, h, g) { if (g == undefined) { g = 1.70158 } return i * (f /= h) * f * ((g + 1) * f - g) + a }, easeOutBack: function (e, f, a, i, h, g) { if (g == undefined) { g = 1.70158 } return i * ((f = f / h - 1) * f * ((g + 1) * f + g) + 1) + a }, easeInOutBack: function (e, f, a, i, h, g) { if (g == undefined) { g = 1.70158 } if ((f /= h / 2) < 1) { return i / 2 * (f * f * (((g *= (1.525)) + 1) * f - g)) + a } return i / 2 * ((f -= 2) * f * (((g *= (1.525)) + 1) * f + g) + 2) + a }, easeInBounce: function (e, f, a, h, g) { return h - jQuery.easing.easeOutBounce(e, g - f, 0, h, g) + a }, easeOutBounce: function (e, f, a, h, g) { if ((f /= g) < (1 / 2.75)) { return h * (7.5625 * f * f) + a } else { if (f < (2 / 2.75)) { return h * (7.5625 * (f -= (1.5 / 2.75)) * f + 0.75) + a } else { if (f < (2.5 / 2.75)) { return h * (7.5625 * (f -= (2.25 / 2.75)) * f + 0.9375) + a } else { return h * (7.5625 * (f -= (2.625 / 2.75)) * f + 0.984375) + a } } } }, easeInOutBounce: function (e, f, a, h, g) { if (f < g / 2) { return jQuery.easing.easeInBounce(e, f * 2, 0, h, g) * 0.5 + a } return jQuery.easing.easeOutBounce(e, f * 2 - g, 0, h, g) * 0.5 + h * 0.5 + a } });

/*! modernizr 3.2.0 (Custom Build) | MIT *
 * http://modernizr.com/download/?-flexbox-flexboxtweener-placeholder-setclasses !*/
!function (e, n, t) { function r(e, n) { return typeof e === n } function o() { var e, n, t, o, s, i, a; for (var l in C) if (C.hasOwnProperty(l)) { if (e = [], n = C[l], n.name && (e.push(n.name.toLowerCase()), n.options && n.options.aliases && n.options.aliases.length)) for (t = 0; t < n.options.aliases.length; t++) e.push(n.options.aliases[t].toLowerCase()); for (o = r(n.fn, "function") ? n.fn() : n.fn, s = 0; s < e.length; s++) i = e[s], a = i.split("."), 1 === a.length ? Modernizr[a[0]] = o : (!Modernizr[a[0]] || Modernizr[a[0]] instanceof Boolean || (Modernizr[a[0]] = new Boolean(Modernizr[a[0]])), Modernizr[a[0]][a[1]] = o), g.push((o ? "" : "no-") + a.join("-")) } } function s(e) { var n = w.className, t = Modernizr._config.classPrefix || ""; if (_ && (n = n.baseVal), Modernizr._config.enableJSClass) { var r = new RegExp("(^|\\s)" + t + "no-js(\\s|$)"); n = n.replace(r, "$1" + t + "js$2") } Modernizr._config.enableClasses && (n += " " + t + e.join(" " + t), _ ? w.className.baseVal = n : w.className = n) } function i() { return "function" != typeof n.createElement ? n.createElement(arguments[0]) : _ ? n.createElementNS.call(n, "http://www.w3.org/2000/svg", arguments[0]) : n.createElement.apply(n, arguments) } function a(e, n) { return function () { return e.apply(n, arguments) } } function l(e, n, t) { var o; for (var s in e) if (e[s] in n) return t === !1 ? e[s] : (o = n[e[s]], r(o, "function") ? a(o, t || n) : o); return !1 } function f(e, n) { return !!~("" + e).indexOf(n) } function u(e) { return e.replace(/([a-z])-([a-z])/g, function (e, n, t) { return n + t.toUpperCase() }).replace(/^-/, "") } function d(e) { return e.replace(/([A-Z])/g, function (e, n) { return "-" + n.toLowerCase() }).replace(/^ms-/, "-ms-") } function p() { var e = n.body; return e || (e = i(_ ? "svg" : "body"), e.fake = !0), e } function c(e, t, r, o) { var s, a, l, f, u = "modernizr", d = i("div"), c = p(); if (parseInt(r, 10)) for (; r--;) l = i("div"), l.id = o ? o[r] : u + (r + 1), d.appendChild(l); return s = i("style"), s.type = "text/css", s.id = "s" + u, (c.fake ? c : d).appendChild(s), c.appendChild(d), s.styleSheet ? s.styleSheet.cssText = e : s.appendChild(n.createTextNode(e)), d.id = u, c.fake && (c.style.background = "", c.style.overflow = "hidden", f = w.style.overflow, w.style.overflow = "hidden", w.appendChild(c)), a = t(d, e), c.fake ? (c.parentNode.removeChild(c), w.style.overflow = f, w.offsetHeight) : d.parentNode.removeChild(d), !!a } function m(n, r) { var o = n.length; if ("CSS" in e && "supports" in e.CSS) { for (; o--;) if (e.CSS.supports(d(n[o]), r)) return !0; return !1 } if ("CSSSupportsRule" in e) { for (var s = []; o--;) s.push("(" + d(n[o]) + ":" + r + ")"); return s = s.join(" or "), c("@supports (" + s + ") { #modernizr { position: absolute; } }", function (e) { return "absolute" == getComputedStyle(e, null).position }) } return t } function h(e, n, o, s) { function a() { d && (delete T.style, delete T.modElem) } if (s = r(s, "undefined") ? !1 : s, !r(o, "undefined")) { var l = m(e, o); if (!r(l, "undefined")) return l } for (var d, p, c, h, v, y = ["modernizr", "tspan"]; !T.style;) d = !0, T.modElem = i(y.shift()), T.style = T.modElem.style; for (c = e.length, p = 0; c > p; p++) if (h = e[p], v = T.style[h], f(h, "-") && (h = u(h)), T.style[h] !== t) { if (s || r(o, "undefined")) return a(), "pfx" == n ? h : !0; try { T.style[h] = o } catch (g) { } if (T.style[h] != v) return a(), "pfx" == n ? h : !0 } return a(), !1 } function v(e, n, t, o, s) { var i = e.charAt(0).toUpperCase() + e.slice(1), a = (e + " " + b.join(i + " ") + i).split(" "); return r(n, "string") || r(n, "undefined") ? h(a, n, o, s) : (a = (e + " " + E.join(i + " ") + i).split(" "), l(a, n, t)) } function y(e, n, r) { return v(e, t, t, n, r) } var g = [], C = [], x = { _version: "3.2.0", _config: { classPrefix: "", enableClasses: !0, enableJSClass: !0, usePrefixes: !0 }, _q: [], on: function (e, n) { var t = this; setTimeout(function () { n(t[e]) }, 0) }, addTest: function (e, n, t) { C.push({ name: e, fn: n, options: t }) }, addAsyncTest: function (e) { C.push({ name: null, fn: e }) } }, Modernizr = function () { }; Modernizr.prototype = x, Modernizr = new Modernizr; var w = n.documentElement, _ = "svg" === w.nodeName.toLowerCase(); Modernizr.addTest("placeholder", "placeholder" in i("input") && "placeholder" in i("textarea")); var S = "Moz O ms Webkit", b = x._config.usePrefixes ? S.split(" ") : []; x._cssomPrefixes = b; var E = x._config.usePrefixes ? S.toLowerCase().split(" ") : []; x._domPrefixes = E; var P = { elem: i("modernizr") }; Modernizr._q.push(function () { delete P.elem }); var T = { style: P.elem.style }; Modernizr._q.unshift(function () { delete T.style }), x.testAllProps = v, x.testAllProps = y, Modernizr.addTest("flexbox", y("flexBasis", "1px", !0)), Modernizr.addTest("flexboxtweener", y("flexAlign", "end", !0)), o(), s(g), delete x.addTest, delete x.addAsyncTest; for (var z = 0; z < Modernizr._q.length; z++) Modernizr._q[z](); e.Modernizr = Modernizr }(window, document);;
$(function () {

    $('.socialconnect').socialConnect({
        filterForView: function(item) {

            function transformDate(datestring) {
                var date = new Date(datestring);
                var shortMonth = date.toLocaleString('default', { month: 'short' });

                return date.getDate() + ' ' + shortMonth + ' ' + date.getFullYear();
            }

            item.date = transformDate(item.timestamp);

            item.message = (item.message && item.message.length > 240 && item.message.substring(0, 240) + '...') || item.message;

            return item;
        }
    });

    //Handle the select for news per page
    var $select = $('select[name=posts-per-page]');
    if ($select.length > 0) {
        $select.val($select.data('currentAmount'));

        $select.change(function () {
            var newUrl = addOrReplaceParam(window.location.href, 'pageSize', $(this).val());
            newUrl = addOrReplaceParam(newUrl, 'page', "1");
            window.location = newUrl;
        });
    }

    /* För att slidea undermenyn upp och ner */
    $(".treeview ul li.has-subs span").click(function () {
        var $this = $(this).closest('li.has-subs');
        $this.toggleClass('open');
        $this.find('.open').toggleClass('open');

        return false;
    });

    $('span.comment').click(function () {
        $('#comment-form').slideToggle(300);

    });

    $('span.comment-to-contentmanager').click(function () {
        $('#comment-form').slideToggle(300);

    });


    $('span.share').click(function () {
        $('#share-wrapper').slideToggle(300);
    });

    $('#comment-form button').click(function () {

        jQuery.support.cors = true;

        var $this = $(this), token = $this.data('token');

        //Get the values
        var name = $('#commentName').val(),
            email = $('#commentEmail').val(),
            message = $('#commentMessage').val(),
            pageId = $('#commentPageId').val(),
            recepientEmail = $('#commentRecepientEmail').val();

        //Check if the message is null/undefined/blank/only whitespace
        if (!message || /^\s*$/.test(message) || !message.trim()) {
            $('.form-error-message').addClass('show-error');
            $('#commentMessage').addClass('form-error');
        } else {
            $.ajax({
                url: "/sendcomment",
                type: "POST",
                crossDomain: true,
                //contentType: "application/json",
                data: { name: name, email: email, message: message, pageId: pageId, recepientEmail: recepientEmail }, // JSON data goes here
                dataType: "html",
                headers: {
                    'RequestVerificationToken': token,
                    'Access-Control-Allow-Origin':'*'
                },
                success: function (response) {
                    $('#comment-form').html(response);
                },
                error: function (response) {
                    $('#comment-form').html(response);
                }
            });
        }

        //return false;
    });

    $('.translate-trigger').click(function (e) {
        $('#google_translate_element').toggleClass('translate-open');
        e.preventDefault();
    });

    $('a[href*="#"]:not([href="#"])').on('click', function (e) {
        var target = this.hash;
        var $target = $(target);

        if ($target.length) {
            e.preventDefault();

            $('html, body').stop().animate({
                'scrollTop': $target.offset().top
            }, 900, 'swing', function () {
                //window.location.hash = target;
            });
            return false;
        }
    });

    //Check if ie 11
    (function () {
        var d = document;
        var b = d.body;
        var s = b.style;
        var isIE11;
        var property;

        var ie11Styles = [
            'msTextCombineHorizontal'
        ];

        // Test IE11 properties
        for (var i = 0; i < ie11Styles.length; i++) {
            property = ie11Styles[i];

            if (s[property] !== undefined) {
                isIE11 = true;
            }
        }

        if (isIE11) {
            $("html").addClass("ie11settings");
        }

    }());

    var calendarBlock = $('.calendarblock');
    if (calendarBlock.length > 0) {
        var reference = calendarBlock.data('container');

        loadCalendarBlockItems(reference);
        $('.calendarblock .calendarblock__filter button').click(function () {
            if ($(this).hasClass('comp-btn--selected')) {
                loadCalendarBlockItems(reference);
                $(this).removeClass('comp-btn--selected');
            } else {
                loadCalendarBlockItems(reference, $(this).data('filter'));
                $('.calendarblock .calendarblock__filter button').removeClass('comp-btn--selected');
                $(this).addClass('comp-btn--selected');
            }
        });
    }

    var calendarList = $('#events');
    if (calendarList.length > 0) {
        var currentFilter = $.urlParam('filter');
        if (currentFilter) {
            calendarList.find('.calendarblock__filter button[data-filter="' + currentFilter + '"]').addClass('comp-btn--selected');
        } else {
            calendarList.find('.calendarblock__filter button[data-filter=""]').addClass('comp-btn--selected');
        }

        calendarList.find('.calendarblock__filter button').click(function () {
            var url = calendarList.data("baseUrl");
            url = addOrReplaceParam(url, "filter", $(this).data('filter'));
            window.location = url;
        });
    }
});

function loadCalendarBlockItems(reference, filter) {
    if (filter) {
        filter = '?filter=' + filter;
    } else {
        filter = '';
    }
    $.getJSON('/api/calendar/list/' + reference + filter, function (res) {
        //console.log('/api/calendar/list/' + reference + filter, res);

        var container = $('.calendarblock__items');
        container.html('');

        if (res && res.length <= 0 && !container.hasClass('calendarblock__items--empty')) {
            container.addClass('calendarblock__items--empty');
            var emptySpan = $('<span>').addClass('calendarblock__empty').text('Inga resultat');
            emptySpan.appendTo(container);
        } else {
            container.removeClass('calendarblock__items--empty');
        }

        res.forEach(function (x) {
            var html = $('.calendaritem__template').clone();
            html.addClass('calendaritem').removeClass('calendaritem__template');

            html.find('.calendaritem__inner').attr('href', x.href).attr('style', 'background-image: url(\'' + x.image + '\');');
            html.find('.calendaritem__header').html(x.name);
            html.find('.calendaritem__day').html(x.day);
            html.find('.calendaritem__number').html(x.dayNumber);
            html.find('.calendaritem__month').html(x.month);

            html.appendTo(container);
        });
    });
}

$.urlParam = function (name, url) {
    if (!url) {
        url = window.location.href;
    }
    var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
    if (!results) {
        return undefined;
    }
    return results[1] || undefined;
}

// Used for validating search term to make sure it isnt an empty search
function validateSearchTerm() {
    if ($(".search-searchinputfield").val() === "") {
        $(".search-holder").append("<div class=\"search-arrow-box\">Du måste skriva in ett sökord</div>");
        $(".search-searchinputfield").addClass("border-red");
        return false;
    }

    return true;
}

// Remove search term missing alert when search input is in focus
function removeSearchAlert() {
    $(".search-searchinputfield").removeClass("border-red");
    $(".search-arrow-box").hide();
}

function addOrReplaceParam(url, param, value) {
    param = encodeURIComponent(param);
    var r = "([&?]|&amp;)" + param + "\\b(?:=(?:[^&#]*))*";
    var a = document.createElement('a');
    var regex = new RegExp(r);
    var str = param + (value ? "=" + encodeURIComponent(value) : "");
    a.href = url;
    var q = a.search.replace(regex, "$1" + str);
    if (q === a.search && q.indexOf(str) === -1) {
        a.search += (a.search ? "&" : "") + str;
    } else {
        a.search = q;
    }
    return a.href;
}

;
$(function () {
    var $fields = $("input.search");
    var timeout = null;
    var currentAutoComplete = null;
    
    $fields.keyup(function (e) {
        var $this = $(this);
        var query = $this.val();
        $this.parent().children(".autocomplete-suggestion").remove();

        var code = e.keyCode || e.which;
        if (code == 39) { // right arrow
            if (currentAutoComplete !== null) {
                $this.val(currentAutoComplete);
                query = currentAutoComplete;
            } else {
                return;
            }
        }

        if (timeout !== null) {
            clearTimeout(timeout);
        }

        timeout = setTimeout(function() {
            if (query !== undefined && query.length >= 1) {
                handleSearch($this, query);
            }
        }, 150);
    });

    $fields.keydown(function (e) {
        var code = e.keyCode || e.which;
        if (code == '9') {
            if (currentAutoComplete !== null) {
                var $this = $(this);
                $this.val(currentAutoComplete);
                $this.parent().children(".autocomplete-suggestion").remove();
            }
        }
    });

    $fields.focusout(function () {
        var $this = $(this);
        setTimeout(function () {
            $this.parent().children(".autocomplete-result").remove();
        }, 400);
    });

    $fields.attr("autocomplete", "off");
    $fields.parent().css({ "position": "relative" });

    function handleSearch($this, query) {
        $.getJSON("/api/search/autocomplete/" + encodeURIComponent(query), function (result) {
            if (query !== $this.val())
                return;
            
            var $ul = $this.parent().children(".autocomplete-result");
            if ($ul.length === 0) {
                $ul = $this.parent().append('<ul class="autocomplete-result"></ul>').children(".autocomplete-result");
            }

            $ul.html("");
            $ul.css({ "top": $this.outerHeight() + "px", "width": $this.outerWidth() + "px", "left": $this.position().left + "px" });

            var $span = $this.parent().children(".autocomplete-suggestion");
            if ($span.length === 0) {
                $span = $this.parent().append('<span class="autocomplete-suggestion"></ul>').children(".autocomplete-suggestion");
            }

            if (result.autoComplete && result.autoComplete !== "") {
                currentAutoComplete = result.autoComplete;

                $span.css({
                    "top": ($this.position().top + parseInt($this.css("border-top-width")) + parseInt($this.css("padding-top"))) + "px",
                    "height": $this.outerHeight() + "px",
                    "font-size": $this.css("font-size"),
                    "visibility": "hidden"
                });

                var width = $span.text(result.autoComplete.substr(0, query.length)).width();
                $span.text(result.autoComplete.substr(query.length, result.autoComplete.length - query.length));

                $span.css({
                    "left": ($this.position().left + parseInt($this.css("border-left-width")) + width + parseInt($this.css("padding-left")) + 1) + "px",
                    "visibility": ""
                });
            } else {
                currentAutoComplete = null;
                $span.remove();
            }

            result.hits.forEach(function (hit) {
                $ul.append('<li><a href="' + hit.url + '">' + hit.name + '</a></li>');
            });
        });
    }
});;
!function(){"use strict";const e={};const t=(Symbol("solid-proxy"),Symbol("solid-track")),n=(Symbol("solid-dev-component"),{equals:(e,t)=>e===t});let r=O;const o={owned:null,cleanups:null,context:null,owner:null},l={};var s=null;let i=null,a=null,u=null,c=null,d=0;const[f,h]=p(!1);function g(e,t){const n=a,r=s,l=0===e.length,i=l?o:{owned:null,cleanups:null,context:null,owner:void 0===t?r:t},u=l?e:()=>e((()=>m((()=>E(i)))));s=i,a=null;try{return C(u,!0)}finally{a=n,s=r}}function p(e,t){const r={value:e,observers:null,observerSlots:null,comparator:(t=t?Object.assign({},n,t):n).equals||void 0};return[k.bind(r),e=>("function"==typeof e&&(e=i&&i.running&&i.sources.has(r)?e(r.tValue):e(r.value)),$(r,e))]}function v(e,t,n){const r=D(e,t,!0,1);A(r)}function y(e,t,n){const r=D(e,t,!1,1);A(r)}function b(e,t,r){r=r?Object.assign({},n,r):n;const o=D(e,t,!0,0);return o.observers=null,o.observerSlots=null,o.comparator=r.equals||void 0,A(o),k.bind(o)}function m(e){if(null===a)return e();const t=a;a=null;try{return e()}finally{a=t}}function w(e){return null===s||(null===s.cleanups?s.cleanups=[e]:s.cleanups.push(e)),e}function _(e){const t=b(e),n=b((()=>B(t())));return n.toArray=()=>{const e=n();return Array.isArray(e)?e:null!=e?[e]:[]},n}let S;function k(){const e=i&&i.running;if(this.sources&&(!e&&this.state||e&&this.tState))if(!e&&1===this.state||e&&1===this.tState)A(this);else{const e=u;u=null,C((()=>M(this)),!1),u=e}if(a){const e=this.observers?this.observers.length:0;a.sources?(a.sources.push(this),a.sourceSlots.push(e)):(a.sources=[this],a.sourceSlots=[e]),this.observers?(this.observers.push(a),this.observerSlots.push(a.sources.length-1)):(this.observers=[a],this.observerSlots=[a.sources.length-1])}return e&&i.sources.has(this)?this.tValue:this.value}function $(e,t,n){let r=i&&i.running&&i.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(i){const r=i.running;(r||!n&&i.sources.has(e))&&(i.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&C((()=>{for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t],r=i&&i.running;r&&i.disposed.has(n)||((r&&!n.tState||!r&&!n.state)&&(n.pure?u.push(n):c.push(n),n.observers&&T(n)),r?n.tState=1:n.state=1)}if(u.length>1e6)throw u=[],new Error}),!1)}return t}function A(e){if(!e.fn)return;E(e);const t=s,n=a,r=d;a=s=e,x(e,i&&i.running&&i.sources.has(e)?e.tValue:e.value,r),i&&!i.running&&i.sources.has(e)&&queueMicrotask((()=>{C((()=>{i&&(i.running=!0),a=s=e,x(e,e.tValue,r),a=s=null}),!1)})),a=n,s=t}function x(e,t,n){let r;try{r=e.fn(t)}catch(t){return e.pure&&(i&&i.running?(e.tState=1,e.tOwned&&e.tOwned.forEach(E),e.tOwned=void 0):(e.state=1,e.owned&&e.owned.forEach(E),e.owned=null)),e.updatedAt=n+1,F(t)}(!e.updatedAt||e.updatedAt<=n)&&(null!=e.updatedAt&&"observers"in e?$(e,r,!0):i&&i.running&&e.pure?(i.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function D(e,t,n,r=1,l){const a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:s,context:null,pure:n};return i&&i.running&&(a.state=0,a.tState=r),null===s||s!==o&&(i&&i.running&&s.pure?s.tOwned?s.tOwned.push(a):s.tOwned=[a]:s.owned?s.owned.push(a):s.owned=[a]),a}function N(e){const t=i&&i.running;if(!t&&0===e.state||t&&0===e.tState)return;if(!t&&2===e.state||t&&2===e.tState)return M(e);if(e.suspense&&m(e.suspense.inFallback))return e.suspense.effects.push(e);const n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<d);){if(t&&i.disposed.has(e))return;(!t&&e.state||t&&e.tState)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,o=n[r+1];for(;(t=t.owner)&&t!==o;)if(i.disposed.has(t))return}if(!t&&1===e.state||t&&1===e.tState)A(e);else if(!t&&2===e.state||t&&2===e.tState){const t=u;u=null,C((()=>M(e,n[0])),!1),u=t}}}function C(e,t){if(u)return e();let n=!1;t||(u=[]),c?n=!0:c=[],d++;try{const t=e();return function(e){if(u&&(O(u),u=null),e)return;let t;if(i)if(i.promises.size||i.queue.size){if(i.running)return i.running=!1,i.effects.push.apply(i.effects,c),c=null,void h(!0)}else{const e=i.sources,n=i.disposed;c.push.apply(c,i.effects),t=i.resolve;for(const e of c)"tState"in e&&(e.state=e.tState),delete e.tState;i=null,C((()=>{for(const e of n)E(e);for(const t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)E(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}h(!1)}),!1)}const n=c;c=null,n.length&&C((()=>r(n)),!1),t&&t()}(n),t}catch(e){n||(c=null),u=null,F(e)}}function O(e){for(let t=0;t<e.length;t++)N(e[t])}function M(e,t){const n=i&&i.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){const o=e.sources[r];o.sources&&(!n&&1===o.state||n&&1===o.tState?o!==t&&(!o.updatedAt||o.updatedAt<d)&&N(o):(!n&&2===o.state||n&&2===o.tState)&&M(o,t))}}function T(e){const t=i&&i.running;for(let n=0;n<e.observers.length;n+=1){const r=e.observers[n];(!t&&!r.state||t&&!r.tState)&&(t?r.tState=2:r.state=2,r.pure?u.push(r):c.push(r),r.observers&&T(r))}}function E(e){let t;if(e.sources)for(;e.sources.length;){const t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){const e=r.pop(),o=t.observerSlots.pop();n<r.length&&(e.sourceSlots[o]=n,r[n]=e,t.observerSlots[n]=o)}}if(i&&i.running&&e.pure){if(e.tOwned){for(t=0;t<e.tOwned.length;t++)E(e.tOwned[t]);delete e.tOwned}j(e,!0)}else if(e.owned){for(t=0;t<e.owned.length;t++)E(e.owned[t]);e.owned=null}if(e.cleanups){for(t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}i&&i.running?e.tState=0:e.state=0,e.context=null}function j(e,t){if(t||(e.tState=0,i.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)j(e.owned[t])}function V(e){return e instanceof Error||"string"==typeof e?e:new Error("Unknown error")}function F(e){e=V(e);throw e}function B(e){if("function"==typeof e&&!e.length)return B(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=B(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function L(e,t){return function(t){let n;return y((()=>n=m((()=>(s.context={[e]:t.value},_((()=>t.children)))))),void 0),n}}const q=Symbol("fallback");function P(e){for(let t=0;t<e.length;t++)e[t]()}function H(e,t){return m((()=>e(t||{})))}function U(e){const n="fallback"in e&&{fallback:()=>e.fallback};return b(function(e,n,r={}){let o=[],l=[],s=[],i=0,a=n.length>1?[]:null;return w((()=>P(s))),()=>{let u,c,d=e()||[];return d[t],m((()=>{let e,t,n,h,p,v,y,b,m,w=d.length;if(0===w)0!==i&&(P(s),s=[],o=[],l=[],i=0,a&&(a=[])),r.fallback&&(o=[q],l[0]=g((e=>(s[0]=e,r.fallback()))),i=1);else if(0===i){for(l=new Array(w),c=0;c<w;c++)o[c]=d[c],l[c]=g(f);i=w}else{for(n=new Array(w),h=new Array(w),a&&(p=new Array(w)),v=0,y=Math.min(i,w);v<y&&o[v]===d[v];v++);for(y=i-1,b=w-1;y>=v&&b>=v&&o[y]===d[b];y--,b--)n[b]=l[y],h[b]=s[y],a&&(p[b]=a[y]);for(e=new Map,t=new Array(b+1),c=b;c>=v;c--)m=d[c],u=e.get(m),t[c]=void 0===u?-1:u,e.set(m,c);for(u=v;u<=y;u++)m=o[u],c=e.get(m),void 0!==c&&-1!==c?(n[c]=l[u],h[c]=s[u],a&&(p[c]=a[u]),c=t[c],e.set(m,c)):s[u]();for(c=v;c<w;c++)c in n?(l[c]=n[c],s[c]=h[c],a&&(a[c]=p[c],a[c](c))):l[c]=g(f);l=l.slice(0,i=w),o=d.slice(0)}return l}));function f(e){if(s[c]=e,a){const[e,t]=p(c);return a[c]=t,n(d[c],e)}return n(d[c])}}}((()=>e.each),e.children,n||void 0))}function Y(e){let t=!1;const n=e.keyed,r=b((()=>e.when),void 0,{equals:(e,n)=>t?e===n:!e==!n});return b((()=>{const o=r();if(o){const r=e.children,l="function"==typeof r&&r.length>0;return t=n||l,l?m((()=>r(o))):r}return e.fallback}),void 0,void 0)}function I(e){let t=!1,n=!1;const r=_((()=>e.children)),o=b((()=>{let e=r();Array.isArray(e)||(e=[e]);for(let t=0;t<e.length;t++){const r=e[t].when;if(r)return n=!!e[t].keyed,[t,r,e[t]]}return[-1]}),void 0,{equals:(e,n)=>e[0]===n[0]&&(t?e[1]===n[1]:!e[1]==!n[1])&&e[2]===n[2]});return b((()=>{const[r,l,s]=o();if(r<0)return e.fallback;const i=s.children,a="function"==typeof i&&i.length>0;return t=n||a,a?m((()=>i(l))):i}),void 0,void 0)}function z(e){return e}!function(e,t){const n=Symbol("context");L(n)}(),Object.create(null),Object.create(null);const G="_$DX_DELEGATE";function W(e,t,n){const r=document.createElement("template");if(r.innerHTML=e,t&&r.innerHTML.split("<").length-1!==t)throw`The browser resolved template HTML does not match JSX input:\n${r.innerHTML}\n\n${e}. Is your HTML properly formed?`;let o=r.content.firstChild;return n&&(o=o.firstChild),o}function X(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function J(e,t,n,r){if(void 0===n||r||(r=[]),"function"!=typeof t)return R(e,t,r,n);y((r=>R(e,t(),r,n)),r)}function K(e,t,n){const r=t.trim().split(/\s+/);for(let t=0,o=r.length;t<o;t++)e.classList.toggle(r[t],n)}function Q(t){const n=`$$${t.type}`;let r=t.composedPath&&t.composedPath()[0]||t.target;for(t.target!==r&&Object.defineProperty(t,"target",{configurable:!0,value:r}),Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return r||document}}),e.registry&&!e.done&&(e.done=!0,document.querySelectorAll("[id^=pl-]").forEach((e=>{for(;e&&8!==e.nodeType&&e.nodeValue!=="pl-"+t;){let t=e.nextSibling;e.remove(),e=t}e&&e.remove()})));r;){const e=r[n];if(e&&!r.disabled){const o=r[`${n}Data`];if(void 0!==o?e.call(r,o,t):e.call(r,t),t.cancelBubble)return}r=r._$host||r.parentNode||r.host}}function R(t,n,r,o,l){for(e.context&&!r&&(r=[...t.childNodes]);"function"==typeof r;)r=r();if(n===r)return r;const s=typeof n,i=void 0!==o;if(t=i&&r[0]&&r[0].parentNode||t,"string"===s||"number"===s){if(e.context)return r;if("number"===s&&(n=n.toString()),i){let e=r[0];e&&3===e.nodeType?e.data=n:e=document.createTextNode(n),r=te(t,r,o,e)}else r=""!==r&&"string"==typeof r?t.firstChild.data=n:t.textContent=n}else if(null==n||"boolean"===s){if(e.context)return r;r=te(t,r,o)}else{if("function"===s)return y((()=>{let e=n();for(;"function"==typeof e;)e=e();r=R(t,e,r,o)})),()=>r;if(Array.isArray(n)){const s=[],a=r&&Array.isArray(r);if(Z(s,n,r,l))return y((()=>r=R(t,s,r,o,!0))),()=>r;if(e.context){if(!s.length)return r;for(let e=0;e<s.length;e++)if(s[e].parentNode)return r=s}if(0===s.length){if(r=te(t,r,o),i)return r}else a?0===r.length?ee(t,s,o):function(e,t,n){let r=n.length,o=t.length,l=r,s=0,i=0,a=t[o-1].nextSibling,u=null;for(;s<o||i<l;)if(t[s]!==n[i]){for(;t[o-1]===n[l-1];)o--,l--;if(o===s){const t=l<r?i?n[i-1].nextSibling:n[l-i]:a;for(;i<l;)e.insertBefore(n[i++],t)}else if(l===i)for(;s<o;)u&&u.has(t[s])||t[s].remove(),s++;else if(t[s]===n[l-1]&&n[i]===t[o-1]){const r=t[--o].nextSibling;e.insertBefore(n[i++],t[s++].nextSibling),e.insertBefore(n[--l],r),t[o]=n[l]}else{if(!u){u=new Map;let e=i;for(;e<l;)u.set(n[e],e++)}const r=u.get(t[s]);if(null!=r)if(i<r&&r<l){let a,c=s,d=1;for(;++c<o&&c<l&&null!=(a=u.get(t[c]))&&a===r+d;)d++;if(d>r-i){const o=t[s];for(;i<r;)e.insertBefore(n[i++],o)}else e.replaceChild(n[i++],t[s++])}else s++;else t[s++].remove()}}else s++,i++}(t,r,s):(r&&te(t),ee(t,s));r=s}else if(n instanceof Node){if(e.context&&n.parentNode)return r=i?[n]:n;if(Array.isArray(r)){if(i)return r=te(t,r,o,n);te(t,r,null,n)}else null!=r&&""!==r&&t.firstChild?t.replaceChild(n,t.firstChild):t.appendChild(n);r=n}else console.warn("Unrecognized value. Skipped inserting",n)}return r}function Z(e,t,n,r){let o=!1;for(let l=0,s=t.length;l<s;l++){let s=t[l],i=n&&n[l];if(s instanceof Node)e.push(s);else if(null==s||!0===s||!1===s);else if(Array.isArray(s))o=Z(e,s,i)||o;else if("function"==typeof s)if(r){for(;"function"==typeof s;)s=s();o=Z(e,Array.isArray(s)?s:[s],Array.isArray(i)?i:[i])||o}else e.push(s),o=!0;else{const t=String(s);"<!>"===t?i&&8===i.nodeType&&e.push(i):i&&3===i.nodeType?(i.data=t,e.push(i)):e.push(document.createTextNode(t))}}return o}function ee(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function te(e,t,n,r){if(void 0===n)return e.textContent="";const o=r||document.createTextNode("");if(t.length){let r=!1;for(let l=t.length-1;l>=0;l--){const s=t[l];if(o!==s){const t=s.parentNode===e;r||l?t&&s.remove():t?e.replaceChild(o,s):e.insertBefore(o,n)}else r=!0}}else e.insertBefore(o,n);return[o]}function ne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const r=[];if(e<=0)throw new TypeError("count expects a positive integer");if(n<=0)throw new TypeError("step expects a positive integer");for(let o=0;o<e;o+=n)r.push(t+o);return r}function re(e){return e.toISOString().slice(0,10)}function oe(e,t,n){return new Date(Date.UTC(e,t-1,n))}function le(e,t){return oe(e,t+1,0).getDate()}function se(e,t,n){return n.map((n=>re(oe(e,t,n))))}function ie(e){return e[0].toUpperCase()+e.substring(1)}function ae(e){return new Promise((t=>{setTimeout((()=>t()),e)}))}function ue(e,t){const[n,r]=p(e,t);return function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return 1===t.length?r((()=>t[0])):n()}}new Map;const ce=W('<button type="button" class="citybreak__calendar-day"></button>',2),de=W('<div class="citybreak__calendar"><div class="citybreak__calendar-controls"><button type="button" aria-label="Föregående månad" title="Föregående månad" class="citybreak__calendar-control"><svg stroke="currentColor" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M19 12H5m7 7-7-7 7-7"></path></svg></button><span class="citybreak__calendar-header"></span><button type="button" aria-label="Nästa månad" title="Nästa månad" class="citybreak__calendar-control"><svg stroke="currentColor" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M5 12h14m-7-7 7 7-7 7"></path></svg></button></div><div class="citybreak__calendar-body"><div class="citybreak__calendar-weekdays"></div><div class="citybreak__calendar-days"></div></div></div>',24),fe=W('<span class="citybreak__calendar-weekday"></span>',2),he=Intl.DateTimeFormat("sv-SE",{month:"long",year:"numeric"});var ge=e=>{const t=function(e){const t=oe(1970,1,1),n=t.getDay()+1;n>0&&t.setDate(n);const r=[];for(let e=0;e<7;e++)r.push(t.toLocaleDateString("sv-SE",{weekday:"long"})),t.setDate(1+t.getDate());return r}().map((e=>ie(e.substring(0,3)))),n=b((()=>ie(he.format(oe(e.year,e.month,1))))),r=b((()=>function(e,t){const n=function(e){return(e.getDay()+6)%7}(oe(e,t,1)),r=[];if(n>0){const o=ne(n,le(e,t-1)-n+1);r.push(...se(e,t-1,o))}const o=le(e,t);r.push(...se(e,t,ne(o,1)));const l=r.length%7;if(l>0){const n=ne(7-l,1);r.push(...se(e,t+1,n))}return r}(e.year,e.month))),o=b((()=>{const t=oe(e.year,e.month-1,1),n=new Date;return t>=oe(n.getFullYear(),n.getMonth()+1,1)}));function l(){const t=oe(e.year,e.month+1,1),n={year:t.getFullYear(),month:1+t.getMonth()};e?.onNext?.(n)}function s(){if(!o())return;const t=oe(e.year,e.month-1,1),n={year:t.getFullYear(),month:1+t.getMonth()};e?.onPrev?.(n)}function i(t){const r=new Date(t),o=r.getFullYear()!=e.year||r.getMonth()!=e.month-1,l=e.activeDates.includes(t),s=e.selectedDate==r.getDate(),i={"citybreak__calendar-day--is-selected":!o&&s,"citybreak__calendar-day--is-active":!o&&l,"citybreak__calendar-day--is-transitive":o};function a(){e.onSelect(r.getDate())}return(()=>{const e=ce.cloneNode(!0);return e.$$click=a,e.disabled=!l,J(e,H(Y,{when:!o,get children(){return r.getDate()}})),y((t=>{const o=`Välj ${r.getDate()} den ${n()}`,l=`Välj ${r.getDate()} den ${n()}`,s=i;return o!==t._v$&&X(e,"aria-label",t._v$=o),l!==t._v$2&&X(e,"title",t._v$2=l),t._v$3=function(e,t,n={}){const r=Object.keys(t||{}),o=Object.keys(n);let l,s;for(l=0,s=o.length;l<s;l++){const r=o[l];r&&"undefined"!==r&&!t[r]&&(K(e,r,!1),delete n[r])}for(l=0,s=r.length;l<s;l++){const o=r[l],s=!!t[o];o&&"undefined"!==o&&n[o]!==s&&s&&(K(e,o,!0),n[o]=s)}return n}(e,s,t._v$3),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0}),e})()}return(()=>{const e=de.cloneNode(!0),a=e.firstChild,u=a.firstChild,c=u.nextSibling,d=c.nextSibling,f=a.nextSibling.firstChild,h=f.nextSibling;return u.$$click=s,J(c,n),d.$$click=l,J(f,(()=>t.map((e=>(()=>{const t=fe.cloneNode(!0);return J(t,e),t})())))),J(h,(()=>r().map(i))),y((()=>u.disabled=!o())),e})()};!function(e,t=window.document){const n=t[G]||(t[G]=new Set);for(let r=0,o=e.length;r<o;r++){const o=e[r];n.has(o)||(n.add(o),t.addEventListener(o,Q))}}(["click"]);const pe=W('<img class="citybreak__event-image">',1),ve=W('<li class="citybreak__event"><a class="citybreak__event-link"><div class="citybreak__event-body"><h3 class="citybreak__event-header"></h3><p class="citybreak__event-description"></p></div></a></li>',10);var ye=e=>(()=>{const t=ve.cloneNode(!0),n=t.firstChild,r=n.firstChild,o=r.firstChild,l=o.nextSibling;return J(n,H(Y,{get when(){return e.product.mediaUrl},get children(){const t=pe.cloneNode(!0);return y((n=>{const r=e.product.mediaUrl,o=e.product.mediaName,l=e.product.mediaName,s=e.product.mediaName;return r!==n._v$&&X(t,"src",n._v$=r),o!==n._v$2&&X(t,"alt",n._v$2=o),l!==n._v$3&&X(t,"title",n._v$3=l),s!==n._v$4&&X(t,"aria-label",n._v$4=s),n}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),t}}),r),J(o,(()=>e.product.name)),J(l,(()=>{return null==(t=e.product.ingress)?"":t.length<=150?t:`${t.substring(0,150).trim()}...`;var t})),y((t=>{const r=e.product.url,o=e.product.name,l=e.product.name;return r!==t._v$5&&X(n,"href",t._v$5=r),o!==t._v$6&&X(n,"title",t._v$6=o),l!==t._v$7&&X(n,"aria-label",t._v$7=l),t}),{_v$5:void 0,_v$6:void 0,_v$7:void 0}),t})();const be=W('<ul class="citybreak__events"></ul>',2),me=W("<p>Error fetching data!</p>",2),we=W('<div class="citybreak__widget"></div>',2),_e=W("<p>Laddar...</p>",2),Se=W("<li>Finns inga händelser för valt datum</li>",2);async function ke(e){const t=await async function(e,t){return(await Promise.all([t,ae(2e3)]))[0]}(0,fetch(`/api/citybreak/events?period=${e}`,{method:"GET",headers:{Accept:"application/json"}}));if(!t.ok)throw new Error(`Error fetching data, got status ${t.status} ${t.statusText}`);return(await t.json())?.map((e=>({id:e.id,url:e.url,name:e.name,description:e.description,ingress:e.ingress,mediaUrl:e.mediaUrl,mediaName:e.mediaName,start:new Date(e.start),end:new Date(e.end)})))??[]}const $e=()=>{const t=new Date,n=ue(t.getFullYear()),r=ue(1+t.getMonth()),o=ue(null),[s]=function(t,n,r){let o,s,u;2===arguments.length&&"object"==typeof n||1===arguments.length?(o=!0,s=t,u=n||{}):(o=t,s=n,u=r||{});let c=null,d=l,f=null,h=!1,g=!1,y="initialValue"in u,w="function"==typeof o&&b(o);const _=new Set,[k,$]=(u.storage||p)(u.initialValue),[A,x]=p(void 0),[D,N]=p(void 0,{equals:!1}),[O,M]=p(y?"ready":"unresolved");if(e.context){let t;f=`${e.context.id}${e.context.count++}`,"initial"===u.ssrLoadFrom?d=u.initialValue:e.load&&(t=e.load(f))&&(d=t[0])}function T(e,t,n,r){return c===e&&(c=null,y=!0,e!==d&&t!==d||!u.onHydrated||queueMicrotask((()=>u.onHydrated(r,{value:t}))),d=l,i&&e&&h?(i.promises.delete(e),h=!1,C((()=>{i.running=!0,E(t,n)}),!1)):E(t,n)),t}function E(e,t){C((()=>{void 0===t&&$((()=>e)),M(void 0!==t?"errored":"ready"),x(t);for(const e of _.keys())e.decrement();_.clear()}),!1)}function j(){const e=S,t=k(),n=A();if(void 0!==n&&!c)throw n;return a&&!a.user&&e&&v((()=>{D(),c&&(e.resolved&&i&&h?i.promises.add(c):_.has(e)||(e.increment(),_.add(e)))})),t}function F(e=!0){if(!1!==e&&g)return;g=!1;const t=w?w():o;if(h=i&&i.running,null==t||!1===t)return void T(c,m(k));i&&c&&i.promises.delete(c);const n=d!==l?d:m((()=>s(t,{value:k(),refetching:e})));return"object"==typeof n&&n&&"then"in n?(c=n,g=!0,queueMicrotask((()=>g=!1)),C((()=>{M(y?"refreshing":"pending"),N()}),!1),n.then((e=>T(n,e,void 0,t)),(e=>T(n,void 0,V(e),t)))):(T(c,n,void 0,t),n)}return Object.defineProperties(j,{state:{get:()=>O()},error:{get:()=>A()},loading:{get(){const e=O();return"pending"===e||"refreshing"===e}},latest:{get(){if(!y)return j();const e=A();if(e&&!c)throw e;return k()}}}),w?v((()=>F(!1))):F(!1),[j,{refetch:F,mutate:$}]}((()=>{let e=r().toString();return 1==e.length&&(e=`0${e}`),`${n()}-${e}`}),ke),u=b((()=>{const e=s();return null==e?[]:(t=e.map((e=>re(e.start)))).filter(((e,n)=>t.indexOf(e)==n));var t})),c=b((()=>s()?.filter((e=>{return t=e.start,o=new Date(n(),r()-1,d()??1),t.getFullYear()===o.getFullYear()&&t.getMonth()===o.getMonth()&&t.getDate()==o.getDate();var t,o}))??[])),d=b((()=>{if(s.loading)return null;const e=o();re(t),re(new Date(n(),r()-1,1));let l=u().map((e=>Number.parseInt(e.split("-")[2]))).sort(((e,t)=>e-t));return null==e?(t.getFullYear()==n()&&t.getMonth()==r()-1&&(l=l.filter((e=>e>=t.getDate()))),l[0]):e}));function f(e){n(e.year),r(e.month),o(null)}return(()=>{const e=we.cloneNode(!0);return J(e,H(ge,{get year(){return n()},get month(){return r()},get activeDates(){return u()},get selectedDate(){return d()},onSelect:o,onNext:f,onPrev:f}),null),J(e,H(I,{get fallback(){return _e.cloneNode(!0)},get children(){return[H(z,{get when(){return"ready"==s.state},get children(){const e=be.cloneNode(!0);return J(e,H(U,{get each(){return c()},get fallback(){return Se.cloneNode(!0)},children:e=>H(ye,{product:e})})),e}}),H(z,{get when(){return"errored"==s.state},get children(){return me.cloneNode(!0)}})]}}),null),e})()};var Ae;Ae=()=>{const e="cityBreakCalendarWidget"?.length?document.getElementById("cityBreakCalendarWidget"):null;null!=e&&function(e,t,n,r={}){let o;g((r=>{o=r,t===document?e():J(t,e(),t.firstChild?null:void 0,n)}),r.owner)}((()=>H($e,{})),e)},"loading"!=document.readyState?Ae():document.addEventListener("DOMContentLoaded",Ae)}();;
