
var app;function OnLoad(){SetMapDivs();app=new App();GetMap();}
function App(){this.myMap=null;this.markerList=new Array();this.myMap=new GMap2(document.getElementById("gmap"));this.myMap.addControl(new GSmallMapControl());this.myMap.addControl(new GMapTypeControl());this.myMap.addControl(new GScaleControl(200));this.myMap.enableScrollWheelZoom();this.myMap.setCenter(new GLatLng(52.295042284537324,4.833984375),7);GEvent.bind(this.myMap,"move",this,gmapGetAndChange);GEvent.bind(this.myMap,"maptypechanged",this,gmapChangeMaptype);var searchControl=new GSearchControl();var localSearch=new GlocalSearch();var options=new GsearcherOptions();options.setExpandMode(GSearchControl.EXPAND_MODE_CLOSED);searchControl.addSearcher(localSearch,options);localSearch.setCenterPoint(this.myMap);searchControl.draw(document.getElementById("searchcontrol"));searchControl.setSearchCompleteCallback(this,App.prototype.OnSearchComplete);searchControl.setSearchStartingCallback(this,App.prototype.OnSearchStarting);searchControl.setOnKeepCallback(this,App.prototype.OnKeep,"Bekijk op kaart");}
function gmapGetAndChange(){var gcenter=this.myMap.getCenter();var glat=(parseFloat(gcenter.y)).toFixed(14);var glng=(parseFloat(gcenter.x)).toFixed(14);var gzoom=this.myMap.getZoom();document.getElementById("gmessage").innerHTML="G: "+gcenter.toString()+" @ "+gzoom;lmap.SetCenterAndZoom(new VELatLong(glat,glng),gzoom);}
function gmapChangeMaptype(){var gtype=this.myMap.getCurrentMapType().getUrlArg()
if(gtype=='m')
{lmap.SetMapStyle(VEMapStyle.Road);}
else if(gtype=='k')
{lmap.SetMapStyle(VEMapStyle.Aerial);}
else
{lmap.SetMapStyle(VEMapStyle.Hybrid);}}
App.prototype.OnSearchComplete=function(sc,searcher){if(searcher.results&&searcher.results.length>0){for(var i=0;i<searcher.results.length;i++){var result=searcher.results[i];if(result.GsearchResultClass==GlocalSearch.RESULT_CLASS){var markerObject=new Object();markerObject.result=result;markerObject.latLng=new GLatLng(parseFloat(result.lat),parseFloat(result.lng));markerObject.gmarker=new GMarker(markerObject.latLng);var clickHandler=method_closure(this,App.prototype.OnMarkerClick,[markerObject]);GEvent.bind(markerObject.gmarker,"click",this,clickHandler);this.markerList.push(markerObject);this.myMap.addOverlay(markerObject.gmarker);result.__markerObject__=markerObject;var lpin=lmap.AddPushpin(new VELatLong(parseFloat(result.lat),parseFloat(result.lng)));lpin.SetTitle(result.title);lpin.SetDescription(result.streetAddress+'<br>'+result.city);}}
this.OnMarkerClick(this.markerList[0]);}}
App.prototype.OnSearchStarting=function(sc,searcher,query){this.myMap.closeInfoWindow();for(var i=0;i<this.markerList.length;i++){var markerObject=this.markerList[i];this.myMap.removeOverlay(markerObject.gmarker);}
this.markerList=new Array();lmap.DeleteAllShapes();}
App.prototype.OnKeep=function(result){if(result.__markerObject__){markerObject=result.__markerObject__;this.OnMarkerClick(markerObject);}}
App.prototype.OnMarkerClick=function(markerObject){this.myMap.closeInfoWindow();var htmlNode=markerObject.result.html.cloneNode(true);markerObject.gmarker.openInfoWindow(htmlNode);}
function method_closure(object,method,opt_argArray){return function(){return method.apply(object,opt_argArray);}}
GSearch.setOnLoadCallback(OnLoad);var lmap=null;function GetMap()
{lmap=new VEMap('lmap');lmap.AttachEvent("onmousemove",lmapGetAndChange);lmap.AttachEvent("onendzoom",lmapGetAndChange);lmap.AttachEvent("onchangemapstyle",lmapChangeMaptype);lmap.SetDashboardSize(VEDashboardSize.Small);lmap.LoadMap(new VELatLong(52.295042284537324,4.833984375),7);lmap.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);}
function lmapGetAndChange(){var lcenter=lmap.GetCenter();var llat=(parseFloat(lcenter.Latitude)).toFixed(14);var llng=(parseFloat(lcenter.Longitude)).toFixed(14);var lzoom=lmap.GetZoomLevel();document.getElementById("lmessage").innerHTML="L: "+lcenter.toString()+" @ "+lzoom;app.myMap.setCenter(new GLatLng(llat,llng),lzoom);}
function lmapChangeMaptype(){var ltype=lmap.GetMapStyle();if(ltype==VEMapStyle.Road)
{app.myMap.setMapType(G_NORMAL_MAP);}
else if(ltype==VEMapStyle.Aerial)
{app.myMap.setMapType(G_SATELLITE_MAP);}
else
{app.myMap.setMapType(G_HYBRID_MAP);}}
function changeCSSclass(classid,classpassed){document.getElementById(classid).className=classpassed;}

function SetMapDivs() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
myWidth = myWidth /2;
myHeight = myHeight - 77;
document.getElementById('gmap').style.width = myWidth + "px";
document.getElementById('gmap').style.height = myHeight + "px";
document.getElementById('lmap').style.width = myWidth + "px";
document.getElementById('lmap').style.height = myHeight + "px";
}