function header_stats_joiner() {

	var xml_http = get_xml_http();
	var in_remote_call = false;
	var lastText = false;

	initialise_header_stats_joiner();

	function initialise_header_stats_joiner() {
		update_div_from_remote();
	}

	function schedule_update() {
		setTimeout(function(){update_div_from_remote();}, 5000);
	}

	function update_div_from_remote() {

		if (!xml_http) return true;

		if (!in_remote_call) {

			in_remote_call = true;

			if (xml_http.readyState != 0)
				xml_http.abort();

			// We have to change the URL to stop IE caching
			xml_http.open("GET", "header_stats_server.php?JS=" + new Date().getTime(), true);

			xml_http.onreadystatechange = function() {
				if (xml_http.readyState == 4 && xml_http.responseText) {
					eval(xml_http.responseText);
					in_remote_call = false;
				}
			}

			xml_http.send(null);
		}

		schedule_update();
		return true;
	}

	function update_div_from_local(div_id, text) {

		if (lastText == text) return;

		var span = document.createElement("SPAN");
		span.innerHTML = text;

		var div = document.getElementById(div_id);
		while (div.childNodes.length > 0)
			div.removeChild(div.childNodes[0]);
		div.appendChild(span);

		lastText = text;
	}

	function get_xml_http() {
	
		var xml = null;
	
		if (!xml) try { xml = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {}
		if (!xml) try { xml = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}
		if (!xml) try { xml = new XMLHttpRequest(); } catch(e) {}
	
		return xml;
	}
}
