// function makeAlert() {
// 	alert("GOOGLE MAPS");
// }

var map;
var geocoder;
var hans;
var blueIcon;
var markerb;
var laden;

function load_google_map() {
 	if (GBrowserIsCompatible()) {
	        map = new GMap2(document.getElementById("map"));
	        map.setCenter(new GLatLng(47.387071, 8.520363), 13);
	        map.addControl(new GSmallMapControl());
	        //map.addControl(new GMapTypeControl());
					geocoder = new GClientGeocoder();
					
					blueIcon = new GIcon(G_DEFAULT_ICON);
					blueIcon.image = "http://server49.hostpoint.ch/~wavesick/wavesick.com/images/marker.png";

					// Set up our GMarkerOptions object
							markerb = { icon:blueIcon };

	}
}

// addAddressToMap() is called when the geocoder returns an
   // answer.  It adds a marker to the map with an open info window
   // showing the nicely formatted version of the address and the country code.
   function addAddressToMap(response) {
     map.clearOverlays();
     if (!response || response.Status.code != 200) {
       alert("Sorry, we were unable to geocode that address");
     } else {
       place = response.Placemark[0];
       point = new GLatLng(place.Point.coordinates[1],
                           place.Point.coordinates[0]);
			marker = new GMarker(point, markerb);
									map.addOverlay(marker);
			
			// map.addOverlay(new GMarker(point, marker));

       marker.openInfoWindowHtml( "<div id='pano' style='width:250px;height:150px;'><img src='http://server49.hostpoint.ch/~wavesick/wavesick.com/images/dealersticker.jpg' alt='wavesick'><br>" + laden + "<br></div>" + '<br>' + place.address );
     }
   }

   // showLocation() is called when you click on the Search button
   // in the form.  It geocodes the address entered into the form
   // and adds a marker to the map at that location.
	 function showLocation() {
		//   var address = document.forms[0].q.value;
     var address = hans;
     geocoder.getLocations(address, addAddressToMap);
   }

  // findLocation() is used to enter the sample addresses into the form.
   function findLocation(address) {
     //document.forms[0].q.value = address;
		hans = address;
     showLocation();
   }

function uebergabe(inName){
	laden = inName;
	// alert(laden);
}