// Reload von allen Frames die als Liste von Frame-Namen mitgegeben werden
function reloadFrames() {
    for (var i = 0; i < reloadFrames.arguments.length; i++)
        top.frames[reloadFrames.arguments[i]].location.reload(true);
}

// Anzeige von status_text in der Browser-Status-Zeile
function showStatus(status_text) {
    window.status = status_text;
    return true;
}

// Löschen der Browser-Status-Zeile
function clearStatus() {
    window.status = ' ';
}

// Überprüfung ob ein Element eines Schalters aktiviert wurde
function isRadioChecked(radio) {
    var checked = false;
    if (radio != null) {
        for (var i = 0; !checked && i < radio.length; i++)
            if (radio[i].checked)
                checked = true;
    }

    return checked;
}

function checkLeer(txt) {
    txt = txt.split('\\');
    txt = txt[txt.length - 1];
    if (txt.replace(/ /g, '').length == 0) {
        return false;
    }
    else
        return true;
}

/* Wegen Mac-MSIE und NS 4.X:
 * Setze den Wert des Parameters act_name aus act_req als
 * form.elements[].value
 */
/*
 function setFormActionPar(form, act_req, act_name) {
 // alert("setFormActionPar: act_req=" + act_req + ", act_name=" + act_name);
 if (form != null &&
 act_name != null && act_name.length > 0 &&
 act_req != null && act_req.length > 0) {

 var elt = form.elements[act_name];
 if (elt != null) {

 var search = act_name + '=';
 // alert("search=" + search);
 var pos = act_req.indexOf(search);
 // alert("pos=" + pos);
 var val = act_req.substring(pos + search.length, 1000);
 if (val != null && val.length > 0) {
 if ((pos = val.indexOf('&')) > 0)
 val = val.substring(0, pos);
 // alert("val=" + val);
 elt.value = val;
 }
 }
 }
 }
 */

// Rückgabe der Form mit Index idx
function getHtmlForm(idx) {
    var form = document.forms[idx];

    if (form == null) {
        form = document.layers[idx].document.forms[idx];
    }
    return form;
}

function findLayer(name)
{
    if (window.document.getElementById) {              // prüft, ob es die Methode getElementById gibt (DOM-kompatibler Browser)
        return window.document.getElementById(name);
        // nutzt die DOM-Methode, um das Element zu finden
    }
    else if (document[name]) {                       // Browser ist nicht DOM-kompatibel; Netscape Communicator 4.x legt alle Elemente auch direkt in das document-Objekt
        return document[name];
        // wenn es das Objekt mit dem Namen gab, geben wir es zurück
    }
}

function openList(id, len, listid) {
    if (findLayer(id).style.display == "none") {
        if (document.all) {
            if (len > 11) {
                findLayer(listid).style.height = "350px";
                findLayer(listid).style.overflowY = "scroll";
            }
            else
                findLayer(listid).style.height = "auto";
            findLayer(id).style.display = "block";
        }
        else {
            findLayer(id).style.display = "table-row";
        }
    }
    else
        findLayer(id).style.display = "none";
}

function openElement(id) {
    if (findLayer(id).style.display == "none") {
        if (document.all) {
            findLayer(id).style.display = "block";
        }
        else {
            findLayer(id).style.display = "table-row";
        }
    }
    else
        findLayer(id).style.display = "none";
}

function closeList(id) {
    findLayer(id).style.display = "none";
}

function getLocationURL(index) {
    var action_old = window.location.href;
    return action_old.substr(0, action_old.indexOf(index));
}

function setTooltip(obj) {
    var title = obj.value;
    obj.title = title;
}



