﻿
baseurl="/inicio.nsf/";

var WWBANNER = new Array(7);
var hr = "<hr style='color:#db530a; background-color:#db530a;height:1px;width:92%; border:0 none'>"
var txutil="";
if(navigator.appName == "Netscape")txutil="<div style='margin-left:4px; margin-right:4px; padding: 4px'>"+"<div id='semanales' class='textocontenido' style='text-align:left; margin-bottom:4px'></div>";
else txutil="<div style='margin-left:4px; margin-right:4px; padding: 4px; margin-top:-15px'>"+"<div id='semanales' class='textocontenido' style='text-align:left; margin-bottom:4px'></div>";
txutil=txutil+"<div id='mensuales' class='textocontenido' style='text-align:left; margin-bottom:4px'></div>";
txutil=txutil+"<div id='accesos' class='textocontenido' style='text-align:left; margin-bottom:4px'></div>";
txutil=txutil+"<div id='actualizadas' class='textocontenido' style='text-align:left; margin-bottom:4px'></div>";
txutil=txutil+"<div id='aleatorias' class='textocontenido' style='text-align:left; margin-bottom:4px'></div>";
txutil=txutil+"<div id='destacadas' class='textocontenido' style='text-align:left; margin-bottom:4px'></div>";
txutil=txutil+"<br><label class='textoNaranjaTitulos'>Oficina Virtual</label>"+hr+"<a href='/inicio.nsf/admele?openpage&windice=1,1'><img style='border: 0px; margin: 2px 2px 2px 2px' src='/v70/oficina_virtual.jpg' alt='oficina Virtual' title='Oficina Virtual' style='height: 100px; width:163px;' /></a>"+hr+"<a href='/inet/hwgr.nsf/corta/FB4A?opendocument'><img style='border: 0px; margin: 2px 2px 2px 2px' src='/v70/sac_010.jpg' alt='Servicio de atención al ciudadano' title='servicio de atención al ciudadano' style='height: 100px; width:163px;' /></a><div id='access' style='width:100%'></div></div>";

WWBANNER[0] = new Array();
WWBANNER[0][0] = txutil;
WWBANNER[1] = new Array();
WWBANNER[1][0] = txutil;
WWBANNER[2] = new Array();
WWBANNER[2][0] = txutil;
WWBANNER[3] = new Array();
WWBANNER[3][0] = txutil;
WWBANNER[4] = new Array();
WWBANNER[4][0] = txutil;
WWBANNER[5] = new Array();
WWBANNER[5][0] = txutil;
WWBANNER[6] = new Array();
WWBANNER[6][0] = txutil;
WWBANNER[7] = new Array();
WWBANNER[7][0] = txutil;

function aleatorio(){
    var idsm = ["destaca","aleatoria","massem","masmes"];
    miFecha = new Date();
    ver=miFecha.getSeconds() % 4;
    //alert(ver);
    cerrartodos();
    accmuestra(idsm[ver]);
} 

function cerrartodos(){ 
    var idsm = ["destaca","aleatoria","massem","masmes"];
    for (i=0; i<idsm.length;i++){    
    var divm = document.getElementById(idsm[i]);
    var imgm = document.getElementById(idsm[i]+"img");
    if (typeof(divm) != "undefined" && divm != null){
            divm.style.display="none";
            imgm.src = '/v70/plegado.gif';
        }
    }
}

//function cerrartodosmenosuno(nombre){ 
//    var idsm = ["destaca","aleatoria","massem","masmes"];
//    for (i=0; i<idsm.length;i++){
//        if (nombre != idsm[i]){
//        var divm = document.getElementById(idsm[i]);
//        var imgm = document.getElementById(idsm[i]+"img");
//        if (typeof(divm) != "undefined" && divm != null){
//                divm.style.display="none";
//                imgm.src = '/v70/plegado.gif';
//            }
//        }
//    }
//}

