var points = [];
var markers = [];
var counter = 0;
var to_htmls = [];
var from_htmls = [];
var map = null;
function onLoad() {
if (GBrowserIsCompatible()) {
var mapObj = document.getElementById("map");
if (mapObj != "undefined" && mapObj != null) {
map = new GMap2(document.getElementById("map"));


// Koordinaten
map.setCenter(new GLatLng(46.5506437,11.8740453), 12);
var point = new GLatLng(46.5506437,11.8740453);


// Wechseln Sie die Ortsbeschreibung durch Ihre eigenen Angaben aus
var marker = createMarker(point,"Hotel La Plaza, 39033 Corvara, Italy","<div id=\"gmapmarker\"><div style=\"font-family:Verdana;font-size:11px;\"><strong>Hotel La Plaza</strong><br/>Col Alt 26<br/>39033 Corvara/Alta Badia<br /> S&uuml;dtirol - Italien</div></div>", 0);




// Ein textbasiertes Zoom-Bedienelement ist ein GControl, das die Textlinks "Zoom In" und "Zoom Out" anzeigt (im Gegensatz zu den Symbolschaltflächen in Google Maps).

// Zunächst wird die Funktion definiert
 function TextualZoomControl() {
}

// Zum Erstellen einer "Unterklasse" des GControl wird das Prototypobjekt auf eine Instanz des GControl-Objekts festgelegt
TextualZoomControl.prototype = new GControl();

// Erstellt ein DIV für jede der Schaltflächen und platziert sie in einem Container
// DIV, das als Bedienelement zurückgegeben wird. Das Bedienelement wird zum Kartencontainer hinzugefügt und gibt das Element für die Kartenklasse zurück, damit es ordnungsgemäß positioniert wird.
TextualZoomControl.prototype.initialize = function(map) {
  var container = document.createElement("div");

  var zoomInDiv = document.createElement("div");
  this.setButtonStyle_(zoomInDiv);
  container.appendChild(zoomInDiv);
  zoomInDiv.appendChild(document.createTextNode("Einzoomen"));
  GEvent.addDomListener(zoomInDiv, "click", function() {
    map.zoomIn();
  });

  var zoomOutDiv = document.createElement("div");
  this.setButtonStyle_(zoomOutDiv);
  container.appendChild(zoomOutDiv);
  zoomOutDiv.appendChild(document.createTextNode("Auszoomen"));
  GEvent.addDomListener(zoomOutDiv, "click", function() {
    map.zoomOut();
  });

  map.getContainer().appendChild(container);
  return container;
}



// Kontroller hinzu
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.enableScrollWheelZoom();
map.addMapType(G_PHYSICAL_MAP);
map.removeMapType(G_HYBRID_MAP);


map.addOverlay(marker);

GEvent.trigger(marker, "click");
}
} else {
alert("Entschuldigung, diese Funktion ist nicht kompatibel mit Ihrem Browser!");
}
}
function createMarker(point, title, html, n) {
if(n >= 0) { n = -1; }
var marker = new GMarker(point);
var tabFlag = isArray(html);
if(!tabFlag) { html = [{"contentElem": html}]; }
to_htmls[counter] = html[0].contentElem + '<p /><form class="gmapDir" id="gmapDirTo" style="white-space: nowrap;" action="http://maps.google.de/maps" method="get" target="_blank">' +
                     '<span class="gmapDirHead" id="gmapDirHeadTo">Route berechnen: <strong>Hierher</strong> - <a href="javascript:fromhere(' + counter + ')">Von hier</a></span>' +
                     '<p class="gmapDirItem" id="gmapDirItemTo"><label for="gmapDirSaddr" class="gmapDirLabel" id="gmapDirLabelTo">Start:<br /></label>' +
                     '<input type="text" size="16" maxlength="40" name="saddr" class="gmapTextBox" id="gmapDirSaddr" value="" onfocus="this.style.backgroundColor = \'#e0e0e0\';" onblur="this.style.backgroundColor = \'#ffffff\';" />' +
                     '<span class="gmapDirBtns" id="gmapDirBtnsTo"><input value="Los!" type="submit" class="gmapDirButton" id="gmapDirButtonTo" /></span></p>' +
                     '<input type="hidden" name="daddr" value="' +
                     point.y + ',' + point.x + "(" + title.replace(new RegExp(/"/g),'&quot;') + ")" + '" /></form>';
                      from_htmls[counter] = html[0].contentElem + '<p /><form class="gmapDir" id="gmapDirFrom" style="white-space: nowrap;" action="http://maps.google.de/maps" method="get" target="_blank">' +
                     '<span class="gmapDirHead" id="gmapDirHeadFrom">Route berechnen: <a href="javascript:tohere(' + counter + ')">Hierher</a> - <strong>Von hier</strong></span>' +
                     '<p class="gmapDirItem" id="gmapDirItemFrom"><label for="gmapDirSaddr" class="gmapDirLabel" id="gmapDirLabelFrom">Ziel:<br /></label>' +
                     '<input type="text" size="16" maxlength="40" name="saddr" class="gmapTextBox" id="gmapDirSaddr" value="" onfocus="this.style.backgroundColor = \'#e0e0e0\';" onblur="this.style.backgroundColor = \'#ffffff\';" />' +
                     '<span class="gmapDirBtns" id="gmapDirBtnsFrom"><input value="Los!" type="submit" class="gmapDirButton" id="gmapDirButtonFrom" /></span></p' +
                     '<input type="hidden" name="daddr" value="' +
                     point.y + ',' + point.x + "(" + title.replace(new RegExp(/"/g),'&quot;') + ")" + '" /></form>';
                     html[0].contentElem = html[0].contentElem + '<p /><div id="gmapDirHead" class="gmapDir" style="white-space: nowrap;">Route berechnen: <a href="javascript:tohere(' + counter + ')">Hierher</a> - <a href="javascript:fromhere(' + counter + ')">Von hier</a></div>';
if(!tabFlag) { html = html[0].contentElem; }if(isArray(html)) { GEvent.addListener(marker, "click", function() { marker.openInfoWindowTabsHtml(html); }); }
else { GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); }
points[counter] = point;
markers[counter] = marker;
counter++;
return marker;
}
function isArray(a) {return isObject(a) && a.constructor == Array;}
function isObject(a) {return (a && typeof a == 'object') || isFunction(a);}
function isFunction(a) {return typeof a == 'function';}
function showInfoWindow(idx,html) {
map.centerAtLatLng(points[idx]);
markers[idx].openInfoWindowHtml(html);
}
function tohere(idx) {
markers[idx].openInfoWindowHtml(to_htmls[idx]);
}
function fromhere(idx) {
markers[idx].openInfoWindowHtml(from_htmls[idx]);
}





 
window.onload = onLoad;

// Modifiziertes Javascript welches den Onload-Parameter
// des fehlenden body-Tags umgeht.
