//This function has been checked for compat with species commonname model
function retrieveMarkers() {
var request = GXmlHttp.create();
	//mgr = new MarkerManager(map);
	//var batch = [];
	//tell the request where to retrieve data from.
	request.open('GET', '/!_public_WPA/retrieveMarkers.php', true);

	//tell the request what to do when the state changes.
	request.onreadystatechange = function() {
		if (request.readyState == 4) {
			var xmlDoc = request.responseXML;

			var markers = xmlDoc.documentElement.getElementsByTagName("marker");
			for (var i = 0; i < markers.length; i++) {
				var lng = markers[i].getAttribute("lng");
				var lat = markers[i].getAttribute("lat");
				//check for lng and lat so MSIE does not error
				//on parseFloat of a null value
				if(lng && lat) {



                                   var urlString2 = "?species=" + markers[i].getAttribute("species")
                                      + "&yourname=" + markers[i].getAttribute("yourname")
		                      + "&date=" + markers[i].getAttribute("date")
		                      + "&wild=" + markers[i].getAttribute("wild")
                                      + "&dateobs=" + markers[i].getAttribute("dateobs")
		                      + "&subspecific=" + markers[i].getAttribute("subspecific")
		                      + "&state=" + markers[i].getAttribute("state")
                                      + "&county=" + markers[i].getAttribute("county")
		                      + "&township=" + markers[i].getAttribute("township")
		                      + "&watershed=" + markers[i].getAttribute("watershed")
		                      + "&park=" + markers[i].getAttribute("park")
		                      + "&locale=" + markers[i].getAttribute("locale")
		                      + "&phenology=" + markers[i].getAttribute("phenology")
		                      + "&dbh=" + markers[i].getAttribute("dbh")
		                      + "&abundance=" + markers[i].getAttribute("abundance")
		                      + "&accuracy=" + markers[i].getAttribute("accuracy")
		                      + "&notes=" + markers[i].getAttribute("notes")
		                      + "&herbarium=" + markers[i].getAttribute("herbarium")
		                      + "&collector=" + markers[i].getAttribute("collector")
		                      + "&collnumb=" + markers[i].getAttribute("collnumb")
		                      + "&recordID=" + markers[i].getAttribute("recordID")
		                      + "&lng=" + lng
		                      + "&lat=" + lat;


					var latlng = new GLatLng(parseFloat(lat),parseFloat(lng));

                             var html = '<div style="white-space:wrap; width: 600px;"><font size="1" face="verdana" /><strong>Plants of '+ markers[i].getAttribute("state") +'</strong>' +
'<br /><strong>Species: </strong>' + markers[i].getAttribute("species") +
			'<br /><strong>Subspecific Epithet: </strong>' + markers[i].getAttribute("subspecific") +
			'<br /><strong>Wild Status: </strong>' + markers[i].getAttribute("wild") +
			'<br /><strong>Contributor: </strong>' + markers[i].getAttribute("yourname") +
			'<br /><strong>Date Contributed: </strong>' + markers[i].getAttribute("date") +
			'<br /><strong>Date Observed: </strong>' + markers[i].getAttribute("dateobs") +
			'<br /><strong>State: </strong>' + markers[i].getAttribute("state") +
			'<br /><strong>County: </strong>' + markers[i].getAttribute("county") +
			'<br /><strong>Township: </strong>' + markers[i].getAttribute("township") +
                        '<br /><strong>Watershed: </strong>' + markers[i].getAttribute("watershed") +
                        '<br /><strong>Park or Forest: </strong>' + markers[i].getAttribute("park") +
			'<br /><strong>Precise Locale: </strong>' + markers[i].getAttribute("locale") + 
                        '<br /><strong>Lat: </strong>' + markers[i].getAttribute("lat") +
                        '<br /><strong>Lng: </strong>' + markers[i].getAttribute("lng") +
			'<br /><strong>Phenology: </strong>' + markers[i].getAttribute("phenology") +
			'<br /><strong>DBH for Woodies: </strong>' + markers[i].getAttribute("dbh") +
			'<br /><strong>Abundance: </strong>' + markers[i].getAttribute("abundance") +
			'<br /><strong>Location Precision: </strong>' + markers[i].getAttribute("accuracy") +
			'<br /><strong>Notes: </strong>' + markers[i].getAttribute("notes") +
			'<br /><strong>Herbarium Voucher: </strong>' + markers[i].getAttribute("collector") +
                        '<strong> </strong>' + markers[i].getAttribute("collnumb") +
                        '<strong> (Herbarium: </strong>' + markers[i].getAttribute("herbarium") +
                        '<strong>)</strong>' +
			'<br /><form action="EditMarkers.php" method="post" target="_blank"><strong>Record ID: </strong><input type="text" size="6" style="width: 20px; border: Solid 0px; font-size=0;" id="SearchID" name="SearchID" value="' + markers[i].getAttribute("recordID") + '   "/>       <input type="submit" value="Edit this record" /></form>' +
                        '<br /><i>'+ markers[i].getAttribute("species") +'</i> on <a href="http://en.wikipedia.org/wiki/' + markers[i].getAttribute("species") + '" target="_blank">Wikipedia</a>, <a href="http://plants.usda.gov/java/nameSearch?mode=sciname&keywordquery=' + markers[i].getAttribute("species") + '" target="_blank">USDA PLANTS</a>, <a href="http://images.google.com/images?hl=en&q=' + markers[i].getAttribute("species") + '" target="_blank">GOOGLE Images</a> or <a href="http://scholar.google.com/scholar?q=' + markers[i].getAttribute("species") + '" target="_blank">Scholar</a>, <a href="http://www.tropicos.org/NameSearch.aspx?name=' + markers[i].getAttribute("species") + '" target="_blank">TROPICOS</a>' +
                        '</div>'
                          
                                        if(markers[i].getAttribute("CutDownDate") != "") {
					   var marker = createMarker(latlng, html, "true");
                                        } else {
					   var marker = createMarker(latlng, html, "false");
                                        }

					map.addOverlay(marker);

					//batch.push(marker);
				}
			} //for

		} //if
				//mgr.addMarkers(batch,10);
				//mgr.refresh;
	} //function
	  
	request.send(null);

}

