    var http_request = false;
	var numFound = 0;
    function makeLookupRequest(qString) {
        stat = document.getElementById('streetStatus')
		if( qString.length < 3 ) 
		{
			if( qString.length == 0 )
		        {if( stat ) stat.innerText = '';}
			else
		        {if( stat ) stat.innerText = 'Please Enter at least 3 letters';}
			return;
		}
		numFound = 0;
        http_request = false;
        if( stat ) stat.innerText = 'Searching...';
		document.forms[0].streetList.length=0;
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!http_request) {
            alert('Giving up :( Unable to create Lookup Request!');
            return false;
        }
        http_request.onreadystatechange = alertContents;
		var parameters = 'q=' + qString;
//        http_request.open('POST', "http://localhost/hareamap/ggarstreetquery.aspx", true);
        http_request.open('POST', "ggarstreetquery.aspx", true);
        http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        http_request.setRequestHeader("Content-length", parameters.length);
        http_request.setRequestHeader("Connection", "close");
        http_request.send(parameters);
    }

    function alertContents() {
		var numFound = 0;
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
				divObj = crsGetObject('divStreetList');
				var xmldoc = http_request.responseXML;
				var nodeList = xmldoc.getElementsByTagName('street');
				if( nodeList )
				{
					var sName = null;
					var sDisplayName = null;
					var sFips = null;
					var sMLSzone = null;
					var sZip = null;
					var sCountyName = null;
					var optionObject;
					var sHTML = '<table cellpadding=0 border=0 width=\"100%\"><tr><th>StreetName</th><th>ZipCode</th><th>MLS Area</th><th>County</th></tr>'
					numFound = nodeList.length;
					for(i=0;i<nodeList.length;i++)
					{
						sName = nodeList[i].getElementsByTagName("name")[0].firstChild.nodeValue;
						if( sName.indexOf("'") > 0 )
						{
							alert(sName);
							sDisplayName = sName.replace("'","");
							alert(sDisplayName);
						}
						else
							sDisplayName = sName;
						sFips = nodeList[i].getElementsByTagName("fips")[0].firstChild.nodeValue;
						sMLSzone = nodeList[i].getElementsByTagName("mlsZone")[0].firstChild.nodeValue;
						sCountyName = nodeList[i].getElementsByTagName("countyName")[0].firstChild.nodeValue;
						if( nodeList[i].getElementsByTagName("zipCode")[0].firstChild )
						{
						    sZip = nodeList[i].getElementsByTagName("zipCode")[0].firstChild.nodeValue;
						    sZipDisp = sZip;
						}
						else
						{
							sZip = '';
							sZipDisp = 'na';
						}
						if( sName && sFips )
						{
//							document.forms[0].streetList.options[i] = new Option(sName + ' - ' + sZip + ' - MLS Area ' + sMLSzone + ' - ' + sCountyName,sFips + '|' + sName + '|' + sMLSzone + '|' + sZip );
							sThisHTML = '<tr><td><a href=\"Go\" onClick=\"streetAnchorSelected(\'' + sFips + '|' + sName + '|' + sMLSzone + '|' + sZip + '\');return false;\">' + sDisplayName + '</a></td><td>' + sZipDisp + '</td><td>' + sMLSzone + '</td><td>' + sCountyName + "</td></tr>"
							sHTML = sHTML + sThisHTML;
							if( sName != sDisplayName ) alert(sThisHTML);
						}
					}
				}
				if( numFound > 0 )
				{
					divObj.innerHTML = sHTML + '</table>';
					divObj.style.display = 'block';
//					alert(divObj.innerHTML);
//					document.forms[0].streetList.length=numFound;
//					document.forms[0].streetList.size=numFound;
//					if( numFound < 2 ) document.forms[0].streetList.size=2;
//					document.forms[0].streetList.style.display='block';
			        stat = document.getElementById('streetStatus')
			        if( numFound == 1 )
			        {
						if( stat ) stat.innerHTML = numFound + ' Street was found.<br>Click the name to go to that street.';
					}
					else
					{
						if( stat ) stat.innerHTML = numFound + ' Streets found.<br>Click the one you want.';
					}
				}
				else
				{
//  					document.forms[0].streetList.length = 0
//					document.forms[0].streetList.size=0;
//					document.forms[0].streetList.style.display='none';
					divObj.style.display = 'none';
			        stat = document.getElementById('streetStatus')
					if( stat ) stat.innerHTML = 'Sorry. No streets were found.';
				}
           } else {
//  				document.forms[0].streetList.length = 0
//				document.forms[0].streetList.size= 0;
//				document.forms[0].streetList.style.display='none';
				divObj.style.display = 'none';
		        stat = document.getElementById('streetStatus')
				if( stat ) stat.innerHTML = 'Sorry. No streets were found.'; //http_request.status;
            }
        }
