// feiler.business limited
// All rights reserved!
// post@feiler.co.uk


	function checkNickname(sNickname){
		// Stuff to work out date (needed to make sure IE doesn't mess me about by caching the callbacks)
		var today = new Date();
		var iMinutes = today.getMinutes();
		var iSeconds = today.getSeconds();
		var iMilliseconds = today.getMilliseconds();
		// Make the URL
		var postURL = '/layout/checknickname.asp?now=' + iMinutes + iSeconds + iMilliseconds + '&n=' + sNickname
		if (window.XMLHttpRequest){
			// mozilla/firefox etc
			xmlhttp=new XMLHttpRequest();
			xmlhttp.open('GET',postURL,false);
			xmlhttp.send(null);
		}
		else if (window.ActiveXObject) {
			// internet explorer
			xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
			if (xmlhttp){
				xmlhttp.open('GET',postURL,false);
				xmlhttp.send();
			}
		}
		sReply = xmlhttp.responseText;
		
		if (sReply == "##notfound##") {
			//window.alert('this is ok');
			document.getElementById('usernamefree').style.display="block";
			document.getElementById('usernametaken').style.display="none";
		} else {
			//window.alert('this is taken');
			document.getElementById('usernamefree').style.display="none";
			document.getElementById('usernametaken').style.display="block";
		}
	}




	function US_checkMail() {
		var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
		var returnval=emailfilter.test(document.getElementById('email').value)
		if (returnval==false){
			document.getElementById('valid').src = '../layout/t/x.gif';
		}
		else {
			document.getElementById('valid').src = '../layout/t/valid.gif'
		}
	}
	
	function US_checkConfirmMail() {
		if (document.getElementById('email').value == document.getElementById('confirmemail').value) {
			document.getElementById('confirmvalid').src = '../layout/t/valid.gif';
		}
		else {
			document.getElementById('confirmvalid').src = '../layout/t/x.gif';
		}
	}
	
	function US_checkConfirmPassword() {
		if (document.getElementById('password').value == document.getElementById('confirmpassword').value) {
			document.getElementById('passwordvalid').src = '../layout/t/valid.gif';
		}
		else {
			document.getElementById('passwordvalid').src = '../layout/t/x.gif';
		}
	}
	
	function US_callOtherLayer() {
		if ((document.getElementById('hearfrompuffta').value == "Other...") ^ (document.getElementById('hearfrompuffta').value == "")) {
			document.getElementById('otherbox').style.display="block";
		}
		else {
			document.getElementById('otherbox').style.display="none";
		}
	}
	
	function US_toggleBackgroundColor(currentdiv) {
		if (currentdiv != "join1")  { document.getElementById('join1').style.backgroundColor='' }
		if (currentdiv != "join2")  { document.getElementById('join2').style.backgroundColor='' }
		if (currentdiv != "join3")  { document.getElementById('join3').style.backgroundColor='' }
		if (currentdiv != "join4")  { document.getElementById('join4').style.backgroundColor='' }
		if (currentdiv != "join5")  { document.getElementById('join5').style.backgroundColor='' }
		if (currentdiv != "join6")  { document.getElementById('join6').style.backgroundColor='' }
		document.getElementById(currentdiv).style.backgroundColor='#E9EFFA';
	}