<!-- Google Map // Display Homes -->

var dBoston;
var dChicago;
var dCincinatti;
var dAnchorage;

    function CreateMarker(lattitude, longitude, infoWindowHtml)
	{
	    var center = new GLatLng(lattitude,longitude);
	  	var dLocalObj = new GMarker(center, {draggable: false});
	  	GEvent.addListener(dLocalObj, "click", function() {
        	dLocalObj.openInfoWindowHtml(infoWindowHtml);
        });
		
		return dLocalObj;
	}

	function initialize() {
      if (GBrowserIsCompatible()) {
	  	
		//Establish Canvas
        map = new GMap2(document.getElementById("map_canvas"));
		
		//Set map center and zoom level
		map.setCenter(new GLatLng(-31.94284,115.85495), 9);
		//map.setCenter(new GLatLng(-31.886886525780806,115.8233642578125), 9); Joondalup
		//map.setCenter(new GLatLng(-32.00807595929104,115.850830078125), 9);
		
		//Boston Marker and Information
		dBoston = CreateMarker(-31.645405,115.708508, "<div class='markerInfo'><h2>The Boston</h2><img src='images/display_homes/boston.jpg' alt='The Boston' class='markerThumb' /><h3>Location</h3><p>Impington Road,<br /> Butler 6036</p><div><a href='display_homes_boston.aspx'>More information</a>&nbsp;|&nbsp;<a href='http://maps.google.com.au/maps?f=q&source=s_q&hl=en&geocode=&q=6+Impington+Road,+Butler+WA+6036&sll=-31.645525,115.708302&sspn=0.003279,0.004823&ie=UTF8&hq=&hnear=6+Impington+Rd,+Butler+WA+6036&ll=-31.645527,115.708297&spn=0.00633,0.009645&z=17' target='_blank'>Get directions</a></div></div>");
		
		//Chicago Marker and Information
		dChicago = CreateMarker(-32.165488,115.846641, "<div class='markerInfo'><h2>The Chicago</h2><img src='images/display_homes/chicago.jpg' alt='The Chicago' class='markerThumb' /><h3>Location</h3><p>Macquarie Blvd,<br />Hammond Park 6164</p><div><a href='display_homes_chicago.aspx'>More information</a>&nbsp;|&nbsp;<a href='http://maps.google.com.au/maps?f=q&source=s_q&hl=en&geocode=&q=60+Macquarie+Blvd+Hammond+Park+WA+6164&sll=-32.165441,115.846925&sspn=0.003147,0.004823&ie=UTF8&hq=&hnear=60+Macquarie+Blvd,+Hammond+Park+WA+6164&ll=-32.165441,115.846925&spn=0.006521,0.009645&z=17' target='_blank'>Get directions</a></div></div>");
		
		//Cincinatti Marker and Information
		dCincinatti = CreateMarker(-31.756905,115.983651, "<div class='markerInfo'><h2>The Cincinatti</h2><img src='images/display_homes/cincinatti.jpg' alt='The Cincinatti' class='markerThumb' /><h3>Location</h3><p>Brigalow Bnd,<br />Ellenbrook 6069</p><div><a href='display_homes_cincinatti.aspx'>More information</a>&nbsp;|&nbsp;<a href='http://maps.google.com.au/maps?f=q&source=s_q&hl=en&geocode=&q=Brigalow+Bnd++Ellenbrook&sll=-31.758167,115.982623&sspn=0.0131,0.01929&ie=UTF8&hq=&hnear=Brigalow+Bend,+Ellenbrook+WA+6069&z=17' target='_blank'>Get directions</a></div></div>");
		
		//Anchorage Marker and Information
	  	dAnchorage = CreateMarker(-32.118563,115.928319, "<div class='markerInfo'><h2>The Anchorage</h2><img src='images/display_homes/anchorage.jpg' alt='The Anchorage' class='markerThumb' /><h3>Location</h3><p>Rufous Lne,<br />Forrestdale 6036</p><div><a href='display_homes_anchorage.aspx'>More information</a>&nbsp;|&nbsp;<a href='http://maps.google.com.au/maps?f=q&source=s_q&hl=en&geocode=&q=Rufous+Lane,+Forrestdale&sll=-31.756908,115.983653&sspn=0.006514,0.009645&ie=UTF8&hq=&hnear=Rufous+Ln,+Harrisdale+WA+6112&z=17&iwloc=A' target='_blank'>Get directions</a></div></div>");
	  
		//Add markers
		map.addOverlay(dBoston);
		map.addOverlay(dChicago);
		map.addOverlay(dCincinatti);
		map.addOverlay(dAnchorage);
		  
		//Add Controls, remove Scale
		var customUI = map.getDefaultUI();
		customUI.controls.scalecontrol = false;
		map.setUI(customUI);

      }
    }
	
	//Go to the Boston when this function is called
    function gotoBoston() {    
	  dChicago.closeInfoWindow();
	  dCincinatti.closeInfoWindow();
	  dAnchorage.closeInfoWindow();
      var center = new GLatLng(-31.645405,115.708508);
	  map.panTo(center);
	  GEvent.trigger(dBoston, "click");
	}
	
	//Go to the Chicago when this function is called
    function gotoChicago() {    
	  dBoston.closeInfoWindow();
	  dCincinatti.closeInfoWindow();
	  dAnchorage.closeInfoWindow();
      var center = new GLatLng(-32.165488,115.846641);
	  map.panTo(center);
	  GEvent.trigger(dChicago, "click");
	}
	
	//Go to the Cincinatti when this function is called
    function gotoCincinatti() {    
	  dBoston.closeInfoWindow();
	  dChicago.closeInfoWindow();
	  dAnchorage.closeInfoWindow();
      var center = new GLatLng(-31.756905,115.983651);
	  map.panTo(center);
	  GEvent.trigger(dCincinatti, "click");
	}
	
	//Go to the Anchorage when this function is called
    function gotoAnchorage() {    
	  dBoston.closeInfoWindow();
	  dChicago.closeInfoWindow();
	  dCincinatti.closeInfoWindow();
      var center = new GLatLng(-32.118563,115.928319);
	  map.panTo(center);
	  GEvent.trigger(dAnchorage, "click");
	}