
function getLat(GLatLng) {
	var lat = GLatLng.slice(1, GLatLng.indexOf(','));
	var dec = lat.split('.');
	return dec[0] + '.' + dec[1].substr(-5);
}

function getLong(GLatLng) {
	var long = GLatLng.slice(GLatLng.indexOf(',')+1, GLatLng.indexOf(')')-1);
	var dec = long.split('.');
	return dec[0] + '.' + dec[1].substr(-5);
}

/*

function createMarker(point, name, html) {
	
		var marker = new GMarker(point);
	
		GEvent.addListener(marker, "click", function() {
		  marker.openInfoWindowHtml("Marker #<b>" + number + "</b>");
		});


		// The info window version with the "to here" form open
		to_htmls[i] = html +
			'<br>Directions: <b>To here</b> - <a href="javascript:fromhere(' + i + ')">From here</a>' +
			'<br>Start address:<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="Get Directions" TYPE="SUBMIT">' +
			'<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() + 
			// "(" + name + ")" + 
			'"/>';
		
		// 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() +
			// "(" + name + ")" + 
			'"/>';


	
		// The inactive version of the direction info
		html = html + 
			'<br>Directions: <a href="javascript:tohere('+i+')">To here</a> - <a href="javascript:fromhere('+i+')">From here</a>';

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

		// save the info we need to use later for the side_bar
		gmarkers[i] = marker;
		htmls[i] = html;
		
		// add a line to the side_bar html
		side_bar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
		i++;

		return marker;
	}
*/












function createMarker(point, number,i)
{
	if(i==1)
	{
		var marker = new GMarker(point);
	}
	else
	{
		var marker = new GMarker(point,i);
	}
	// Show this markers index in the info window when it is clicked
	var html = number;
	GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
	return marker;
}




/*




	// geo coding	
	function showAddress(address) {
		if (geocoder) {
			
			geocoder.getLatLng(
				address,
				function(point) {
					if (!point) {
						alert(address + " not found");
					} else {
						map.setCenter(point, 13);
						var marker = new GMarker(point);
						map.addOverlay(marker);
						marker.openInfoWindowHtml(address);
					}
				}
			);
		}
	}
*/

	// 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]);
	}


































