//Declaring some variables we will be using var gmap_search_state = false; var map; var markerArray = []; var circleArray = []; var polygons_on_map_array = []; var xmlhttp; var targetDiv = "infotop"; var selected = false; var overNode; var markerSelected = ""; var highlightCircle; var currentMarker; //This function is called from index.php function initialize_map() { //We will only do this function if the browser is compatible if (GBrowserIsCompatible()) { //Adding the google map into the div called #mapcanvas map = new GMap2(document.getElementById("mapcanvas"), {googleBarOptions : {style : "new"}}); //Center the map on Leiden map.setCenter(new GLatLng(52.162687, 4.493294), 11); // Vars should go to config map.setUIToDefault(); /* * Go through the array 'markers' (Declared in index.php) and add a marker for each marker stored in the array * using our addMarker function. * If the latLng of the marker is both 0 */ for (var i=0; i 0 || current.latitude[0] < 0) { addMarker(current, i); } } GEvent.addListener(map, "click", function() { if(!overNode == true) deSelect(); }); GEvent.addListener(map, "zoomend", function() { mapZoomed(); }); suggestMarkers(""); new MarkerClusterer(map, markerArray); } } //This function will contain the displaying and not displaying of nodes on the map function toggleMyKml() { } //This function adds a marker with an object from our 'marker'array defined in index.php function addMarker(current, i) { var latitude = Number(current.latitude[0]); var longitude = Number(current.longitude[0]); var displayIcon; var currentstatus = current.status[0]; if(currentstatus == "up") { displayIcon = greenIcon; } else { displayIcon = redIcon; } var marker = new GMarker(new GLatLng(current.latitude[0], current.longitude[0]), {title: current.name[0], icon: displayIcon}); //Added mouseover listener that calls on our mouseOver function when the mouse moves over a marker on the map GEvent.addListener(marker, 'mouseover', function() { mouseOverNode(current.id, current.name[0],latitude, longitude); }); GEvent.addListener(marker, 'click', function() { mouseClickNode(current.id, current.name[0], marker); }); GEvent.addListener(marker, 'mouseout', function() { mouseOutNode(current.id, current.name[0]); }); markerArray.push(marker); //circleArray.push(circle); return marker; } //Our mouseover function for single nodes. Gives the ID(our own given ID) and the name of the node. function mouseClickNode(id, name, marker) { if(selected == true) { deSelect(); markerSelected = ""; } if(markerSelected == marker) { deSelect(); markerSelected = ""; } else { selected = true; markerSelected = marker; for(var i=0; i