// #######################################
function xml_request(url) {

	req = xml_http_request_object();
	req.open("GET",url,false);
	req.send(null);

	return req;

}


// #######################################
function checkName(input, iUserID) {
	message = document.getElementById('nameCheckFailed');
	btnSubmit = document.getElementById('btnSubmitUser');

	response = xml_request("xml/username_exist.asp?q=" + input + "&uid=" + iUserID).responseText

	if (response == '1') {
		message.className = 'error';
		btnSubmit.disabled = true;
	}
	else {
		message.className = 'hidden';
		btnSubmit.disabled = false;
	}
}

// http://www.xmlhttprequest.net/forum/viewtopic.php?p=9#9

// #######################################
function xml_http_request_object() {
	try {
		req = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e) {
		try {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (E) {
			req = false;
		}
	}

	if (!req && typeof XMLHttpRequest!='undefined') {
		req = new XMLHttpRequest();
	}

	return req;
}


function gebid(sID) {
	return document.getElementById(sID);
}
