//<![CDATA[

var map = new GMap2(document.getElementById("jazzMap"));
var gmarker = createMarker(new GLatLng(51.90627,8.37119));
var to_html;
var from_html;

map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(51.90627,8.37119), 13, G_NORMAL_MAP);

map.addOverlay(gmarker)

//]]>

// functions that open the directions forms
function tohere() {
  gmarker.openInfoWindowHtml(to_html);
}
function fromhere() {
  gmarker.openInfoWindowHtml(from_html);
}

function createMarker(point) {
	var marker = new GMarker(point);
	var html = "<strong style='color: #97BE0D;'>JAZZ</strong> IN G&Uuml;TERSLOH<br/>Friedrichstraße 10<br/>33330 G&uuml;tersloh";

	// The info window version with the "To here" form open
	to_html = html + '<br />Route berechnen: Hierher - <a class="route" href="javascript:fromhere()">Von hier<\/a>' +
		 '<br /><small>Startadresse</small><form action="http://maps.google.com/maps" method="get" target="_blank">' +
		 '<input type="text" maxlength="40" name="saddr" id="saddr" value="" />' +
		 '<input class="button75" value="Los!" type="SUBMIT" />' +
		 '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() +
		 '" />';

	// The info window version with the "From here" form open
	from_html = html + '<br />Route berechnen: <a class="route" href="javascript:tohere()">Hierher<\/a> - Von hier' +
		 '<br /><small>Zieladresse</small><form action="http://maps.google.com/maps" method="get" target="" _blank="">' +
		 '<input type="text" maxlength="40" name="daddr" id="daddr" value="" />' +
		 '<input class="button75" value="Los!" type="SUBMIT" />' +
		 '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
		 '" />';

	// The inactive version of the direction info
	html = html + '<br />Route berechnen: <a class="route" href="javascript:tohere()">Hierher<\/a> - <a class="route" href="javascript:fromhere()">Von hier<\/a>';


	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
	});

	marker.openInfoWindowHtml(html);
	return marker;
}

