/*************************FUNCION DE PAGINACION************************/
var NumeroRegistros;
var NumeroRegPagina;
var HojaActual;
var PaginaActual;
var NumeroPagVisibles;

function FuncionPaginador(NuevaPosicion,IdGeneralPagina,IdPaginador,IdHoja)
{
    if(NuevaPosicion != null && IdGeneralPagina != null && IdPaginador != null && IdHoja !=null && NumeroRegPagina > 0 && NumeroPagVisibles > 0)
    {
        var NuevaPagina;
        //var PaginaAnterior = PaginaActual;
        var i,j, ctrlpag,ctrlpagaux;
        //CAPTURA LA PAGINA A LA CUAL DIRIGIRSE
        if(NuevaPosicion == '+'){
            //INCREMENTA HOJA
            NuevaPagina = (HojaActual + 1) * NumeroPagVisibles;
        }
        else if(NuevaPosicion == '-'){
            //DECREMENTA HOJA
            NuevaPagina = (HojaActual - 1) * NumeroPagVisibles;
        }
        else{
            //ASIGNA UNA PAGINA
            NuevaPagina = new Number(NuevaPosicion);
        }
        //ASIGNA HOJA EN LA QUE SE ENCUENTRA
        if(NuevaPagina == NaN || NuevaPagina < 0)
            NuevaPagina = 0;
        if(NumeroRegistros < (NuevaPagina*NumeroRegPagina))
            NuevaPagina = PaginaActual;

        HojaActual = parseInt(NuevaPagina/NumeroPagVisibles);

        //ORGANIZA VISUALIZACION DE HOJAS DEL PAGINADOR
        for(i=0; i< NumeroRegistros/(NumeroRegPagina*NumeroPagVisibles); i++)
        {
            ctrlpag  = document.getElementById(IdHoja + i);
            if(ctrlpag != null)
            {
                if(i == HojaActual)
                {
                    ctrlpag.style.display='block';
                }
                else
                {
                    ctrlpag.style.display='none';
                }
            }
        }
        
        //GUARDA PAGINA EN LA QUE SE ENCUENTRA
        PaginaActual = NuevaPagina;
        
        for(i=0; i<NumeroRegistros/NumeroRegPagina; i++)
        {
            //BUSCA TODOS LOS CONTROLES DE PAGINACION
            ctrlpag = document.getElementById(IdGeneralPagina + i);
            if(ctrlpag != null)
            {
                if(i==PaginaActual)
                {
                    ctrlpag.style.display='block';
                }
                else
                {
                    ctrlpag.style.display='none';
                }
            }
            //ORGANIZA VISUALIZACION DEL PAGINADOR
            ctrlpag = document.getElementById(IdPaginador + i);
            if(ctrlpag != null)
            {
                //ASIGNA ESTILOS DE SELECCION
                if(i == PaginaActual)
                {
                    ctrlpag.attributes["class"].nodeValue = "tahoma_13_negra";
                }
                else
                {
                    ctrlpag.attributes["class"].nodeValue = "arial_11_azul_link";
                }
            }
        }
    }
}
/*************************FIN FUNCION DE PAGINACION************************/

/*******Leonardo Guerreero************/


function fImprime()
{	
	window.print();
}

function muestra_imagen(archivo,ancho,alto,resumen,link1){ 
 xInnerHtml('c1','' + archivo);
 xInnerHtml('Label3','' + link1+ancho+'</a>');
 xInnerHtml('Label4','' + alto);
 xInnerHtml('Label5','' + resumen);
 //xInnerHtml('Label6','' + link1);
 //init(ancho,alto,resumen)
} 

//function cerrar_ampliacion(){ 
//  xHide('ampliacion'); 
//} 

function init(valor,valor1,valor3) {
//document.getElementById("Label3").innerText = valor;
document.getElementById("Label4").innerText = valor1;
document.getElementById("Label5").innerText = valor3;
} 
/*******Fin Leonardo Guerrero********/

function Mostrarnew(pImagen,pAncho,pAlto)
{	
	
	var nom = navigator.appName;	
	
	var lImagen = document.getElementById('imgCapa');

	
	
	if(nom== "Netscape")
	{
		pAlto= pAlto +50;
		pAncho= pAncho +10;
	}			
	
	lImagen.style.width = pAncho+'px';
	lImagen.style.height = pAlto+'px'

	if(pAlto > document.body.clientHeight)
		pAlto = document.body.clientHeight;

	lImagen.src = pImagen;
	
	var x = document.getElementById('ImagenBig');
	x.style.visibility = "visible";
	x.style.height=(window.document.body.scrollHeight)+'px';

	var x = document.getElementById('ImagenBigInner');
	x.style.visibility = "visible";
	
	
	//alert(nom);
	if (nom == "Netscape")
		{
			var lPosY = window.pageYOffset;
			x.style.top=((document.body.clientHeight / 2) + window.pageYOffset)-parseInt(pAlto*40/100)+'px'; 			
		}
	else
		x.style.top =(window.document.body.scrollTop)+((document.body.clientHeight/2)-(parseInt(pAlto*45/100)))+'px';
		
	x.style.left = ((document.body.clientWidth/2)-parseInt(pAncho*50/100))+'px';



}

