
function getXMLObject()  //XML OBJECT
{
   var xmlHttp = false;
   try {
     xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")  // For Old Microsoft Browsers
   }
   catch (e) {
     try {
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")  // For Microsoft IE 6.0+
     }
     catch (e2) {
       xmlHttp = false   // No Browser accepts the XMLHTTP Object then false
     }
   }
   if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
     xmlHttp = new XMLHttpRequest();        //For Mozilla, Opera Browsers
   }
   return xmlHttp;  // Mandatory Statement returning the ajax object created
}
 
var xmlhttp = new getXMLObject();	//xmlhttp holds the ajax object
 
function makeAjaxRequest(url, params, output) {
  var getdate = new Date();  //Used to prevent caching during ajax call
  document.getElementById(output).innerHTML='<img width="100" height="50" src="./images/site/ajax.gif"></img>'; 
  if(xmlhttp) { 
    xmlhttp.open("POST",url,true); //calling testing.php using POST method
	xmlhttp.onreadystatechange = function(){
	   if (xmlhttp.readyState == 4) {
		 if(xmlhttp.status == 200) {
		   document.getElementById(output).innerHTML=xmlhttp.responseText; //Update the HTML Form element 
		 }
		 else {
			alert("Error during AJAX call. Please try again");
		 }
	   }	
	}
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send(params); //Posting txtname to PHP File
  }
}

function makeAjaxGetRequest(url, output) {
  var getdate = new Date();  //Used to prevent caching during ajax call
  document.getElementById(output).innerHTML='<img width="100" height="50" src="./images/site/ajax.gif"></img>'; 
  if(xmlhttp) { 
    xmlhttp.open("GET",url,true); //calling testing.php using POST method
	xmlhttp.onreadystatechange = function(){
	   if (xmlhttp.readyState == 4) {
		 if(xmlhttp.status == 200) {
		   document.getElementById(output).innerHTML=xmlhttp.responseText; //Update the HTML Form element 
		 }
		 else {
			alert("Error during AJAX call. Please try again");
		 }
	   }	
	}
    xmlhttp.send(null); //Posting txtname to PHP File
  }
}

function emptyAjaxReportBox(id)
{
	document.getElementById(id).innerHTML= '';
}
