function mapState()
{
	// set document elements to state-level info
	$("progress").innerHTML = "";
	// document.getElementById("ad1").innerHTML = '<h4>Real estate in Texas</h4><p><a href="javascript:contact();">Your ad here!</a></p><h4>Private schools in Texas</h4><p><a href="javascript:contact();">Your ad here!</a></p>';
	
	// hide markers if any, center and zoom map to show entire state for most screen resolutions
	// 36.633162,-84.342041
	// 33.669497,-75.673828
	map.clearOverlays();
	markers = [];
	
	var stateBounds = new GLatLngBounds();
	stateBounds.extend(new GLatLng(25.75, -106.65));
	stateBounds.extend(new GLatLng(36.65, -93.6));
	
	map.setCenter(stateBounds.getCenter(), map.getBoundsZoomLevel(stateBounds));

}

function updateAds()
{
	/* 
	if (map.getZoom() < 8 || topCity == '')
	{
		document.getElementById("ad1").innerHTML = '<h4>Real estate in Texas</h4><p><a href="javascript:contact();">Your ad here!</a></p><h4>Private schools in Texas</h4><p><a href="javascript:contact();">Your ad here!</a></p>';
	}
	else
	{
		document.getElementById("ad1").innerHTML = '<h4>Real estate in the ' + topCity + ' area</h4><p><a href="javascript:contact();">Your ad here!</a></p><h4>Private schools in the ' + topCity + ' area</h4><p><a href="javascript:contact();">Your ad here!</a></p>';
	}
	*/
}

function getSchoolTypeCode()
// compile school type criteria from checkboxes
{
	var stc = "0";
	if ($("elementary").checked) stc = "1";
	if ($("middle").checked)
	{
		if (stc == "0")
			stc = "2";
		else
			stc += ",2";
	}
	if ($("high").checked)
	{
		if (stc == "0")
			stc = "3";
		else
			stc += ",3";
	}
	if ($("other").checked)
	{
		if (stc == "0")
			stc = "4";
		else
			stc += ",4";
	}
	return stc;
}

function createSchoolMarker(location,cds,nces,district,school,rankinfo,avgrank)
{
	var marker = new GMarker(location, {icon: (avgrank == 1 ? icon01 : (avgrank == 2 ? icon02 : (avgrank == 3 ? icon03 : (avgrank == 4 ? icon04 : (avgrank == 5 ? icon05 : (avgrank == 6 ? icon06 : (avgrank == 7 ? icon07 : (avgrank == 8 ? icon08 : (avgrank == 9 ? icon09 : (avgrank == 10 ? icon10 : icon00)))))))))), title: school});
	
	var testresults = rankinfo.split(",");
	
	var resultstable = '<table class="testresults"><tr><th>Year:</th><th>2005</th><th>2006</th><th>2007</th></tr>' +
		'<tr><th>Decile Rank:</th>';
	
	if (testresults[1] == 0)
	{
		resultstable += '<td class="rank0">N/A</td>';
	} else {
		resultstable += '<td class="rank' + testresults[1] + '">' + testresults[1] + '</td>';
	}
	
	if (testresults[3] == 0)
	{
		resultstable += '<td class="rank0">N/A</td>';
	} else {
		resultstable += '<td class="rank' + testresults[3] + '">' + testresults[3] + '</td>';
	}
	
	if (testresults[5] == 0)
	{
		resultstable += '<td class="rank0">N/A</td></tr>';
	} else {
		resultstable += '<td class="rank' + testresults[5] + '">' + testresults[5] + '</td></tr>';
	}
	
	resultstable += "<tr><th>% Passing All Tests:</th>";
	
	resultstable += '<td>' + testresults[0] + '</td>';
	resultstable += '<td>' + testresults[2] + '</td>';
	resultstable += '<td>' + testresults[4] + '</td></tr></table>';

	var html = '<strong>' + school + '</strong><br />' + district + '<br />' + resultstable +
		'More info: <a href="http://www.tea.state.tx.us/cgi/sas/broker?_service=marykay&amp;_program=perfrept.perfmast.sas&amp;prgopt=2007/aeis/alltypec.sas&amp;year4=2007&amp;search=campback&amp;year2=05&amp;topic=aeis&amp;ptype=HTML&amp;third=0&amp;sublevel=camp&amp;gifname=g_aeis05campus&amp;title=AEIS+Report&amp;level=Campus&amp;campback=' + cds + '" target="_blank">TX Campus Report</a>';

	if (nces != 0) html += '&nbsp;&nbsp;<a href="http://nces.ed.gov/ccd/schoolsearch/school_detail.asp?ID=' + nces + '" target="_blank">US NCES</a>';
	
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
	});
	return marker;
}
