addEvent(window,"load",load);addEvent(window,"unload",GUnload);var EventId=null,MainTabName="Info",SubTabName="Omleiding",inMap=null;var aGEvent=null,isFirstTab=false;var ogDate=new Date();var gMap=null,gShowMap=null,oShowEvent=null;var filteredEvents=[];var Districts=[];var aDays=[];var aMonths=[];var aOverlays=[];var aDiversionsData=[];var aGPeriods=[];var colors=["#ff0066","#ff0000","#6600ff","#66ff00","#0066ff","#00ff66"];var aEventFields=["id","project_name","project_number","project_contents","project_start","project_end","website","location","heaviness","traffic_diversion","description","time_period","longitude","latitude","direction","source","type","type_report","event_period","time_period_humanise"];var aDays=["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"];var aMonths=["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"];function inDistrict(){this.polygon_id=null;this.polygon_name=null;this.parent_id=null;this.polydata=null;this.parentDistrict=null}if(!Array.prototype.filter){Array.prototype.filter=function(B){var A=this.length;if(typeof B!="function"){throw new TypeError()}var E=[];var D=arguments[1];for(var C=0;C<A;C++){if(C in this){var F=this[C];if(B.call(D,F,C,this)){E.push(F)}}}return E}}if(!Array.indexOf){Array.prototype.indexOf=function(B,C){for(var A=(C||0);A<this.length;A++){if(this[A]==B){return A}}}}function stripslashes(A){A=A.replace(/\\'/g,"'");A=A.replace(/\\"/g,'"');A=A.replace(/\\\\/g,"\\");A=A.replace(/\\0/g,"\0");return A}function DEBUG(A){$("#footer_banners").html($(this).html+A)}function update_event_delay(){inMap.showInEventsByType();var A=$("#period").val();SetTime(A);inMap.hide_loading()}function update_events(){show_loading();window.setTimeout(update_event_delay,20)}function setCertainDay(C){if(GBrowserIsCompatible()){show_loading();var G=$("#map").get(0);inMap=new inMaps(G);inMap.init();var F=window.location.href;var M=/event_id=([0-9]+)/;var H=/period=([1-6]{1})/;var L=/firsttab=1/;var E=M.exec(F);var A=H.exec(F);var B=L.exec(F);if(E){EventId=E[1]}if(B){isFirstTab=true}var J=C.getMonth()+1;J=(J<10)?"0"+J.toString():J;var D=C.getDate();D=(D<10)?"0"+D.toString():D;var I=new Date();inMap.getJsonInEvents(sBaseUrl+"/certaineventsjson.php?day="+C.getFullYear()+"-"+J+"-"+D+"&"+I.getTime());if(A){var K=A[1];$("#period").get(0).selectedIndex=A[1]}else{var K=$("#period").val()}ogDate=C;SetTime(K)}}function newload(){if(GBrowserIsCompatible()){show_loading();var E=$("#map").get(0);inMap=new inMaps(E);inMap.init();var D=window.location.href;var J=/event_id=([0-9]+)/;var F=/period=([1-6]{1})/;var I=/firsttab=1/;var C=J.exec(D);var A=F.exec(D);var B=I.exec(D);if(C){EventId=C[1]}if(B){isFirstTab=true}var G=new Date();inMap.getJsonInEvents(sBaseUrl+"/eventsjsonlight.php");if(A){var H=A[1];$("#period").get(0).selectedIndex=A[1]}else{var H=$("#period").val()}SetTime(H);if(typeof updateData=="function"){updateData()}inMap.getJsonInDistricts(sBaseUrl+"/districtsjson.php")}}function load(){window.setTimeout(newload,20)}function inMaps(A){this.GMap=null;this.inMapElement=A;this.inList=null;this.inEvents=[];this.inSelection={};this.inOpenWindow=null;this.markerBatch=null;this.markerManager=null;this.firstRun=true;this.aUserDate=null}inMaps.prototype.init=function(D){if(this.inMapElement==null){alert("The Map could not be initialized. Map element is not specified!");return }this.GMap=new GMap2(this.inMapElement);this.markerManager=new ClusterMarker(this.GMap,{clusteringEnabled:true,level:9,clusterMarkerTitle:"Klik hier om in te zoomen op %count meldingen"});gMap=this.GMap;this.GMap.addControl(new GLargeMapControl());this.GMap.addControl(new GScaleControl());var C=mapgetCookie("maplattomove");if(C){var A=mapgetCookie("maplevelstomove");var B=mapgetCookie("maplngtomove");this.GMap.setCenter(new GLatLng(parseFloat(C),parseFloat(B)),parseInt(A))}else{this.GMap.setCenter(new GLatLng(51.556582,5.273438),9)}this.GMap.getCurrentMapType().getMinimumResolution=function(){return 7};this.markerBatch=[];if(D==true){if(this.inMapElement.addEventListener){addEvent(this.inMapElement,"DOMMouseScroll",scrollEvent)}else{addEvent(this.inMapElement,"mousewheel",scrollEvent)}}this.setBehaviour();this.GMap.getInfoWindow();this.GMap.getInfoWindow().show()};inMaps.prototype.setBehaviour=function(){GEvent.addListener(this.GMap,"moveend",function(){$("#district").get(0).selectedIndex=0;$("#upper_region").get(0).selectedIndex=0;inMap.markerManager.refresh(true)});GEvent.addListener(this.GMap,"zoomend",function(){$("#district").get(0).selectedIndex=0;$("#upper_region").get(0).selectedIndex=0;inMap.markerManager.refresh(true)})};inMaps.prototype.getJsonInDistricts=function(A){sendRequest(A,this.parseJsonInDistricts,null,null,this)};inMaps.prototype.parseJsonInDistricts=function(req,oInMap){var jDistricts=eval("("+req.responseText+")");for(var i=0;i<jDistricts.length;i++){jd=jDistricts[i];var oD=new inDistrict();oD.polygon_id=jd.polygon_id;oD.parent_id=jd.parent_id;oD.polygon_name=jd.polygon_name;oD.polydata=jd.polydata;oD.parentDistrict=jd.parentDistrict;Districts.push(oD)}SetDistrict(true)};inMaps.prototype.getJsonInEvents=function(A){sendRequest(A,this.parseJsonInEvents,null,null,this)};inMaps.prototype.parseJsonInEvents=function(req,oInMap){var aJson=eval("("+req.responseText+")");var fLength=aJson.length;if(fLength>0){var i=fLength-1;while(i>=0){var oEvent=new inEvent();var j=aEventFields.length-1;while(j>=0){oEvent[aEventFields[j]]=aJson[i][aEventFields[j]];j--}if(aJson[i]["rec_descr"]){oEvent.rec_descr=aJson[i]["rec_descr"]}if(aJson[i]["rectype"]){oEvent.rectype=aJson[i]["rectype"]}oEvent.init();oEvent.inMap=this;oInMap.addInEvent(oEvent);i--}}else{oEvent=new inEvent();oEvent.point=oInMap.GMap.getCenter();oEvent.icon=oEvent.getIcon(3);oEvent.marker=new GMarker(oEvent.point,oEvent.icon);oEvent.project_name="Werkzaamheden en evenementen momenteel niet bekend, informatie volgt.";oEvent.listelement.className="event-3";oEvent.inMap=this;oEvent.marker.openInfoWindowHtml(oEvent.project_name);oEvent.addMarker(oInMap.GMap);oEvent.setBehaviours();oInMap.addInEvent(oEvent)}oInMap.showInEventsByType();oInMap.hide_loading()};inMaps.prototype.hide_loading=function(A){$("#map_controls input, select").attr("disabled","");$("#maploadoverlay").hide()};inMaps.prototype.addInEvent=function(A){this.inEvents.push(A)};inMaps.prototype.isSetDatepickerDate=function(){if($("#isdateset").length>0&&parseInt($("#isdateset").val())>0){return true}else{return false}};inMaps.prototype.showInEventsByType=function(){function J(K){return $("#d"+K+":checked").length}function C(L){if(L){var K=L.length-1;while(K>=0){if($("#period").val()==L[K]){return true}K--}}return false}function B(M){var L=M.split(",");var K=L.length-1;while(K>=0){if($("#c"+L[K]+":checked").length){return true}K--}return false}function G(K){if(jQuery.inArray(K.toString(),H)>=0){return true}else{return false}}function I(L,K,M){if(L.id==EventId){return true}if(A){return(J(L.heaviness)&&G(L.id)&&B(L.time_period))}else{return(J(L.heaviness)&&C(L.event_period)&&B(L.time_period))}}this.markerBatch=[];var D=null;var H=["9478","9531"];var A=0;if(this.isSetDatepickerDate()){A=1;if(this.aUserDate){H=this.aUserDate}else{H=[]}}this.markerManager.removeMarkers();filteredEvents=this.inEvents.filter(I);var F=filteredEvents.length-1;var E=null;while(F>=0){E=filteredEvents[F];E.addMarker(this);if(!E.behaviour_ready){E.setBehaviours()}this.markerBatch.push(E.marker);if(E.id==EventId){D=E;EventId=null}F--}this.markerManager.addMarkers(this.markerBatch);this.markerManager.refresh();if(D){gMap.addOverlay(D.marker);gMap.setCenter(D.point,14);setTimeout(function(){GEvent.trigger(D.marker,"click")},3000)}};function inDetour(){this.detour_id;this.name;this.color;this.direction;this.description;this.points;this.levels;this.event_periods_num;this.num;this.init=function(A){};this.setProperty=function(A,B){this[A]=B}}function inPeriods(){this.id;this.event_id;this.start_datm;this.start_tijd;this.end_datm;this.end_tijd;this.type_hinder;this.oorzaak_hinder;this.oude_omleiding;this.afgesloten;this.oude_tijd_afsluiting;this.oude_tijd_afsluiting_anders;this.num}function inEvent(){this.id;this.point;this.icon;this.iconType;this.marker;this.inMap;this.ListItemElement=null;this.ListItemElementLink=null;this.infoTabs=null;this.project_name="";this.project_number="";this.project_contents="";this.project_start="";this.project_end="";this.website="";this.location="";this.heaviness="";this.traffic_diversion="";this.description="";this.time_period="";this.longitude="";this.latitude="";this.direction="";this.source="";this.type="";this.type_report="";this.event_period="";this.time_period_humanise="";this.rectype="";this.rec_descr="";this.oInfoWindowOptions={maxWidth:300};this.detours;this.periods;this.initialized=false;this.MainTabName="";this.MainTabContent="";this.MainSubName="";this.MainSubContent="";this.behaviour_ready=false}inEvent.prototype.showInfoWindow=function(){this.marker.openInfoWindowHtml('Loading... <img src="'+sBaseUrl+'/images/loader.gif" />');var A=this.rec_descr;$.ajax({url:sBaseUrl+"/geteventjson.php",dataType:"json",data:"event_id="+this.id,timeout:7000,success:function(C){parseInJsonPeriods=function(E,G){var D=E.length;for(var F=0;F<D;F++){G[F]=new inPeriods();G[F].id=E[F].id;G[F].event_id=E[F].event_id;G[F].start_datm=E[F].start_datm;G[F].start_tijd=E[F].start_tijd;G[F].end_datm=E[F].end_datm;G[F].end_tijd=E[F].end_tijd;G[F].type_hinder=E[F].type_hinder;G[F].oorzaak_hinder=E[F].oorzaak_hinder;G[F].oude_omleiding=E[F].oude_omleiding;G[F].afgesloten=E[F].afgesloten;G[F].oude_tijd_afsluiting=E[F].oude_tijd_afsluiting;G[F].oude_tijd_afsluiting_anders=E[F].oude_tijd_afsluiting_anders;G[F].num=E[F].num}};parseInJsonDetours=function(D,F){var G=D.length;for(var E=0;E<G;E++){F[E]=new inDetour();F[E].detour_id=D[E].detour_id;F[E].name=D[E].name;F[E].color=D[E].color;F[E].direction=D[E].direction;F[E].description=D[E].description;if(D[E].encodedDetour){if(D[E].encodedDetour.Points){F[E].points=D[E].encodedDetour.Points}if(D[E].encodedDetour.Levels){F[E].levels=D[E].encodedDetour.Levels}}F[E].event_periods_num=D[E].event_periods_num;F[E].num=D[E].num}};var B=new inEvent();j=aEventFields.length-1;while(j>=0){B[aEventFields[j]]=C[aEventFields[j]];j--}if(C.rec_descr){B.rec_descr=A}if(C.rectype){B.rectype=C.rectype}B.init();B.detours=[];B.periods=[];if(C.Detours){parseInJsonDetours(C.Detours,B.detours)}if(C.Periods){parseInJsonPeriods(C.Periods,B.periods)}setTimeout(function(){gMap.updateInfoWindow(InfoWindowTabs(B));if(B.detours!=null&&B.detours!=undefined&&B.detours.length>0){if(B.source=="Falk"&&B.detours[0].name==sTextDtour){var E=false;for(var D=0;D<B.detours.length;D++){if(B.detours[D].name!=sTextDtour){E=true}}if(E){createDiversionMap(B)}else{createTextDiversionMap(B)}}else{createDiversionMap(B)}}else{if(B.periods!=null&&B.periods!=undefined&&B.periods.length>0){createOldDiversionMap(B)}}},100)}})};inEvent.prototype.init=function(){this.point=new GLatLng(parseFloat(this.latitude),parseFloat(this.longitude));this.iconType=this.iconType(parseInt(this.heaviness),parseInt(this.type));this.icon=this.getIcon(this.iconType);this.marker=new GMarker(this.point,this.icon)};inEvent.prototype.setBehaviours=function(){this.marker.parent=this;GEvent.addListener(this.marker,"click",function(){this.tooltip.hide();this.parent.showInfoWindow()});GEvent.addListener(this.marker,"mouseover",function(){this.tooltip.show()});GEvent.addListener(this.marker,"mouseout",function(){this.tooltip.hide()});this.behaviour_ready=true};inEvent.prototype.addMarker=function(B){var A=this.getTitle();var C=new Tooltip(this.marker,A,this.project_start,this.project_end,this.heaviness,this.direction,this.time_period_humanise,4);this.marker.tooltip=C;B.GMap.addOverlay(C)};inEvent.prototype.iconType=function(B,A){return B=(A==10)?B:B+4};inEvent.prototype.getIcon=function(C){var D;if(BpBrowser.type==BpBrowser.MSIE){D=".gif"}else{D=".png"}var A=["hinder-ernstig","hinder-groot","hinder-middel","hinder-licht","evenement-ernstig","evenement-groot","evenement-matig","evenement-licht"];var B=new GIcon(G_DEFAULT_ICON);B.image="images/icons-"+A[C-1]+D;if(BpBrowser.type==BpBrowser.MSIE&&BpBrowser.version<7){B.shadow=null;B.shadowSize=null}else{B.shadow="images/icons-alert-schaduw.png";B.shadowSize=new GSize(49,33)}B.iconSize=new GSize(29,33);B.iconAnchor=new GPoint(14,33);B.infoWindowAnchor=new GPoint(30,5);return B};inEvent.prototype.getTitle=function(){var A="";if(this.direction!="Niet van toepassing"&&this.direction!="not available"){A=" (ri. "+this.direction+")"}return((this.project_number!="")?this.project_number+",":"")+" "+this.project_name+A};function changeRegion(){GEvent.clearListeners(inMap.GMap,"moveend");GEvent.clearListeners(inMap.GMap,"zoomend");var A=this.value;if(this.id=="upper_region"){mapsetCookie("mapregion",A);mapsetCookie("mapdistrict",-2)}else{if(this.id=="district"){mapsetCookie("mapdistrict",A);mapsetCookie("mapregion",-1)}}if(A==-1||A==-2){return }if(A==-10){inMap.GMap.setCenter(new GLatLng(51.556582,5.273438),9);inMap.markerManager.refresh(true)}else{for(var C=0;C<Districts.length-1;C++){if(Districts[C].polygon_id==this.value){break}}var B=[{color:"#FF000",weight:5,opacity:0.3,points:stripslashes(Districts[C].polydata.Points),levels:Districts[C].polydata.Levels,zoomFactor:32,numLevels:4}];var F=new GPolygon.fromEncoded({polylines:B,fill:true,color:"#030303",opacity:0.3,outline:true});var E=F.getBounds();var G=this.value;if(G==73||G==69){inMap.GMap.setZoom(inMap.GMap.getBoundsZoomLevel(E)+1)}else{inMap.GMap.setZoom(inMap.GMap.getBoundsZoomLevel(E))}inMap.GMap.setCenter(E.getCenter());var D=E.getCenter();mapsetCookie("maplattomove",D.lat());mapsetCookie("maplngtomove",D.lng());mapsetCookie("maplevelstomove",inMap.GMap.getZoom());inMap.markerManager.refresh(true);if(this.id=="upper_region"){$("#district").val("-2")}else{if(this.id=="district"){document.getElementById("upper_region").selectedIndex=0}}}inMap.setBehaviour()}function SetDistrict(E){dSelect=$("#district").html("").append('<option value="-2">Gemeente</option>').change(changeRegion);if(dSelect){var B=$("#upper_region").change(changeRegion);var F=mapgetCookie("mapdistrict");var A=mapgetCookie("mapregion");for(var D=0;D<Districts.length;D++){var C="<option value='"+Districts[D].polygon_id+"'>"+Districts[D].polygon_name+"</option>";if((B.val()==-1&&Districts[D].parent_id>0)||(B.val()==Districts[D].parent_id)){dSelect.append(C)}else{if(Districts[D].parent_id==0&&E){B.append(C)}}}dSelect=null;B=null;if(F){$("#district").val(F)}if(A){$("#upper_region").val(A)}}else{alert("Geen ditrict element in de code")}}function mapsetCookie(F,G,B,C,A,E){var D=F+"="+encodeURIComponent(G);if(B){D+="; expires="+B.toGMTString()}if(C){D+="; path="+C}if(A){D+="; domain="+A}if(E){D+="; secure"}document.cookie=D}function mapgetCookie(C){var B="(?:; )?"+C+"=([^;]*);?";var A=new RegExp(B);if(A.test(document.cookie)){return decodeURIComponent(RegExp["$1"])}else{return null}}function SetTime(D){var C=new Date(ogDate);var B=new Date(ogDate);var A=new Date(ogDate);D=D||0;if(inMap.isSetDatepickerDate()){A=new Date(Date.parse($("#altuserdate").val()));B=A}else{switch(parseInt(D)){case 0:default:B=C;A.setDate(C.getDate()+1);break;case 1:B=C;A.setDate(C.getDate()+7);break;case 2:B.setDate(C.getDate()+7);A.setDate(C.getDate()+14);break;case 3:B=C;A.setMonth(C.getMonth()+1);break;case 4:B.setMonth(C.getMonth()+1);A.setMonth(C.getMonth()+2);break;case 5:B=C;A.setYear(takeYear(C)+1);break;case 6:B.setYear(takeYear(C)+1);A.setYear(takeYear(C)+2);break}A.setDate(A.getDate()-1)}$("#map_header em").html(dateFormat(B,A))}function dateFormat(B,A){function C(F){return aDays[F.getDay()]+" "+F.getDate()+" "+aMonths[F.getMonth()]+" "+takeYear(F)}var E=C(B);var D=C(A);if(E==D){return E}else{return E+" tot en met "+D}}function nextDate(B,C){var A=new Date();A.setDate(B.getDate()+C);return A}function takeYear(B){var A=B.getYear();var C=A%100;C+=(C<38)?2000:1900;return C}function truncateStr(A,B){return(A.length>B)?A.substring(0,B)+"...":A}function InfoWindowTabs(N){var J=/^(www\.)?[a-zA-Z0-9\.]+\.[a-z]{2,5}(\/.*)?/i;var B=/^http/;var A="";var M="";var C=40;if(B.test(N.website)){A='<p class="website">Contact / Meer info: <a href="'+N.website+'" target="_blank">'+truncateStr(N.website,C)+"</a></p>"}else{if(J.test(N.website)){A='<p class="website">Contact / Meer info: <a href="http://'+N.website+'" target="_blank">'+truncateStr(N.website,C)+"</a></p>"}}if(N.traffic_diversion==""||N.traffic_diversion=="Niet van toepassing"||N.traffic_diversion=="geen"){diversion="Geen informatie beschikbaar."}else{diversion=N.traffic_diversion}if(N.description==""||N.description=="Niet van toepassing"||N.description=="geen"||!N.description){M=""}else{M="<strong>Omschrijving verkeerssituatie:</strong><br />"+N.description}var K=new Date();var E=new Date();K.setTime(Date.parse(N.project_start));E.setTime(Date.parse(N.project_end));var F=dateFormat(K,E);if(N.source=="Via"&&N.periods.length&&N.periods[0].oorzaak_hinder){N.project_contents=N.periods[0].oorzaak_hinder}var H='<div id="popupwrp"><div class="mappopup" style="width:450px"><h4>'+N.getTitle()+"</h4><p>"+N.project_contents+"</p><p>"+N.location+'</p><p class="periode">Periode: '+((N.rectype)?N.rec_descr:F+N.time_period_humanise)+"</p><p>"+getLEventTypeLabel(N.heaviness)+"</p>"+A+"</div>";var I="&nbsp;";if(typeof (N.detours[0])!="undefined"&&N.detours[0].description!=""){I=N.detours[0].description}var D='<div id="minimapwrapper"><div id="legend">&nbsp;</div><div id="miniMap">&nbsp;</div><div class="clear"></div></div><div id="detourinfo">'+I+"</div>";if(N.source=="Falk"&&typeof (N.detours[0])!="undefined"&&N.detours[0].description!=""&&N.detours[0].name==sTextDtour){var L=false;for(var G=0;G<N.detours.length;G++){if(N.detours[G].name!=sTextDtour){L=true}}if(!L){D='<div id="detourinfo">'+getTextDetourHtml(N.detours[0].description)+"</div>"}}this.MainTabName=MainTabName;this.MainTabContent=H;this.MainSubName=SubTabName;this.MainSubContent=D;H+="<div>"+D+"</div>";H+="</div>";if(0&&(N.detours.length>0||N.periods.length)){return[new GInfoWindowTab(MainTabName,H),new GInfoWindowTab(SubTabName,D)]}else{return[new GInfoWindowTab(MainTabName,H)]}}function removeStuff(A){($("#"+A)).remove()}function createOldDiversionMap(B){removeStuff("minimapwrapper");var A=$("#detourinfo").width("400px");if(B.periods[0].oude_omleiding){A.html(B.periods[0].oude_omleiding+"<br />");if(B.periods[0].type_hinder){A.html(this.html()+getTextDetourHtml(B.periods[0].type_hinder))}}else{if(B.periods[0].type_hinder){A.html(getTextDetourHtml(B.periods[0].type_hinder))}}}function getTextDetourHtml(A){return"<br><b>Omschrijving verkeerssituatie:</b><br/>"+A.replace(/\\n/g,"<br />")}function createTextDiversionMap(B){removeStuff("minimapwrapper");var A=$("#detourinfo").width("400px");if(typeof (B.detours[0].description)!="undefined"&&A.length){A.html(getTextDetourHtml(B.detours[0].description))}var C=$("#legend");if(C.length){if(C.html()=="&nbsp;"){C.hide()}}A=null}function createDiversionMap(O){var G=O.detours;var J=O.periods;var P=$("#miniMap").html("").height("160px").width("365px");if(!P.length){O.marker.closeInfoWindow()}else{minimap=new GMap2(P.get(0));minimap.setCenter(O.point,9);minimap.addControl(new GSmallZoomControl());var M="<ul id='periods'>";var D="#detourinfo";var A=undefined;aGEvent=O.point;minimap.addOverlay(new GMarker(O.point,O.icon));if(O.source=="Via"){var K=J.length;aGPeriods=[];aOverlays=[];aDiversionsData=[];for(var F=0;F<K;F++){M+="<li><a onclick=\"showDiversions('#detours"+F+"', this,  '"+D+"', "+F+');" href="javascript:void(0)" class="plus_bg">Fase '+(F+1)+"</a>";aGPeriods[F]=J[F];var C=G.length;var L=0;M+='<ul id="detours'+F+'" class="detours" style="display: none">';for(var H=0;H<C;H++){if(G[H].event_periods_num==J[F].num){L++;var E=new GPolyline.fromEncoded({color:colors[(H%colors.length)],weight:5,points:stripslashes(G[H].points),levels:G[H].levels,zoomFactor:32,numLevels:4});aOverlays[H]=E;aDiversionsData[H]=G[H];M+='<li><a href="javascript:void(0)"  onclick="chngDiversion('+H+", '"+D+"', this, "+F+');">Oml. '+L+"</a></li>"}}M+="</ul></li>"}if(J[0].type_hinder!=""){$("#detourinfo").after("<div id='phasetype_hinder'>"+J[0].type_hinder+"</div>")}}else{if(O.source=="Falk"){var I=1;var N=true;for(var H=0;H<G.length;H++){if(G[H].points){var E=new GPolyline.fromEncoded({color:colors[(H%colors.length)],weight:5,points:stripslashes(G[H].points),levels:G[H].levels,zoomFactor:32,numLevels:4});aOverlays[H]=E;if(A==undefined){A=E.getBounds()}if(N){minimap.addOverlay(E);$(D).html("<div><strong>"+G[H].name+"</strong></div>");var B="";if(G[H].description){B=G[H].description}else{for(var F=0;F<G.length;F++){if(H!=F){if(G[F].name==sTextDtour){B=G[F].description}}}}if(B!=""){$("<div>"+B+"</div>").appendTo(D)}}M+='<li style="color:'+colors[(H%colors.length)]+'">';M+="<a "+((N)?'class="sel"':"")+' href="#" onclick="chngFalkDiversion('+H+", '"+D+"', this )\"> Oml. "+I+"</a>";M+="</li>";I++;N=false}aDiversionsData[H]=G[H]}}}if(A){minimap.setZoom(minimap.getBoundsZoomLevel(A));minimap.setCenter(A.getCenter())}M+="</ul>";$("#legend").html(M);$("div#miniMap span, div#miniMap a").remove();P=null}}function getPeriodTerm(A){return dateFormat(new Date(Date.parse(A.start_datm)),new Date(Date.parse(A.end_datm)))}function hideDetours(){var A=aOverlays.length;for(var B=0;B<A;B++){if(aOverlays[B]){aOverlays[B].hide()}}}function drawPeriodTerm(C,A,B){$(C).html("<strong>Fase "+(A+1)+":</strong> "+getPeriodTerm(B));if(B.type_hinder!=""){$("#phasetype_hinder").text(B.type_hinder)}}function showDiversions(D,C,B,A){hideDetours();minimap.setCenter(aGEvent,9);$(D).toggle("fast");$(C).toggleClass("minus_bg");$(".sel_period").removeClass("sel_period");$(".sel").removeClass("sel");$(C).addClass("sel_period");if(aGPeriods[A]){drawPeriodTerm(B,A,aGPeriods[A])}}function chngDiversion(C,D,B,A){minimap.setZoom(minimap.getBoundsZoomLevel(aOverlays[C].getBounds()));minimap.setCenter(aOverlays[C].getBounds().getCenter());hideDetours();minimap.addOverlay(aOverlays[C]);aOverlays[C].show();drawPeriodTerm(D,A,aGPeriods[A]);$("<div><strong>"+aDiversionsData[C].name+"</strong></div>").appendTo(D);$("<div>"+aDiversionsData[C].description+"</div>").appendTo(D);$(".sel").removeClass("sel");$(".sel_period").removeClass("sel_period");$(B).addClass("sel");gMap.updateInfoWindow(gMap.getInfoWindow().getTabs())}function chngFalkDiversion(D,F,C){minimap.setZoom(minimap.getBoundsZoomLevel(aOverlays[D].getBounds()));minimap.setCenter(aOverlays[D].getBounds().getCenter());hideDetours();var A=aOverlays.length;for(var B=0;B<A;B++){if(aOverlays[B]){minimap.removeOverlay(aOverlays[B])}}minimap.addOverlay(aOverlays[D]);aOverlays[D].show();$(F).html("<div><strong>"+aDiversionsData[D].name+"</strong></div>");var E="";for(var B=0;B<aDiversionsData.length;B++){if(D!=B){if(aDiversionsData[B].name==sTextDtour){E=aDiversionsData[B].description}}}if(E==""){E=aDiversionsData[D].description}$("<div>"+E+"</div>").appendTo(F);$(".sel").removeClass("sel");$(".sel_period").removeClass("sel_period");$(C).addClass("sel");gMap.updateInfoWindow(gMap.getInfoWindow().getTabs())}function scrollEvent(A){var B=0;if(!A){A=window.event}if(A.wheelDelta){B=A.wheelDelta/120;if(window.opera){B=-B}}else{if(A.detail){B=-A.detail/3}}if(B){if(B<0){map.zoomOut()}else{map.zoomIn()}}if(A.preventDefault){A.preventDefault()}A.returnValue=false}function getLEventTypeLabel(A){switch(A){case"1":return"Hinder: mogelijk meer dan 30 min. extra reistijd";break;case"2":return"Hinder: mogelijk 10-30 min. extra reistijd";break;case"3":return"Hinder: mogelijk 2-10 min. extra reistijd";break;case"4":return"Hinder: mogelijk minder dan 2 min. extra reistijd";break;default:return"";break}}function getEventTypeLabel(A){switch(A){case"1":return"> 30 min. extra reistijd";break;case"2":return"> 10 min. extra reistijd";break;case"3":return"2-10 min. extra reistijd";break;case"4":return"< 2 min. extra reistijd";break;default:return"";break}}function Tooltip(C,G,H,B,D,F,A,E){this.marker_=C;this.direction_=F;this.text_=G;this.start_=H;this.end_=B;this.type_=D;this.padding_=E;this.time_period_=A}Tooltip.prototype=new GOverlay();Tooltip.prototype.initialize=function(D){var F=document.createElement("div");var A=new Date(this.start_);var C=new Date(this.end_);start=A.getDate()+"-"+(A.getMonth()+1)+"-"+takeYear(A);end=C.getDate()+"-"+(C.getMonth()+1)+"-"+takeYear(C);var E="";(start==end)?E=start:E=start+" tot en met "+end;var B="<strong>"+this.text_+"</strong><br/>"+E+"<br/><span>"+getEventTypeLabel(this.type_)+"</span>";$(F).html(B).addClass("tooltip").css("position","absolute");$(D.getPane(G_MAP_FLOAT_PANE)).append(F);this.map_=D;this.div_=$(F)};Tooltip.prototype.remove=function(){this.div_.remove()};Tooltip.prototype.redraw=function(D){if(!D){return }var B=this.map_.fromLatLngToDivPixel(this.marker_.getPoint());var A=this.marker_.getIcon().iconAnchor;var E=Math.round(B.x+24);var C=B.y-A.y-this.padding_+7;this.div_.css("top",C+"px").css("left",E+"px")};Tooltip.prototype.show=function(){this.div_.css("visibility","visible")};Tooltip.prototype.hide=function(){this.div_.css("visibility","hidden")};function show_loading(){var B=$("#map");var C=$("#maploadoverlay");var E=B.width()/2-C.width()/2;var D=B.height()/2-C.height()/2;var F=B.offset();var A=F.left+E;var G=F.top+D;C.css("display","block").css("position","absolute").css("top",G).css("left",A);$("#map_controls input, select").attr("disabled","disabled")};