startList = function()
    {
        if (document.all&&document.getElementById) {
            navRoot = document.getElementById("nav");
            for (i=0; i<navRoot.childNodes.length; i++) {
                node = navRoot.childNodes[i];
                if (node.nodeName=="LI") {
                    node.onmouseover=function() {
                        this.className+=" over";
                    }
                    node.onmouseout=function() {
                        this.className=this.className.replace(" over", "");
                    }
                }
            }
        }
    }

function zoomText(Accion,Elemento)
{
    obj=document.getElementById(Elemento);
    var as = obj.getElementsByTagName("p");
    var tabla = obj.getElementsByTagName('table');
	
    if(obj.style.fontSize=="")
    {
        obj.style.fontSize="100%";
    }
    actual=parseInt(obj.style.fontSize);
    incremento=5;
	
    if(Accion=="reestablecer"){
        valor="100"
    }
    if(Accion=="aumentar"){
        valor=actual+incremento;
    }
    if(Accion=="disminuir"){
        valor=actual-incremento;
    }

    obj.style.fontSize=valor+"%"
    for (var i=0; i<as.length; i++) {
        as[i].style.fontSize = valor+"%";
    }
    for (i=0; i<tabla.length; i++) {
        var celda = tabla[i].getElementsByTagName('td');
        for (var j=0; j<celda.length; j++){
            celda[j].style.fontSize=valor+"%";
        }
    }
}

function openPictureWindow(imageType,imageName,imageWidth,imageHeight,scroll,alt,posLeft,posTop)
{  // v4.01
    newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=" + scroll +",left="+posLeft+",top="+posTop);
    newWindow.document.open();
    newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
    if (imageType == "swf"){
        newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
        newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
        newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
        newWindow.document.write('</embed></object>');
    }else{
        newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">');
    }
    newWindow.document.write('</body></html>');
    newWindow.document.close();
    newWindow.focus();
}
function MM_openBrWindow(theURL,winName,features)
{ //v2.0
    window.open(theURL,winName,features);
}

// para guia de tramites, turismo como llegar
function ocultar()
{
    var a = document.getElementById("tabla1");
    a.style.display = 'none';
    a = document.getElementById("tabla2");
    a.style.display = 'none';
    a = document.getElementById("tabla3");
    a.style.display = 'none';
    a = document.getElementById("tabla4");
    a.style.display = 'none';
    a = document.getElementById("tabla5");
    a.style.display = 'none';
    a = document.getElementById("tabla6");
    a.style.display = 'none';
    a = document.getElementById("tabla7");
    a.style.display = 'none';
    a = document.getElementById("tabla8");
    a.style.display = 'none';
}
function mostrar(obj)
{
    ocultar();
    var a = document.getElementById(obj);
    if (a.style.display != 'none'){
        a.style.display = 'none'
    }
    else{
        a.style.display = 'inline'
    }
}

// para organigramas y para menu de guia de tramites
// nombrediv es lo que se oculta y titulo tiene la opcion de ocultar y mostrar
function muestra(nombrediv, titulo)
{
    if(document.getElementById(nombrediv).style.display == '') {
        document.getElementById(nombrediv).style.display = 'none';
        document.getElementById(titulo).className = "mas";
    } else {
        document.getElementById(nombrediv).style.display = '';
        document.getElementById(titulo).className = 'menos';
    }
}

/* esta funcion permite tener mas de un script que se ejecute en el evento onload,
   q solo hay uno!!!! */
function addOnLoad(nuevoOnLoad)
{
    var prevOnload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = nuevoOnLoad;
    }
    else {
        window.onload = function() {
            prevOnload();
            nuevoOnLoad();
        }
    }
}

/*********************************************************************
 *      VALIDACIONES PARA FORMULARIOS
 *********************************************************************/
function ValidaHora( campohora )
{
    var er_fh = /^(0|00|1|01|2|02|3|03|4|04|5|05|6|06|7|07|8|08|9|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23)\:([0-5]0|[0-5][1-9])$/
    if( campohora.value != "" )
    {
        if ( !(er_fh.test( campohora.value )) )
        {
            alert("El dato en el campo hora no es válido.")
            campohora.value = "";
            return false
        }
    }

    return true
}


contenido_textarea = ""

function ValidaLongitud(campotexto, num_caracteres_permitidos){
    num_caracteres = campotexto.value.length

    if (num_caracteres > num_caracteres_permitidos){
        campotexto.value = contenido_textarea
    }else{
        contenido_textarea = campotexto.value
    }

    if (num_caracteres >= num_caracteres_permitidos){
        document.forms[0].caracteres.style.color="#ff0000";
    }else{
        document.forms[0].caracteres.style.color="#000000";
    }

    cuenta()
}
function cuenta(){
    document.forms[0].caracteres.value=campotexto.value.length
}

function cancela(url){
    window.location = url;
}
