// This creates a XMLRequest (ActiveXObject) to be sent to the server
var XmlReq;
// This page returns the XML Response for the selected choice

function CreateXmlReq()
{
	try
	{
		XmlReq = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlReq = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlReq = null;
		}
	}
	if(!XmlReq && typeof XMLHttpRequest != "undefined")
	{
		XmlReq = new XMLHttpRequest();
	}
}

//This fucntion is to send the choice into the AJAX Server page for processing
function getbody(val)
{
	//Starts displaying the Process Image table
	var requestUrl = './' + val;

	CreateXmlReq();
	
	if(XmlReq)
	{
		XmlReq.onreadystatechange = HandleResponse;
		XmlReq.open("GET", requestUrl,  true);
		XmlReq.send();		
	}
}

function HandleResponse()
{
	if(XmlReq.readyState == 4)
	{
		if(XmlReq.status == 200)
		{		
			// Fill the cleared Datagrid with new XML Reponse
			FillContentDiv(XmlReq.responseText);
			// Hides the Process Image Table after displaying the contents
		}
		else
		{
			alert(XmlReq.status + " There was a problem retrieving data from the server." );

		}
	}
}

function FillContentDiv(values)
{
	// Gets the response XML
	if (values == null)
	{
	}
	else
	{
		document.getElementById('news').innerHTML = values;  
	}
}