//<![CDATA[
/* A lot of the code is taken from other tutorials. */
function createMarker(point,html) {
	var marker = new GMarker(point);
 	GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html,{maxWidth:600});});
	return marker;
   	}

function getMarks(url) { /* pass url during the call. */
	map.closeInfoWindow(); /*close any InfoWindows that happen to be open  */
	map.clearOverlays();
  	var request = GXmlHttp.create(); /* use the XML methods  */
    	request.open("GET", url, true);
    	request.onreadystatechange = function() {
     	if (request.readyState == 4) {	
		var xmlDoc = request.responseXML; /* php returns 'XML' */
		var markers = xmlDoc.documentElement.getElementsByTagName("marker"); 
		for (var loop1=0;loop1<markers.length;loop1++){
			var lat = parseFloat(markers[loop1].getAttribute("lat"));  /* data is string. */
			var lng = parseFloat(markers[loop1].getAttribute("lng")); 
			var point = new GLatLng(lat,lng);
			var listid = markers[loop1].getAttribute("listid");
			var mls = markers[loop1].getAttribute("mls");
			var price = markers[loop1].getAttribute("price");
			var bed = markers[loop1].getAttribute("bed");
			var bath = markers[loop1].getAttribute("bath");
			var office = markers[loop1].getAttribute("office");
			var acres = markers[loop1].getAttribute("acres");
			var sqft = markers[loop1].getAttribute("sqft");
			var city = markers[loop1].getAttribute("city");
			var img = "<img width=85 style='float:left' src=http://buysihomes.com/modules/ProMatch/full/"+listid+"-01.jpg>";
			var link= "<a style='font-size:8pt' href=http://buysihomes.com/index.php?mact=ProMatch,mc4594,showDetail,1&mc4594street=&mc4954mls=303084&mc4594ListingID="+listid+"&mc4594city="+city+"&mc4594priceMin=0&mc4594priceMax=10000000&mc4594county=Any&mc4594bed=0&mc4594bath=0&mc4594start=0&mc4594returnPage=1&m0d85creturnid=66&page=66>View Details</a>";
			var credit="<span style='font-size:7pt'>Listing Courtesy of: "+markers[loop1].getAttribute("office")+"</span>";
			var html="<div style='width:260px;height:125px'>"+img+"List Price: $"+price+"<br>Bedrooms:"+bed+"<br>Bathrooms:"+bath+"<br>Acres:"+acres+"<br><br><br><br>"+link+"<br>"+credit+"</div>";
			var marker = createMarker(point,html);
			map.addOverlay(marker);
			}
		}
		};
	request.send(null);
}
	
//]]>
