/***********************************************************
* dom.js                                           by Ralp *
*   Common basic operations on the DOM tree                *
***********************************************************/

function getId(id) {
    if(document.getElementById)
        return document.getElementById(id);
    else if(document.all) // Fuck IE
        return document.all(id);
    return false;
}

function create(element) {
    if (document.createElementNS)
        return document.createElementNS('http://www.w3.org/1999/xhtml', element);
    else if (document.createElement) // Doublefuck IE
        return document.createElement(element);
    return false;
}

function hide(id) {
    getId(id).setAttribute("class", "hidden");
    //getId(id).style.display = <-- This is only an optional DOM method
    //getId(id).style.setProperty("display","none","important");
}
function show(id) {
    getId(id).removeAttribute("class");
    //getId(id).style.removeProperty("display");
}
function disableButton(id) {
    //getId(id).setAttribute("class", "disbutton");
    getId(id).className = "disbutton";
    getId(id).removeAttribute("href");
}
function enableButton(id) {
    //getId(id).setAttribute("class", "button");
    getId(id).className = "button";
    getId(id).setAttribute("href", "#");
}

function setText(id, string) {
    var textEl = getId(id).firstChild;
    getId(id).removeChild(textEl);
    textEl = document.createTextNode(string);
    getId(id).appendChild(textEl);
}
