﻿/**********************************************************
 *** Googlemap by SiMedia                               ***
 **********************************************************/

function LoadGoogleMap( _Name, _Address, _ZipCode, _Place, _Telephone, _Telefax, _Email, _GoogleMapX, _GoogleMapY, _RedirectPage ) {
    
    if (GBrowserIsCompatible()) { 

    // parse to float
    var GoogleMapX = parseFloat( _GoogleMapX );
    var GoogleMapY = parseFloat( _GoogleMapY );

    // GoogleMap
    var GoogleMap = new GMap2(document.getElementById("GoogleMap"));
        GoogleMap.addControl(new GOverviewMapControl());
    var CompanyIcon                  = new GIcon();
	    CompanyIcon.image            = "/de/betriebe-detail/GoogleMapIcons/haus.png";
	    CompanyIcon.iconSize         = new GSize(32, 32);
	    CompanyIcon.shadowSize       = new GSize(18, 20);
	    CompanyIcon.iconAnchor       = new GPoint(8, 22);
	    CompanyIcon.infoWindowAnchor = new GPoint(5, 1);
			
	    GoogleMap.setCenter (new GLatLng( GoogleMapY, GoogleMapX ), 10);
        GoogleMap.addControl(new GLargeMapControl());
        GoogleMap.addControl(new GMapTypeControl());

    // define markers
    var Marker = new GMarker(new GLatLng( GoogleMapY, GoogleMapX ), CompanyIcon);
       
    var MarkerManager = new GMarkerManager(GoogleMap);
        MarkerManager.addMarker(Marker,8,17);
  
        if ( _Telefax!= "" ) { _Telefax = "Fax: " + _Telefax; } else { _Telefax = ""; }
        
    var InformationTab = [
		                    new GInfoWindowTab("Info", '<h2>' + _Name + '</h2><br /><font class=""clscell"">' + _Address + ' ' + _ZipCode + ' ' + _Place + '<br>Tel.:  ' + _Telephone + '<br>' + _Telefax + "<br /><br /><a href='" + _RedirectPage + "'>Anfrage senden</a><br></font>"),
		  	                new GInfoWindowTab("Route", '<font class=""clscell""><form action="http://maps.google.de/maps" target="_blank"><br>Geben Sie Ihre Startadresse ein:<br>(Strasse Nr, PLZ Ort)<br><input name="saddr" class="ib" value="" type="text"><br><br><input name="daddr" value="' + _Place + '" type="hidden"><input class="euSubmit" name="send" value="Route anzeigen" type="submit"><br><br></form><font>')
		                 ];
  
        GEvent.addListener(Marker, "click", 
                                function() {
                                    Marker.openInfoWindowTabsHtml(InformationTab);
      	                        }
      	                   );
    }
}

/**********************************************************
 *** Googlemap by SiMedia                               ***
 **********************************************************/

