function GetHTTPRequest()
{
  var req2 = false;
  
  if(window.XMLHttpRequest)
  {
    try
    {
  	  req2 = new XMLHttpRequest();
    }
    catch(e)
    {
  	  req2 = false;
    }
  }
  else if(window.ActiveXObject)
  {
    try
    {
      req2 = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
      try
      {
        req2 = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e)
      {
        req2 = false;
      }
		}
  }
    
  return(req2);
}

function CallAJAXFunction(url, asynchron, body, requestMethod, FunctionName, parameterArray)
{
  var req2 = GetHTTPRequest();
  if (req2)
  {
    if(FunctionName != null)
    {
      if(parameterArray != null && parameterArray != false)
      {
        req2.onreadystatechange = function() { eval(FunctionName + "(req2,parameterArray);") };
      }else{
        req2.onreadystatechange = function() { eval(FunctionName + "(req2);") };
      }      
      req2.open(requestMethod, url, asynchron);
      req2.send(body);
    }else{
      req2.open(requestMethod, url, asynchron);
      req2.send(body);
      req2 = false;
      req2 = null;
    }
  }else{
    alert('Can\'t create object of type XMLHTTP!');
  }
}

