/* AJAX Fun! */var ecnet_check_url = "ecnet_check.cfm?ecnet="; // The server-side script for checking ECNetsvar index_optionStatus_url = "lotto_check.cfm"; //"lotto_check.cfm"; // The server-side script for optionsvar isWorking = false;var temp_type;var temp_uid;var temp_divid;var xmlDocument;/* Stuff when form sends action. */function checkECNet() {	if (element('add_rooommate_text').value == undefined || element('add_rooommate_text').value == "") {		roommateError("Please enter the ECNet username of your desired roommate.");	} else {		ecnet = element('add_rooommate_text').value;		if (roommateCheckECNet(ecnet)) {			if (!isWorking && http) {				http.open("GET", ecnet_check_url + ecnet,true);				http.onreadystatechange = checkECNetResponse; http.send(null);			}		}	}	element('add_rooommate_text').value = "";}/* Stuff when a respond on the HTTPObject is recieved */function checkECNetResponse() {	if (http.readyState == 4) {    	if (http.responseText.indexOf('invalid') == -1) {			// Use the XML DOM to get the data			var xmlDocument = http.responseXML;			var status = xmlDocument.getElementsByTagName('status').item(0).firstChild.data;			var firstname = xmlDocument.getElementsByTagName('firstname').item(0).firstChild.data;			var lastname = xmlDocument.getElementsByTagName('lastname').item(0).firstChild.data;			var ecnet = xmlDocument.getElementsByTagName('ecnet_username').item(0).firstChild.data;			/* Check status.				0 = Student cleared				1 = Student has room				2 = Student doesn't exist in lotto			*/			if (status == 0) {				roommateAccept(firstname, lastname, ecnet);			} else if (status == 1) {				roommateError("This student already has a room.");			} else if (status == 2) {				roommateError("This student doesn't exist in your housing lotto.");			} else {				roommateError("Something else went wrong.");			}			isWorking = false;		} else {			roommateError("A system error occored. Blame Seg.");		}	}}/*	GET LOTTO OPTION STATUS*/function index_getOptionStatus(type,uid,divid) {	temp_type = type;	temp_uid = uid;	temp_divid = divid;	if (!isWorking && http) {		http.open("GET", index_optionStatus_url,true);		http.onreadystatechange = index_getOptionStatusResponse; http.send(null);//(divid,uid,type)	}}function index_getOptionStatusResponse(divid,uid,type) {	// Vars are in temp_*	if (http.readyState == 4) {    	if (http.responseText.indexOf('invalid') == -1) {			// Use the XML DOM to get the data				xmlDocument = http.responseXML;							// Loop out the entries in the XML and set the array variables			/*for (i = 0; i < xmlDocument.getElementsByTagName('lotto').length; i++) {				// Name of Lotto					element("tester_"+i).value = xmlDocument.getElementsByTagName('lotto').item(i).firstChild.data;				// Status of Lotto (1 = Approved; 0 = Disallowed)					element("id_status_"+i).value = xmlDocument.getElementsByTagName('lotto').item(i).attributes[0].value;				// ID Number of Lotto					element("uid_"+i).value = xmlDocument.getElementsByTagName('lotto').item(i).attributes[1].value;			}*/						index_displayOptions(temp_divid);			isWorking = false;					} else {			alert("A system error occored. Blame Seg.");		}	} else {		//element("tester_1").value = http.readyState;	}}// Don't touch.function getHTTPObject() {  var xmlhttp;  /*@cc_on  @if (@_jscript_version >= 5)    try {      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");    } catch (e) {      try {        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");      } catch (E) {        xmlhttp = false;      }    }  @else  xmlhttp = false;  @end @*/  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {    try {      xmlhttp = new XMLHttpRequest();    } catch (e) {      xmlhttp = false;    }  }  return xmlhttp;}var http = getHTTPObject(); // We create the HTTP Object