﻿function initNavig(){var e=document.getElementById("navigation"),r,f,t,n,o,u,i;if(e)for(r=e.getElementsByTagName("li"),n=0;n<r.length;n++)r[n].getElementsByTagName("ul").length&&r[n].parentNode.id=="navigation"&&(f=r[n].getElementsByTagName("a").item(0),f&&(f.onclick=function(){var n=this.parentNode;return n.className.indexOf("active")!=-1?n.className=n.className.replace("active",""):n.className+=" active",!1}));for(t=document.getElementsByTagName("div"),n=0;n<t.length;n++){t[n].className.indexOf("kontakt")!=-1&&(o=t[n].getElementsByTagName("h2")[0],o.onclick=function(){this.parentNode.className.indexOf("close")!=-1?this.parentNode.className=this.parentNode.className.replace("close",""):this.parentNode.className+=" close"});if(t[n].className.indexOf("info-3")!=-1)for(u=t[n].getElementsByTagName("a"),i=0;i<u.length;i++)u[i].className.indexOf("specification")!=-1&&(u[i].onclick=function(){return this.parentNode.className.indexOf("close")!=-1?(this.parentNode.className=this.parentNode.className.replace("close",""),this.innerHTML="Begrens produktspesifikasjon"):(this.parentNode.className+=" close",this.innerHTML="Utvid produktspesifikasjon"),!1})}}function initKontakt(){for(var t=document.getElementsByTagName("div"),i,n=0;n<t.length;n++)t[n].className.indexOf("kontakt")!=-1&&(i=t[n].getElementsByTagName("h2")[0],i.parentNode.className+=" close")}function initSpecification(){for(var i=document.getElementsByTagName("a"),t,n=0;n<i.length;n++)i[n].className.indexOf("specification")!=-1&&(t=i[n],t.parentNode.className+=" close",t.innerHTML="Utvid produktspesifikasjon")}function initNavig2(){var r=document.getElementById("navigation2"),t,n,i;if(r)for(t=r.getElementsByTagName("li"),n=0;n<t.length;n++)t[n].getElementsByTagName("ul").length&&t[n].parentNode.id=="navigation2"&&(i=t[n].getElementsByTagName("a").item(0),i&&(i.onclick=function(){var n=this.parentNode;return n.className.indexOf("active")!=-1?n.className=n.className.replace("active",""):n.className+=" active",!1}))}function changeLayout(n){$(".ProductItemList").hide(),$(n).show()}function SaveCookieInformation(n,t){var i=new Date;i.setTime(i.getTime()+12e5),$.cookie(COOKIE_NAME,n,{expires:i}),$.cookie(ADDITIONAL_COOKIE_NAME,t,{expires:i})}var Site;jQuery.cookie=function(n,t,i){var e,r,f,u;return arguments.length>1&&String(t)!=="[object Object]"?(i=jQuery.extend({},i),(t===null||t===undefined)&&(i.expires=-1),typeof i.expires=="number"&&(e=i.expires,r=i.expires=new Date,r.setDate(r.getDate()+e)),t=String(t),document.cookie=[encodeURIComponent(n),"=",i.raw?t:encodeURIComponent(t),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")):(i=t||{},u=i.raw?function(n){return n}:decodeURIComponent,(f=new RegExp("(?:^|; )"+encodeURIComponent(n)+"=([^;]*)").exec(document.cookie))?u(f[1]):null)},window.addEventListener?(window.addEventListener("load",initNavig,!1),window.addEventListener("load",initNavig2,!1),window.addEventListener("load",initKontakt,!1),window.addEventListener("load",initSpecification,!1)):window.attachEvent&&(window.attachEvent("onload",initNavig),window.attachEvent("onload",initNavig2),window.attachEvent("onload",initKontakt),window.attachEvent("onload",initSpecification)),$(".datepicker").change(function(){$(".hafslund-status")&&$(".hafslund-status").val("Avtalt befaring"),$(".hafslund-installation")&&$(".hafslund-installation").val("Send ordre til ABK")}),$(".hafslund-installation").change(function(){var n=$(this).val();n==="Send ordre til ABK"?($("#extras").show(),$("#documents").show()):($("#extras").hide(),$("#documents").hide())}),jQuery.ui&&jQuery.ui.tabs&&$("#overview").tabs(),jQuery.ui&&jQuery.ui.datepicker&&$(".datepicker").datepicker({dateFormat:"dd.mm.yy"}),jQuery.tablesorter&&$("#overview table").tablesorter();var COOKIE_NAME="0",ADDITIONAL_COOKIE_NAME="selected_panel",LUFTLUFT_COOKIE_NAME="luftluft",selectedPane=$.cookie(COOKIE_NAME),selectedPanel=$.cookie(ADDITIONAL_COOKIE_NAME),activePane;activePane=selectedPane==null?0:parseInt(selectedPane),jQuery.accordion&&$("#accordion").accordion({clearStyle:!0,active:activePane,autoheight:!1}),selectedPanel!==undefined&&selectedPanel!=null&&$(selectedPanel).show(),$("#accordion a").click(function(){var n=$(this).attr("id");switch(n){case"bedrift":changeLayout("#bedrift-container"),SaveCookieInformation("3","#bedrift-container");break;case"luft-vann":changeLayout("#luft-vann-container"),SaveCookieInformation("1","#luft-vann-container");break;case"luft-luft":changeLayout("#luft-luft-container"),SaveCookieInformation("0","#luft-luft-container");break;case"veske-vann":changeLayout("#veske-vann-container"),SaveCookieInformation("2","#veske-vann-container")}}),jQuery.fancybox&&($("a.gallery").fancybox({hideOnContentClick:!1,width:680,height:520}),$("a#inline").fancybox({hideOnContentClick:!1,width:272,height:288}),$("a.video").fancybox({hideOnContentClick:!0}),$("a.iframe").fancybox({hideOnContentClick:!1,width:550,height:490})),Site={init:function(){Site.googleAnalyticsInit()},googleAnalyticsInit:function(){$(".trackPageView").live("click",function(){var t=$(this).attr("data-page");_gaq.push(["_trackPageview",""+t+""])})}},Site.init()
