﻿// Creates a marker at the given point with the given number label
function createMarker(point, number) {
  var marker = new GMarker(point);
  GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml("Marker #<b>" + number + "</b>");
  });
  return marker;
}
function MarkerHtml()
{
    var r='<div style="width:300px">Per raggiungerci scorri la mappa o inserisci il punto di partenza e premi "Calcola percorso" [es:"piazza Duomo, Milano"]<br><br>';
    r+='<form onsubmit="return f_Percorso();"><input id="mGoogleMapFrom" name="mMap"><input type="submit" value="Calcola percorso"></form></div>';
    return r;
}
function f_Percorso()
{
    if(document.getElementById('mGoogleMapFrom').value==''){
        alert('Inserire un indirizzo di partenza');
        return;
        }
    f_Percorso2(document.getElementById('mGoogleMapFrom').value);
    return false;
}
function f_Percorso2(value)
{
    window.open('http://maps.google.it/maps?f=d&hl=it&sll=45.709277,9.691950&sspn=0.020623,0.054245&saddr='+value+'&daddr=%4045.709277,9.691950')
}                                                          
function load() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GScaleControl());
    map.addControl(new GMapTypeControl());
   
    map.setCenter(new GLatLng(45.709277,9.691950),13);
    
    var marker = new GMarker(map.getCenter());
    GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(MarkerHtml());});
    map.addOverlay(marker);
    marker.openInfoWindowHtml(MarkerHtml());
  }
}


function f_SetBigImage(url)//, text) {
{

    document.getElementById('fid_bigimage').src = url;
    //document.getElementById('fid_imagetext').innerHTML = text;
}
