function AJAX()
{	
	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.Url = '';
	this.Processed;
	this.Method = 'GET';
	
	this.Message = 'Processing...';
	this.MessageBox = document.getElementById("ProcessingMessage");
	
	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 = '';
		for(var z=0; z < this.QueryStringItems.length; z++)
		{
			Q = Q + "&" + this.QueryStringItems[z] + "=" +  this.QueryStringValues[z];
		}
		return Q;
	}
	
	//TRY TO PROCESS UNTIL IT IS PROCESSED.
	this.Process = function()
	{
		this.DisplayMessage();
		this.http = this.LoadObj();
		this.Processed = false;
		do
		{ this.SendtoProcess();	}while(!this.Processed)
	}
	
	this.DisplayMessage = function()
	{
		this.MessageBox.innerHTML = this.Message;
		this.MessageBox.style.visibility = 'visible';
	}
	this.HideMessage = function()
	{
		this.MessageBox.innerHTML = '';
		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{
			
		}
	}
		
	//ONCE THE PROCESS HAS RETURNED THE XML WE NEED TO UPDATE THE CONTENT
	//OF THE PAGE
	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;
				//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; 
					if(varName == 'WeeklyReport.PreviousBusinessClosedId') WeeklyReport.PreviousBusinessClosedId = varVal;
					if(varName == 'WeeklyReport.PreviousSPId') WeeklyReport.PreviousSPId = varVal;
				}
				this.HideMessage();
				this.Working = false;
			}else{

			}
		}
	}
	
	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