﻿// FUNCIONES DE LAS ACCIONES DE LOS BOTONES DE LA APLICACION
var strcampoobligado;
var host = window.location.host;
if(host=="localhost"){host="localhost/esglesia2";}
//alert(host);
var ventana="";

function Consultar(){
    // Para comprobar el acceso a la aplicacion
	strcampoobligado="txtTexto";
	//var blnoks=camposobligatorios();
	//if(blnoks==true){
	    try{
	    if ((ventana=="")&&(ventana.name!="consulta")){
	        ventana=window.open('','_blank','title:Bienvenido a Esglesia');
		    ventana.location.href="listado.htm";
		    ventana.name="consulta";
	    }
		var strRuta="http://"+host+"/ListaEnlaces.asp";
		var valores = llamadaPost(strRuta);
		//valores=valores.join("&quot;",formatChar(34));
		ventana.document.body.innerHTML=valores;
		ventana.focus();
		ventana.onload=function(){MM_reloadPage(true);}
		}catch(e){
			 if ((ventana=="")&&(ventana.name!="consulta")){
		    ventana=window.open('','_blank','title:Bienvenido a Esglesia');
		    ventana.location.href="listado.htm";
		    ventana.name="consulta";
			 }
		    var strRuta="http://"+host+"/ListaEnlaces.asp";
		    var valores = llamadaPost(strRuta);
		    //valores=valores.join("&quot;",formatChar(34));
		    ventana.document.body.innerHTML=valores;
		    ventana.focus();
		    ventana.onload=function(){MM_reloadPage(true);}
		}
		
	//}
}

function Buscar(){
    // Para comprobar el acceso a la aplicacion
	strcampoobligado="selIdiomas";
	var blnoks=camposobligatorios();
	if(blnoks==true){
	   try{
	    if ((ventana=="")&&(ventana.name!="consulta")){
	        ventana=window.open('','_blank','title:Bienvenido a Esglesia');
		    ventana.location.href="listado.htm";
		    ventana.name="consulta";
	    }
		var strRuta="http://"+host+"/ListaEnlaces.asp";
		var valores = llamadaPost(strRuta);
		//valores=valores.join("&quot;",formatChar(34));
		ventana.document.body.innerHTML=valores;
		ventana.focus();
		ventana.onload=function(){MM_reloadPage(true);}
		}catch(e){
		    ventana=window.open('','_blank','title:Bienvenido a Esglesia');
		    ventana.location.href="listado.htm";
		    ventana.name="consulta";
		    var strRuta="http://"+host+"/ListaEnlaces.asp";
		    var valores = llamadaPost(strRuta);
		    //valores=valores.join("&quot;",formatChar(34));
		    ventana.document.body.innerHTML=valores;
		    ventana.focus();
		    ventana.onload=function(){MM_reloadPage(true);}
		}
	}
}

function Paginacion(){
	
    strcampoobligado="txtIrA";
	var blnoks=camposobligatorios();
	if(blnoks==true){
	    document.getElementById("Accion").value=2;
	    strRuta="http://"+host+"/ListaEnlaces.asp";
		var valores = llamadaPost(strRuta);
	    window.document.body.innerHTML=valores;
	}
}
function BotonesPaginar(bytOperacion){
	try{
		bytOperacion=parseInt("0" + bytOperacion);
		//Pasamos los valores de las cajas de texto del FILTRO.
		intNumRegistros = document.getElementById("txtnumregistros").value;
		switch (parseInt(bytOperacion)) {
			case 1:
				document.getElementById("txtIrA").value=parseInt(document.getElementById("txtIrA").value)-1;
				break;
			case 2:
				document.getElementById("txtIrA").value=parseInt(document.getElementById("txtIrA").value)+1;
				break;
			case 3:
				intNumPage = parseInt(document.getElementById('txtIrA').value);
				break;
		}
	}catch(e){
		alert(e.number + " " +e.description);
	}
}		

function Limpiar(){
    strcampofiltro="txtTexto";
    Restablecer();
}