dojo.require("dojo.undo.browser");dojo.require("dojo.widget.ContentPane");dojo.require("dojo.html.*");dojo.require("dojo.widget.Dialog");anwb.title=document.title;dojo.addOnLoad(function(){dojo.debug("OnLoad");anwb.bookmark.init(updateView,anwb.bookmark.updatePolicy.Never)});function updateView(a,b){dojo.debug("updateView()");if(b.bestemmingzoeker&&b.bestemmingzoeker!="none"){updateWidget(dojo.widget.byId("bestemmingzoekerContents"),b.bestemmingzoeker+".html",b)}if(b.bestemmingzoeker!=a.bestemmingzoeker){if(b.bestemmingzoeker&&b.bestemmingzoeker!="none"){dojo.widget.byId("bestemmingzoeker").show()}else{dojo.widget.byId("bestemmingzoeker").hide()}}updateDetails(a,b);if(anwb.title!==""){document.title=anwb.title}updateCommandLinks(dojo.byId("maincontent"));updateCommandLinks(dojo.byId("bestemmingzoeker"))}function updateWidget(b,c,a){b.setUrl(c+anwb.bookmark.queryString(a))}function updateDetails(a,b){if(b.btiId!=a.btiId){renderDetails(b)}else{if(b.themaId!=a.themaId){if(hasTabs()&&!isCurrentThema(b.themaId)){renderTab(b)}else{renderInfo(b)}}}}function isInToeristisch(a){if(a==undefined){return true}else{return(a.indexOf("BEST_P")==-1)}}function hasTabs(){return(dojo.byId("tabsm")!=undefined)}function isCurrentThema(a){return(dojo.byId("menuItem"+a)!=undefined)}function renderDetails(a){updateWidget(dojo.widget.byId("details"),"details.html",a);updateSidebar(a)}function renderTab(d){dojo.debug("renderTab("+d.themaId+")");updateWidget(dojo.widget.byId("tab"),"tab.html",d);updateSidebar(d);deselectMenuItems(dojo.byId("tabsm").getElementsByTagName("ul")[0]);var b=dojo.byId("tabsm").getElementsByTagName("li");for(var a=0;a<b.length;a++){var c=b[a].id.substring(4);if(isInToeristisch(c)==isInToeristisch(d.themaId)){if(c!="FOTOS"){dojo.html.prependClass(b[a],"selected")}}}}function updateSidebar(b){var a=isInToeristisch(b.themaId);dojo.html.setDisplay(dojo.byId("toeristisch"),a);dojo.html.setDisplay(dojo.byId("praktisch"),!a)}function renderInfo(c){dojo.debug("updateInfo("+c.themaId+")");updateWidget(dojo.widget.byId("infoPane"),"info.html",c);var d=dojo.html.getElementsByClass("menu",dojo.byId("main"),"ul")[0];if(c.themaId){var a="menuItem"+c.themaId}else{dojo.debug("Selecting first menu item");var a=d.getElementsByTagName("li")[0].id}deselectMenuItems(d);var e=dojo.byId(a);while((e)&&(e.nodeName.toLowerCase()=="li")){if(e.id==a){dojo.html.prependClass(e,"selected")}else{dojo.html.prependClass(e,"open")}var b=e.parentNode;if(dojo.html.hasClass(b,"menu")){e=null}else{e=b.parentNode}}}function deselectMenuItems(b){var c=dojo.html.getElementsByClass("selected",b,"li");for(var a=0;a<c.length;a++){dojo.html.removeClass(c[a],"selected",false)}var c=dojo.html.getElementsByClass("open",b,"li");for(var a=0;a<c.length;a++){dojo.html.removeClass(c[a],"open",false)}}function linkCallBack(b,a){if(b.themaId!="FOTOS"){dojo.debug("linkCallBack(...)");anwb.bookmark.update(b,a);return false}}function zoekCallBack(){zoekterm=encodeURIComponent(dojo.byId("zoekterm").value);dojo.debug("zoekCallBack("+zoekterm+")");anwb.bookmark.update({bestemmingzoeker:"zoekresultaat",zoekterm:zoekterm})}function updateCommandLinks(c){var a=dojo.html.getElementsByClass("commandLink",c,"a");for(var b=0;b<a.length;b++){if(a[b].className.indexOf("update:themaId:FOTOS")===0){continue}if(!dojo.lang.has(a[b],"updates")){addUpdatesAndDeletes(a[b]);if(dojo.html.hasClass(a[b],"clientUpdate")){a[b].onclick=function(){return linkCallBack(this.updates,this.deletes)}}}var d=anwb.bookmark.updateState(a[b].updates,a[b].deletes);a[b].href=anwb.bookmark.queryString(d)}}function addUpdatesAndDeletes(d){dojo.debug("addUpdatesAndDeletes: "+dojo.html.getClass(d));var c=dojo.html.getClasses(d);d.deletes=[];d.updates={};for(var b=0;b<c.length;b++){var a=c[b].split(":");if(a[0]=="delete"){d.deletes.push(c[b].split(":")[1])}else{if(a[0]=="update"){d.updates[a[1]]=a[2]}}}}UICount=0;function UI(){return"UI"+(new Date()).valueOf()+"UI"+(UICount++)}function popupFile(c,a,b){if(!a){a=650}if(!b){b=460}var d=window.open(c,UI(),"toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width="+a+",height="+b+"");d.focus()};
