//// Googlemaps mit Routenplaner (c) 2007 by www.rpa-com.de
//
//  Vers. 1.10 mit eigenen Icons
//
//  Vers. 1.00 
//
////


//Koordinaten
var point = new GLatLng(51.682015, 6.957580);

//Adresse     
var infoname= 'rpa-com Webdesign';
var infoname2= 'Ronald Parcinski';
var infostrasse= 'Parallelstr.28';
var infoort= '46284 Dorsten';
var infotelefon= 'Telefon: 02362 - 794621';

if (infoname2!=''){infoname2='<br>' + infoname2;}
var infohtml= '<center><div style="width:230px;"><b><big>' + infoname + '</big></b>' + infoname2 + '<br>' + infostrasse + '<br>' + infoort + '<br>' + infotelefon + '</div></center>';

// Beispiel für Routenplanereingabe
var beispiel= '<div style="font-size: 10px";>Beispiel: Gladbecker Str. 178, 46282 Dorsten</div>';
//var beispiel= '<div style="font-size: 10px";>Beispiel: Parallelstr. 28, 46284 Dorsten</div>';


// Foto (optional)
//var fotopfad= '<center><img src="http://www.rpa-com.de/grafik/foto_gm.jpg" width=120 height=74 vspace=3></center>';
//var infohtml= infohtml + fotopfad; 
     

iconpfad= 'http://www.rpa-com.de/grafik/blue_marker.png';


// Icon definieren
var baseIcon = new GIcon();
    baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    baseIcon.iconSize = new GSize(20, 34);
    baseIcon.shadowSize = new GSize(37, 34);
    baseIcon.iconAnchor = new GPoint(9, 34);
    baseIcon.infoWindowAnchor = new GPoint(9, 2);
    baseIcon.infoShadowAnchor = new GPoint(18, 25);
    
var icon = new GIcon(baseIcon);
    icon.image = iconpfad;
 


//<![CDATA[

    // Check to see if this browser can run the Google API
    if (GBrowserIsCompatible()) {      
      
      var gmarkers = [];
      var htmls = [];
      var to_htmls = [];
      var from_htmls = [];
      var i=0;
      
      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
        var marker = new GMarker(point,icon);

        // The info window version with the "Hierher" form open
        to_htmls[i] = html + '<br>Route planen: <b>Hierher</b> - <a href="javascript:fromhere(' + i + ')">Von hier aus</a>' +
           '<br>Startadresse: <form action="http://maps.google.com/maps" method="get" target="_blank">' +
           '<input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' + beispiel + '<br>' +
           '<INPUT value="Route berechnen" TYPE="SUBMIT">' +
           '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() + 
                  // "(" + name + ")" + 
           '"/>';
        // The info window version with the "Von hier aus" form open
        from_htmls[i] = html + '<br>Route planen: <a href="javascript:tohere(' + i + ')">Hierher</a> - <b>Von hier aus</b>' +
           '<br>Zieladresse: <form action="http://maps.google.com/maps" method="get" target="_blank"> ' +
           '<input type="text" SIZE=40 MAXLENGTH=40 name="daddr" id="daddr" value="" /><br>' + beispiel + '<br>' +
           '<INPUT value="Route berechnen" TYPE="SUBMIT">' +
           '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
                  // "(" + name + ")" + 
           '"/>';
        // The inactive version of the direction info
        html = html + '<br>Route planen: <a href="javascript:tohere('+i+')">Hierher</a> - <a href="javascript:fromhere('+i+')">Von hier aus</a>';

        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        
        gmarkers[i] = marker;
        htmls[i] = html;
        i++;
        return marker;
      }

      // functions that open the directions forms
      function tohere(i) {
        gmarkers[i].openInfoWindowHtml(to_htmls[i]);
      }
      function fromhere(i) {
        gmarkers[i].openInfoWindowHtml(from_htmls[i]);
      }

      // Display the map, with some controls and set the initial location 
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      //map.setCenter(new GLatLng(48.615243,11.605757), 15);
      map.setCenter(point, 15);
    
      // Set up ONE markers with info windows 
    
     
     var marker = createMarker(point,infoname,infohtml);
     map.addOverlay(marker);
     
     //Übersichtsfenster
     overview = new GOverviewMapControl(new GSize(135,135));
     map.addControl(overview);
     //setOverviewPos(); 
     
    }

    
    // display a warning if the browser was not compatible
    else {
      alert("Leider ist Google Maps API nicht kompatibel mit diesem Browser!");
    }

    // This Javascript is based on code provided by the
    // Blackpool Community Church Javascript Team
    // http://www.commchurch.freeserve.co.uk/   
    // http://www.econym.demon.co.uk/googlemaps/

    //]]>
    
