			var googlemap = null;
			var googleDirections = null;
			var showRouteDiv = false;
			var directionsPanel_box = false;
    		var geocoder = null;
    		var googlemap_marker = new Array();
			var googlemap_activate_nr = 0;
			
			if (GBrowserIsCompatible()) {
				var icon = new GIcon();
				icon.image = "/html/images/main/ico_marker_map.png";
				//icon.iconSize = new GSize(16, 16);
				//icon.iconAnchor = new GPoint(8, 8);
				//icon.infoWindowAnchor = new GPoint(8, 8);
				
				icon.iconSize = new GSize(30, 30);
				icon.iconAnchor = new GPoint(15, 15);
				icon.infoWindowAnchor = new GPoint(15, 15);
			}
			
			var google_data = [
									{
										"address" : "13353 Berlin,  Müllerstr. 178",
										"zoom"	:	10,
										"window_html" : "<div style='padding:10px; width:230px'><img src='/html/images/main/googlemap_unternehmen.jpg' align='right' style='margin-left:5px;' /><strong>Bayer Schering Pharma AG</strong><br />Müllerstr. 178<br />13353 Berlin</div>"
									}
									
							];
			
			function load_google() {
		      if (BrowserDetect.browser == "Explorer" && BrowserDetect.version == 6) {
					return false;
			  }

			  if (GBrowserIsCompatible()) {
				
		        googlemap = new GMap2(document.getElementById("googlemap"));
		        //googlemap.setCenter(new GLatLng(1650, -214), 13);
				
				googlemap.addControl(new GLargeMapControl());
				
				var mapTypeControl = new GMapTypeControl();
				var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
				googlemap.addControl(mapTypeControl, topRight);
				googlemap.addControl(new GOverviewMapControl());

				
				googlemap.enableScrollWheelZoom();
				
				directionsPanel = document.getElementById("route");
				directionsPanel_box = document.getElementById("route_overlay");
				googleDirections = new GDirections(googlemap, directionsPanel);
				GEvent.addListener(googleDirections, "load", onGDirectionsLoad);
				GEvent.addListener(googleDirections, "error", onGDirectionsErrors);

        		geocoder = new GClientGeocoder();
        		
				if (google_data[googlemap_activate_nr]) {
					var address = google_data[googlemap_activate_nr].address;
					var zoom = google_data[googlemap_activate_nr].zoom;
					geocoder.getLatLng(
						  address,
							function(point) {
								if (point) {
									googlemap.setCenter(point, zoom);
								}
							}
						);

				}
				
				for (i=0;i<google_data.length;i++) {
					showAddress(google_data[i], i);
				}
		      }

			  }
			
			function showAddress(data, nr) {
				var address = data.address;
				var msg = data.window_html;
				var zoom = data.zoom;
				var active = data.active;
				
      			if (geocoder) {
        			geocoder.getLatLng(
          			address,
          			function(point) {
            				if (!point) {
              					alert(address + " not found");
            				} else {
								
              					googlemap_marker[nr] = new GMarker(point,icon);
              					googlemap.addOverlay(googlemap_marker[nr]);
              					
								if (googlemap_activate_nr == nr) {
									googlemap_marker[nr].openInfoWindowHtml(msg);
								}	
              					
              					googlemap_marker[nr].html = msg;
								GEvent.addListener(googlemap_marker[nr], 'click', function() {
									googlemap_marker[nr].openInfoWindowHtml(googlemap_marker[nr].html);
								});
            				}
          			}
        			);
      			}
    		}
			
			
			function showRoute(from, locale, flag_show) {
				directionsPanel_box.style.display = 'none';
				showRouteDiv = flag_show;
				if (flag_show == false) {
					document.getElementById("googlemap_search").from.value = from;
				}
				
				googleDirections.clear();
				googleDirections.load("from: "+from+" to: "+google_data[0].address, { "locale": locale });
			}
			
			function onGDirectionsErrors(){
			   if (googleDirections.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
				 alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + googleDirections.getStatus().code);
			   else if (googleDirections.getStatus().code == G_GEO_SERVER_ERROR)
				 alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + googleDirections.getStatus().code);
			   
			   else if (googleDirections.getStatus().code == G_GEO_MISSING_QUERY)
				 alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + googleDirections.getStatus().code);

			  else if (googleDirections.getStatus().code == G_GEO_BAD_KEY)
				 alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + googleDirections.getStatus().code);

			   else if (googleDirections.getStatus().code == G_GEO_BAD_REQUEST)
				 alert("A directions request could not be successfully parsed.\n Error code: " + googleDirections.getStatus().code);
				
			   else alert("An unknown error occurred.");
	   
			}

			function onGDirectionsLoad(){ 
				if (showRouteDiv) {
					url = '/scripts/pages/'+document.getElementById('locale').value+'/map_popup.html';
					popup = window.open(url, "popup2", "width=800,height=600,screenX=750,screenY=0,toolbar=yes,scrollbars=yes,resizable=yes,menubar=yes,location=no,status=no");
					popup.focus();
				} 
			}
			
			function closeRouteOverlay() {
				directionsPanel_box.style.display = 'none';
			}
			
			function getMapData() {
				return directionsPanel.innerHTML;
			}
			
			
			registerOnload (load_google);
			
			
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

			
			
			
