/*
==Methods==
abort() - Stops the current request 
getAllResponseHeaders() - Returns complete set of headers (labels and values) as a string 
getResponseHeader("headerLabel") - Returns the string value of a single header label 
open("method", "URL"[, asyncFlag[, "userName"[, "password"]]]) - Assigns destination URL, method, and other optional attributes of a pending request 
send(content) - Transmits the request, optionally with postable string or DOM object data 
setRequestHeader("label", "value") - Assigns a label/value pair to the header to be sent with a request 

==Properties==
onreadystatechange - Event handler for an event that fires at every state change 
readyState - Object status integer:
		0 = uninitialized
		1 = loading
		2 = loaded
		3 = interactive
		4 = complete 
responseText - String version of data returned from server process 
responseXML - DOM-compatible document object of data returned from server process 
status - Numeric code returned by server, such as 404 for "Not Found" or 200 for "OK" 
statusText - String message accompanying the status code 
*/

var xmlHttp;

function getXmlHttpObject()
{
 xmlHttp=null;
 try
 {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
 }
 catch (e)
 {
  // Internet Explorer
  try
  {
   xmlHttp=new ActiveXObject("MSXML2.XMLHTTP");
  }
  catch (e)
  {
   try
   {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
   }
   catch (e)
   {
    alert("Your browser does not support AJAX!");
    xmlHttp=null;
   }
  }
 }
 return xmlHttp;
}

function setXmlHttpObject(xObject,xMethod,xAsynch,xEncode,xURL,xData)
{
 xmlHttp=xObject;
 if ((xMethod==null) || (xMethod=="")) { xMethod="GET"; }
 if ((xAsynch==null) || (xAsynch=="")) { xAsynch=true; }
 if ((xEncode==null) || (xEncode=="")) { xEncode="application/x-www-form-urlencoded"; }
 if (xURL.indexOf("?")>=0) { xURL=xURL+"&sid="+Math.random(); }
 if (xURL.indexOf("?")<0) { xURL=xURL+"?sid="+Math.random(); }
 try
 {
  xmlHttp.open(xMethod,xURL,xAsynch);
  xmlHttp.setRequestHeader("Content-Type",xEncode);
  xmlHttp.send(xData);
 }
 catch (e)
 {
  alert("Internal server error. Please try again later.");
  xmlHttp.abort();
 }
}
