var xmlHttp=null;

function setAjax(xmlHttp)
{
  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 AjaxPost(url, functionCall, strXMLPost, blnSync)
{

  var blnTransfer = true;
  if (blnSync != undefined)
  {
      blnTransfer = blnSync;
  }

  xmlHttp = setAjax(xmlHttp); 
 
 if(xmlHttp != null)
  {

    if (functionCall != undefined)
    {
      if(functionCall != "") xmlHttp.onreadystatechange=functionCall;
    } else {
      xmlHttp.onreadystatechange=stateChanged;
    }

    xmlHttp.open("POST",url + "&ran=" + Math.random(),blnTransfer);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", strXMLPost.length);
    xmlHttp.setRequestHeader("Connection", "close");

    xmlHttp.send(strXMLPost);

    return true;
  } else
  {
	return false;
  }
}

function AjaxGet(url, functionCall, blnSync)
{
  var blnTransfer = true;
  if (blnSync != undefined)
  {
      blnTransfer = blnSync;
  }
  xmlHttp = setAjax(xmlHttp);

  if(xmlHttp != null)
  {
    if (functionCall != undefined)
    {
      if(functionCall != "") xmlHttp.onreadystatechange=functionCall;
    } else {
      xmlHttp.onreadystatechange=stateChanged;
    }

    xmlHttp.open("GET",url + "&ran=" + Math.random(),blnTransfer);
    xmlHttp.send(null);
    return true;
  } else
  {
	return false;
  }
}
