var imageHandler = new ImageHandler();
window.onload = function()
{
	var noImages = imageHandler.loadImages(9);
	// addMap(lat, long );
}

function newWindow(url, width, height)
{
	window.open(url, 'propertydetails', 'width=' + width + ',height=' + height + ',scrollbars=yes,resizable=yes')
	return false
}



function postForm()
{
	var routeform = document.getElementById("route");
	window.open("", "Myroute", "800,600,scrollbars=yes,resizable=yes");
	routeform.target="Myroute";
	routeform.submit();
	return false;
}	
function addMap(glat, glng)
{
	html = '<div class="mapInfo">';
	html = html + '<div class="imageform">';
	html = html + '<form id="route" onSubmit="javascript: return postForm();" action="http://maps.google.co.uk/maps?f=d&hl=en&om=1" method="get">';
	html = html + '		  Calculate a Route to this property from where I am.<br />';
	html = html + '			My postcode - <input type="text" name="saddr" value="" />';
	html = html + '			<input type="hidden" value="' + PC + '" name="daddr">';
	html = html + '			<input name="Submit" type="submit" id="Submit" value="Go" />';
	html = html + '		</form>';
	html = html + '	</div>';
		
		var property = new GLatLng(glat, glng);
		var map = new GMap2(document.getElementById("map"));
		map.setCenter(property, 15);
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		var marker = createMarker(property,html,  map)
		map.addOverlay(marker);
		
		marker.openInfoWindowHtml(html);
}

   function createMarker(point, html, map)
    {
		var marker = new GMarker(point);
		GEvent.addListener(marker, 'click',function (){
		map.setCenter(point);
		marker.openInfoWindowHtml(html);
		});
		return marker;
    }
