﻿//<![CDATA[
// Google Map Maker script v.1.1
// (c) 2006 Richard Stephenson http://www.donkeymagic.co.uk
// Email: donkeymagic@gmail.com
// http://mapmaker.donkeymagic.co.uk
var map;
var icon0;
var newpoints = new Array();
 
function addLoadEvent(func) { 
	var oldonload = window.onload; 
	if (typeof window.onload != 'function'){ 
		window.onload = func
	} else { 
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
 
addLoadEvent(loadMap);
addLoadEvent(addPoints);

function loadMap() {

 if (GBrowserIsCompatible()) {
        // A TextualZoomControl is a GControl that displays textual "Zoom In"
// and "Zoom Out" buttons (as opposed to the iconic buttons used in
// Google Maps).
function TextualZoomControl() {
}

TextualZoomControl.prototype = new GControl();

// Creates a one DIV for each of the buttons and places them in a container
// DIV which is returned as our control element. We add the control to
// to the map container and return the element for the map class to
// position properly.
TextualZoomControl.prototype.initialize = function(map) {
  var container = document.createElement("div");

  var zoomInDiv = document.createElement("div");
  this.setButtonStyle_(zoomInDiv);
  container.appendChild(zoomInDiv);
  zoomInDiv.appendChild(document.createTextNode("Zoom In"));
  GEvent.addDomListener(zoomInDiv, "click", function() {
    map.zoomIn();
  });

  var zoomOutDiv = document.createElement("div");
  this.setButtonStyle_(zoomOutDiv);
  container.appendChild(zoomOutDiv);
  zoomOutDiv.appendChild(document.createTextNode("Zoom Out"));
  GEvent.addDomListener(zoomOutDiv, "click", function() {
    map.zoomOut();
  });

  map.getContainer().appendChild(container);
  return container;
}

// By default, the control will appear in the top left corner of the
// map with 7 pixels of padding.
TextualZoomControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(7, 7));
}

// Sets the proper CSS for the given button element.
TextualZoomControl.prototype.setButtonStyle_ = function(button) {
  button.style.textDecoration = "none";
  button.style.color = "#333333";
  button.style.backgroundColor = "#dbbe97";
  button.style.font = "11px Arial";
  button.style.border = "1px solid #666666";
  button.style.padding = "1px";
  button.style.marginBottom = "3px";
  button.style.textAlign = "center";
  button.style.width = "5em";
  button.style.cursor = "pointer";
  button.style.marginBottom = "16";
}



 

	map = new GMap2(document.getElementById("map"));
	map.addControl(new TextualZoomControl());
	map.addControl(new GMapTypeControl());
	map.setCenter(new GLatLng(42.49023238201793, 2.806835174560547 ), 6);
	map.setMapType(G_MAP_TYPE);
 
	
}}
 
function addPoints() {
 
	newpoints[0] = new Array(42.49023238201793, 2.806835174560547,  icon0,'Vores sted.','Lone og Jenses domicil'); 
 
	for(var i = 0; i < newpoints.length; i++) {
		var point = new GPoint(newpoints[i][1],newpoints[i][0]);
		var popuphtml = newpoints[i][4] ;
		var marker = createMarker(point,newpoints[i][2],popuphtml);
		map.addOverlay(marker);
	}
}
function createMarker(point, icon) {
	
	var marker = new GMarker(point, icon);
	
//function createMarker(point, icon, popuphtml) {
	//var popuphtml = "<div id=\"popup\">" + popuphtml + "<\/div>";
	//var marker = new GMarker(point, icon);
	//GEvent.addListener(marker, "click", function() {
		//marker.openInfoWindowHtml(popuphtml);
	//});
	return marker;
}
//]]>
