var xmlHttp;

function createXMLHttpRequest(){
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
}

function startResponse(myaction,myid) {
	var sChar = document.getElementById("char1"+myid).value;
	var sSortOrder = document.getElementById("orderby").value;
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.open('GET', '../ajax/architect_dropdown.asp?char=' + sChar + '&orderby=' + sSortOrder + '&myaction=' + myaction + '&myid=' + myid, true);
	xmlHttp.send(null);
}

function startResponse2(myaction) {
	var iArch = document.getElementById("archs").value;
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.open('GET', '../ajax/architect_dropdown.asp?myaction=' + myaction + '&archs=' + iArch, true);
	xmlHttp.send(null);
}

function handleStateChange() {
	if(xmlHttp.readyState == 4) {
		if(xmlHttp.status == 200) {
			var response = xmlHttp.responseText;
			var update = new Array();
			if(response.indexOf('|' != -1)) {
				update = response.split('|');
				document.getElementById(update[0]).innerHTML = update[1];
			}
		}
	}
}
