function getCounties(select, countySelect){
	state = select.options[select.selectedIndex].value;
		
	var xmlHttp;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer 6.0+
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			// Internet Explorer 4.5+
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function(){
	    if(xmlHttp.readyState==4){
	    	var arCounties = xmlHttp.responseText.split('|');
			populateSelect(arCounties, countySelect)
		}
    }	
	xmlHttp.open("get","/getCounties.cfm?state=" + state,true);
	xmlHttp.send(null);
}

function populateSelect(newOptions, select){
	select = document.getElementById(select);

	while (select.options.length > 0)
	{
		select.remove(0);
	}
	
	for (var i = 0; i < newOptions.length; i++){
		var tmpData = new Array();
		tmpData = newOptions[i].split('&');
		var tmpOpt = new Option(tmpData[0],tmpData[1]);
		try
		    {
		    select.add(tmpOpt,null); // standards compliant
		    }
		  catch(ex)
		    {
		    select.add(tmpOpt); // IE only
		    }	
	}
	
	if (select.options[0].value == 0){
		select.disabled = true;
	}
	else {
		select.disabled = false;
	}
}