//Functions for Ajaxs
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
 	{
 		// Firefox, Opera 8.0+, Safari
 		xmlHttp=new XMLHttpRequest();
 	}
	catch (e)
 	{
 		// Internet Explorer
 		try
   		{
   			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
   		}
		 catch (e)
   		{
   			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
   		}
 	}
	return xmlHttp;
}
//updates the Options Text part of the html
//Updates Display Block
function UpdateContent() 
{
	//alert ("Start Display:"); 
	if (xmlHttp.readyState == 4)
	{ 
		//alert ("Response:" + xmlHttp.responseText);
		document.getElementById("Content").innerHTML = xmlHttp.responseText;
	}
}

//Called when it is time to update.
function UpdatePage(Script, Method, Pass)
{
	//alert ("Script: " + Script + "\nType: " + Type + "\nMethod: " + Method + "\nPass: " + Pass);
	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			} 
			
	//alert ("Type: " + Type );
	
	//Select a StatChange
	
	xmlHttp.onreadystatechange = UpdateContent;
	
	//Select a Method	
	if(Method == "g")
	{
		//alert ("In Get: " + Script + "?" + Pass);		
		xmlHttp.open("GET", Script + "?" + Pass, true);
		xmlHttp.send(null);
	}
	else if (Method == "p")
	{
		//alert ("In Post.");
		xmlHttp.open("POST", Script, true);

		//Send the proper header information along with the request
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", Pass.length);
		xmlHttp.setRequestHeader("Connection", "close");
		
		xmlHttp.send(Pass);	
	}
	//alert ("End Update");
}