function check_form(f) {
		if(f.nombre.value == 0){
		alert("Dato obligatorio: NOMBRE. Solo admite letras y espacios");
		f.nombre.focus();
		return false;
		}
		if(f.apellidos.value == 0){
		alert("Dato obligatorio: APELLIDOS. Solo admite letras y espacios");
		f.apellidos.focus();
		return false;
		}
		if(f.paisN.value == 0){
		alert("Dato obligatorio: PAIS. Solo admite letras y espacios");
		f.paisN.focus();
		return false;
		}
		if(f.email.value.indexOf('@',0)==-1 || f.email.value.indexOf(';',0)!=-1
		
			|| f.email.value.indexOf(' ',0)!=-1 || f.email.value.indexOf('/',0)!=-1
		
			|| f.email.value.indexOf(';',0)!=-1 || f.email.value.indexOf('<',0)!=-1
		
			|| f.email.value.indexOf('>',0)!=-1 || f.email.value.indexOf('*',0)!=-1
		
			|| f.email.value.indexOf('|',0)!=-1 || f.email.value.indexOf('`',0)!=-1
		
			|| f.email.value.indexOf('&',0)!=-1 || f.email.value.indexOf('$',0)!=-1
		
			|| f.email.value.indexOf('!',0)!=-1 || f.email.value.indexOf('"',0)!=-1
		
			|| f.email.value.indexOf(':',0)!=-1) {
		
				alert("Dato obligatorio: email. El email tiene que tener un formato correcto");
				f.email.focus();
				return (false);
		  }
		  if(f.direccion.value == 0){
		  alert("Dato obligatorio: DIRECCION");
		  f.direccion.focus();
		  return false;
	  	  }
		  if(f.nif.value == 0){
		  alert("Dato obligatorio: NIF");
		  f.nif.focus();
		  return false;
	  	  }
		  if(f.telefono1.value == 0){
		  alert("Dato obligatorio: TELEFONO.");
		  f.telefono1.focus();
		  return false;
		  }	
		  if( f.provincia.value == "X") {
		  alert("Dato obligatorio: provincia");
		  f.provincia.value = '';
		  return false;
		  }
		  if (f.localidad.value == 0) {
		  alert("Dato obligatorio:localidad");
		  return false;
	 	  }
		
return (true); 
}

function check_formS(f) {
		if(f.sociedad.value == 0){
		alert("Dato obligatorio: SOCIEDAD.");
		f.sociedad.focus();
		return false;
		}
		if(f.cif.value == 0){
		alert("Dato obligatorio: CIF.");
		f.cif.focus();
		return false;
		}
		if(f.direccionS.value == 0){
		alert("Dato obligatorio: DIRECCION SOCIEDAD");
		f.direccionS.focus();
		return false;
		}
		if(f.cpS.value == 0){
		alert("Dato obligatorio: CODIGO POSTAL SOCIEDAD");
		f.cpS.focus();
		return false;
		}
		if(f.provinciaS.value == 0){
		alert("Dato obligatorio: PROVINCIA SOCIEDAD");
		f.provinciaS.focus();
		return false;
		}
		if(f.localidadS.value == 0){
		alert("Dato obligatorio: LOCALIDAD SOCIEDAD");
		f.localidadS.focus();
		return false;
		}
		if(f.nombre.value == 0){
		alert("Dato obligatorio: NOMBRE.");
		f.nombre.focus();
		return false;
		}
		if(f.apellidos.value == 0){
		alert("Dato obligatorio: APELLIDOS.");
		f.apellidos.focus();
		return false;
		}
		if(f.paisN.value == 0){
		alert("Dato obligatorio: PAIS. Solo admite letras y espacios");
		f.paisN.focus();
		return false;
		}
		if(f.email.value.indexOf('@',0)==-1 || f.email.value.indexOf(';',0)!=-1
		
			|| f.email.value.indexOf(' ',0)!=-1 || f.email.value.indexOf('/',0)!=-1
		
			|| f.email.value.indexOf(';',0)!=-1 || f.email.value.indexOf('<',0)!=-1
		
			|| f.email.value.indexOf('>',0)!=-1 || f.email.value.indexOf('*',0)!=-1
		
			|| f.email.value.indexOf('|',0)!=-1 || f.email.value.indexOf('`',0)!=-1
		
			|| f.email.value.indexOf('&',0)!=-1 || f.email.value.indexOf('$',0)!=-1
		
			|| f.email.value.indexOf('!',0)!=-1 || f.email.value.indexOf('"',0)!=-1
		
			|| f.email.value.indexOf(':',0)!=-1) {
		
				alert("Dato obligatorio: email. El email tiene que tener un formato correcto");
				f.email.focus();
				return (false);
		  }
		  if(f.direccion.value == 0){
		  alert("Dato obligatorio: DIRECCION");
		  f.direccion.focus();
		  return false;
	  	  }
		  if(f.nif.value == 0){
		  alert("Dato obligatorio: NIF");
		  f.nif.focus();
		  return false;
	  	  }
		  if(f.telefono3.value == 0){
		  alert("Dato obligatorio: TELEFONO.");
		  f.telefono1.focus();
		  return false;
		  }	
		  if( f.provincia1.value == "X") {
		  alert("Dato obligatorio: provincia");
		  f.provincia1.value = '';
		  return false;
		  }
		  if( f.localidad1.value == 0 ) {
		  alert("Dato obligatorio:localidad");
		  return false;
	 	  }
		
return (true); 
}

function check_name(f) {
		if( f.value.search('^[a-z A-Z αινσϊΑΙΝΣΪΡρ]+$') == -1 ) {
		alert("Dato obligatorio: Solo admite letras y espacios");
		f.value = '';
		return false;
		}
}
function check_correo(f) {
	if( f.value.toLowerCase().search('(^[a-z][a-z0-9\-_.]+[@][a-z0-9\-_.]+[.][a-z]+$)') == -1 ) {
	alert("Dato obligatorio: Formato de correo electronico incorrecto");
	f.value = '';
	return false;
	}
}
function check_entero(f) {
	if( f.value.search('[^0-9]') != -1 ) {
	alert("Dato obligatorio: Solo admite numeros");
	f.value = '';
	return false;
	}
}

function check_cp(f) {
    if (f.value.search('^([1-9]{2}|[0-9][1-9]|[1-9][0-9])[0-9]{3}$') == -1) {      
        alert("Dato obligatorio: formato incorrecto");
        f.value = '';
    	return false;
	} 
}




