// JavaScript Document
var xHTTP
var m_ID

function SendAjaxRequest(url,params,CallBack,PostOrGet)
{
  xHTTP=GetHTTPObject();
  if (xHTTP==null)
    {
    alert ("Your browser does not support XMLHTTP!");
    return;
    }

  xHTTP.onreadystatechange=function(){
    if (xHTTP.readyState==4)
      CallBack(xHTTP.responseText);
  }
  if (PostOrGet=="post")
  {
    xHTTP.open("POST",url,true);
    //Send the proper header information along with the request
    xHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xHTTP.setRequestHeader("Content-length", params.length);
    xHTTP.setRequestHeader("Connection", "close");  
    xHTTP.send(params);
    return;      
  }
  // default to get
  //params=params+math.random();
  xHTTP.open("GET",url+"?"+params,true);
  xHTTP.send(null);
}

function SynchAjax(url, params, PostOrGet)
{
  xHTTP=GetHTTPObject();
  if (xHTTP==null)
    {
    alert ("Your browser does not support XMLHTTP!");
    return;
    }

  if (PostOrGet=="post")
  {
    xHTTP.open("POST",url,false);
    //Send the proper header information along with the request
    xHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xHTTP.setRequestHeader("Content-length", params.length);
    xHTTP.setRequestHeader("Connection", "close");  
    xHTTP.send(params);
    return xHTTP.responseText;
  }
  // default to get
  //params=params+math.random();
  xHTTP.open("GET",url+"?"+params,false);
  xHTTP.send(null);
  return xHTTP.responseText;
}

function GetHTTPObject()
{
  if (window.XMLHttpRequest)
    {
      // for all of the 'Good' browsers
      return new XMLHttpRequest();
    }
  if (window.ActiveXObject)
    {
      // for IE6, IE5
      return new ActiveXObject("Microsoft.XMLHTTP");
    }
  return null;
}