function MostrarLeo(pImagen,pAncho,pAlto)
{	
	
	var nom = navigator.appName;
	var lImagen = document.getElementById('imgCapa');
	if(nom== "Netscape")
	{
		pAlto= pAlto +50;
		pAncho= pAncho +10;
	}
	lImagen.style.width = pAncho+'px';
	lImagen.style.height = pAlto+'px'
	
	if(pAlto > document.body.clientHeight)
		pAlto = document.body.clientHeight;
	
	lImagen.src = pImagen;
	
	var x = document.getElementById('ImagenBig');
	x.style.visibility = "visible";
	x.style.height=(window.document.body.scrollHeight)+'px';
	//x.style.top =(window.document.body.scrollTop);

	

	
	var x = document.getElementById('ImagenBigInner');
	x.style.visibility = "visible";
	
	
	if (nom == "Netscape"){
		//x.style.top =(((document.body.clientHeight/2)+ window.pageYOffset)-250)+'px';
		//x.style.top=((document.body.clientHeight) + window.pageYOffset)-parseInt(pAlto*40/100)+'px'; 	
		x.style.top=((document.body.clientHeight / 2) + window.pageYOffset)-220-parseInt(pAlto*40/100)+'px';
	}
	else{
		x.style.top =(window.document.body.scrollTop)+((document.body.clientHeight/2)-260)+'px';
	}
	    x.style.left = ((document.body.clientWidth/2)-300)+'px';

//alert(x.style.top)

}


function Mostrar1(pImagen,pAncho,pAlto)
{	
	
	var nom = navigator.appName;
	var lImagen = document.getElementById('imgCapa');
	if(nom== "Netscape")
	{
		pAlto= pAlto +50;
		pAncho= pAncho +10;
	}
	lImagen.style.width = pAncho+'px';
	lImagen.style.height = pAlto+'px'
	
	if(pAlto > document.body.clientHeight)
		pAlto = document.body.clientHeight;
	
	lImagen.src = pImagen;
	
	var x = document.getElementById('ImagenBig');
	x.style.visibility = "visible";
	x.style.height=(window.document.body.scrollHeight)+'px';
	//x.style.top =(window.document.body.scrollTop);

	

	
	var x = document.getElementById('ImagenBigInner');
	x.style.visibility = "visible";
	
	
	if (nom == "Netscape"){
		//x.style.top =(((document.body.clientHeight/2)+ window.pageYOffset)-250)+'px';
		//x.style.top=((document.body.clientHeight) + window.pageYOffset)-parseInt(pAlto*40/100)+'px'; 	
		x.style.top=((document.body.clientHeight / 2) + window.pageYOffset)-parseInt(pAlto*40/100)+'px';
	}
	else{
		x.style.top =(window.document.body.scrollTop)+((document.body.clientHeight/2)-500)+'px';
	}
	    x.style.left = ((document.body.clientWidth/2)-300)+'px';

//alert(x.style.top)

}

function Ocultar()
{
	var x = document.getElementById('ImagenBig')
	x.style.visibility = "hidden"
	
	var x = document.getElementById('ImagenBigInner');
	x.style.visibility = "hidden";
	//window.location.reload();
	
}

function OcultarAvatar(pImagen,Pimagenoriginal)
{
	var x = document.getElementById('ImagenBig')
	x.style.visibility = "hidden"
	var x = document.getElementById('ImagenBigInner');
	x.style.visibility = "hidden";
	//window.location.reload();
	var lImagen = document.getElementById('Avatar1');
	lImagen.src = pImagen;
	lImagen.width = 100;
  lImagen.height = 100;

	var lImagen = document.getElementById('Avatar');
	lImagen.value = Pimagenoriginal;
}

function Ocultar1()
{
	var x = document.getElementById('ImagenBig1')
	x.style.visibility = "hidden"
	
	var x = document.getElementById('ImagenBigInner1');
	x.style.visibility = "hidden";
	//window.location.reload();
}

function cerrar()
	{
		window.parent.Ocultar();
	}
	
function Redireccionar(codpais,codciudad,nompais)
{
	  window.parent.navigate('home'+ nompais +'.asp?slctpis=' + codpais + '&NomPais='+nompais+'&slctcdad=' + window.document.getElementById(codciudad).value);
}

function fnMenu(item) {
   obj = document.getElementById(item);
   visible = (obj.style.display!="none")
   if (visible) {
     obj.style.display="none";
     } else {
      obj.style.display="block";
     }
}

function fnMenu1(objFuente,objDivAfectado) 
        {
        	  var ObjDiv = document.getElementById(objDivAfectado);
            var AtributoSRC = objFuente.getAttribute('src');
            var visible = (ObjDiv.style.display!="none");
            
            if (visible) {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="none";
                //CAMBIA IMAGEN
                objFuente.setAttribute('src', AtributoSRC.replace('bt_menos_colapsa.jpg','bt_mas_colapsa.jpg'));
            } 
            else {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="block";
                //CAMBIA IMAGEN
                objFuente.setAttribute('src', AtributoSRC.replace('bt_mas_colapsa.jpg','bt_menos_colapsa.jpg'));
            }
        }

