varN2=function(){functiona(a,b){varc=this;this.lang="en",b.lang&&(this.lang=b.lang.replace(/#/g,"")),b.langdata&&(this.langData=b.langdata),1==this.showSearch,1==this.showHelp,1==this.showLanguage,1==this.showUser,1==this.showNavigation,b.showSearch&&(this.showSearch=b.showSearch),b.showLanguage&&(this.showLanguage=b.showLanguage),b.showHelp&&(this.showHelp=b.showHelp),b.showUser&&(this.showUser=b.showUser),b.showNavigation&&(this.showNavigation=b.showNavigation),this.userUrl="/",b.user&&(this.user=b.user,this.user.url&&(this.userUrl=this.user.url)),b.navigation&&(this.navigation=b.navigation),c.langData?c.setup(c.langData.tTitle,a):reqwest({url:"lang/navigation."+c.lang+".json",method:"get",type:"json",success:function(b){c.langData=b,c.setup(c.langData.tTitle,a)}})}returna.prototype.setup=function(a,b){varc=this;c.navDiv=document.getElementById(b);vard=L.DomUtil.create("nav","uk-navbar",c.navDiv),e=L.DomUtil.create("a","",L.DomUtil.create("li","",L.DomUtil.create("ul","uk-navbar-nav",d)));e.href="/",L.DomUtil.create("span","uk-icon-arrow-left",e);L.DomUtil.create("a","",L.DomUtil.create("li","",L.DomUtil.create("ul","uk-navbar-nav",d)));e.href="/",L.DomUtil.create("span","uk-icon-arrow-left",e);varf=L.DomUtil.create("div","uk-navbar-flip",d),g=L.DomUtil.create("ul","uk-navbar-nav uk-hidden-small",f);if(c.showNavigation&&c.navigation){varh=L.DomUtil.create("li","uk-parent",g);h.setAttribute("data-uk-dropdown","{mode:'click'}");vari=L.DomUtil.create("a","",h);i.textContent="Navigation";varj=L.DomUtil.create("div","uk-dropdown uk-dropdown-navbar uk-dropdown-bottom",h),k=L.DomUtil.create("ul","uk-nav uk-nav-navbar",j);for(varlinc.navigation)if(c.navigation.hasOwnProperty(l)){varm=L.DomUtil.create("a","",L.DomUtil.create("li","",k));m.textContent=l,m.href=c.navigation[l]}}if(c.showHelp){varn=L.DomUtil.create("a","",L.DomUtil.create("li","",g));n.textContent="Help",n.href="#help",n.setAttribute("data-uk-modal","{target:'#help'}");varo=L.DomUtil.create("div","uk-modal",c.navDiv);o.id="help";varp=L.DomUtil.create("div","uk-modal-dialog uk-modal-dialog-large",o),q=(L.DomUtil.create("a","uk-modal-close uk-close",p),L.DomUtil.create("div","uk-modal-header",p)),r=L.DomUtil.create("h2","",q);r.textContent="Help & Support";vars=L.DomUtil.create("p","navigation-help-smallfont",p);s.textContent="To provide the best experience possible, we provide several reasources to assist you";vart=L.DomUtil.create("div","uk-grid uk-grid-match",p);t.setAttribute("data-uk-grid-match","{target:'.uk-panel'}");varu=L.DomUtil.create("div","uk-panel uk-panel-header uk-margin-bottom",L.DomUtil.create("div","uk-width-medium-1-4",t)),v=L.DomUtil.create("h3","uk-panel-title",u);v.textContent="Interactive Guides";varw=L.DomUtil.create("p","navigation-help-smallfont navigation-help-txt",u);w.textContent="An interactive guide shows the basics on how to fill out a feature or performing a task. Start the interactive guide quickly learn how Seatrack Web works. ";varx=L.DomUtil.create("button","uk-button navigation-help-button",u);x.textContent="Start Interactive Guide";vary=L.DomUtil.create("div","uk-panel uk-panel-header uk-margin-bottom",L.DomUtil.create("div","uk-width-medium-1-4",t)),z=L.DomUtil.create("h3","uk-panel-title",y);z.textContent="Prompts ";varA=(L.DomUtil.create("span","uk-icon-info-circle",z),L.DomUtil.create("p","navigation-help-smallfont navigation-help-txt",y));A.innerHTML="Anywhere you see a <span class='uk-icon-info-circle'></span> in the application you can click it to see a short explanation of the option or feature it refers to. These are great for a quick reminder of how a feature works.";varB=L.DomUtil.create("div","uk-panel uk-panel-header uk-margin-bottom",L.DomUtil.create("div","uk-width-medium-1-4",t)),C=L.DomUtil.create("h3","uk-panel-title",B);C.textContent="Classic documentation";varD=L.DomUtil.create("p","navigation-help-smallfont navigation-help-txt",B);D.textContent="The classic documentation is the equivalent to a User Manual. This document describes parts of Seatrack Web in depth and is printable or accessable on the web. ";varE=L.DomUtil.create("button","uk-button navigation-help-button",B);E.textContent="Open documentation";varF=L.DomUtil.create("div","uk-panel uk-panel-header uk-margin-bottom",L.DomUtil.create("div","uk-width-medium-1-4",t)),G=L.DomUtil.create("h3","uk-panel-title",F);G.textContent="In Depth";varH=L.DomUtil.create("p","navigation-help-smallfont navigation-help-txt",F);H.textContent="When the need for deeper understanding arises, look into our in depth sections for behind the scenes explanations.";varI=L.DomUtil.create("button","uk-button navigation-help-button",F);I.textContent="Open documentation";varJ=L.DomUtil.create("div","uk-modal-footer",p),K=L.DomUtil.create("p","navigation-help-smallfont",J);K.innerHTML='We continually strive to improve the experiences of our products, please feel welcome to send any feed-back to <a href="mailto:seatrackweb@smhi.se"><span class="uk-icon-envelope"></span> seatrackweb@smhi.se</a>'}if(c.showLanguage){varM=L.DomUtil.create("li","uk-parent",g);M.setAttribute("data-uk-dropdown","{mode:'click'}");varN=L.DomUtil.create("a","",M),O=L.DomUtil.create("span","uk-icon-language",N);O.textContent=" Language";varP=L.DomUtil.create("div","uk-dropdown uk-dropdown-navbar uk-dropdown-bottom",M),Q=L.DomUtil.create("ul","uk-nav uk-nav-navbar",P),R=L.DomUtil.create("a","",L.DomUtil.create("li","",Q));R.textContent="English";varS=L.DomUtil.create("a","",L.DomUtil.create("li","",Q));S.textContent="العربية",R.onclick=function(){window.location.search=c.getSearchUrl("language","en")},S.onclick=function(){window.location.search=c.getSearchUrl("language","ar")}}if(c.user&&c.showUser){varT=L.DomUtil.create("li","uk-parent",g);T.setAttribute("data-uk-dropdown","{mode:'click'}");varU=L.DomUtil.create("a","",T),V=(L.DomUtil.create("span","uk-icon-user",U),L.DomUtil.create("div","uk-dropdown uk-dropdown-navbar uk-dropdown-bottom",T)),W=L.DomUtil.create("ul","uk-nav uk-nav-navbar",V);c.largeUserSpan=L.DomUtil.create("span","",L.DomUtil.create("li","uk-nav-header",W)),c.largeUserLogin=L.DomUtil.create("a","",L.DomUtil.create("li","",W)),c.largeUserLogin.textContent=c.langData.tLogin,c.largeUserLogin.onclick=function(){c.login()},c.largeUserLogout=L.DomUtil.create("a","",L.DomUtil.create("li","",W)),c.largeUserLogout.textContent=c.langData.tLogout,c.largeUserLogout.onclick=function(){c.logout()}}varX=L.DomUtil.create("ul","uk-navbar-nav uk-visible-small",f),Y=L.DomUtil.create("li","uk-parent",X);Y.setAttribute("data-uk-dropdown","{mode:'click'}");varZ=(L.DomUtil.create("a","uk-navbar-toggle",Y),L.DomUtil.create("div","uk-dropdown uk-dropdown-navbar uk-dropdown-bottom",Y)),$=L.DomUtil.create("ul","uk-nav uk-nav-navbar",Z);if(c.showNavigation&&c.navigation){var_=L.DomUtil.create("li","uk-nav-header",$),aa=L.DomUtil.create("span","",_);aa.textContent="Navigation";for(varlinc.navigation)if(c.navigation.hasOwnProperty(l)){varm=L.DomUtil.create("a","",L.DomUtil.create("li","",$));m.textContent=l,m.href=c.navigation[l]}}if(c.showHelp){varba=L.DomUtil.create("li","uk-nav-header",$),ca=L.DomUtil.create("span","",ba);ca.textContent="Help";varda=L.DomUtil.create("a","",L.DomUtil.create("li","",$));da.textContent="Help",da.href="#help",da.setAttribute("data-uk-modal","{target:'#help'}")}if(c.showLanguage){varea=L.DomUtil.create("li","uk-nav-header",$),fa=L.DomUtil.create("span","uk-icon-language",ea);fa.textContent=" Language";varga=L.DomUtil.create("a","",L.DomUtil.create("li","",$));ga.textContent="English";varha=L.DomUtil.create("a","",L.DomUtil.create("li","",$));ha.textContent="العربية",ga.onclick=function(){window.location.search=c.getSearchUrl("language","en")},ha.onclick=function(){window.location.search=c.getSearchUrl("language","ar")}}if(c.user&&c.showUser){L.DomUtil.create("li","uk-nav-header",$);c.smallUserSpan=L.DomUtil.create("span","uk-icon-user",L.DomUtil.create("li","uk-nav-header",$)),c.smallUserLogin=L.DomUtil.create("a","",L.DomUtil.create("li","",$)),c.smallUserLogin.textContent=c.langData.tLogin,c.smallUserLogin.onclick=function(){c.login()},c.smallUserLogout=L.DomUtil.create("a","",L.DomUtil.create("li","",$)),c.smallUserLogout.textContent=c.langData.tLogout,c.smallUserLogout.onclick=function(){c.logout()},c.login()}},a.prototype.login=function(){vara=this;a.user&&a.user.id?(a.smallUserSpan.textContent=""+a.user.name+" ("+a.user.id+")",a.smallUserLogin.style.display="none",a.smallUserLogout.style.display="block",a.largeUserSpan.textContent=""+a.user.name+" ("+a.user.id+")",a.largeUserLogin.style.display="none",a.largeUserLogout.style.display="block"):reqwest({url:a.userUrl+"/login",method:"get",type:"json",success:function(b){a.user=JSON.parse(b),a.smallUserSpan.textContent=""+a.user.name+" ("+a.user.id+")",a.smallUserLogin.style.display="none",a.smallUserLogout.style.display="block",a.largeUserSpan.textContent=""+a.user.name+" ("+a.user.id+")",a.largeUserLogin.style.display="none",a.largeUserLogout.style.display="block"}})},a.prototype.logout=function(){vara=this;reqwest({url:a.userUrl+"/logout",method:"get",success:function(b){a.user=null,a.smallUserSpan.textContent="",a.smallUserLogin.style.display="block",a.smallUserLogout.style.display="none",a.largeUserSpan.textContent="",a.largeUserLogin.style.display="block",a.largeUserLogout.style.display="none"}})},a.prototype.getSearchUrl=function(a,b){for(varc,d=/\+/g,e=/([^&=]+)=?([^&]*)/g,f=function(a){returndecodeURIComponent(a.replace(d,""))},g=window.location.search.substring(1),h=[];c=e.exec(g);)h.push(),h[h.length]=[f(c[1]),f(c[2])];if(0==h.length)return"?"+a+"="+b;for(vari=!1,j=0;j<h.length;j++)h[j][0]==a&&(h[j][1]=b,i=!0);i||(h.push(),h[h.length]=[a,b]);for(vark="?",j=0;j<h.length;j++)j>0&&(k+="&"),k+=h[j][0]+"="+h[j][1];returnk},a}(),Navigation=function(){functiona(a,b){b.playerLink&&(this.playerLink=b.playerLink),b.playerLinkFn&&(this.playerLinkFn=b.playerLinkFn),b.inputLink&&(this.inputLink=b.inputLink),b.inputLinkFn&&(this.inputLinkFn=b.inputLinkFn),b.aisLink&&(this.aisLink=b.aisLink),b.aisLinkFn&&(this.aisLinkFn=b.aisLinkFn),b.graphLink&&(this.graphLink=b.graphLink),b.graphLinkFn&&(this.graphLinkFn=b.graphLinkFn),b.simulationLink&&(this.simulationLink=b.simulationLink),b.simulationLinkFn&&(this.simulationLinkFn=b.simulationLinkFn),b.userLink&&(this.userLink=b.userLink),b.languageLink&&(this.languageLink=b.languageLink),b.generalLinkArray&&(this.generalLinkArray=b.generalLinkArray),this.lang="en",b.lang&&(this.lang=b.lang.replace(/#/g,"")),b.langdata&&(this.langData=b.langdata),b.doneFn&&(this.doneFn=b.doneFn);varc=this;c.langData?c.setup(c.langData.tTitle,a):reqwest({url:"lang/navigation."+c.lang+".json",method:"get",type:"json",success:function(b){c.langData=b,c.setup(title,a)}})}returna.prototype.setup=function(a,b){varc=this;c.navDiv=document.getElementById(b),c.navDiv.className="navigationbar navigationbar-fixed-top navigation",c.addNavigation(a),c.doneFn&&c.doneFn()},a.prototype.addUser=function(a,b,c){vard=document.createElement("li"),e=document.createElement("span");e.id=c,e.appendChild(document.createTextNode(b)),e.style.position="relative";varf=document.createElement("img");f.src="images/user.png",f.className="userImg",e.appendChild(f),d.appendChild(e),a.appendChild(d)},a.prototype.addLink=function(a,b,c,d){vare=this,f=document.createElement("li"),g=document.createElement("a");g.href=d,g.id=c,g.onclick=function(){e.showNavContent=!1,e.navCollapse.className="navigationbar-collapse",e.navCollapse.style.display="none"},g.appendChild(document.createTextNode(b)),f.appendChild(g),a.appendChild(f)},a.prototype.test=function(){console.log("hej")},a.prototype.addLinkDiv=function(a,b,c,d){vare=this,f=document.createElement("li"),g=document.createElement("div");g.id=c,g.onclick=function(){e.showNavContent=!1,e.navCollapse.className="navigationbar-collapse",e.navCollapse.style.display="none"},g.appendChild(document.createTextNode(b)),f.appendChild(g),a.appendChild(f)},a.prototype.addLinkFn=function(a,b,c,d){vare=this,f=document.createElement("li"),g=document.createElement("div");g.id=c,g.onclick=function(){e.showNavContent=!1,e.navCollapse.className="navigationbar-collapse",e.navCollapse.style.display="none",d(c)},g.appendChild(document.createTextNode(b)),f.appendChild(g),a.appendChild(f)},a.prototype.addDropdownDiv=function(a,b,c){vard=document.createElement("li");d.className="dropdown";vare=document.createElement("div"),f=!1;e.onclick=function(){f=!f,f?d.className="dropdown open":d.className="dropdown"};varg=document.createElement("img");g.src="images/language.png",g.width=16,g.className="navigationbar-languageImg",e.appendChild(g),e.appendChild(document.createTextNode(""+b+""));varh=document.createElement("b");h.className="caret",e.appendChild(h),d.appendChild(e),d.appendChild(c),a.appendChild(d)},a.prototype.addNavigation=function(a){varb=this,c=document.createElement("div");c.className="navigationcontainer",b.navDiv.appendChild(c);vard=document.createElement("div");d.className="navigationbar-header",c.appendChild(d);vare=document.createElement("button");e.className="navigationbar-toggle",d.appendChild(e);varf=document.createElement("span");f.className="navigationbar-icon";varg=document.createElement("span");g.className="navigationbar-icon";varh=document.createElement("span");h.className="navigationbar-icon",e.appendChild(f),e.appendChild(g),e.appendChild(h);vari=document.createElement("a");i.className="navigationbar-title",i.href="/";varj=document.createElement("img");j.id="back",j.className="navigationbar-img",j.src="images/24back.png",i.appendChild(j),i.appendChild(document.createTextNode(a)),d.appendChild(i),b.navCollapse=document.createElement("div"),b.navCollapse.className="navigationbar-collapse";vark=document.createElement("ul");if(k.className="navigation-links",b.generalLinkArray)for(varl=0;l<b.generalLinkArray.length;l++)b.addLink(k,b.generalLinkArray[l].name,"",b.generalLinkArray[l].href);if(b.playerLink&&b.addLink(k,b.langData.tViewpreviousresults,"playerButton",b.playerLink),b.playerLinkFn&&b.addLinkFn(k,b.langData.tViewpreviousresults,"playerButton",b.playerLinkFn),b.inputLink&&b.addLink(k,b.langData.tViewinputs,"inputButton",b.inputLink),b.inputLinkFn&&b.addLinkFn(k,b.langData.tViewinputs,"inputButton",b.inputLinkFn),b.aisLink&&b.addLink(k,b.langData.tViewais,"aisButton",b.aisLink),b.aisLinkFn&&b.addLinkFn(k,b.langData.tViewais,"aisButton",b.aisLinkFn),b.graphLink&&b.addLink(k,b.langData.tViewgraphs,"graphButton",b.graphLink),b.graphLinkFn&&b.addLinkFn(k,b.langData.tViewgraphs,"graphButton",b.graphLinkFn),b.simulationLink&&b.addLinkDiv(k,b.langData.tLoadsimulations,"loadSimulationButton",b.simulationLink),b.simulationLinkFn&&b.addLinkFn(k,b.langData.tLoadsimulations,"loadSimulationButton",b.simulationLinkFn),b.languageLink){varm=document.createElement("ul");m.className="dropdown-menu";varn=function(a){window.location.search=b.getSearchUrl("language",a.substring(4))};b.addLinkFn(m,"English","langen",n),b.addLinkFn(m,"العربية","langar",n),b.addDropdownDiv(k,"Language",m)}b.userLink&&(b.addUser(k,"","userId"),b.addLink(k,b.langData.tLogin,"login","#"),b.addLink(k,b.langData.tLogout,"logout","#")),b.navCollapse.appendChild(k),c.appendChild(b.navCollapse),b.showNavContent=!1,e.onclick=function(){b.showNavContent=!b.showNavContent,b.showNavContent?(b.navCollapse.className="navigationbar-collapse navigation in",b.navCollapse.style.display="block"):(b.navCollapse.className="navigationbar-collapse",b.navCollapse.style.display="none")}},a.prototype.getSearchUrl=function(a,b){for(varc,d=/\+/g,e=/([^&=]+)=?([^&]*)/g,f=function(a){returndecodeURIComponent(a.replace(d,""))},g=window.location.search.substring(1),h=[];c=e.exec(g);)h.push(),h[h.length]=[f(c[1]),f(c[2])];if(0==h.length)return"?"+a+"="+b;for(vari=!1,j=0;j<h.length;j++)h[j][0]==a&&(h[j][1]=b,i=!0);i||(h.push(),h[h.length]=[a,b]);for(vark="?",j=0;j<h.length;j++)j>0&&(k+="&"),k+=h[j][0]+"="+h[j][1];returnk},a}();