// JavaScript Document
function createRequestObject(){
          var peticion;
          var browser = navigator.appName;
                if(browser == "Microsoft Internet Explorer"){
                      peticion = new ActiveXObject("Microsoft.XMLHTTP");
                }else{
                      peticion = new XMLHttpRequest();
   				}
  		  return peticion;
   		}
    
var http = new Array();
function ObtDatos(url, div){
         var act = new Date();
         http[act] = createRequestObject();
         http[act].open('get', url);
         http[act].onreadystatechange = function() {
											 if (http[act].readyState == 4) {
												   if (http[act].status == 200 || http[act].status == 304) {
														 var texto
														 texto = http[act].responseText;
														 if (texto != ''){
															 document.enlaces.Submit.disabled  = true;
															 }else{
															 document.enlaces.Submit.disabled  = false;
																 }
														 var DivDestino = document.getElementById(div);
														 DivDestino.innerHTML = texto;
													}
											 }
   										}
   		http[act].send(null);
}
    
function compUsuario(Tecla, seccion, tipo, div) {
Tecla = (Tecla) ? Tecla: window.event;
input = (Tecla.target) ? Tecla.target :
Tecla.srcElement;
      if (Tecla.type == "keyup") {
           if (input.value) {
                 ObtDatos("../../incl/verificar.php?info=" + input.value + "&seccion=" + seccion + "&tipo=" + tipo, div);
            }
       }
}
 function isChosen_one(select) {
    if (select.options[select.selectedIndex].value == -1) {
		alert('Debes seleccionar una categoria');
        return false;
    } else {
        return true;
    }
}
function send_frm (form){
	 if (isNotEmpty(form.nombre)) {
         if (isNotEmpty(form.url)) { 
			 if (isNotEmpty(form.descripcion)) {
				 if(maxCaract(form.descripcion,250)){
					if (isNotEmpty(form.email)) {
						if(isEmailAddr(form.email)){
							if(vHttp(form.url)){
							return true;
							 }
						}
					}
              }
          }
      }
            }
	return false;	
}
function send_frm2 (form){
	 if(isChosen_one(form.subcategoria)){
	   if (isNotEmpty(form.nombre)) {
          if (vHttp(form.url)) {
			 if (isNotEmpty(form.url)) {
				if (isNotEmpty(form.descripcion)) {
					 if(maxCaract(form.descripcion,250)){
						if(isEmailAddr(form.email)){
							if(isNotEmpty(form.email)){
								return true;
							}
					     }
					  }
                  }
               }
            }
         }
	  }
  return false;
}

function send_pres(form){
	if (isNotEmpty(form.nombre)) {
		if (isNotEmpty(form.url)) {
			return true;
		}
	}
	return false;
}
function send_minist(form){
	if (isNotEmpty(form.nombre)) {
		if (isNotEmpty(form.url)) {
			if(isChosen_one(form.persona_titulo)){
				if (isNotEmpty(form.persona_nombre)) {
					 if (isNotEmpty(form.correo_electronico)) {
						 if(isEmailAddr(form.correo_electronico)){
							return true;
						 }
					 }
				}
			}
		}
	}
	return false;
}
function send_desc(form){
	if (isNotEmpty(form.nombre)) {
		if (isNotEmpty(form.url)) {
			if(isNotEmpty(form.persona_titulo)){
				if (isNotEmpty(form.persona_nombre)) {
					 if (isNotEmpty(form.correo_electronico)) {
						 if(isEmailAddr(form.correo_electronico)){
							return true;
						 }
					 }
				}
			}
		}
	}
	return false;
}
function send_organo(form){
	if (isNotEmpty(form.nombre)) {
		if (isNotEmpty(form.url)) {
			if (isNotEmpty(form.presidente)) {
				if (isNotEmpty(form.primer_vicepresidente)) {
					if (isNotEmpty(form.segundo_vicepresidente)) {
						if (isNotEmpty(form.correo_electronico)) {
							if(isEmailAddr(form.correo_electronico)){
								return true;
							}
						}
					}
				}
			}
		}
	}
	return false;
}