	///////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////
	/////// Copyright © ChessCorner.net 2004 ////////////////////
	/////// Reproduction strictly forbidden ////////////////////
	////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////
	
	function validEmail(email) {
			invalidChars = " /:,;"
	
			if (email == "") {
				return false
			}
			for (i=0; i<invalidChars.length; i++) {
				badChar = invalidChars.charAt(i)
				if (email.indexOf(badChar,0) > -1) {
					return false
				}
			}
			atPos = email.indexOf("@",1)
			if (atPos == -1) {
				return false
			}
			if (email.indexOf("@",atPos+1) > -1) {
				return false
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {
				return false
			}
			if (periodPos+3 > email.length)	{
				return false
			}
			return true
		}
		
		function validNick(txtNick) {
			invalidChars = " /:,;@<>.!£$%^&*()=+{}[]~#|\"'"
	
			if (txtNick == "") {
				return false
			}
			for (i=0; i<invalidChars.length; i++) {
				badChar = invalidChars.charAt(i)
				if (txtNick.indexOf(badChar,0) > -1) {
					return false
				}
			}
			return true
		}
		
		function validFirstName(txtFirstName) {
			invalidChars = " /:,;@<>.!£$%^&*()=+{}[]~#|\"'"
	
			for (i=0; i<invalidChars.length; i++) {
				badChar = invalidChars.charAt(i)
				if (txtFirstName.indexOf(badChar,0) > -1) {
					return false
				}
			}
			return true
		}
		
		function validLastName(txtLastName) {
			invalidChars = " /:,;@<>.!£$%^&*()=+{}[]~#|\""
	
			for (i=0; i<invalidChars.length; i++) {
				badChar = invalidChars.charAt(i)
				if (txtLastName.indexOf(badChar,0) > -1) {
					return false
				}
			}
			return true
		}
		
		
		
	
		function validateForm(theform)
		{
			
			if (theform.agecheck.checked != true)
			{
				alert('If you are aged 13 or over please tick the box at the bottom of this form. Otherwise please come back when you are 13. In the meantime, please visit www.chesscorner.com where you can prepare to come back as a chess tiger!');
				return(false);
			}
			
			
			if (theform.pwdPassword.value == "" || document.userdata.pwdPassword.value != document.userdata.pwdPassword2.value)
			{
			alert('Passwords do not match!');
			theform.pwdPassword2.focus();
				return(false);
			}
			
			if (theform.email2.value == "" || document.userdata.email.value != document.userdata.email2.value)
			{
			alert('Emails do not match!');
			theform.email2.focus();
				return(false);
			}
				
				
			if (theform.cidade.value == 'country')
			{
			alert('Select your country');
			theform.cidade.focus();
				return(false);
			}
			
			
			if (!validNick(theform.txtNick.value ))
			{
			alert('Please enter a valid nickname without extra characters');
			theform.txtNick.focus();
				return(false);
			}
			
			if (!validFirstName(theform.txtFirstName.value ))
			{
			alert('Please enter a valid first name');
			theform.txtFirstName.focus();
				return(false);
			}
			
			if (!validLastName(theform.txtLastName.value ))
			{
			alert('Please enter a valid last name');
			theform.txtLastName.focus();
				return(false);
			}
			
			
			
			if (!validEmail(theform.email.value ))
			{
				alert('Please enter a valid email');
				theform.email.focus();
				return(false);
			}
					
				return(true);
			
				
		}
		
