
//---------- Validar el formulario de las personas --------
function ValidatorUsuarioReg (pForm) {

	
	if (pForm.login.value == "") {
		alert ("The login can't be empty.") ;
		pForm.login.focus() ;
		return (false) ;
	}
	if(isStringValid(pForm.login.value)!=1){
		alert ("The login can't contain invalid caracters.") ;
		pForm.login.focus() ;
		return (false);
	}
	if(isStringValidURL(pForm.password.value)!=1){
		alert ("The password can't contain invalid caracters.") ;
		pForm.password.focus() ;
		return (false);
	}
	if (pForm.password.value == "") {
		alert ("The password can't be empty.") ;
		pForm.password.focus() ;
		return (false) ;
	} else {
		if (pForm.password.value != pForm.passwordconf.value) {
			alert ("The two passwords do not match.") ;
			pForm.passwordconf.focus() ;
			return (false) ;
		}
	}
	if (pForm.first_name.value == "") {
		alert ("The first name can't be empty.") ;
		pForm.first_name.focus() ;
		return (false) ;
	}
	if (pForm.last_name.value == "") {
		alert ("The last name can't be empty.") ;
		pForm.last_name.focus() ;
		return (false) ;
	}
	if(isStringValidURL(pForm.organization.value)!=1){
		alert ("The organization can't contain invalid caracters.") ;
		pForm.organization.focus() ;
		return (false);
	}
	if(isStringValidURL(pForm.department.value)!=1){
		alert ("The department can't contain invalid caracters.") ;
		pForm.department.focus() ;
		return (false);
	}
	if(isStringValidURL(pForm.address.value)!=1){
		alert ("The address can't contain invalid caracters.") ;
		pForm.address.focus() ;
		return (false);
	}
	
	if (pForm.city.value == "") {
		alert ("The city can't be empty.") ;
		pForm.city.focus() ;
		return (false) ;
	}
	
	if(isStringValidURL(pForm.city.value)!=1){
		alert ("The city can't contain invalid caracters.") ;
		pForm.city.focus() ;
		return (false);
	}
	
	
	if(isStringValidURL(pForm.state_province.value)!=1){
		alert ("The state or province can't contain invalid caracters.") ;
		pForm.state_province.focus() ;
		return (false);
	}
	
	if (pForm.id_pais.options[pForm.id_pais.options.selectedIndex].value == -1) {
		alert ("Choose your country.") ;
		pForm.id_pais.focus() ;
		return (false) ;
	}	
		
	if (pForm.phone.value == "") {
		alert ("The phone can't be empty.") ;
		pForm.phone.focus() ;
		return (false) ;
	}
	if (!isPhoneNumber(pForm.phone.value)) {
			alert("The phone is not in the correct format.") ;
			pForm.phone.focus();
			return (false) ;
	}
	
	if (pForm.cell_phone.value!="" ) {
		if (!isPhoneNumber(pForm.cell_phone.value) ){
			alert("The cell phone is not in the correct format.") ;
			pForm.cell_phone.focus();
			return (false) ;
		}
	}
	
	if (!isPhoneNumber(pForm.fax.value) ){
			alert("The fax is not in the correct format.") ;
			pForm.fax.focus();
			return (false) ;
	}
	if (!isStringValidURL(pForm.url.value) ){
			alert("The url is not in the correct format.") ;
			pForm.url.focus();
			return (false) ;
	}
	if (pForm.email.value == "") {
		alert ("The email can't be empty.") ;
		pForm.email.focus() ;
		return (false) ;
	}
	if (!isEmail(pForm.email.value) ){
		alert("The e-mail address is not in the correct format.") ;
		pForm.email.focus();
		return (false) ;
	}
	
	if (!(pForm.checklegal.checked)) {
		alert ("Please accept the terms of the GENERAL TERMS OF USE AND ACCESS.") ;
		return (false);
	}
	
}
	



