JRButton = function(id, w, h, fce, caption) {
/*    var cssNode = document.createElement('link');
    cssNode.setAttribute('rel', 'stylesheet');
    cssNode.setAttribute('type', 'text/css');
    cssNode.setAttribute('href', '../ccs/Button.css');
    document.getElementsByTagName('head')[0].appendChild(cssNode);*/

    this.self = this;
    this.output = document.createElement("div");
    this.output.id = id;
    this.output.style.offsetWidth = w;
/*    this.output.style.border = "1px solid #c3c3c3";
    this.output.style.padding = "2px 2px 2px 2px";
    this.output.style.backgroundColor = "#f2f2f2";*/
//    this.h = h;
    this.fce = fce;
    this.caption = caption;


    this.select = document.createElement("table");
    this.select.className = "button";
//    this.select.style.width = (w - 2) + "px";
//    this.select.style.height = h + "px";
    this.row = this.select.insertRow(0);
    this.col = this.row.insertCell(0);

    this.a = document.createElement("a");
    this.a.innerHTML = this.caption;
    this.a.className = "buttoncaption";

    this.select.fce = this.fce;
    this.select.onclick = function() { 
        if (this.fce != null) {
            this.fce(this);
        }
    };
    this.select.onmouseover = function() { 
        buttonover(this);
    };
    this.select.onmouseout = function() { 
        buttonout(this);
    };
    this.col.appendChild(this.a);

    this.oblouk1 = document.createElement("div");
    this.oblouk1.className = "divbuttonoblouk1_1";

    this.oblouk2 = document.createElement("div");
    this.oblouk2.className = "divbuttonoblouk1_2";


    this.upper = document.createElement("div");
    this.upper.className = "divtopbutton";
    this.upper.appendChild(this.oblouk1);
    this.upper.appendChild(this.oblouk2);

    this.middle = document.createElement("div");
    this.middle.className = "divmiddlebutton";
    this.middle.appendChild(this.select);

    this.oblouk1 = document.createElement("div");
    this.oblouk1.className = "divbuttonoblouk1_1";

    this.oblouk2 = document.createElement("div");
    this.oblouk2.className = "divbuttonoblouk1_2";

    this.bottom = document.createElement("div");
    this.bottom.className = "divbottombutton";
    this.bottom.appendChild(this.oblouk2);
    this.bottom.appendChild(this.oblouk1);


    this.output.appendChild(this.upper);
    this.output.appendChild(this.middle);
    this.output.appendChild(this.bottom);
}

function buttonover(obj) {
//    obj.style.backgroundImage = "url(http://www.mhdspoje.cz/jrw20/png/buttonactive.PNG)";
    obj.style.cursor = "pointer";
}

function buttonout(obj) {
//    obj.style.backgroundImage = "url(http://www.mhdspoje.cz/jrw20/png/buttoninactive.PNG)";
    obj.style.cursor = "auto";
}

JRButton.prototype.getHeight = function() {
    return this.select.offsetHeight;
}

JRButton.prototype.show = function(tag) {
    tag.appendChild(this.output);
}