//	Copyright (c) 2008
//	CMX-Networks LLC.
//	http://cmx-networks.net
//
//	You need to edit the variable below and set it to the base directory of this file (do NOT include a '/' at the end!)

var baseURL = "modules";

// Don't edit below this line unless you know what you're doing
var obj;
function getXMLHttpObject() {
	obj = null;
	if (window.ActiveXObject) {
  		obj = new ActiveXObject("Microsoft.XMLHTTP");
 	} else if (window.XMLHttpRequest) {
  		obj = new XMLHttpRequest();
	}
	return obj;
}

function checkName() {
	var name = document.getElementById("username").value;
	if (name.length==0) {
		document.getElementById("nameStatus").innerHTML = "";
	} else {
		document.getElementById("nameStatus").innerHTML = "Checking, please wait...";
		obj = getXMLHttpObject();
		if (obj==null) {
			alert("AJAX is needed for this function which your browser doesn't support");
		} else {
			var url = baseURL+"/check.php?name="+name+"&sid="+Math.random();
			obj.onreadystatechange = updateStatus;
			obj.open("GET",url,true);
			obj.send(null);
		}
	}
}
function updateStatus() {
	if (obj.readyState==4) {
			document.getElementById("nameStatus").innerHTML = obj.responseText;
	}
}
