/* Dieser Code kann frei verwendet werden solange die Seite
 * http://www.hedonist-international.org auf deiner Seite verlinkt ist.
 * Überflüssig zu sagen das wir überhaupt keine Verantwortung für diesen 
 * Code übernehmen und so einige Codeschnippsel sind von den Beispielen
 * auf der Google Maps Seite inspiriert.
 * Bei Fragen bitte Mail an info@domainname
 */
 
 //Start der G8 Google Map

	// anhand dieser Strings bestimmt Google die Koordinaten
	var campRostock = "Schlachthofstr rostock deutschland";
	var campReddelich = "Suhring 1-30, 18209 Reddelich Deutschland";
	var campWichmannsdorf = "Wichmannsdorf Deutschland";
	var heiligendamm = "Heiligendamm Deutschland";
	var openAir = "Heiligendamm Deutschland";
	var demo = "Hamburger str Rostock Deutschland"; // N&auml\;he Schutower Kreuz / Hamburger Str. Demoanfang
	var rostockLaage = "Rostock Laage Deutschland"; // Flughafen Laage

// ---- Start Übersetzung ------------------------------

	// Die Strings zur Anzeige in den Blasen inkl. Links zu Bildern
	var infoRostock = "<strong>1-8. june 2007</strong><br/>Camp Rostock, 5000-6000 people, we will have our<br/> own barrio for 500 people, <br/>more infos on the <a href=\"http://www.camping-07.de/content/view/72/86/lang,de/ \">official website</a>.";
	var infoReddelich = "<strong>1-8. june 2007</strong><br/>Camp Reddelich, base camp for protest and action in front<br/> of the fence. More details on the <a href=\"http://www.camping-07.de/content/view/79/94/lang,de/ \">official website</a>.";
	var infoHeiligendamm = "<strong>6-8. june 2007</strong><br/>G8 summit at the Kempinski hotel in Heiligendamm <br/>where the 8 most powerful rulers will hide away<br/> from people like you and me behind a 12km security<br/> fence.";
var infoWichmannsdorf = "<strong>1-8. june 2007</strong> - Camp Wichmannsdorf,<br/>in the hill range K&uuml;hlung on the hill Hoppenberg,<br/> close to the village Wichmannsdorf (in the borough Kr&ouml;pelin),<br/>in the proximity of K&uuml;hlungsborn. <br/> ... more infos: <a href=\"http://www.camping-07.de/content/view/91/103/lang,en/\">www.camping-07.de</a>";
	//var infoOpenAir = "<a href=\"http://hedonist-international.org/?q=de/node/109\"><img src=\"/files/Raveagainstthemachine_ganzklein.jpg\"></a>";
	var infoDemo = "<strong>2. june 2007</strong><br/>Demo Rostock: we will be there with our groovemobile<br/> to provide deep bass lines. There are two starting points,<br/> the two demos will meet in the middle.<br/>The Hedonists will participate with the demo starting<br/> at the train station.<br/><a href=\"http://hedonist-international.org/?q=en/node/156\">... more infos</a>";
	var infoRostockLaage = "<strong>6. Juni 2007</strong><br/> Action day anti-militarismus, blockade<br/> of the airport Rostock-Laage.<br/>More details: <a href=\"http://www.gipfelsoli.org\">www.gipfelsoli.org</a> <br/> - German website with links to english sites";
	
	// die Strings zur Anzeige auf den Buttons
	var butRostock = "Camp Rostock";
	var butRedd = "Camp Reddelich";
	var butWichmannsdorf = "Camp Wichmannsdorf";
	var butGacht = "G8 summit";
	var butOpenAir = "OpenAir";
	var butDemo = "Demo Rostock";
	var butRostockLaage = "Airport Laage";



