function submitRegisterForm(alertUsernameLength,alertPasswordLength,alertPasswordMissmatch,alertSameUsername,alertUsernameChars,alertPasswordChars,alertSameName,alertSameEmail)
{
	//check that all the mandatory fields are filled
	if(checkForm('registerForm'))
	{
		var username = dojo.byId('reg_username').value;
		username = username.replace(/[^a-zA-Z0-9_]/g,"");
		
		var password = dojo.byId('reg_password1').value;
		password = password.replace(/[^a-zA-Z0-9_]/g,"");
		
		//check that the user name doesn't contain special characters
		if(username == dojo.byId('reg_username').value)
		{
			//check that the password doesn't contain special characters
			if(password == dojo.byId('reg_password1').value)
			{
				//check that the user name is at least 5 characters
				if(username.length > 4)
				{
					//check that the password is at least 8 characters
					if(password.length > 7)
					{
						//check that the passwords match
						if(password == dojo.byId('reg_password2').value)
						{
							var firstname = dojo.byId('reg_firstname').value;
							var lastname = dojo.byId('reg_lastname').value;
							var email = dojo.byId('reg_email').value;
							
							dojo.io.bind
							({
								url: "index.php?name=Register&method=checkSubmit&username="+username+"&firstname="+firstname+"&lastname="+lastname+"&email="+email+"&password="+password,
								method: "GET",
								mimetype: "text/plain",
								error: function (type, msg, event)
								{
									alert(msg.description); //ok
								},
								load: function(type, data, event)
								{
									if(data == 'success')
										dojo.byId('registerForm').submit();
									else if(data == 'error_username')
										alert(alertSameUsername); //ok
									else if(data == 'error_name')
										alert(alertSameName); //ok
									else if(data == 'error_email')
										alert(alertSameEmail); //ok
								}
							});
						}
						else
							alert(alertPasswordMissmatch); //ok
					}
					else
						alert(alertPasswordLength); //ok
				}
				else
					alert(alertUsernameLength); //ok
			}
			else
				alert(alertPasswordChars); //ok
		}
		else
			alert(alertUsernameChars); //ok
	}
}
