var req = null;

function InitXMLHttpRequest() {
	// Make a new XMLHttp object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
}



function Selectstate(section, stateid, ctrlid, destination, text) 
{
	InitXMLHttpRequest();
	if (stateid != '') 
	{
		if (req) 
		{
			req.onreadystatechange = function() 
			{
				if (req.readyState == 4) 
				{
					destination.innerHTML = req.responseText;
				} 
				else 
				{
					destination.innerHTML = "<select style=\"width:150px;\"><option>"+text+"</option></select>";
				}
			}
			req.open("GET", "location.php?sec=" + section + "&stateid=" + stateid + "&ctrlid=" + ctrlid, true);
			req.send(null);
		} 
		else 
		{
			destination.innerHTML = 'Browser unable to create XMLHttp Object';
		}
	} 
}
