var xmlHttp


function modifyObjectType()
{
	var dataType = document.getElementById("selectDatatype");
	var objectType = document.getElementById("selectObjectType");
	
	var dataText = dataType.options[dataType.selectedIndex].text;

	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	} 


	var url="../include/ajax_handler.php"
	args = "selected=" + dataText                      //set up the query for the POST
	args = args + "&resource=modifyObject"

	//args = args + "&sid=" + Math.random()   //add a random number to ensure new requests

	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("POST",url,true)

	//need to set the request header so PHP can do a normal $_POST array retrival
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");

	//for a post, you send the arguments as parameters, for get you just pass them in the url
	xmlHttp.send(args)
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		//document.getElementById("selectObjectType").innerHTML=xmlHttp.responseText 
		var objectElement = document.getElementById("selectObjectType");
		var i = 0;
		var theArray = xmlHttp.responseText.split(":");

		//empty the options array
		objectElement.options.length = 0;

		objectElement.options[0] = new Option("All", "");

		//fill the options array with the returned values
		for(i=0; i < theArray.length; i++)
		{ 
			var tempOption = new Option(theArray[i], theArray[i]);
			objectElement.options[i+1] = tempOption;
		}
	} 
} 


/**********************
* This function returns an xml object that will be cross browser compatible
**********************/
function GetXmlHttpObject()
{
	var objXMLHttp = null

	try
	{
		objXMLHttp = new XMLHttpRequest();
	}
	catch(e1)
	{
		//Internet Explorer Browsers
		try
		{
			objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e2)
		{
			try
			{
				objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e3)
			{
				return false;
			}
		}
	}
	
	
	return objXMLHttp;
}

