	function valida(form)
	{
		status="";
		control="";				
		
		if (trim(form.filefoto1.value) != "")
		{
			var n,aux,aux2;			
			n=form.filefoto1.value.length;
			aux=form.filefoto1.value.substring(n-3,n);
			if ((aux.toLowerCase()!='jpg')&&(aux.toLowerCase()!='jpe')&&(aux.toLowerCase()!='gif')&&(aux.toLowerCase()!='png'))
			{								
				control="007";
			}				
		}		
		
		if (trim(form.estciv.value) == 0)
			control=form.estciv;			
		if (trim(form.gen.value) == 0)
			control=form.gen;
		bandera=0;	
		
		if (trim(form.dia.value) == 0)
			control=form.dia;
		if (trim(form.mes.value) == 0)
			control=form.mes;		
		if (trim(form.anio.value) == 0)
			control=form.anio;
		
		if (trim(form.ape.value) == "")
			control=form.ape;
		if (trim(form.nom.value) == "")
			control=form.nom;
		if (trim(form.ciu.value) == "")
			control=form.ciu;
		if (trim(form.provincia.value) == 0)
			control=form.provincia;
		if (trim(form.pais.value) == 0)
			control=form.pais;
		if (trim(form.pas2.value) == "")
			control=form.pas2;
		if (trim(form.pas.value) == "")
			control=form.pas;
		if (trim(form.ema.value) == "")
			control=form.ema;
		if (trim(form.cod.value) == "")
			control=form.cod;
			
		if (bandera == 1)
		{
			alert("El campo fecha de nacimiento tiene un error...");
			return false;
		} 					
		
		if ( form.pas2.value!=form.pas.value )
		{
			alert("ERROR: Confirme el password...");		
			return false;
		} 
											
					
					
		if ((control != "")||(control == "007"))
		{
			if (control == "007")
				alert('El formato de la imagen es incorrecto… No se admite la extencion .'+aux.toLowerCase());
			else {
				alert("Los campos * son obligatorios...");
			status = "Este campo no puede estar en blanco";			
			control.focus();
			}
			return false;
		}		
		
			
		// VALIDAMOS LA DIRECCION DE CORREO SI SE HA INGRESADO ALGUNA
		email1=formulario.ema.value;
		if (trim(email1) != "")
		{
			if ((email1.indexOf("@") == -1) || (email1.indexOf(".") == -1) || (email1.indexOf(" ") != -1))
			{
	    		alert('Debes escribir una dirección de e-mail válida');
				staus = 'La dirección e-mail no es válida'
				formulario.ema.focus();
	  			formulario.ema.select();
		  		return false;
	 		}
		}
		
	}
	
	function trim(s)
	{
  		while (s.substring(0,1) == ' ')
		{
    		s = s.substring(1,s.length);
  		}
  		while (s.substring(s.length-1,s.length) == ' ')
		{
    		s = s.substring(0,s.length-1);
  		}
  		return s;
	}
	
	function confirmar( mensaje, destino)
	{
		if (confirm(mensaje))
		{
			document.location = destino;
		}
	}
	
	function tecla(e)
	{						
		if ( ((e.keyCode>=48) && (e.keyCode<=57)) || ((e.keyCode>=65) && (e.keyCode<=90)) || ((e.keyCode>=97) && (e.keyCode<=122)) )
			return true;
		else
			return false;		
	}
	
	function fecha(e)
	{								
		if ( ((e.keyCode>=48) && (e.keyCode<=57)) )
			return true;
		else
			return false;		
	}
	
