//This function to add Google Map on Chinese Properties page
//Powered by Inhouse Web
//Code by Alex Sun
//Support email: alex@inhouseweb.cn

function initialize()
{
	//var myurl = "http://china.whichproperty.com.au/_product_28588/Gooding_Drive";
	var myurl = document.URL;
	var gethis = myurl.split("/");
	
	var thisLoc = gethis[(gethis.length-1)];
	
	for(var i=0;i<allLocation.length;i++)
	{
		if (thisLoc == allLocation[i][0])
		{
			break;
		}
	}

	var thisdiv = "map_" + allLocation[i][0];
	var thislat = allLocation[i][1];
	var thislng= allLocation[i][2];
	setmap(thisdiv,thislat,thislng);
}

function setmap(i,x,y) {
   if (GBrowserIsCompatible()) {
	    //Resize the map;
        //var map = new GMap2(document.getElementById(i),{ size: new GSize(500,280) }); 
        var map = new GMap2(document.getElementById(i));

        var center = new GLatLng(x,y);
        var zoomlevel = 11;
        var blueIcon = new GIcon(G_DEFAULT_ICON);
        blueIcon.image = "http://china.whichproperty.com.au/Images/gm_blank.png";
        markerOptions = { icon:blueIcon };
        map.addOverlay(new GMarker(center, markerOptions));
        map.setCenter(center, zoomlevel);

        var customUI = map.getDefaultUI();
        map.setUI(customUI);
        map.removeMapType(G_HYBRID_MAP);
        map.removeMapType(G_PHYSICAL_MAP);

        var mapControl = new GMapTypeControl();
        map.addControl(mapControl);

     }
    }
