// JavaScript Document
function activar(F){
 if(F.tipo.value == 0){
  F.nombre.disabled = true;
  F.apellido.disabled = true;
  F.ocupacion.disabled = true;
  F.dia.disabled = true;
  F.mes.disabled = true;
  F.anno.disabled = true;
  F.empresa.disabled = true;
  F.rubro.disabled = true;	 
 }
 else if(F.tipo.value == "Persona Natural"){
  F.nombre.disabled=!F.nombre.disabled
  F.apellido.disabled=!F.apellido.disabled
  F.ocupacion.disabled=!F.ocupacion.disabled
  F.dia.disabled=!F.dia.disabled
  F.mes.disabled=!F.mes.disabled
  F.anno.disabled=!F.anno.disabled

  F.empresa.disabled = true;
  F.rubro.disabled = true;
  
  F.nombre.focus();
 }
 else if(F.tipo.value == "Empresa"){
	 
  F.empresa.disabled=!F.empresa.disabled
  F.rubro.disabled=!F.rubro.disabled
  
  F.nombre.disabled = true;
  F.apellido.disabled = true;
  F.ocupacion.disabled = true;
  F.dia.disabled = true;
  F.mes.disabled = true;
  F.anno.disabled = true;

  F.empresa.focus();
 }
}

/*function vacio(q) {
	for ( i = 0; i < q.length; i++ ) {
		if ( q.charAt(i) != " " ) {
		return true;
		}
	}
	return false;
}

function validar(F){
	if(F.tipo.value==0)
	{  alert("Elija el tipo de Inscripcion.");
	   F.tipo.focus();
	   return false;
	}
	if(F.tipo.value=="Persona Natural")
	{
	  if(vacio(F.nombre.value) == false){
	   alert("Ingrese su NOMBRE.");
	   F.nombre.focus();
	   return false;
	  }
	  if(vacio(F.apellido.value) == false){
	   alert("Ingrese su APELLIDO.");
	   F.apellido.focus();
	   return false;
	  }
	  if(F.ocupacion.value==0){
	   alert("Elija su tipo de Ocupacion.");
	   F.ocupacion.focus();
	   return false;
	  }
	  if(F.dia.value==0){
	   alert("Elija su Dia de Nacimiento.");
	   F.dia.focus();
	   return false;
	  }
	  if(F.mes.value==0){
	   alert("Elija su Mes de Nacimiento.");
	   F.mes.focus();
	   return false;
	  }
	  if(F.anno.value==0){
	   alert("Elija su Anno de Nacimiento.");
	   F.anno.focus();
	   return false;
	  }
	}
	if(F.tipo.value=="Empresa")
	{
	  if(vacio(F.empresa.value) == false){
	   alert("Ingrese el Nombre de su Empresa.");
	   F.empresa.focus();
	   return false;
	  }
	  if(vacio(F.rubro.value) == false){
	   alert("Ingrese el rubro de su Empresa.");
	   F.rubro.focus();
	   return false;
	  }
	}
	if(F.nro.value=="")
	{  alert("Ingrese su Nro de Identificacion.");
	F.nro.focus();
	return false;
	}
	if(vacio(F.email.value) == false){
	 alert("Ingrese su EMAIL.");
	 F.email.focus();
	 return false;
	}
	var er_email = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
	if(!er_email.test(F.email.value)) {
	 alert("Contenido del campo E-MAIL no Valido.")
	 F.email.focus();
	 return false;
	}
	if(F.pais.value==0)
	{  alert("Elija su PAIS de origen.");
	F.pais.focus();
	return false;
	}
	if(vacio(F.ciudad.value) == false){
	 alert("Ingrese su CIUDAD.");
	 F.ciudad.focus();
	 return false;
	}
	if(vacio(F.direccion.value) == false){
	 alert("Ingrese su DIRECCION.");
	 F.direccion.focus();
	 return false;
	}
	if(vacio(F.fijo.value) == false){
	 alert("Ingrese su Nro de Telefono Fijo.");
	 F.fijo.focus();
	 return false;
	}
	if (vacio(F.uword.value) == false){
	  alert("Ingrese el CODIGO visualizado.");
	  F.uword.focus();
	  return false;
	 }
	 else{
		 var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ\" + \"abcdefghijklmnñopqrstuvwxyzáéíóú\"";
		 var checkStr = form1.name.value;
		 var allValid = true;
		 var uword = hex_md5(document.getElementById('uword').value);

		 for (i = 0; i < checkStr.length; i++) {
			  ch = checkStr.charAt(i);
			  for (j = 0; j < checkOK.length; j++)
				  if (ch == checkOK.charAt(j))
					  break;
				  if (j == checkOK.length) {
					  allValid = false;
					  break;}
		 }

		 if (!allValid) {
			  alert("inserte el nombre");
			  form1.name.focus();
			  return false;
		 }

		 if (uword==cword[anum-1]) {
			  return true;}
		 else {
			 alert("Codigo de imagen INCORRECTO, si no logra ver la imagen presione la tecla F5");
			 document.getElementById('uword').focus();
			 return false;}
	  }

	return true;
} */

function solo_num(evento){
// Algunos caracteres: backspace = 8, enter = 13, '0' = 48, '9' = 57 '-' = 45
  var nav4 = window.Event ? true : false;
  var key = nav4 ? evento.which : evento.keyCode;
  return (key <= 13 || (key >= 48 && key <= 57) || key == 45);
}
