var getRarsNextAction = "";

function getRarsRequest() {
	httpObject = getHTTPObject();
	if (httpObject != null) {
		urlString = "xml/getrars.php";
		httpObject.open("GET",urlString, true);
		httpObject.onreadystatechange = getRarsResponse;
		httpObject.send(null);
	}
}

function getRarsResponse() {
	if(httpObject.readyState == 4) {
		//show the results and format the page for another add
		try { // Internet Explorer
			xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.async = "false";
			xmlDoc.loadXML(httpObject.responseText);
		} catch (e) {
			try { //Firefox Mozilla etc
				parser = new DOMParser();
				xmlDoc = parser.parseFromString(httpObject.responseText,"text/xml");
			} catch (e) {
				alert(e.message)
			}
		}
		rars = xmlDoc.getElementsByTagName('rar');
		if (getRarsNextAction == "newPlayerPopup") {
			getRarsNextAction == "";
			rarArray = new Array(rars.length);
			for (a = 0; a < rars.length; a++) {
				rar = rars[a];
				rarArray[a] = new Array(2);
				rarArray[a][0] = rar.getAttribute("id");
				rarArray[a][1] = rar.getAttribute("name");
			}
			newPlayerPopup2(rarArray);
		} else if (getRarsNextAction == "editPlayerPopup") {
			getRarsNextAction == "";
			rarArray = new Array(rars.length);
			for (a = 0; a < rars.length; a++) {
				rar = rars[a];
				rarArray[a] = new Array(2);
				rarArray[a][0] = rar.getAttribute("id");
				rarArray[a][1] = rar.getAttribute("name");
			}
			editPlayerPopup2(rarArray);
		}
	}
}

