<!--

// global request object
var xmlHttp;
var Queue = new Array();

function ajaxNew(){
   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!");
            return false;
         }
      }
   }
}

function ajaxRequest(Function,RequestType,url,Args) {

if (xmlHttp==null) { ajaxNew();}
	var nQueue={};
	nQueue.Function=Function;
	nQueue.RequestType=RequestType;
	nQueue.url=url;
	nQueue.Args=Args;

	if (xmlHttp.readyState == 0) {
		Queue[Queue.length] = nQueue;
		ajaxStateManager();
	}
	else {
		Queue[Queue.length] = nQueue;
	}
}

function ajaxStateManager() {
	var readyState = xmlHttp.readyState;
	if (readyState == 0) {
		//Process Next Item In Queue
		if (Queue.length>0) {
			xmlHttp.open(Queue[0].RequestType,Queue[0].url,true);
			xmlHttp.onreadystatechange = ajaxStateManager;
			xmlHttp.send(null);			
		}
	}
	else if (readyState == 1) {
	}
	else if (readyState == 2) {
	}
	else if (readyState == 3) {
	}
	else if (readyState == 4) {
		//Process Current Item
		if (Queue.length>0) {
			
			Queue[0].Function();
			Queue.splice(0,1);
			ajaxNew();
			ajaxStateManager();
		}
	}
}
-->
