<!-- Google Map // Display Homes -->

var dMichigan;
var dBerkley;
var dStanford;
var dConnecticut;
var dNotreDame;
var dPrinceton;

    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); Perth
		//map.setCenter(new GLatLng(-31.886886525780806,115.8233642578125), 9); Joondalup
		map.setCenter(new GLatLng(-32.00807595929104,115.850830078125), 9);
		
		//Michigan Marker and Information
		dMichigan = CreateMarker(-32.109447,115.951695, "<div class='markerInfo'><h2>The Michigan</h2><img src='images/display_homes/michigan.jpg' alt='The Michigan' class='markerThumb' /><h3>Location</h3><p>Aldenham Dr,<br /> Southern River 6110</p><div><a href='display_homes_michigan.aspx'>More information</a>&nbsp;|&nbsp;<a href='http://maps.google.com.au/maps?f=q&source=s_q&hl=en&q=Aldenham+Dr,+Southern+River+WA+6110&sll=-32.474609,115.759456&sspn=0.012925,0.01929&gl=au&g=28+Jasper+Way,+Lakelands+WA+6210&ie=UTF8&cd=1&geocode=FaMOFv4dZ0bpBg&split=0&hq=&hnear=Aldenham+Dr,+Southern+River+WA+6110&ll=-32.10497,115.948656&spn=0.012978,0.01929&z=16&iwloc=A' target='_blank'>Get directions</a></div></div>");
		
		//Berkley Marker and Information
		dBerkley = CreateMarker(-32.474609,115.759456, "<div class='markerInfo'><h2>The Berkley</h2><img src='images/display_homes/berkley.jpg' alt='The Berkley' class='markerThumb' /><h3>Location</h3><p>28 Jasper Way,<br />Lakelands 6210</p><div><a href='display_homes_berkley.aspx'>More information</a>&nbsp;|&nbsp;<a href='http://maps.google.com.au/maps?hl=en&q=28+Jasper+Way,+Lakelands&ie=UTF8&hq=&hnear=28+Jasper+Way,+Lakelands+WA+6210&gl=au&ei=IGIPS8eDLsKOkQWS0-CiBw&ved=0CAgQ8gEwAA&z=16' target='_blank'>Get directions</a></div></div>");
		
		//Stanford Marker and Information
		dStanford = CreateMarker(-31.886323,115.818354, "<div class='markerInfo'><h2>The Stanford</h2><img src='images/display_homes/stanford.jpg' alt='The Stanford' class='markerThumb' /><h3>Location</h3><p>25 Lycium Quays,<br />Roslea Estate<br />Stirling 6021</p><div><a href='display_homes_stanford.aspx'>More information</a>&nbsp;|&nbsp;<a href='http://maps.google.com.au/maps?f=q&source=s_q&hl=en&geocode=&q=25+Lycium+Quays,+Stirling+WA+6021&sll=-31.885866,115.81903&sspn=0.001635,0.002411&gl=au&ie=UTF8&hq=&hnear=25+Lycium+Quays,+Stirling+WA+6021&z=17' target='_blank'>Get directions</a></div></div>");
		
		//Connecticut Marker and Information
	  	dConnecticut = CreateMarker(-31.650049,115.69409, "<div class='markerInfo'><h2>The Connecticut</h2><img src='images/display_homes/connecticut.jpg' alt='The Connecticut' class='markerThumb' /><h3>Location</h3><p>Jindalee Boulevard,<br />Jindalee 6036</p><div><a href='display_homes_connecticut.aspx'>More information</a>&nbsp;|&nbsp;<a href='http://maps.google.com.au/maps?f=q&source=s_q&hl=en&geocode=&q=22+Jindalee+Boulevard,+Jindalee+WA&sll=-31.650304,115.694221&sspn=0.006558,0.009645&gl=au&ie=UTF8&hq=&hnear=22+Jindalee+Blvd,+Jindalee+WA+6036&ll=-31.65003,115.694093&spn=0.006521,0.009645&z=17' target='_blank'>Get directions</a></div></div>");
		
		//Notre Dame Marker and Information
		dNotreDame = CreateMarker(-31.72864,115.727058, "<div class='markerInfo'><h2>The Notre Dame</h2><img src='images/display_homes/notredame.jpg' alt='The Notre Dame' class='markerThumb' /><h3>Location</h3><p>Burns Beach Road,<br />Burns 6028</p><div><a href='display_homes_notredame.aspx'>More information</a>&nbsp;|&nbsp;<a href='http://maps.google.com.au/maps?f=q&source=s_q&hl=en&geocode=&q=Burns+Beach+Road,+Burns+WA+6028&sll=-31.72864,115.727058&sspn=0.013031,0.01929&gl=au&ie=UTF8&hq=&hnear=Burns+Beach+Rd,+Burns+WA+6028&ll=-31.728627,115.72712&spn=0.013104,0.01929&z=16' target='_blank'>Get directions</a></div></div>");
		
		//Princeton Marker and Information
		dPrinceton = CreateMarker(-31.893512,115.819287, "<div class='markerInfo'><h2>The Princeton</h2><img src='images/display_homes/princeton.jpg' alt='The Princeton' class='markerThumb' /><h3>Location</h3><p>Candella Square,<br />Princeton Estate<br />Stirling 6021</p><div><a href='display_homes_princeton.aspx'>More information</a>&nbsp;|&nbsp;<a href='http://maps.google.com.au/maps?f=q&source=s_q&hl=en&geocode=&q=Candella+Square+Stirling+WA+6021&sll=-31.893491,115.819287&sspn=0.006504,0.009645&gl=au&ie=UTF8&hq=&hnear=Candella+Square,+Stirling+WA+6021&ll=-31.893509,115.819287&spn=0.006504,0.009645&z=17' target='_blank'>Get directions</a></div></div>");
	  
		//Add markers
		map.addOverlay(dMichigan);
		map.addOverlay(dBerkley);
		map.addOverlay(dStanford);
		map.addOverlay(dConnecticut);
		map.addOverlay(dNotreDame);
		map.addOverlay(dPrinceton);
		  
		//Add Controls, remove Scale
		var customUI = map.getDefaultUI();
		customUI.controls.scalecontrol = false;
		map.setUI(customUI);

      }
    }
	
	//Go to the Michigan when this function is called
    function gotoMichigan() {    
	  dBerkley.closeInfoWindow();
	  dStanford.closeInfoWindow();
	  dConnecticut.closeInfoWindow();
	  dNotreDame.closeInfoWindow();
	  dPrinceton.closeInfoWindow();
      var center = new GLatLng(-32.109447,115.951695);
	  map.panTo(center);
	  GEvent.trigger(dMichigan, "click");
	}
	
	//Go to the Berkley when this function is called
    function gotoBerkley() {    
	  dMichigan.closeInfoWindow();
	  dStanford.closeInfoWindow();
	  dConnecticut.closeInfoWindow();
	  dNotreDame.closeInfoWindow();
	  dPrinceton.closeInfoWindow();
      var center = new GLatLng(-32.474609,115.759456);
	  map.panTo(center);
	  GEvent.trigger(dBerkley, "click");
	}
	
	//Go to the Stanford when this function is called
    function gotoStanford() {    
	  dMichigan.closeInfoWindow();
	  dBerkley.closeInfoWindow();
	  dConnecticut.closeInfoWindow();
	  dNotreDame.closeInfoWindow();
	  dPrinceton.closeInfoWindow();
      var center = new GLatLng(-31.886323,115.818354);
	  map.panTo(center);
	  GEvent.trigger(dStanford, "click");
	}
	
	//Go to the Connecticut when this function is called
    function gotoConnecticut() {    
	  dMichigan.closeInfoWindow();
	  dBerkley.closeInfoWindow();
	  dStanford.closeInfoWindow();
	  dNotreDame.closeInfoWindow();
	  dPrinceton.closeInfoWindow();
      var center = new GLatLng(-31.650049,115.69409);
	  map.panTo(center);
	  GEvent.trigger(dConnecticut, "click");
	}
	
	//Go to the Notre Dame when this function is called
    function gotoNotreDame() {    
	  dMichigan.closeInfoWindow();
	  dBerkley.closeInfoWindow();
	  dStanford.closeInfoWindow();
	  dConnecticut.closeInfoWindow();
	  dPrinceton.closeInfoWindow();
      var center = new GLatLng(-31.72864,115.727058);
	  map.panTo(center);
	  GEvent.trigger(dNotreDame, "click");
	}
	
	//Go to the Princeton when this function is called
    function gotoPrinceton() {    
	  dMichigan.closeInfoWindow();
	  dBerkley.closeInfoWindow();
	  dStanford.closeInfoWindow();
	  dConnecticut.closeInfoWindow();
	  dNotreDame.closeInfoWindow();
      var center = new GLatLng(-31.893512,115.819287);
	  map.panTo(center);
	  GEvent.trigger(dPrinceton, "click");
	}