// JavaScript Document

	function popup (url, large) {
		if (large == 1 ){
			fenster = window.open(url, "Popupfenster", "width=1200,height=810,resizable=yes");
		}
		else {
			fenster = window.open(url, "Popupfenster", "width=590,height=810,resizable=yes");	
		}
		fenster.focus();
		return false;
	}

	function loadMap() {	
		if (lageplan == true) {
			lageplan = false;
			if (GBrowserIsCompatible()) {
				firstOpen_shuttles = true;
				if(showParkingArea == true) {
					var zoomlevel = 14;
				}
				else {
					var zoomlevel = 10;
				}
				
				var map = new GMap2(document.getElementById("map"));
				map.setCenter(new GLatLng(47.3505,9.0673), zoomlevel);
				var mapTypeControl = new GMapTypeControl();
				var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
				var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,10));
				map.addControl(mapTypeControl, topRight);
				GEvent.addListener(map, "dblclick", function() {
														map.removeControl(mapTypeControl);
														map.addControl(new GMapTypeControl(), bottomRight);
													});
				map.addControl(new GLargeMapControl());
				var marker = new GMarker(new GLatLng(47.3505,9.0673));
				var marker_shuttle_1 = new GMarker(new GLatLng(47.3597, 9.075));
				var marker_shuttle_2 = new GMarker(new GLatLng(47.356, 9.0763));
				var html_OA = '<div style="width: 210px; height: 80px; padding-right: 5px"><img src=media/lageplan/logo_tiny.gif><br><font size=2><b>Openair 2010 Location</b></font><p>Bitte zoomen für Shuttlebus und Parkplatzinfos</p></div>';
				var html_OA_short = '<div style="width: 225px; height: 120px; padding-right: 5px"><img src=media/lageplan/logo_tiny.gif><br><font size=2><b>Openair 2010 Location</b></font><br><br><img src="images/signal_of_transit_quer.gif"><br>Parkverbot auf dem Openairgelände!!!</div>';
				var html_shuttle_1 = '<div style="width: 235px; height: 80px; padding-right: 5px"><font size=2><b>Shuttlebus BAHNHOF Bütschwil</b></font><br><br><img src=images/shuttlebus.gif><p><a href=?id=6>hier klicken für Fahrplanübersicht</a></p></div>';
				var html_shuttle_2 = '<div style="width: 220px; height: 80px; padding-right: 5px"><font size=2><b>Shuttlebus & Parkplatz SOOR</b></font><br><br><img src=images/shuttlebus.gif>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src=images/parkplatz.gif><p><a href=?id=6>hier klicken für Fahrplanübersicht</a></p></div>';
				
				GEvent.addListener(marker, "click", function() {
														if(map.getZoom() >= 14) {
															marker.openInfoWindowHtml(html_OA_short);
														}
														else {
															marker.openInfoWindowHtml(html_OA);
														}
													});
				
				GEvent.addListener(marker_shuttle_1, "click", function() {			
														marker_shuttle_1.openInfoWindowHtml(html_shuttle_1);
													});
				GEvent.addListener(marker_shuttle_2, "click", function() {			
														marker_shuttle_2.openInfoWindowHtml(html_shuttle_2);
													});
				
				map.addOverlay(marker);
				map.addOverlay(marker_shuttle_1);
				map.addOverlay(marker_shuttle_2);
				
				if(showParkingArea) {
					marker_shuttle_1.show()
					marker_shuttle_2.show()
					GEvent.trigger(marker_shuttle_2, "click");
					firstOpen_shuttles = false;
					showParkingArea = false;
				}
				else {
					marker_shuttle_1.hide();
					marker_shuttle_2.hide();				
					GEvent.trigger(marker, "click");
				}
				
				GEvent.addListener(map, "zoomend", function(oldlevel, newlevel) {
														if(newlevel >= 14) {
															marker_shuttle_1.show()
															marker_shuttle_2.show()
															if(newlevel = 14 && firstOpen_shuttles) {
																marker_shuttle_2.openInfoWindowHtml(html_shuttle_2);
																firstOpen_shuttles = false;
															}
															marker.closeInfoWindow()
														}
														else {
															marker_shuttle_1.closeInfoWindow()
															marker_shuttle_2.closeInfoWindow()
															marker_shuttle_1.hide()
															marker_shuttle_2.hide()
														}
													});
			}
		}
	}