var ajaxHtmlElement;

function GetXmlHttpObject(handler)  
{  
   var objXMLHttp=null  
   if (window.XMLHttpRequest)  
   {  
       objXMLHttp=new XMLHttpRequest()  
   }  
   else if (window.ActiveXObject)  
   {  
       objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")  
   }  
   return objXMLHttp  
}  
  
function stateChanged()  
{  
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")  
   {  
           document.getElementById(ajaxHtmlElement).innerHTML= xmlHttp.responseText;  
   }  
   else {  
           //alert(xmlHttp.status);  
   }  
}  
  
// Will populate data based on input  
function htmlData(url, qStr, htmlElement)  
{  
   ajaxHtmlElement = htmlElement;   
   if (url.length==0)  
   {  
       document.getElementById(ajaxHtmlElement).innerHTML="";  
       return;  
   }  
   xmlHttp=GetXmlHttpObject()  
   if (xmlHttp==null)  
   {  
       alert ("Browser does not support HTTP Request");  
       return;  
   }  
  
   url=url+"?"+qStr;  
   url=url+"&sid="+Math.random();  
   xmlHttp.onreadystatechange=stateChanged;  
   xmlHttp.open("GET",url,true) ;  
   xmlHttp.send(null);  
}  

