/*
	Karte für Stiftung Zuhoeren
	Voraussetzungen: JQuery, GMaps-API
	
	Hinweis: Die Quelle für das MarkerIcon "sz_loudspeaker.png" muss entsprechend der Pfadlage modifiziert werden (Z.139)
	Zielort: http://www.zuhoeren.de/schule-jugendeinrichtungen/die-welt-im-ohr/hessen-hoeren.html
	Verzeichnis: js/sz_gmap.js
*/

$(document).ready(function(){
   initHessenHoerenMap();
});

var map = null;

function initHessenHoerenMap(){
	var initial_latlng = new google.maps.LatLng(50.578, 9.136);
	var myOptions = {
      zoom: 8,
      center: initial_latlng,
	  mapTypeId: 'ws',
      disableDefaultUI: false,
     // navigationControl: false,
	  mapTypeControlOptions: {
              mapTypeIds: []
      },
	  scaleControl: true
    };
	
	/* Styled Map Parameters */
	var styles = {
          'WS': [
			{ featureType: "administrative.locality", elementType: "all", stylers: [ { gamma: 6.47 }, { visibility: "on" } ] },
			{ featureType: "administrative.province", elementType: "all", stylers: [ { visibility: "on" }, { lightness: -100 }, { saturation: 98 }, { hue: "#ff7700" } ] },
			{ featureType: "road", elementType: "all", stylers: [ { visibility: "simplified" } ] },
			{ featureType: "road.local", elementType: "all", stylers: [ { visibility: "off" } ] },
			{              
              featureType: 'all',
              stylers: [
                {saturation: -40},
                {gamma: 0.70}
              ]
            }	
			]
    };
	var styledMapType = new google.maps.StyledMapType(styles['WS'], {name: 'ws'});
	
    map= new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	map.mapTypes.set('ws', styledMapType);
	
	var hh_data=[
	   {"location":"Bad Wildungen", "lat": 51.10428, "lon":
		9.12208,"tooltip":"Ense Schule",
		"url":"http://www.zuhoeren.de/index.php?id=250"},

		{"location":"Gudensberg", "lat": 51.17264, "lon":
		9.35994,"tooltip":"Klasse 9a, GAZ Gudensberg",
		"url":"http://www.zuhoeren.de/index.php?id=259"},


		{"location":"Kassel", "lat": 51.31694, "lon":
		9.47794,"tooltip":"1. Mädchenhaus Kassel 1992 e. v.",
		"url":"http://www.zuhoeren.de/index.php?id=261"},

		{"location":"Großalmerode", "lat": 51.26033, "lon":
		9.77881,"tooltip":"Valentin-Traudt-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=257"},

		/*{"location":"Eschwege", "lat": 51.18694, "lon":
		10.04029,"tooltip":"Hessische Stenografenjugend",
		"url":""},*/

		{"location":"Schwalmstadt-Ziegenhain", "lat": 50.91759, "lon":
		9.24457,"tooltip":"Carl-Bantzer-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=268"},

		{"location":"Nidda", "lat": 50.41535, "lon":
		9.01412,"tooltip":"Gymnasium Nidda",
		"url":"http://www.zuhoeren.de/index.php?id=265"},

		{"location":"Niddatal-Assenheim", "lat": 50.29913, "lon":
		8.81438,"tooltip":"NABU Umweltwerkstatt Wetterau e. V.",
		"url":"http://www.zuhoeren.de/index.php?id=266"},

		{"location":"Freigericht", "lat": 50.141765, "lon":
		9.124745,"tooltip":"Wahlunterricht Mediengestaltung Jahrgang 9, Kopernikusschule Freigericht",
		"url":"http://www.zuhoeren.de/index.php?id=256"},

		{"location":"Dreieich", "lat": 50.020666, "lon":
		8.689716,"tooltip":"Die rasenden Reporter, Ricarda-Hauch-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=254"},

		{"location":"Langen", "lat": 49.98499, "lon":
		8.6682,"tooltip":"Klasse 8aG, Adolf-Reichwein-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=262"},

		{"location":"Darmstadt", "lat": 49.85101, "lon":
		8.65139,"tooltip":"Lichtenbergschule Darmstadt",
		"url":"http://www.zuhoeren.de/index.php?id=253"},

		{"location":"Michelstadt", "lat": 49.67117, "lon":
		9.00806,"tooltip":"Radio-AG, Theodor-Litt-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=264"},

		{"location":"Bensheim", "lat": 49.682782, "lon":
		8.621355,"tooltip":"Jugendrotkreuz Bensheim",
		"url":"http://www.zuhoeren.de/index.php?id=251"},

		{"location":"Bürstadt", "lat": 49.63921, "lon":
		8.46872,"tooltip":"Erich-Kästner-Schule, WPU-Medien, Klasse 9",
		"url":"http://www.zuhoeren.de/index.php?id=252"},

		{"location":"Groß-Gerau", "lat": 49.91559, "lon":
		8.49354,"tooltip":"Radio-AG, Prälat-Diehl-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=258"},

		{"location":"Rüsselsheim", "lat": 49.995393, "lon":
		8.414148,"tooltip":"Jugendbildungswerk Rüsselsheim",
		"url":"http://www.zuhoeren.de/index.php?id=267"},

		{"location":"Schwanheim", "lat": 50.084108, "lon":
		8.588257,"tooltip":"The Cubes",
		"url":"http://www.zuhoeren.de/index.php?id=269"},

		{"location":"Frankfurt", "lat": 50.14296, "lon":
		8.68458,"tooltip":"Deutsche Jugend aus Russland e. V.",
		"url":"http://www.zuhoeren.de/index.php?id=255"},

		{"location":"Hüttenberg", "lat": 50.51802, "lon":
		8.57305,"tooltip":"Wahlpflichtkurs Medienkunde, 8. und 9. Jahrgangsstufe, Gesamtschule Schwingbach",
		"url":"http://www.zuhoeren.de/index.php?id=260"},

		{"location":"Lollar", "lat": 50.65737, "lon":
		8.71793,"tooltip":"Clemens-Brentano-Europaschule",
		"url":"http://www.zuhoeren.de/index.php?id=263"},
		
		{"location":"Wiesbaden", "lat": 50.07179, "lon":
		8.23059,"tooltip":"Wolfram-von-Eschenbach-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=342"},


		{"location":"Wiesbaden", "lat": 50.07489, "lon":
		8.25683,"tooltip":"Helene-Lange-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=343"},

		{"location":"Frankfurt", "lat": 50.1186, "lon":
		8.56079,"tooltip":"Eduard-Spranger-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=339"},


		{"location":"Frankfurt", "lat": 50.11989, "lon":
		8.76906,"tooltip":"Heinrich-Kraft-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=340"},
	

		{"location":"Frankfurt", "lat": 50.0999, "lon":
		8.67892,"tooltip":"Schwanthaler Schule",
		"url":"http://www.zuhoeren.de/index.php?id=341"},

		{"location":"Frankfurt", "lat": 50.12769, "lon":
		8.70301,"tooltip":"IGS Nordend",
		"url":"http://www.zuhoeren.de/index.php?id=337"},

		{"location":"Frankfurt", "lat": 50.12157, "lon":
		8.6459,"tooltip":"Mädchenbüro Frankfurt",
		"url":"http://www.zuhoeren.de/index.php?id=336"},


		{"location":"Frankfurt", "lat": 50.13763, "lon":
		8.66285,"tooltip":"Mosaikschule",
		"url":"http://www.zuhoeren.de/index.php?id=338"},

		
		{"location":"Neu-Anspach", "lat": 50.29826, "lon":
		8.50962,"tooltip":"Adolf-Reichwein-Schule Neu-Anspach",
		"url":"http://www.zuhoeren.de/index.php?id=329"},
		
		{"location":"Dietzenbach", "lat": 50.02072, "lon":
		8.79983,"tooltip":"Kreisjugendfeuerwehr Offenbach",
		"url":"http://www.zuhoeren.de/index.php?id=331"},	
		
		{"location":"Giessen", "lat": 50.57687, "lon":
		8.69310,"tooltip":"Gesamtschule Giessen-Ost",
		"url":"http://www.zuhoeren.de/index.php?id=332"},
		
		{"location":"Buedingen", "lat": 50.28160, "lon":
		9.11560,"tooltip":"Schule am Dohlberg",
		"url":"http://www.zuhoeren.de/index.php?id=330"},
		
		{"location":"Fritzlar", "lat": 51.12818, "lon":
		9.27336,"tooltip":"Ursulinenschule Fritzlar",
		"url":"http://www.zuhoeren.de/index.php?id=323"},	
		
		{"location":"Kirchhain", "lat": 50.81957, "lon":
		8.92669,"tooltip":"Jugendfeuerwehr Kirchhain",
		"url":"http://www.zuhoeren.de/index.php?id=324"},
	
		{"location":"Reichelsheim", "lat": 49.71718, "lon":
		8.84189,"tooltip":"Georg-August-Zinn Schule",
		"url":"http://www.zuhoeren.de/index.php?id=325"},
		
		
		{"location":"Heusenstamm", "lat": 50.05397, "lon":
		8.78537,"tooltip":"Adolf-Reichwein-Gymnasium",
		"url":"http://www.zuhoeren.de/index.php?id=327"},
		
		{"location":"Bad Homburg", "lat": 50.22715, "lon":
		8.63126,"tooltip":"Maria-Ward-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=328"},
		
				
		{"location":"Seeheim-Jugenheim", "lat": 49.760545, "lon":
		8.63433,"tooltip":"Schuldorf Bergstrasse",
		"url":"http://www.zuhoeren.de/index.php?id=333"},
		
		{"location":"Griesheim", "lat": 49.86348, "lon":
		8.57854,"tooltip":"Gerhard-Hauptmann-Schule",
		"url":"http://www.zuhoeren.de/index.php?id=334"},	
		
		
		
];

	var hh_icon = new google.maps.MarkerImage('images/sz_loudspeaker.png',
      new google.maps.Size(26, 26),
      // The origin for this image is 0,0.
      new google.maps.Point(0,0),
      // The anchor for this image is the base of the flagpole at 0,32.
      new google.maps.Point(0, 32));



	for (var i=0;i<hh_data.length;i++){
		var loc=hh_data[i].location;
		var lat=hh_data[i].lat;
		var lon=hh_data[i].lon;
		var label=hh_data[i].tooltip;
		var url=hh_data[i].url;
		var point = new google.maps.LatLng(lat, lon );

		var marker = new google.maps.Marker({
		  position: point, 
		  map: map,		 
		  title: label,
		  icon: hh_icon
		});
		google.maps.event.addListener(marker, 'click', buildClickHandler(url));

	}
	
}

function buildClickHandler(url) {
    return function() { 
		window.location = url;
	};
}


