var name_invalid = true;
/* var copyright_invalid = true; */

function check(nobj, cobj) {
	try {
		check_http = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
	} catch (e) {
		alert("Your browser doesn't support AJAX");
	}
	check_http.onreadystatechange = checktrig;
	check_http.open("GET", "/upload.php?request=test&name=" + nobj.value + "&copyright=" + cobj.value);
	check_http.send(null);
}

function checktrig() {
	if ((check_http.readyState == 4) && (check_http.status == 200)) {
		if (check_http.responseText.indexOf('|acc:name|') != -1){
			document.getElementById('name').style.border='1px solid #cccfff';
			name_invalid = false;
			document.getElementById('uploadform').style.visibility='hidden';document.getElementById('uploadform').style.position='absolute'; document.getElementById('uploading').style.visibility='visible';
			AIM.submit(document.forms[0], {'onStart' : startCallback, 'onComplete' : completeCallback});
			document.forms[0].submit();
		} else if (check_http.responseText.indexOf('|rej:name|') != -1) {
			document.getElementById('name').style.border='2px solid #FF0000';
			name_invalid = true;
			alert("Please enter between 2 and 30 characters. Do not start or end with a space character.");
		}
	}
}