/// <summary>
///  The loadXMLDoc() function creates an xmlhttprequest object, calls a specified url and then calls a 
///   specified function to handle the response.
/// </summary>
///
/// <param name="url" required="true">The URL load.</param>
/// <param name="callback" required="true">The Callback function the object will call with the returned document's xml doc.</param>
/// <param name="vars" required="false">An int, string, object or array that is passed through to the callback function.</param>
/// <param name="method" required="false">GET or POST.  Defaults to GET.</param>
/// <param name="post" required="false">If method is POST, then this would be the POST data.</param>
function loadXMLDoc(url, callback, vars, method, post) {
	method = (method == null) ? "GET" : method;
  var xmlhttp=false;
  /*@cc_on @*/
  /*@if (@_jscript_version >= 5)
  // JScript gives us Conditional compilation, we can cope with old IE versions.
  // and security blocked creation of the objects.
   try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
    try {
     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
     xmlhttp = false;
    }
   }
  @end @*/

  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  xmlhttp.open(method, url,true);
  xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
    	callback(xmlhttp.responseXML, vars);
    }
  }
	if (method == "POST") 
	{
  	xmlhttp.send(post);
	} else {
		xmlhttp.send(null)
	}
		
}
/// <summary>
///  The loadXMLDocSync() function uses the xmlhttprequest object to get an xml doc syncronously.
/// </summary>
///
/// <param name="url" required="true">The url of the document to retrieve</a>
function loadXMLDocSync(url) {
  var xmlhttp=false;
  /*@cc_on @*/
  /*@if (@_jscript_version >= 5)
  // JScript gives us Conditional compilation, we can cope with old IE versions.
  // and security blocked creation of the objects.
   try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
    try {
     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
     xmlhttp = false;
    }
   }
  @end @*/

  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  xmlhttp.open("GET", url,false);
  xmlhttp.send(null);
	if(xmlhttp.status == 200)
	{
		return xmlhttp.responseXML;
	}
}




