 //<![CDATA[






    function load() {
		
		
      if (GBrowserIsCompatible()) {
		  
		var localSearch = new GlocalSearch();
		//var localSearch = new GClientGeocoder();
		
        var map = new GMap2(document.getElementById("googleMap"));
        //map.addControl(new GSmallMapControl());
        //map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(51.42, -2.43),11);
		map.setUIToDefault();
		// Create a base icon for all of our markers that specifies the
		// shadow, icon dimensions, etc.
		var baseIcon = new GIcon();
		//baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
		baseIcon.iconSize = new GSize(44, 62);
		//baseIcon.shadowSize = new GSize(37, 34);
		baseIcon.iconAnchor = new GPoint(9, 58);
		baseIcon.infoWindowAnchor = new GPoint(9, 2);
		//baseIcon.infoShadowAnchor = new GPoint(18, 25); 

		//property type beds rate pagelink imgsrc

	
		// Creates a marker at the given point with the given number label
		function createMarker(point, index, property, type, beds, rate, pagelink, imgsrc) {
			// Create a lettered icon for this point using our icon class
			var letter = String.fromCharCode("A".charCodeAt(0) + index);
			var icon = new GIcon(baseIcon);
			icon.image = "http://www.trusteaseproperty.co.uk/images/pointer.png";
			var marker = new GMarker(point, icon);
			//alert(point);
			GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml("<strong style=\'width:250px;display:block;\'>" + property + "</strong><img src=\'" + imgsrc + "\' height=\'70px\' style=\'float:right;margin:5px 20px 0px 0px;padding:3px;border:1px solid #ccc;\' /><br />Type: " + type + "<br />Bedrooms: " + beds + "<br />Monthly rate: " + rate + "<br /><a href=\'javascript:;\' onclick=\parent.location.href=\'" + pagelink + "\' >more info</a>");
			});

		return marker;
		
		}
	
		
		function createPostcodePoint(postcode2, i2, property2, type2, beds2, rate2, pagelink2, imgsrc2) {
			

			localSearch.execute(postcode2 + ", UK");
			//$.get('myhtmlpage.html', function(){
			//  myCallBack(param1, param2);
			//});

			localSearch.setSearchCompleteCallback(null, 
				function() {
					
					if (localSearch.results[0])
					{		
						var resultLat = localSearch.results[0].lat;
						var resultLng = localSearch.results[0].lng;
						var point2 = new GLatLng(resultLat,resultLng);
						var letter = String.fromCharCode("A".charCodeAt(0) + i2);
						var icon2 = new GIcon(baseIcon);
						icon2.image = "http://www.trusteaseproperty.co.uk/images/pointer.png";
						var marker2 = new GMarker(point2, icon2);
						GEvent.addListener(marker2, "click", function() {
						marker2.openInfoWindowHtml("<strong style=\'width:250px;display:block;\'>" + property2 + "</strong><img src=\'" + imgsrc2 + "\' height=\'70px\' style=\'float:right;margin:5px 20px 0px 0px;padding:3px;border:1px solid #ccc;\' /><br />Type: " + type2 + "<br />Bedrooms: " + beds2 + "<br />Monthly rate: " + rate2 + "<br /><a href=\'javascript:;\' onclick=\parent.location.href=\'" + pagelink2 + "\' >more info</a>");
						});
						//alert(property2);
						map.addOverlay(marker2);
					}
				});	
				
		}
		

		var randomnumber=Math.floor(Math.random()*10000)
        GDownloadUrl("../googleMapDataLive2.asp?rnd="+randomnumber, function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),  parseFloat(markers[i].getAttribute("lng")));
		  
			map.addOverlay(createMarker(point, i, markers[i].getAttribute("property"), markers[i].getAttribute("type"), markers[i].getAttribute("beds"), markers[i].getAttribute("rate"), markers[i].getAttribute("pagelink"), markers[i].getAttribute("imgsrc")));
			//usePostcodeMoonshine(markers[i].getAttribute("postcode"));
          }
        });
      }
    }

    //]]>
