// JavaScript Document

function lookup(T12,page) {
		if(T12.length == 0) {
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			$.post(page, {queryString: ""+T12+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} // lookup
	
function fill(thisValue) {
		$('#T12').val(thisValue);
		setTimeout("$('#suggestions').hide();", 300);
}

//carga natural
function cargar_natural(Page){var contenedorVal;
	for (i=0;i<document.form1.Ra1.length;i++){ 
       if (document.form1.Ra1[i].checked) 
          break; 
    }
	idusua = document.form1.Ra1[i].value;
	indice  = document.form1.Se5.selectedIndex;
	id = document.form1.Se5.options[indice].value;
	nu = document.form1.T1.value;
	contenedorVal=document.getElementById('connatural');
	ajax=objetoAjax();	ajax.open("POST", Page, true);	
	ajax.onreadystatechange=function()
	{ if (ajax.readyState==4){contenedorVal.innerHTML=ajax.responseText;}}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("id="+id+"&nu="+nu+"&idusua="+idusua);
}

//cargar natural
function cargar_juridico(Page){var contenedorVal;
	for (i=0;i<document.form1.Ra1.length;i++){ 
       if (document.form1.Ra1[i].checked) 
          break; 
    }
	idusua = document.form1.Ra1[i].value;
	nu = document.form1.T12.value;
	contenedorVal=document.getElementById('conjuridi');
	ajax=objetoAjax();	ajax.open("POST", Page, true);	
	ajax.onreadystatechange=function()
	{ if (ajax.readyState==4){contenedorVal.innerHTML=ajax.responseText;}}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("nu="+nu+"&idusua="+idusua);
}

/*cita alcaldia*/
function cargar_hora_cita(Page,Num){var contenedorVal;
	id = Num;
	contenedorVal=opener.document.getElementById('concita');
	ajax=objetoAjax();	ajax.open("POST", Page, true);	
	ajax.onreadystatechange=function()
	{ if (ajax.readyState==4){contenedorVal.innerHTML=ajax.responseText;}}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("id="+id);
}

/*CITA DEMUNA */
function cargar_hora_cita_demuna(Page,Num){var contenedorVal;
	id = Num;
	contenedorVal=parent.document.getElementById('concita');
	ajax=objetoAjax();	ajax.open("POST", Page, true);	
	ajax.onreadystatechange=function()
	{ if (ajax.readyState==4){contenedorVal.innerHTML=ajax.responseText;}}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("id="+id);
}

function cargar_sector(Page){var contenedorVal;
	indice  = document.form1.sele_sector.selectedIndex;
	id = document.form1.sele_sector.options[indice].value;
	contenedorVal=document.getElementById('conte_organizacion');
	ajax=objetoAjax();	ajax.open("POST", Page, true);	
	ajax.onreadystatechange=function()
	{ if (ajax.readyState==4){contenedorVal.innerHTML=ajax.responseText;}}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("id="+id);
}

function ajx_trmtes(Page){var contenedorVal;
	indice  = document.form1.sele_serv.selectedIndex;
	id 		= document.form1.sele_serv.options[indice].value;
	contenedorVal=document.getElementById('conte_trmte');
	ajax=objetoAjax();	ajax.open("POST", Page, true);	
	ajax.onreadystatechange=function()
	{ if (ajax.readyState==4){contenedorVal.innerHTML=ajax.responseText;}}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("id="+id);
}

function ajx_rqui_plan(Page){var contenedorVal;
	indice  = document.form1.sele_tram.selectedIndex;
	id 		= document.form1.sele_tram.options[indice].value;
	contenedorVal=document.getElementById('conte_requi_plan');
	ajax=objetoAjax();	ajax.open("POST", Page, true);	
	ajax.onreadystatechange=function()
	{ if (ajax.readyState==4){contenedorVal.innerHTML=ajax.responseText;}}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("id="+id); }

function ajx_prgntamin(Page){var contenedorVal;
	indice  = document.form1.sele_tram.selectedIndex;
	id 		= document.form1.sele_tram.options[indice].value;
	contenedorVal=document.getElementById('conte_datomin');
	ajax=objetoAjax();	ajax.open("POST", Page, true);	
	ajax.onreadystatechange=function()
	{ if (ajax.readyState==4){contenedorVal.innerHTML=ajax.responseText;}}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("id="+id); }
