function createMarker(point, name, html) {
	var marker = new GMarker(point);

    // The info window version with the "to here" form open
    to_htmls[i] = html + '<br><b>A qui partendo da:</b><form action="http://maps.google.com/maps" method="get" target="_blank">' +
        '<input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' +
        '<INPUT value="Mostra la strada" TYPE="SUBMIT">' +
        '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() + '"/>';

	// The info window version with the "to here" form open
    from_htmls[i] = html + '<br>Directions: <a href="javascript:tohere(' + i + ')">To here</a> - <b>From here</b>' +
    	'<br>End address:<form action="http://maps.google.com/maps" method="get"" target="_blank">' +
        '<input type="text" SIZE=40 MAXLENGTH=40 name="daddr" id="daddr" value="" /><br>' +
        '<INPUT value="Get Directions" TYPE="SUBMIT">' +
        '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() + '"/>';

    // The inactive version of the direction info
    html = html + '<br><a href="javascript:tohere('+i+')">Come raggiungerci</a>';

    GEvent.addListener(marker, "click", function() {
    	marker.openInfoWindowHtml(html);
    });
    // save the info we need to use later for the GMapSidebar
    gmarkers[i] = marker;
    htmls[i] = html;
    // add a line to the GMapSidebar html
    GMapSidebar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
    i++;
    return marker;
}

// This function picks up the click and opens the corresponding info window
function myclick(i) {
	gmarkers[i].openInfoWindowHtml(htmls[i]);
}

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

function fromhere(i) {
	gmarkers[i].openInfoWindowHtml(from_htmls[i]);
}
