
	var points = [];
	var markers = [];
	var counter = 0;
	var to_htmls = [];
	var from_htmls = [];	
function load() {
  if (GBrowserIsCompatible()) {
	var map = new GMap2(document.getElementById("map"));
	var GLatLng1 = document.getElementById("GLatLng1").value;
	var GLatLng2 = document.getElementById("GLatLng2").value;
	var adresse = document.getElementById("adresse").value;
	var adresse_title = document.getElementById("adresse_title").value;
	map.enableScrollWheelZoom();
	map.addControl(new GLargeMapControl());
	/*map.addControl(new GMapTypeControl());*/
	map.setCenter(new GLatLng(GLatLng1, GLatLng2), 10);
	var point = new GLatLng(GLatLng1,GLatLng2);
	
	var marker = createMarker(point,adresse,"<div id=\"gmapmarker\"><div style=\"text-align:left;font-family:Verdana;font-size:11px;\"><img src=\"fileadmin/new_layout/images/img_content/map_bp_logo.gif\" width=\"46\" height=\"34\" border=\"0\" ><br>"+adresse_title+"<\/div><\/div>", 0,"");


  GEvent.addListener(marker, "click", function() {  
  map.addOverlay(marker);
  marker.openInfoWindowHtml(marker);
  });  /**/
  map.addOverlay(marker);
  marker.openInfoWindowHtml("<div id=\"gmapmarker\"><div style=\"text-align:left;font-family:Verdana;font-size:11px;\"><img src=\"fileadmin/new_layout/images/img_content/map_bp_logo.gif\" width=\"46\" height=\"34\" border=\"0\" ><br>"+adresse_title+"<\/div><\/div>");
  }
}
/*
function load() {
  if (GBrowserIsCompatible()) {
  var map = new GMap2(document.getElementById("map"));
  
  map.enableScrollWheelZoom();
  map.addControl(new GLargeMapControl());
  map.addControl(new GMapTypeControl());
  map.setCenter(new GLatLng(53.9449,10.1937), 13);
   
  // Place a marker in the center of the map and open the info window
  // automatically
  var marker1 = new GMarker(map.getCenter());
  GEvent.addListener(marker1, "click", function() {
    marker1.openInfoWindowHtml("<div id=\"gmapmarker\"><div style=\"text-align:left;font-family:Verdana;font-size:12px;\"><strong>Unternehmensgruppe Pelz<\/strong><br \/>Willy-Pelz-Strasse 8-9, Wahlstedt<\/div><\/div>");
  });
  map.addOverlay(marker1);
  marker1.openInfoWindowHtml("<div id=\"gmapmarker\"><div style=\"text-align:left;font-family:Verdana;font-size:12px;\"><strong>Unternehmensgruppe Pelz<\/strong><br \/>Willy-Pelz-Strasse 8-9, Wahlstedt<\/div><\/div>");
      
  }
}*/
function createMarker(point, title, html, n, tooltip) {
if(n >= 0) { n = -1; }
var marker = new GMarker(point,{'title': tooltip});
var tabFlag = isArray(html);
if(!tabFlag) { html = [{"contentElem": html}]; }
/*to_htmls[counter] = html[0].contentElem + '<form class="gmapDir" id="gmapDirTo" style="white-space: nowrap;" action="http://maps.google.it/maps" method="get" target="_blank">' +
 '<span class="gmapDirHead" id="gmapDirHeadTo"><br>Ottieni indicazioni stradali: <strong>A qu</strong> - <a href="javascript:fromhere(' + counter + ')">Da qui</a></span>' +
 '<p class="gmapDirItem" id="gmapDirItemTo"  style=text-align:left;"><label for="gmapDirSaddr" class="gmapDirLabel" id="gmapDirLabelTo">Indirizzo di partenza<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="Vai" type="submit" class="gmapDirButton" id="gmapDirButtonTo" /></span></p>' +
 '<input type="hidden" name="daddr" value="' + 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.it/maps" method="get" target="_blank">' +
 '<span class="gmapDirHead" id="gmapDirHeadFrom"><br>Ottieni indicazioni stradali: <a href="javascript:tohere(' + counter + ')">A qu</a> - <strong>Da qui</strong></span>' +
 '<p class="gmapDirItem" id="gmapDirItemFrom" style=text-align:left;"><label for="gmapDirSaddr"  id="gmapDirLabelFrom">Indirizzo di arrivo<br /></label>' +
 '<input type="text" size="16" maxlength="40" name="daddr" class="gmapTextBox" id="gmapDirSaddr" value="" onfocus="this.style.backgroundColor = \'#e0e0e0\';" onblur="this.style.backgroundColor = \'#ffffff\';" />' +
 '<span class="gmapDirBtns" id="gmapDirBtnsFrom"><input value="Vai!" type="submit" class="gmapDirButton" id="gmapDirButtonFrom" /></span></p>' +
 '<input type="hidden" name="saddr" value="'  + title.replace(new RegExp(/"/g),'&quot;') + '" /></form>';
 html[0].contentElem = html[0].contentElem + '<p /><div id="gmapDirHead" class="gmapDir" style="white-space: nowrap;"><br>Ottieni indicazioni stradali: <a href="javascript:tohere(' + counter + ')">A qu</a> - <a href="javascript:fromhere(' + counter + ')">Da qui</a></div>';
*/
if(!tabFlag) { html = html[0].contentElem; }
/*if(isArray(html)) { GEvent.addListener(marker, "mouseover", function() { marker.openInfoWindowTabsHtml(html); }); }
else { GEvent.addListener(marker, "mouseover", 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]);
}