function gdirect(){
	el('cleardir').disabled = false;
	gdir = new GDirections(map, document.getElementById("directions"));
	gdir.load("from: " + ((el('fromdir').value.indexOf('AUS')>0)?el('fromdir').value:el('fromdir').value+' AUS') + " to: " + ((el('todir').value.indexOf('AUS')>0)?el('todir').value:el('todir').value+' AUS'),
                { "locale": "en_US" }
	);
}
function cldirect(){
	el('cleardir').disabled = true;
	geocoder.getLatLng(
		address,
		function(point) {
			if (!point) {
				alert(address + " not found");
			} else {
				var ppt = new GIcon(G_DEFAULT_ICON);
				ppt.image = "http://www.thepropertypalace.com.au/_img/gpointer.png";
				markerOptions = { icon:ppt };
				map.setCenter(point, 13);
				var marker = new GMarker(point, markerOptions);
				map.addOverlay(marker);
				marker.openInfoWindowHtml("<strong>The Property Palace</strong><br/>152 Brisbane Road Booval QLD 4304");
			}
		}
	);
}
function getMap() {
    if (GBrowserIsCompatible()) {
        window['map'] = new GMap2(el("map_canvas"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        geocoder = new GClientGeocoder();
        window['address'] = "152 Brisbane Road Booval QLD 4304 AUS";
        if (geocoder) {
            geocoder.getLatLng(
                window['address'],
                function(point) {
                    if (!point) {
                        alert(address + " not found");
                    } else {
                        var ppt = new GIcon(G_DEFAULT_ICON);
                        ppt.image = "http://www.thepropertypalace.com.au/_img/gpointer.png";
                        markerOptions = { icon:ppt };
                        window['map'].setCenter(point, 13);
                        var marker = new GMarker(point, markerOptions);
                        window['map'].addOverlay(marker);
                        marker.openInfoWindowHtml("<strong>The Property Palace</strong><br/>152 Brisbane Road Booval QLD 4304");
                    }
                }
            );
        }
    }
}
$('#map_canvas').ready(function(){
	getMap();
});