//        else
//       {
//			divObj.style.display = 'none';
//	        stat = document.getElementById('streetStatus')
//			if( stat ) stat.innerHTML = http_request.readyState;
//        }
    }
function noenter(box,event) 
{
	divObj = crsGetObject('divStreetList');
	if( (window.event && window.event.keyCode == 13) )
	{
		if( box.value.length == 0 )
		{
				if( divObj ) divObj.innerHTML = '';
				if( divObj ) divObj.style.display='none';
		        stat = document.getElementById('streetStatus')
				if( stat ) stat.innerText = '';
		}
		else if ( box.value.length < 3 )
		{
				if( divObj ) divObj.innerHTML = '';
				if( divObj ) divObj.style.display='none';
		        stat = document.getElementById('streetStatus')
				if( stat ) stat.innerText = 'Please enter at least 3 letters.';
		}
		else
		{
			makeLookupRequest(box.value);
		}
		return false;
	}
	else if ( event && event.which == 13 )
	{
		if( box.value.length == 0 )
		{
				if( divObj ) divObj.innerHTML = '';
				if( divObj ) divObj.style.display='none';
		        stat = document.getElementById('streetStatus')
				if( stat ) stat.innerText = '';
		}
		else if ( box.value.length < 3 )
		{
				if( divObj ) divObj.innerHTML = '';
				if( divObj ) divObj.style.display='none';
		        stat = document.getElementById('streetStatus')
				if( stat ) stat.innerText = 'Please enter at least 3 letters.';
		}
		else
		{
			makeLookupRequest(box.value);
		}
		return false;
	}
}
function streetSelected(selectBox)
{
	document.forms[0].CRSMapImage1_command.value = 'ZOOMSTREET';
	document.forms[0].CRSMapImage1_input.value = selectBox.value;
	__doPostBack('','');
}
function streetAnchorSelected(sValue)
{
	document.forms[0].CRSMapImage1_command.value = 'ZOOMSTREET';
	document.forms[0].CRSMapImage1_input.value = sValue;
	__doPostBack('','');
}
function copyMLStext()
{
var isOpera = navigator.userAgent.indexOf("Opera") > -1; 
var isIE = navigator.userAgent.indexOf("MSIE") > 1 && !isOpera; 
var isMoz = navigator.userAgent.indexOf("Mozilla/5.") == 0 && !isOpera;
	if( !isIE ) return;
	setNoActiveCRSMapCommand();
	tt = document.forms[0].tempText;
	if( tt )
	{
		tt.value = document.forms[0].areaList.value;
		if( tt.value == 'none' ) alert( 'Please select an area first!' );
		else
		{
			if( tt.value.length == '2' ) tt.value = '0' + tt.value;
			r = tt.createTextRange();
			r.execCommand('copy');
			alert('"' + tt.value + '" has been copied to the clipboard!');
		}
	}
}
function crsGetObject(name)
{
  if (document.getElementById)
  {
  	return document.getElementById(name);
  }
  else if (document.all)
  {
	return document.all[name];
  }
  else if (document.layers)
  {
	return crsGetObjectNN4(document,name);
  }
}
