							
	function submitSignup() {
	
		username = document.getElementById("name").value;
		email = document.getElementById("email").value;
		reemail = document.getElementById("reemail").value;
		password = document.getElementById("password2").value;
		repassword = document.getElementById("repassword2").value;
		if (username.length < 4 || !alphanumeric(username)) alert("Error: Username must be between 4 and 15 alphanumeric characters.");
		else if (!CheckEmail(email)) alert("Error: The e-mail address "+ email +" is not valid.");
		else if (email != reemail) alert("Error: You didn't re-enter your e-mail address correctly!");
		else if (password.length < 4 || !alphanumeric(password)) alert("Error: Password must be between 4 and 15 alphanumeric characters.");
		else if (password != repassword) alert("Error: You didn't re-enter your password correctly!");
		else document.getElementById("subform").submit();
								
	}
									
	function alphanumeric(alphane) {
	
		var numaric = alphane;
		for(var j=0; j<numaric.length; j++) {
			var alphaa = numaric.charAt(j);
			var hh = alphaa.charCodeAt(0);
			if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123)) { }
			else	{
			 return false;
			}
		}
		return true;
		
	}
							
	function CheckEmail(s_email) {
	
		if((s_email.length < 6) ||
		(s_email.indexOf('@',0) < 1) ||
		(s_email.lastIndexOf('@') != s_email.indexOf('@',0)) ||
		(s_email.lastIndexOf('@') > (s_email.length - 5)) ||
		(s_email.lastIndexOf('.') > (s_email.length - 3)) ||
		(s_email.lastIndexOf('.') < (s_email.length - 5)) ||
		(s_email.indexOf('..',0) > -1) ||
		(s_email.indexOf('@.',0) > -1) ||
		(s_email.indexOf('.@',0) > -1) ||
		(s_email.indexOf(',',0) > -1)) {
			return false;
		}
		return true;
		
	}			
	
	function detectSpace(e) {
	
		if (window.event && window.event.keyCode == 32) {
			submitSignup();
			return;
		}
		
		var unicode=e.keyCode? e.keyCode : e.charCode
		if (unicode==32)
			submitSignup();
			
	}
							
	function detectReturn(e) {
	
		if (window.event && window.event.keyCode == 13) {
			submitSignup();
			return;
		}
		
		var unicode=e.keyCode? e.keyCode : e.charCode
		if (unicode==13)
			submitSignup();
			
	}
