var XmlHTTP;
var resultId;
XmlHTTP = createHttpRequest();
var is_activex = null;
function createHttpRequest() {
   var XmlHTTP1;
   //Use the native object available in all browsers (IE >= 7)
   if (window.ActiveXObject) //Use the ActiveX version for IE < 7
   {
      try { XmlHTTP1 = new ActiveXObject("Msxml2.XMLHTTP.6.0"); } 
      catch (e) 
      {
            try { XmlHTTP1 = new ActiveXObject("Msxml2.XMLHTTP"); } 
            catch (e) 
            {
                  try { XmlHTTP1 = new ActiveXObject("Microsoft.XMLHTTP"); } 
                  catch (e) { XmlHTTP1 = false; } // не смогли создать объект
            }
      }
      is_activex = true;
   } else if (window.XMLHttpRequest) // Mozilla или IE>=7
   {
      try { XmlHTTP1 = new XMLHttpRequest(); } 
      catch (e) { XmlHTTP1 = false; } // если ошибка
      is_activex = false;
   }

   
   if (!XmlHTTP1)
   {
      return false;
   }

   return XmlHTTP1;
}


function sendRequest(url, _resultId, getRequestProc, SyncFlag) {
 if (SyncFlag == null) {
  SyncFlag = false;
 }
   resultId = _resultId;
   XmlHTTP.open('GET', url, !SyncFlag);
   try { XmlHTTP.onload = getRequestProc;} 
   catch (e) {XmlHTTP.onreadystatechange = getRequestProc;} // если ошибка

   XmlHTTP.setRequestHeader('Content-Type', 'text/html; charset=windows-1251');
   XmlHTTP.send(null);
} 

function getRequest() {
 if (XmlHTTP.readyState == 4) {
   if (XmlHTTP.status == 200) {
    document.getElementById(resultId).innerHTML = unescape(XmlHTTP.responseText);
   }
 }
} 

function getRequestValue() {
 if (XmlHTTP.readyState == 4) {
   if (XmlHTTP.status == 200) {
   document.getElementById(resultId).value = XmlHTTP.responseText;
   }
 }
} 
