function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2)
		{
			alert(alerttxt);
			return false;
		}
		else
		{
			return true;
		}
	}
}

function validate_text(field,alerttxt,long)
{
	with (field)
	{
		if (field.value.length  < long)
		{
			alert(alerttxt);
			return false;
		}
		else
		{
			return true;
		}
	}
}
function validate_number(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }


function validar_registro(thisform)
{
	with (thisform)
	{
		if (validate_text(apellido,"El Apellido no puede estar vacio",1)==false)
		{
			apellido.focus();
			return false;
		}
		if (validate_text(nombre,"El Nombre no puede estar vacio",1)==false)
		{
			nombre.focus();
			return false;
		}
		if (validate_text(nacimiento_dia,"El dia de nacimiento no puede estar vacio",1)==false)
		{
			nacimiento_dia.focus();
			return false;
		}
		if (validate_text(nacimiento_mes,"El mes de nacimiento no puede estar vacio",1)==false)
		{
			nacimiento_mes.focus();
			return false;
		}
		if (validate_text(nacimiento_anio,"El aņo de nacimiento no puede estar vacio",1)==false)
		{
			nacimiento_anio.focus();
			return false;
		}
		if (validate_text(documento,"El Tipo & Numero de Documento no puede estar vacio",1)==false)
		{
			documento.focus();
			return false;
		}
		if (validate_text(dom_calle,"El domicilio no puede estar vacio",1)==false)
		{
			dom_calle.focus();
			return false;
		}
		if (validate_text(dom_numero,"El domicilio no puede estar vacio",1)==false)
		{
			dom_numero.focus();
			return false;
		}
		if (validate_text(dom_localidad,"La localidad no puede estar vacia",1)==false)
		{
			dom_localidad.focus();
			return false;
		}
		if (validate_email(mail_1,"Ingrese una direccion de correo valida",1)==false)
		{
			mail_1.focus();
			return false;
		}
	}
	return true;
}