function validateUser() {
	var myForm=document.forms.frmUser;
	var myRegExp1 = /\s/;
	
	var fix_first_name = remove_XS_whitespace(myForm.first_name.value);
	var fix_last_name = remove_XS_whitespace(myForm.last_name.value);
	var fix_user_id = myForm.user_id.value;
	var fix_pass = myForm.pass.value;
	var fix_pass_copy = myForm.pass_copy.value;
	var fix_email = remove_XS_whitespace(myForm.email.value);
	var fix_captcha = "";

	if (myForm.captcha) {
		fix_captcha = myForm.captcha.value;
	}
	
	myForm.first_name.value = fix_first_name;
	myForm.last_name.value = fix_last_name;
	myForm.email.value = fix_email;
	
	//check first name
	if (fix_first_name == "") {
		alert("Please, enter your first name.");
		return false;
	}
	
	if (fix_first_name.length > 50) {
		alert("Please, enter a valid first name (maximum 50 characters).");
		return false;
	}
	
	//check last name
	if (fix_last_name == "") {
		alert("Please, enter your second name.");
		return false;
	}
	if (fix_last_name.length > 50) {
		alert("Please, enter a valid second name (maximum 50 characters).");
		return false;
	}

	//check user id
	if (fix_user_id == "") {
		alert("Please, enter the username.");
		return false;
	}
	if (fix_user_id.length < 5) {
		alert("Please, type a valid user ID (minimum 5 characters).");
		return false;
	}
	if (fix_user_id.length > 20) {
		alert("Please, type a valid user ID (maximum 20 characters).");
		return false;
	}
	var matchPos1 = fix_user_id.search(myRegExp1);
	if(matchPos1 != -1) {
		alert("Spaces are not admitted in User ID.");
		return false;
	}
	
	//check password
	if (fix_pass == "") {
		alert("Please, type the password .");
		return false;
	}
	if (fix_pass.length < 5) {
		alert("Please, type a valid password (minimum 5 characters).");
		return false;
	}
	if (fix_pass.length > 20) {
		alert("Please, type a valid password (maximum 20 characters).");
		return false;
	}
	var matchPos1 = fix_pass.search(myRegExp1);
	if(matchPos1 != -1) {
		alert("Spaces are not admitted in password.");
		return false;
	}

	//check retyped password
	if (fix_pass != fix_pass_copy) {
		alert("Please, re-type the password correctly.");
		return false;
	}
	
	//check captcha
	if (myForm.captcha) {
		if (fix_captcha == "") {
			alert("Please, type the text of the image.");
			return false;
		}	
	}
	
	//check email
	if (fix_email == "") {
		alert("Please, type your e-mail address.");
		return false;
	}
	if (fix_email.length > 50) {
		alert("Please, type a valid email address (maximum 50 characters).");
		return false;
	}
	return validateEmail(fix_email);
}

function goToAgreement() {
	if (validateUser()) {
		document.forms.frmUser.submit();
	}
}

function signUp() {
	document.forms.frmUser.submit();
} 

function modifySubmit() {
	var myForm=document.forms.frmUser;
	if (myForm.accept.checked) {
		myForm.Register.disabled =false;
	} else {
		myForm.Register.disabled =true;
	}
}
