function view(el){
    var con = document.getElementById("contenedor");
    var hermano = el.nextSibling;
    for (var i = 1; i < (con.childNodes.length); i++) {
        if (con.childNodes[i] != hermano && con.childNodes[i].className == "content" && con.childNodes[i].nodeName == "DIV") 
            con.childNodes[i].style.display = "none";
    }
    if (hermano.style.display == "none" || hermano.style.display == "") 
        hermano.style.display = "block";
    else 
        hermano.style.display = "none";
}


window.executeScript = function(text){
    var startPos = text.indexOf('<script');
    if (startPos >= 0) 
        startPos = text.indexOf('>', startPos) + 1;
    while (startPos >= 0) {
        var endPos = text.indexOf('<\/script>', startPos);
        var script = text.substring(startPos, endPos);
        if (window.execScript) 
            window.execScript(script);
        else 
            window.eval(script);
        if (endPos > startPos) {
            startPos = text.indexOf('<script', endPos);
            if (startPos >= 0) 
                startPos = text.indexOf('>', startPos) + 1;
        }
    }
}

function enableDetails(pref){
    document.location = '#startResults';
    if (pref == undefined) 
        pref = "detail";
    var a = document.getElementById(pref + 'Content');
    var b = document.getElementById(pref + 'Search');
    a.style.display = "block";
    b.style.display = "none";
}

function disableDetails(pref){
    if (pref == undefined) 
        pref = "detail";
    var a = document.getElementById(pref + 'Content');
    var b = document.getElementById(pref + 'Search');
    b.style.display = "block";
    a.style.display = "none";
}

function sendForm(a, b, c, d){
    if (c == undefined && d == undefined) {
        sendFormYui(a, b);
    }
    else {
        try {
            sendFormTP(a, b, c, d);
        } 
        catch (e) {
        
        }
    }
}

function changeFormValue(formName, name, value, idContent){
    var idform = document.getElementById(formName);
    if (idform == undefined) {
        return;
    }
    var component = getelement(idform, name);
    if (component == undefined) {
        return;
    }
    component.value = value;
    sendForm(formName, idContent);
}

function getelement(form, name){
    var k;
    var elements = form.elements;
    for (k = 0; k < elements.length; k++) {
        if (elements[k].name == name) 
            return elements[k];
    }
}


function sendFormYui(formObject, idContent){
    var idcont = document.getElementById(idContent);
    var idform = document.getElementById(formObject);
    if (idcont == undefined) {
        alert("Zona de Contenido no Existe");
        return;
    }
    if (idform == undefined) {
        alert("Formulario no Existe");
        return;
    }
    var callback = {
        success: function(o){
            idcont.innerHTML = o.responseText;
            executeScript(o.responseText);
        },
        failure: function(o){
            idcont.innerHTML = 'Error en la Busqueda.';
        }
    }
    YAHOO.util.Connect.setForm(idform);
    var cObj = YAHOO.util.Connect.asyncRequest('POST', idform.action, callback);
    
    idcont.innerHTML = "<img src='" + INTRA_BASE_URL + "site/images/busy.gif' border='0'>";
}

/* Funcion para certifica */
function Chek(cat){   
    return cat;
}

