
	var aAjaxIntervals = new Array(3);
	aAjaxIntervals[0] = null; // Dashboard..
	aAjaxIntervals[1] = null; // Traffic Sources..
	aAjaxIntervals[2] = null; // Views..
	
	var sPostCallback = "";
	
	/* The new and improved method of executing ajax requests. */
	function jExecuteAjaxRequest(sRequestURL, oInjectionElement, sLoadingHTML, sRequestVars) {
		var oAjaxRequest = jInitAjax(); // Create a new request..
		
		oAjaxRequest.onreadystatechange = function() {
			if (oInjectionElement != null && oAjaxRequest.readyState == 4) {
				oInjectionElement.innerHTML = oAjaxRequest.responseText; // Update the content..
			}
			
			if (sPostCallback != "") {
				document.getElementById("AjaxProcessingDisplay").style.display = "none";
				sPostCallback = "";
			}
		}
		
		if (sLoadingHTML != null) oInjectionElement.innerHTML = sLoadingHTML;
		
		oAjaxRequest.open("POST", sRequestURL, true); // Avoid page cache..
		oAjaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		oAjaxRequest.send("Hash=" + Math.random() + ((sRequestVars != null) ? sRequestVars : "")); // Send the request..
	}
	
	/* The new and improved method of executing ajax requests. */
	function jExecuteAjaxProcessingRequest(sRequestURL, sRequestVars, sCallbackIndex) {
		var oAjaxRequest = jInitAjax(); // Create a new request..
		sPostCallback = sCallbackIndex;
		
		oAjaxRequest.onreadystatechange = function() {
			if (sPostCallback != "") {
				setTimeout("jPostCallback();", 1000);
			}
		}
		
		document.getElementById("AjaxProcessingDisplay").style.display = "";
		
		oAjaxRequest.open("POST", sRequestURL, true); // Avoid page cache..
		oAjaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		oAjaxRequest.send("Hash=" + Math.random() + ((sRequestVars != null) ? sRequestVars : "")); // Send the request..
	}
	
	function jCancelAjaxRequest() {
		document.getElementById("AJAXInjectionContainer").style.display = "none";
	}
	
	function jRestartAjaxInterval(iIntervalIndex) {
		if (aAjaxIntervals[0] != null) clearInterval(aAjaxIntervals[iDashboardTimeout]);
		
		var sRequestURL = "";
		var iTime = 60000;
		
		switch (iIntervalIndex) {
		case 0:
			sRequestURL = "jExecuteAjaxRequest('./ajax/dashboard.ajax.php', document.getElementById('DashboardInjection'), null);";
			iTime = 60000;
			break;
		case 1:
			sRequestURL = "jExecuteAjaxRequest('./ajax/traffic-sources.ajax.php', document.getElementById('TrafficSourcesInjection'), null);";
			iTime = 60000;
			break;
		case 2:
			sRequestURL = "jExecuteAjaxRequest('./ajax/views.ajax.php', document.getElementById('VisitorsInjection'), null, '&IsAutomated=Y');";
			iTime = 60000;
			break;
		}
		
		this.aAjaxIntervals[iIntervalIndex] = setInterval(sRequestURL, iTime);
	}
	
	/* Initializes a new ajax object. */
	function jInitAjax() {
		var oAjaxRequest;
		
		try {
			oAjaxRequest = new XMLHttpRequest(); // Opera, Firefox, Safari..
		} catch (e) {
			try {
				oAjaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer..
			} catch (e) {
				try {
					oAjaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); // Internet Explorer..
				} catch (e) {
					return false;
				}
			}
		}
		
		return oAjaxRequest;
	}
	
