// JavaScript Document

function mostrarPnl(_panel) {
    //Muestra panel de imágenes
    if (typeof (aDivs) !== "undefined") {
        var indiceDiv = parseInt(_panel.split('_')[_panel.split('_').length - 1]);
        var div = document.getElementById("ContentPlaceHolderMain_" + aDivs[indiceDiv - 1]);
        if (div != null) {
            div.setAttribute("class", "preg");
        }
    }
    var panel = document.getElementById('sub_' + _panel);
    panel.style.visibility = 'visible';
    panel.style.display = 'block';
}

function getExtraCSSName() {
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var iPos = navigator.appVersion.indexOf('MSIE ');
        var fVersion = parseFloat(navigator.appVersion.substr(iPos + 5));
        if (fVersion >= 7) {
            return ('general_ie7.css');
        } else {
            return ('general_ie6.css');
        }
    }
}

function mostrarSubItem(nro, cant) {
    var i;
    var abrir = document.getElementById('sub_' + nro).style.visibility != 'visible';
    for (i = 1; i <= cant; i++) {

        if (typeof (aDivs) !== "undefined") {
            var div = document.getElementById("ContentPlaceHolderMain_" + aDivs[i - 1]);
            if (div != null) {
                div.setAttribute("class", "preg4");
            }
        }
        document.getElementById('sub_P_' + i).style.visibility = 'hidden';
        document.getElementById('sub_P_' + i).style.display = 'none';
    }
    if (abrir) {
        if (typeof (aDivs) !== "undefined") {
            var indiceDiv = parseInt(nro.split('_')[nro.split('_').length - 1]);
            var div = document.getElementById("ContentPlaceHolderMain_" + aDivs[indiceDiv - 1]);
            if (div != null) {
                div.setAttribute("class", "preg");
            }
        }
        document.getElementById('sub_' + nro).style.visibility = 'visible';
        document.getElementById('sub_' + nro).style.display = 'block';
    }
}
function mostrarSubItemMenu(nro, cant) {
    var i;
    var abrir = document.getElementById('subMenu_' + nro).style.visibility != 'visible';
    for (i = 1; i <= cant; i++) {
        document.getElementById('subMenu_' + i).style.visibility = 'hidden';
        document.getElementById('subMenu_' + i).style.display = 'none';
    }
    if (abrir) {
        document.getElementById('subMenu_' + nro).style.visibility = 'visible';
        document.getElementById('subMenu_' + nro).style.display = 'block';
    }
}

// Alineación de 2 columnas
/*
function setH() {
var maxH = Math.max(document.getElementById('col1').offsetHeight,document.getElementById('col2').offsetHeight);
document.getElementById('col1').style.height=maxH+'px';
document.getElementById('col2').style.height=maxH+'px';
}
  
window.onload=setH;
*/
// Pop-up
function MM_openBrWindow(theURL, winName, features) { //v2.0
    window.open(theURL, winName, features);
}

// Ramdom
function makeQuote() {
    Quotes = new Array();

    Quotes[0] = "<img src='images/fotos/top_home_01.jpg' alt='' />";
    Quotes[1] = "<img src='images/fotos/top_home_02.jpg' alt='' />";
    Quotes[2] = "<img src='images/fotos/top_home_03.jpg' alt='' />";
    Quotes[3] = "<img src='images/fotos/top_home_04.jpg' alt='' />";
    Quotes[4] = "<img src='images/fotos/top_home_01.jpg' alt='' />";
    //Quotes[5] = "<img src='images/fotos/top_home_05.jpg' alt='' />";
    //Quotes[6] = "<img src='images/fotos/top_home_06.jpg' alt='' />";
    //Quotes[7] = "<img src='images/fotos/top_home_07.jpg' alt='' />";
    //Quotes[0] = "<center style='padding-top:5px'><script type='text/javascript'>AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','584','height','140','src','images/fotos/top_swf','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','images/fotos/top_swf' ); //end AC code</script><noscript><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='584' height='140' type='application/x-shockwave-flash'><param name='movie' value='images/fotos/top_swf.swf' /><param name='quality' value='high' /></object></noscript></center>";

    var x = Math.floor(Quotes.length * Math.random());
    document.write(Quotes[x]);
}
//Solapas 
function mostrarSolapas(nro, cant) {
    var i;
    var abrir = document.getElementById('solapa_' + nro).style.visibility != 'visible';
    for (i = 1; i <= cant; i++) {
        document.getElementById('solapa_' + i).style.visibility = 'hidden';
        document.getElementById('solapa_' + i).style.display = 'none';
    }
    if (abrir) {
        document.getElementById('solapa_' + nro).style.visibility = 'visible';
        document.getElementById('solapa_' + nro).style.display = 'block';
    }
}

function afoto(cual) {

    var cont = 0
    if (cont == 1) { ventana.close(); ventana = null }

    ventana = window.open('', 'ventana', 'resizable=no,sc rollbars=no,width=50,height=50')
    ventana.document.write('<html><head><title></title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no"  onUnload="opener.cont=0"><div align="center"><a href="javascript:this.close()"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)" style="border:none"></a></div>')
    ventana.document.close()
    cont++
}

function redimensionar(ancho, alto) {
    ventana.resizeTo(ancho + 5, alto + 30)
    ventana.moveTo((screen.width - ancho) / 2, (screen.height - alto) / 2) //centra la ventana. Eliminar si no se quiere centrar el popup
}

function Print(ourl) {
    window.open(ourl, 'ventana', 'resizable=no,sc rollbars=no,width=0,height=0');

}

function Save() {
    document.execCommand("SaveAs", 1, "archivo.doc");

}
