// JavaScript Document

var xhr = false;
var xmlFile = "../_txt/endorsers.txt";

function loadText() {
	makeRequest(xmlFile);
	return false;
}

function makeRequest(url) {
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	}
	else {
		if (window.ActiveXObject) {
			try {
				xhr = new ActiveXObject("Microsoft.XMLHttp");
			}
			catch (e) {}
		}
	}
	if (xhr) {
		xhr.onreadystatechange = showContents;
		xhr.open("GET", url, true);
		xhr.send(null);
	}
	else {
		document.getElementById("endorserSection").innerHTML = "Sorry, there was an internal error loading this content";
	}
}

function showContents() {
	if (xhr.readyState == 4) {
		if (xhr.status == 200) {
		var outMsg = (xhr.responseXML && xhr.responseXML.contentType=="text/xml") ? xhr.responseXML.getElementsByTagName("choices")[0].textContent : xhr.responseText;
		}
		else {
			var outMsg = "There was a problem loading this content" + xhr.status;
		}
		document.getElementById("endorserSection").innerHTML = outMsg;
	}
}