function fnMenu2(objFuente,objDivAfectado) 
        {
        	  var ObjDiv = document.getElementById(objDivAfectado);
            var AtributoSRC = objFuente.getAttribute('src');
            var visible = (ObjDiv.style.display!="none");
            
            if (visible) {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="none";
                //CAMBIA IMAGEN
                objFuente.setAttribute('src', AtributoSRC.replace('bt_mas_colapsa.jpg','bt_menos_colapsa.jpg'));
            } 
            else {
                //CAMBIA VISUALIZACION
                ObjDiv.style.display="block";
                //CAMBIA IMAGEN
                objFuente.setAttribute('src', AtributoSRC.replace('bt_menos_colapsa.jpg','bt_mas_colapsa.jpg'));
                
            }
        }        
        
/*************************FIN CALCULO DINAMICO DE PRESUPUESTO************************/
/*************************FUNCION MUESTRA POPUP************************/
function Mostrar(UrlAbrir,AnchoVentana,AltoVentana)
{
    var iframeMostrar;
    var divImagenBig;
    var divImagenBigInner;

    //CAPTURA IFRAME A MOSTRAR
    iframeMostrar = document.getElementById('imgCapa');
    //CAPTURA DIV DE EFECTOS
    divImagenBig = document.getElementById('ImagenBig');
    divImagenBigInner = document.getElementById('ImagenBigInner');

    if(iframeMostrar != null && divImagenBig != null && divImagenBigInner != null)
    {
        //CAPTURA DISTANCIA Y DE LA VENTANA
        var dsoctop = document.all? iecompattest().scrollTop : pageYOffset
    
        //ASIGNA PROPIEDADES AL IFRAME    
        iframeMostrar.style.width = AnchoVentana + 'px';
        iframeMostrar.style.height = AltoVentana + 'px';
        iframeMostrar.src = UrlAbrir;
        
        //ASIGNA PROPIEDADES A DIV DE EFECTOS
        divImagenBig.style.visibility = "";
        divImagenBig.style.display='block';
        divImagenBig.style.height = (window.document.body.scrollHeight) + 'px';
        divImagenBig.style.overflow = 'scroll';
        
        divImagenBigInner.style.visibility = "";
	    divImagenBigInner.style.display='block';
	    
	    //ASIGNA POSICION DEL IFRAME
	    divImagenBigInner.style.left = ((document.body.clientWidth/2) - (AnchoVentana/2))+'px';	    
	    divImagenBigInner.style.top = (dsoctop + 50) + 'px';
    }
}
/*************************FIN FUNCION MUESTRA POPUP************************/

function MostrarBarra(UrlAbrir,AnchoVentana,AltoVentana)
{
    var iframeMostrar;
    var divImagenBig;
    var divImagenBigInner;

    //CAPTURA IFRAME A MOSTRAR
    iframeMostrar = document.getElementById('imgCapa');
    //CAPTURA DIV DE EFECTOS
    divImagenBig = document.getElementById('ImagenBig');
    divImagenBigInner = document.getElementById('ImagenBigInner');

    if(iframeMostrar != null && divImagenBig != null && divImagenBigInner != null)
    {
        //CAPTURA DISTANCIA Y DE LA VENTANA
        var dsoctop = document.all? iecompattest().scrollTop : pageYOffset
    
        //ASIGNA PROPIEDADES AL IFRAME    
        iframeMostrar.style.width = AnchoVentana + 'px';
        iframeMostrar.style.height = AltoVentana + 'px';
        iframeMostrar.src = UrlAbrir;
        
        //ASIGNA PROPIEDADES A DIV DE EFECTOS
        divImagenBig.style.visibility = "";
        divImagenBig.style.display='block';
        divImagenBig.style.height = (window.document.body.scrollHeight) + 'px';
        divImagenBig.style.overflow = 'scroll';
        
        divImagenBigInner.style.visibility = "";
	    divImagenBigInner.style.display='block';
	    
	    //ASIGNA POSICION DEL IFRAME
	    divImagenBigInner.style.left = ((document.body.clientWidth/2) - (AnchoVentana/2))+'px';	    
	    divImagenBigInner.style.top = (dsoctop) + 'px';
    }
}

/*************************FUNCION OCULTA POPUP************************/
function Ocultaraaa()
{
    var divImagenBig;
    var divImagenBigInner;

    //CAPTURA DIV DE EFECTOS
    divImagenBig = document.getElementById('ImagenBig');
    divImagenBigInner = document.getElementById('ImagenBigInner');

    if(divImagenBig != null && divImagenBigInner != null)
    {
        divImagenBig.style.display = 'none';
	    divImagenBigInner.style.display = 'none';
    }
}
/*************************FIN FUNCION OCULTA POPUP************************/

/*************************FUNCION CAPTURA ALTO DE VENTANA************************/
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
/*************************FIN FUNCION CAPTURA ALTO DE VENTANA************************/        

