function GL_checkRegistration() {
	var form = document.forms['registrationForm'];

	if ( !form.editUserId ) {
		var userId = form.userId.value;
	  	if ((userId.length < 3) || (userId.length > 30)) {		
			alert('The username should be 3 to 30 letters.');
			return;
		}
	}
	
	if ( form.password ) {
		var password = form.password.value;
		if ( !form.editUserId ) {
		    if ((password.length < 3) || (password.length > 30)) {
	    	   alert('The password should be 3 to 30 letters.');
		       return;
	    	}
	    }
    }
//   	var illegalChars = /[\W_]/; // allow only letters and numbers    
//    if (illegalChars.test(password)) {
//       return;
//    }   
//    if (!((strng.search(/(a-z)+/))
//    	&& (strng.search(/(A-Z)+/))
//		&& (strng.search(/(0-9)+/)))) {
//  	}	
	if ( form.password2 ) {
		var password2 = form.password2.value;
		if ( !form.editUserId ) {
		    if ((password2.length < 3) || (password2.length > 30)) {
	    	   alert('The repeat password should be 3 to 30 letters.');
	      		return;
	    	}
	    }
	}
    
    if ( form.firstName ) {
	    var firstName = form.firstName.value;
	    if ( firstName.length < 1 ) {
	    	alert('Please enter the first name');
	    	return;
	    }
    }

	if ( form.lastName ) {
	    var lastName = form.lastName.value;
	    if ( lastName.length < 1 ) {
	    	alert('Please enter the last name');
	    	return;
	    }
	}

    //if ( form.phone ) {
	//    var phone = form.phone.value;
	//    if ( phone && phone.length > 0 ) {
	//		var stripped = phone.replace(/[\(\)\.\-\ ]/g, '');
	//		if (isNaN(parseInt(stripped))) {
	//			alert('The phone number contains illegal characters.');
	//			return;
	//		}
	//		if ( ! ( (stripped.length == 10) || (stripped.length == 7)) ) {
	//			alert('The phone number is the wrong length.');
	//			return;
	//		}
	//	} 
	//}   
	
	if ( form.email ) {
	    var email = form.email.value;
		var emailFilter=/^.+@.+\..{2,3}$/;
		if (!(emailFilter.test(email))) { 
			alert('Please enter a valid email address.');
			return;
		}
		var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
		if (email.match(illegalChars)) {
	   		alert('The email address contains illegal characters.');
	   		return;
		}
	}
	
	form.submit();
}

