var xmlHttp=null; // Defines that xmlHttp is a new variable.
var _resultPanel="";
var _resultFlag=0;

function ajax_engine(url,resultPanel)
{
	_resultPanel=resultPanel;
	<!-- // Required to be compliant with XHTML	 
	 // Try to get the right object for different browser
	try 
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest(); // xmlHttp is now a XMLHttpRequest.
	} 
	catch (e) 
	{
		// Internet Explorer
		try 
		{
		   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
		   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	 }
	 var d = new Date();
	 url=url+"time="+d.getTime();	 
	 xmlHttp.open("get",url,true); // .open(RequestType, Source);	 
	 xmlHttp.onreadystatechange = StateChanged;
	 xmlHttp.send(null); // Since there is no supplied form, null takes its place as a new form.
}
 
function StateChanged()
{	
	if(xmlHttp.readyState == 1)
	{
		document.getElementById(_resultPanel).align="center";
		document.getElementById(_resultPanel).valign="middle";
		document.getElementById(_resultPanel).innerHTML=Loading();		
	}
	if (xmlHttp.readyState == 4)
	{
		try 
		{ // In some instance, status cannot be retrieve and will produce an error (ex: Port is not responsive)
			if (xmlHttp.status == 200) 
			{
			 //Set the main HTML of the body to the info provided by the AJAX Request
				document.getElementById(_resultPanel).align="left";
				//document.getElementById(_resultPanel).valign="middle";
			 	document.getElementById(_resultPanel).innerHTML = xmlHttp.responseText;
			}
		} 
		catch (e) 
		{
		  document.getElementById(_resultPanel).innerHTML = "Error on Ajax return call : " + e.description;
		}	
	}
}
 
function Loading()
{
	var strLoading=	'<table width="100%" height="100%" border="0">\r\n'+
					'  <tr valign="middle"> \r\n'+
					'    <td>\r\n'+
							
					'<table width="100%" border="0">\r\n'+
					'  <tr align="center"> \r\n'+
					'    <td><img src="http://www.boattest.com/images/large-loading.gif" width="32" height="32"></td>\r\n'+
					'  </tr>\r\n'+
					'  <tr align="center" > \r\n'+
					'    <td><strong><font face="Arial, Helvetica, sans-serif">Loading...</font></strong></td>\r\n'+
					'  </tr>\r\n'+					
					'</table>\r\n'+
					'  <tr valign="middle"> \r\n'+
					'    <td>\r\n'+
					'</table>\r\n';
	return strLoading;
}

function ajax_ae_engine(url,resultPanel)
{
	_resultPanel=resultPanel;
	<!-- // Required to be compliant with XHTML	 
	 // Try to get the right object for different browser
	try 
	{
	    
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest(); // xmlHttp is now a XMLHttpRequest.
	} 
	catch (e) 
	{
		// Internet Explorer
		try 
		{
		   xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
		   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	 }
	 var d = new Date();
	 url=url+"time="+d.getTime();	 
	 xmlHttp.open("get",url,true); // .open(RequestType, Source);	 
	 xmlHttp.onreadystatechange = StateEaChanged;
	 xmlHttp.send(null); // Since there is no supplied form, null takes its place as a new form.
}
 
function StateEaChanged()
{	
	if(xmlHttp.readyState == 1)
	{
		document.getElementById(_resultPanel).align="center";
		document.getElementById(_resultPanel).valign="middle";
		document.getElementById(_resultPanel).innerHTML=Loading();		
	}
	if (xmlHttp.readyState == 4)
	{
		try 
		{ // In some instance, status cannot be retrieve and will produce an error (ex: Port is not responsive)
		
			if (xmlHttp.status == 200) 
			{
			// alert(xmlHttp.responseText);
			 	//Set the main HTML of the body to the info provided by the AJAX Request
				document.getElementById(_resultPanel).align="center";
				document.getElementById(_resultPanel).valign="middle";
				document.getElementById('txtIsSucceed').value= xmlHttp.responseText;			
			 	document.getElementById(_resultPanel).innerHTML = xmlHttp.responseText;//"Data add or edit successfully.!";
			 	
			}
		} 
		catch (e) 
		{
		  document.getElementById(_resultPanel).innerHTML = "Error on Ajax return call : " + e.description;
		}	
	}
}