//****************************************************************************************************************************
//Global variables
var xmlhttp;
var gDisplayArea;
var strDataToSend;
var gCheckReturn;
//****************************************************************************************************************************
function loadXMLDoc(vUrl, vDisplayArea, vDataToSend, vCheckReturn)
{
	gDisplayArea = vDisplayArea;
	gCheckReturn = vCheckReturn;

	if(vDataToSend != null)
	{
		strDataToSend = vDataToSend;
		strDataToSend = strDataToSend.replace(/\+/g, '%2b');
		strDataToSend = strDataToSend.replace(/ /g, '%20');
		strDataToSend = strDataToSend.replace(/\"/g, '\'');
	}

// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	{
		xmlhttp = new XMLHttpRequest();
		xmlhttp.onreadystatechange=state_Change;
		xmlhttp.open("POST",vUrl,true);
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.send(strDataToSend);
	}
// code for IE
	else if (window.ActiveXObject)
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		if (xmlhttp)
		{
			xmlhttp.onreadystatechange=state_Change;
			xmlhttp.open("POST",vUrl,true);
			xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlhttp.send(strDataToSend);		
		}
	}
}
//****************************************************************************************************************************
function state_Change()
{
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4)
	{
		// if "OK"
		if (xmlhttp.status==200)
		{
			document.getElementById(gDisplayArea).innerHTML = xmlhttp.responseText;
			if (gCheckReturn == 1)
			{
			    eval(document.all.hdnFunctionToExecute.value);
			}
		}
		else
		{
			document.getElementById(gDisplayArea).innerHTML = xmlhttp.responseText;
		}
	}
}
//****************************************************************************************************************************

