function getUrl(){var a=window.location.pathname,b=a.indexOf("/"),c=a.indexOf("/",b+1);return c>-1&&b!=c?a.substring(b+1,c):a.substring(1)}function init_vackert_vader(){if($("#setCookie").length){var a=$("#setCookie").attr("value");$.cookie("vvlastvisited_camp",a,{expires:999})}$("#setStartPlace").click(function(){return $("#dialog").dialog({height:400,resizable:!1,width:600,position:["center",140],closeOnEscape:!0,draggable:!1,buttons:{"Stäng":function(){$(this).dialog("close")}}}),!1}),$("#setCookie").click(function(){var a=$(this).attr("value"),b=$(this).attr("msg");$("#setCookie").html(b).css("fontWeight","bold").css("textDecoration","none"),$.cookie("vvstartpage_camp",a,{expires:999})}),$("#clearCookie").click(function(){$.cookie("vvstartpage_camp",null);var a=$(this).attr("msg");$("#clearCookie").html(a).css("fontWeight","bold").css("textDecoration","none")}),$("#view_five_days").click(function(){return $(".next_five_days").toggle(),$("#hide_five_days").hide(),$("#hide_ten_days").show(),!1}),$("#view_ten_days").click(function(){return $(".next_five_days").toggle(),$("#hide_ten_days").hide(),$("#hide_five_days").show(),!1}),$(".clickable, .forecast_clickable").click(function(){return window.location=$(this).attr("url"),!1}),$("input:submit","#header_search,#sendButtonFacebook").button()}$(function(a){a("#location").autocomplete({source:function(b,c){a.ajax({url:"http://themes-api-cedar.herokuapp.com/locations/find_locations",dataType:"jsonp",data:{limit:15,theme:"camp",location:b.term},success:function(d){var e=jQuery.parseJSON('{"geoname":{"name":"Visa alla träffar på '+b.term+'","url":"search/'+b.term+'"}}');d.geonames.push(e),c(a.map(d.geonames,function(c){return{label:c.geoname.name.toString().replace(new RegExp("("+a.ui.autocomplete.escapeRegex(b.term)+")","gi"),"<strong>$1</strong>"),value:c.geoname.name,state:c.geoname.state,city:c.geoname.city,url:c.geoname.url}}))}})},minLength:2,delay:100,select:function(a,b){location.href="/"+b.item.url},focus:function(a,b){this.value=b.item.value},open:function(b,c){a(this).removeClass("ui-corner-all").addClass("ui-corner-top")},close:function(){a(this).removeClass("ui-corner-top").addClass("ui-corner-all")}}).data("autocomplete")._renderItem=function(b,c){var d=null;return d="<a>"+c.label+"</a>",a("<li></li>").data("item.autocomplete",c).append(d).appendTo(b)},a("#autocomplete").submit(function(){if(a("#location").attr("value").length==0||a("#location").attr("value").indexOf(".")>-1)return!1})}),$(document).ready(function(){init_vackert_vader()}),jQuery.cookie=function(a,b,c){if(arguments.length>1&&(b===null||typeof b!="object")){c=jQuery.extend({},c),b===null&&(c.expires=-1);if(typeof c.expires=="number"){var d=c.expires,e=c.expires=new Date;e.setDate(e.getDate()+d)}return document.cookie=[encodeURIComponent(a),"=",c.raw?String(b):encodeURIComponent(String(b)),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+c.domain:"",c.secure?"; secure":""].join("")}c=b||{};var f,g=c.raw?function(a){return a}:decodeURIComponent;return(f=(new RegExp("(?:^|; )"+encodeURIComponent(a)+"=([^;]*)")).exec(document.cookie))?g(f[1]):null}
