var xmlHttp
var GLOBAL_DIV_ID = "";

function FncAjax(URL, DIV_ID, VALUE, PARAMETERS)
{
	document.getElementById(DIV_ID).innerHTML = '<img src="images/template/loading.gif" /><br />';

	xmlHttp=GetXmlHttpObject();

	GLOBAL_DIV_ID = DIV_ID;

	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}

	URL = URL + "?value=" + VALUE;
	URL = URL + PARAMETERS;
	URL = URL + "&sid=" + Math.random();

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET", URL, true);
	xmlHttp.send(null);
}
function stateChanged() 
{
	if((xmlHttp.readyState == 4) || (xmlHttp.readyState == "complete"))
	{ document.getElementById(GLOBAL_DIV_ID).innerHTML=xmlHttp.responseText; }
}
// Function to check whether the client's web browser supports AJAX or not
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;
}
