function mapa(Vent) {
    PopUp=window.open(Vent,"SEGURIDAD","toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes, copyhistory=yes,width=750,height=550")
}


function init_listado() {
    if ($('frm_sort')) {
        $('sortby').addEvent('change', function() { $('frm_sort').submit(); });
        $('order').addEvent('change', function() { $('frm_sort').submit(); });
    }
}

window.addEvent('load', init_listado);

function procesaPestanas() {
    var objs = document.getElementsByTagName('span');
    if (objs && objs.length) {
        for (var i = 0; i < objs.length; i++) {
            if (objs[i].className == 'pestana') {
                objs[i].onclick = activaPestana;
                var id  = objs[i].id.substring(1);
                var obj = document.getElementById(id);
                if (obj && obj.style) {
                    obj.style.display = 'none';
                }
            }
        }
    }
}

function activaPestana() {
    if (!this.id) {
        return false;
    }

    var objs = document.getElementsByTagName('span');
    if (objs && objs.length) {

        // Verificamos que el DIV destino existe
        for (var i = 0; i < objs.length; i++) {
            if (objs[i].className=='pestana' || objs[i].className=='pestana sel') {
                var idcontent = objs[i].id.substring(1);
                var obj       = document.getElementById(idcontent);
                if (objs[i].id == this.id && !obj) {
                    alert('No se ha encontrado el DIV del contenido');
                    return false;
                }
            }
        }

        // Todo OK
        for (var i = 0; i < objs.length; i++) {
            if (objs[i].className=='pestana' || objs[i].className=='pestana sel') {
                var idcontent = objs[i].id.substring(1);
                var obj       = document.getElementById(idcontent);
                if (objs[i].id == this.id) {
                    if (obj && obj.style) {
                        obj.style.display = 'block';
                    }
                    objs[i].className = 'pestana sel';
                    objs[i].onclick = null;
                } else {
                    if (obj && obj.style) {
                        obj.style.display = 'none';
                    }
                    objs[i].className = 'pestana';
                    objs[i].onclick = activaPestana;
                }
            }
        }
    }
}