// ---- Ende Übersetzung ---------------------------------------------

	function load() {
	      if (GBrowserIsCompatible()) {
	
		var map = new GMap2(document.getElementById("map"));
		var geocoder = new GClientGeocoder();
	
		function showAddress(address) {
		geocoder.getLatLng(address,
	    		function(point) {
	      		if (!point) {
                	    	alert("The server is too busy. Please wait 5 seconds and then try again -- Der Google Maps Server bekommt zuviele Anfragen gleichzeitig. Bitte in 5 Sekunden noch einmal probieren.");
      			    } else {
        			   map.setCenter(point, 11);
        			   var marker = new GMarker(point);
                	           map.addOverlay(marker);
					// die einzelnen Blasen über den jeweiligen Markern
				  	if (address==heiligendamm){
                	           		marker.openInfoWindowHtml(infoHeiligendamm);
				   	}
				  	if (address==campRostock){
                	           		marker.openInfoWindowHtml(infoRostock);
				   	}	
				  	if (address==campReddelich){
                	           		marker.openInfoWindowHtml(infoReddelich);
				   	}
				  	if (address==campWichmannsdorf){
                	           		marker.openInfoWindowHtml(infoWichmannsdorf);
				   	}
				  	/*if (address==openAir){
                	           		marker.openInfoWindowHtml(infoOpenAir);
				   	}*/	
				  	if (address==demo){
                	           		marker.openInfoWindowHtml(infoDemo);
				   	}
					if (address==rostockLaage){
                	           		marker.openInfoWindowHtml(infoRostockLaage);
					}		
     				   }
  		  	}
  		);} // Ende showAddress

	function GoToLocation() {
	}
	GoToLocation.prototype = new GControl();

	// ein div für jeden Button, die Buttons werden einem div control Element hinzugefügt
	// das control div wird dem map container hinzugefügt
	GoToLocation.prototype.initialize = function(map) {
		var container = document.createElement("div");

		// die einzelnen Buttons
		// Camp Rostock Button
		var goRostock = document.createElement("div");
        	this.setButtonStyle_(goRostock);
        	container.appendChild(goRostock);
        	goRostock.appendChild(document.createTextNode(butRostock));
        	GEvent.addDomListener(goRostock, "click", function() {
		// hier weisen wir unserem div eine Aktion zu
		map.panTo(showAddress(campRostock));
		});
        	// Camp Reddelich Button
        	var goReddelich = document.createElement("div");
        	this.setButtonStyle_(goReddelich);
        	container.appendChild(goReddelich);
        	goReddelich.appendChild(document.createTextNode(butRedd));
        	GEvent.addDomListener(goReddelich, "click", function() {
		map.panTo(showAddress(campReddelich));
        	});
        	// Camp Wichmannsdorf Button
        	var goW = document.createElement("div");
        	this.setButtonStyle_(goW);
        	container.appendChild(goW);
        	goW.appendChild(document.createTextNode(butWichmannsdorf));
        	GEvent.addDomListener(goW, "click", function() {
		map.panTo(showAddress(campWichmannsdorf));
        	});
        	// G8 Button
        	var goGacht = document.createElement("div");
        	this.setButtonStyle_(goGacht);
        	container.appendChild(goGacht);
        	goGacht.appendChild(document.createTextNode(butGacht));
        	GEvent.addDomListener(goGacht, "click", function() {
		map.panTo(showAddress(heiligendamm));
        	});
		/*
        	// Rave Button
        	var goRave = document.createElement("div");
        	this.setButtonStyle_(goRave);
        	container.appendChild(goRave);
        	goRave.appendChild(document.createTextNode(butOpenAir));
        	GEvent.addDomListener(goRave, "click", function() {
		map.panTo(showAddress(openAir));
        	});*/
        	// Demo Button
        	var goDemo = document.createElement("div");
        	this.setButtonStyle_(goDemo);
        	container.appendChild(goDemo);
        	goDemo.appendChild(document.createTextNode(butDemo));
        	GEvent.addDomListener(goDemo, "click", function() {
		map.panTo(showAddress(demo));
        	});
        	// Rostock Laage Button
        	var goLaage = document.createElement("div");
        	this.setButtonStyle_(goLaage);
        	container.appendChild(goLaage);
        	goLaage.appendChild(document.createTextNode(butRostockLaage));
        	GEvent.addDomListener(goLaage, "click", function() {
		map.panTo(showAddress(rostockLaage));
        	});

        	map.getContainer().appendChild(container);
        	return container;
	}

	// Position der Buttons
	GoToLocation.prototype.getDefaultPosition = function() {
 		return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 160));
	}

	// Sets the proper CSS for the given button element.
	GoToLocation.prototype.setButtonStyle_ = function(button) {
  		//button.style.textDecoration = "underline";
		button.style.color = "#000000";
  		button.style.backgroundColor = "white";
  		button.style.font = "small Arial";
  		button.style.border = "1px solid black";
  		button.style.padding = "2px";
  		button.style.marginBottom = "3px";
  		button.style.textAlign = "center";
  		button.style.width = "6em";
  		button.style.cursor = "pointer";
	}

	// Kontrollelemente
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
	map.addControl(new GoToLocation());
	//map.setCenter(showAddress(heiligendamm)); // funktioniert nicht mit den Polylines
      	map.setCenter(new GLatLng(54.14192568383839,11.842231750488281), 10);
      	// Array mit den Koordinaten für den Zaun um Heiligendamm
 	var punkteZaun = [ new GLatLng(54.146752076567346,11.869697570800781), new GLatLng(54.13870777614892,11.862831115722656), new GLatLng(54.13347814286039,11.876220703125), new GLatLng(54.12724194787524,11.871757507324219), new GLatLng(54.12482768488993,11.843605041503906), new GLatLng(54.120401170729096,11.827125549316406), new GLatLng(54.12744313010777,11.818199157714844), new GLatLng(54.13890890270483,11.821632385253906), new GLatLng(54.14554553112429,11.816482543945312)];
      	// den Zaun in rot einzeichnen
      	map.addOverlay(new GPolyline(punkteZaun, "#b22222"));
	// einen Marker für den Startpunkt 

	//Koordinaten Demoroute 1 Rostock
 	var punkteDemoRouteEins = [ new GLatLng(54.10465303273579,12.067537307739258), new GLatLng(54.09821117607916,12.090110778808594), new GLatLng(54.09227170305575,12.098007202148438), new GLatLng(54.09378181919031,12.114572525024414), new GLatLng(54.092020011689065,12.130365371704102)];
      	// die 1. Demoroute in lila einzeichnen
      	map.addOverlay(new GPolyline(punkteDemoRouteEins, "#c71585"));

	//Koordinaten Demoroute 2 Rostock
 	var punkteDemoRouteZwei = [ new GLatLng(54.092020011689065,12.130365371704102), new GLatLng(54.09227170305575,12.142724990844727), new GLatLng(54.09030846990081,12.142210006713867), new GLatLng(54.08970437947075,12.129592895507812), new GLatLng(54.085274114230494,12.125988006591797), new GLatLng(54.081346892774775,12.127704620361328), new GLatLng(54.078627829444834,12.125473022460938), new GLatLng(54.077671079613246,12.127189636230469)];
      	// die 2. Demoroute in grün einzeichnen
      	map.addOverlay(new GPolyline(punkteDemoRouteZwei, "#008000"));

      } // Ende isBrowserCompatible
    } // Ende load
//Ende der G8 Google Map