function CargarContenido (url) 
{
    var pagina_requerida = false;
    // Si es Mozilla, Safari etc
    if (window.XMLHttpRequest)
    {        
   
        pagina_requerida = new XMLHttpRequest ();
    } 
    else if (window.ActiveXObject)
    {
        // pero si es IE
       if (ID_NAV[0] == "0" && ID_NAV[1] == "1")
        {
            pagina_requerida = new ActiveXObject ("Msxml2.XMLHTTP");
        }
        else
        {            
                pagina_requerida = new ActiveXObject ("Microsoft.XMLHTTP");           
        }
    } 
    else
    return false;
    /* Invocamos la propiedad onreadystatechange, (cambio en el estado de la carga)
    entonces cuando el objeto llegue a este punto se llamará a una funcion que gestionará el resto del proceso */
    pagina_requerida.onreadystatechange = function ()
    {
        // función de respuesta
        CargarPagina (pagina_requerida);
    }
    pagina_requerida.open ('GET', url, true); // asignamos los métodos open y send
    pagina_requerida.send (null);
}	

function CargarPagina (pagina_requerida)
{
    var fragmentotexto = new Array();
	if (pagina_requerida.readyState == 4 && (pagina_requerida.status == 200 || window.location.href.indexOf ("http") == - 1)){
	    fragmentotexto = pagina_requerida.responseText.split('@');	
	    if (typeof(fragmentotexto[1]) != "undefined" && fragmentotexto[1] != "" && fragmentotexto[1].indexOf('mostrardiv')!= -1) document.getElementById("semanales").innerHTML = fragmentotexto[1];
	    else {
	        document.getElementById("semanales").style.display="none";
	        if (fragmentotexto[1].indexOf('tabacces')!= -1) document.getElementById("access").innerHTML = "<br>"+fragmentotexto[1];
	    }
	    if (typeof(fragmentotexto[2]) != "undefined" && fragmentotexto[2] != "" && fragmentotexto[2].indexOf('mostrardiv')!= -1) document.getElementById("mensuales").innerHTML = fragmentotexto[2];
	    else {
	        document.getElementById("mensuales").style.display="none";
	        if (fragmentotexto[2].indexOf('tabacces')!= -1) document.getElementById("access").innerHTML = "<br>"+fragmentotexto[2];
	    }
	    if (typeof(fragmentotexto[3]) != "undefined" && fragmentotexto[3] != "" && fragmentotexto[3].indexOf('mostrardiv')!= -1) document.getElementById("accesos").innerHTML = fragmentotexto[3];
	    else {
	        document.getElementById("accesos").style.display="none";
	        if (fragmentotexto[3].indexOf('tabacces')!= -1) document.getElementById("access").innerHTML = "<br>"+fragmentotexto[3];
	    }
	    if (typeof(fragmentotexto[4]) != "undefined" && fragmentotexto[4] != "" && fragmentotexto[4].indexOf('mostrardiv')!= -1) document.getElementById("actualizadas").innerHTML = fragmentotexto[4];
	    else {
	        document.getElementById("actualizadas").style.display="none";
	        if (fragmentotexto[4].indexOf('tabacces')!= -1) document.getElementById("access").innerHTML = "<br>"+fragmentotexto[4];
	    }
	    if (typeof(fragmentotexto[5]) != "undefined" && fragmentotexto[5] != "" && fragmentotexto[5].indexOf('mostrardiv')!= -1) document.getElementById("aleatorias").innerHTML = fragmentotexto[5];
	    else {
	        document.getElementById("aleatorias").style.display="none";
	        if (fragmentotexto[5].indexOf('tabacces')!= -1) document.getElementById("access").innerHTML = "<br>"+fragmentotexto[5];
	    }
	    if (typeof(fragmentotexto[6]) != "undefined" && fragmentotexto[6] != "" && fragmentotexto[6].indexOf('mostrardiv')!= -1) document.getElementById("destacadas").innerHTML = fragmentotexto[6];
	    else {
	        document.getElementById("destacadas").style.display="none";
	        if (fragmentotexto[6].indexOf('tabacces')!= -1) document.getElementById("access").innerHTML = "<br>"+fragmentotexto[6];
	    }
	    aleatorio();
	}
	//cerrartodos();
}

function mostrardiv(tipo) {
var mira=0;
var item=document.getElementById(tipo);
if (item != null){
    if (item.style.display == "none" ) mira=1;
    }
cerrartodos();
if (mira>0) accmuestra(tipo)

}
function accmuestra(tipo){
    var div=document.getElementById(tipo);    
    if (div != null){ 
        div.style.display = '';       
        document.getElementById(tipo+"img").src = '/v70/desplegado.gif';    
    }
}
