function dv(T){var M=0,S=1;for(;T;T=Math.floor(T/10))
S=(S+T%10*(9-M++%6))%11;return S?S-1:'k';}

function valida() {
	 	arro=0;
		punto=0;
		dato=0; 
		error=0;
		msg="";	
		if ((document.contacto.nombre == null) || (document.contacto.nombre.value=="")){
			msg= msg+"nombre \n";
			document.contacto.nombre.focus();
			dato++;
		}
		if ((document.contacto.destino.value==0) || (document.contacto.destino.value=="0")) {
			msg= msg+"Destinatario  \n";
			document.contacto.destino.focus();
			dato++;
		}
		
		if ((document.contacto.comentario.value==null) || (document.contacto.comentario.value=="")) {
			msg= msg+"comentario  \n";
			document.contacto.comentario.focus();
			dato++;
		}
		else {
			cad = document.contacto.email.value;
		    //alert("Email: " + cad);
			arro = cad.indexOf("@"); 
			punto = cad.indexOf(".");
			if ((cad.length>=8) && (arro>3) && (punto<(cad.length-2))){
				error=0;
			}
			else { error=1}
			if (error>0) {
				alert("Ingrese e-mail válido \n");
				document.contacto.email.focus();
			}
		}
	   if ((dato==0) && (error==0)){
			return true;}
	   else  {
			if (msg != ""){ alert ("Debe ingresar: \n" + msg);}
			return false;
		}
 }
/*VALIDA EL REGISTRO DE IUSUARIOS*/
function dv(T){var M=0,S=1;for(;T;T=Math.floor(T/10))
S=(S+T%10*(9-M++%6))%11;return S?S-1:'k';}

function validaRegistro() {
	 	arro=0;
		punto=0;
		dato=0; 
		error=0;
		msg="";	
		if ((document.registro.nombre == null) || (document.registro.nombre.value=="") ){
			msg= msg+"Nombre y Apellido \n";
			document.registro.nombre.focus();
			dato++;
		}
		
		if (document.registro.nombre.value.length<6 ){
			msg= msg+"El nombre es demasiado corto \n";
			document.registro.nombre.focus();
			dato++;
		}
		
		
		if ((document.registro.contrasena1 == null) || (document.registro.contrasena1.value=="")){
			msg= msg+"Contrasena \n";
			document.registro.contrasena1.focus();
			dato++;
		}
		if ((document.registro.contrasena2 == null) || (document.registro.contrasena2.value=="")){
			msg= msg+"Repetir contrasena \n";
			document.registro.contrasena2.focus();
			dato++;
		}
		
		else {
			cad = document.registro.email.value;
		    //alert("Email: " + cad);
			arro = cad.indexOf("@"); 
			punto = cad.indexOf(".");
			if ((cad.length>=8) && (arro>3) && (punto<(cad.length-2))){
				error=0;
			}
			else { error=1}
			if (error>0) {
				alert("Ingrese e-mail válido \n");
				document.registro.email.focus();
			}
		}
	   if ((dato==0) && (error==0)){
			return true;}
	   else  {
			if (msg != ""){ alert ("Debe ingresar: \n" + msg);}
			return false;
		}
 }

