// JavaScript Document

var map = null;
var geocoder = null;

var xmlhttp = null;
if (window.XMLHttpRequest) {
	xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
	
// this function create google map for given area

function showMap(area) 
{
	
var area=document.getElementById('address').value;
var property=document.getElementById('property').value;

	if (GBrowserIsCompatible()) 
	{
	

     
		map = new GMap2(document.getElementById("map"));
  map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        
		map.addControl(new GSmallMapControl(),new GControlPosition(new GSize(100,100)));
			map.addControl(new GMapTypeControl());
 
		geocoder = new GClientGeocoder();
		geocoder.getLatLng(area, function(point){map.setCenter(point, 13)}); 
addMarker(area,property);  
 }
}
// this function add marker on google map and display weather data

function addMarker(area,property){
	geocoder = new GClientGeocoder();
	geocoder.getLatLng(area, function(point) {
		if (!point) {
			alert(area + " not found");
		} 
		else{
			map.setCenter(point, 12);
			map.addOverlay(createMarker(point, area,property));
			
		}
	});
}
// this function create marker for google map


function createMarker(point, address,property) {  

	var Icon = new GIcon();
      Icon.image = "images/man.gif";
      Icon.iconSize = new GSize(20, 34);
     // Icon.shadow = "images/man.gif";
      Icon.shadowSize = new GSize(36, 34);
      Icon.iconAnchor = new GPoint(5, 34);
      Icon.infoWindowAnchor = new GPoint(5, 2);
      Icon.transparent = "http://www.bookdirect2save.com.au/property_template/images/map.gif";
      Icon.printImage = "http://www.bookdirect2save.com.au/property_template/images/map.gif";
      Icon.mozPrintImage = "http://www.bookdirect2save.com.au/property_template/images/map.gif";
      Icon.printShadow = "http://www.bookdirect2save.com.au/property_template/images/map.gif";
	var marker = new GMarker(point,Icon); 
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml("<b>"+property+"</b><br>"+address);  });  
	return marker;
}







 

     

