function WBAJAX()
{	
	this.DivId = new Array();
	this.ValueXMLTag = new Array();
	this.VarNames = new Array();
	this.VarValXML = new Array();
			
	this.Working = false;
	this.QueryStringItems = new Array();
	this.QueryStringValues = new Array();
	this.AdditionalQuery = '';
	this.AddWBQueryParams = true;
	
	this.Url = MidPath;
	this.Processed;
	this.Method = 'GET';
	
	this.Message = '';
	this.MessageBox = document.getElementById("ProcessingMessage");
	this.DisplayMessage = false;
	
	this.CallExtMethod = false;
	this.MethodToCall = '';
	
	this.ModuleName = '';
	
	var _this = this;
	
	//GENERATE OUR HTTP OBJECT USED TO INTERACT WITH THE SERVER.
	this.LoadObj = function()
	{
		try 
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			try
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch (E){
				xmlhttp = false;
			}
		}
		
		if (!xmlhttp && typeof XMLHttpRequest!='undefined') 
		{
			try 
			{
				xmlhttp = new XMLHttpRequest();
			}catch (e){
				xmlhttp=false;
			}
		}
		
		if (!xmlhttp && window.createRequest) 
		{
			try
			{
				xmlhttp = window.createRequest();
			}catch (e){
				xmlhttp=false;
			}
		}
		return xmlhttp;
	}
	
	//BUILD THE QUERYSTRING TO SEND TO OUR CODE
	//BASED ON THE ARRAY'S VALUES
	this.BuildQueryString = function()
	{
		var Q = '';
		if(this.AddWBQueryParams) Q = Q + "?WBAJAX=true&moduleName=" + this.ModuleName;
		
		for(var z=0; z < this.QueryStringItems.length; z++)
		{
			Q = Q + "&" + this.QueryStringItems[z] + "=" +  this.QueryStringValues[z];
		}
		if(this.AdditionalQuery != '') Q = Q + '&' + this.AdditionalQuery;
		return Q;
	}
	
	//TRY TO PROCESS UNTIL IT IS PROCESSED.
	this.Process = function()
	{
		this.DisplayProcessMessage();
		this.http = this.LoadObj();
		this.Processed = false;
		do
		{ this.SendtoProcess();	}while(!this.Processed)
	}
	
	this.DisplayProcessMessage = function()
	{
		if(this.DisplayMessage == true)
		{
			this.MessageBox.innerHTML = this.Message;
			this.MessageBox.style.visibility = 'visible';
		}
	}
	this.HideMessage = function()
	{
		if(this.DisplayMessage == true)
		{
			this.MessageBox.innerHTML = '&nbsp;';
			//this.MessageBox.style.visibility = 'hidden';
		}
	}
	//FUNCTION TO SEND THE REQUEST TO SERVER AND PROCESSING CODE
	this.SendtoProcess = function()
	{
		if(!this.Working) {
			this.Processed = true;
			
			this.Url = this.Url + this.BuildQueryString();
			this.Working = true;
			this.http.open(this.Method, this.Url, true);
			this.http.onreadystatechange = function(){ _this.UpdatePage() };
			this.http.send(null);						
		}else{
			
		}
	}

	this.UpdatePage = function()
	{
		if (this.http.readyState == 4) {
			this.Working = false
			this.Method = 'GET';
			if (this.http.responseText.indexOf('invalid') == -1) {
				var xmlDocument =  this.http.responseXML;
								
				try
				{
					//Loop through all the divs that we have to retrieve html for.
					for(var z=0; z < this.DivId.length; z++)
					{
						//FOR EACH ITEM IN OUR ARRAY WE FIND THE CORRESPONDING XML TAG/VALUE
						XMLTagName = this.ValueXMLTag[z];
						var sValue = xmlDocument.getElementsByTagName(XMLTagName).item(0).firstChild.data;
						//SET THE PAGE ELEMENTS INNERHTML
						document.getElementById(this.DivId[z]).innerHTML = sValue;
					}
					
					for(var z=0; z< this.VarNames.length; z++)
					{
						var varName = this.VarNames[z];
						var varVal = xmlDocument.getElementsByTagName(this.VarValXML[z]).item(0).firstChild.data; 
						eval(varName + '= varVal');
					}
				this.HideMessage();	
				
				if(this.CallExtMethod && this.MethodToCall != '') eval(this.MethodToCall);
				this.CallExtMethod = false;
				
				this.Working = false;
				}catch(err)
				{
					if(!isDefined(WBAjaxDebugger)) WBAjaxDebugger = false;
					if(WBAjaxDebugger)
					{
						this.StartDeBugging();
					}
				}
			}else{

			}
		}
		
	}
	
	this.StartDeBugging = function()
	{
		var w = open(this.Url,'WhiteBoxAJAXDebugger','width=800,height=600,scrollbars,resizable,status');
	}

	this.ResetArrays = function()
	{
		if(!this.Working)
		{
			this.QueryStringItems = new Array();
			this.QueryStringValues = new Array();
			this.DivId = new Array();
			this.ValueXMLTag = new Array();
			this.VarNames = new Array();
			this.VarValXML = new Array();
		}else{
			_this.ResetArrays();
		}
	}

}//END OF AJAX OBJECT CONTAINER
WhiteBoxAJAX = new WBAJAX();