﻿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;
}


function doPostData(url, params, obj)
{
    var xmlHttpObj = GetXmlHttpObject();
    xmlHttpObj.open("POST", url, true);
    
    //Send the proper header information along with the request
    xmlHttpObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttpObj.setRequestHeader("Content-length", params.length);
    xmlHttpObj.setRequestHeader("Connection", "close");
    xmlHttpObj.onreadystatechange = function() {//Call a function when the state changes. 
        if (xmlHttpObj.readyState == 1) {
           // obj.innerHTML = '<p align="center" style="padding-top:80"><img src="images/loading.gif" align="center" valign="middle" border="0"></p>'
        }
        if (xmlHttpObj.readyState == 4) {
			//alert(xmlHttpObj.responseText);
            obj.innerHTML = xmlHttpObj.responseText;
			
        }
    }
    xmlHttpObj.send(params);

}



function doGetData(url, params, obj) 
{
    var xmlHttpObj = GetXmlHttpObject();
    url = url + "?" + params
    xmlHttpObj.open("GET", url, false);

    xmlHttpObj.onreadystatechange = function() {//Call a function when the state changes. 
        if (xmlHttpObj.readyState == 1) {
            obj.innerHTML = '<p align="center" style="padding-top:80"><img src="/images/loading.GIF" align="center" valign="middle" border="0"></p>'
        }
        if (xmlHttpObj.readyState == 4) {
            obj.innerHTML = xmlHttpObj.responseText;
        }
    }
    xhttp.send("");

}   
