function Navbar (name)
{
    this.name = name;
    this.url = new Array();
    this.label = new Array();
}

Navbar.prototype.AddButton = function (url, label)
{
    this.url[this.url.length] = url;
    this.label[this.label.length] = label;
}

Navbar.prototype.NumButtons = function ()
{
    return this.url.length;
}

Navbar.prototype.URL = function (n)
{
    return this.url[n];
}

Navbar.prototype.label = function (n)
{
    return this.label[n];
}

Navbar.prototype.Goto = function (i)
{
    var url = this.url[i];
    if (url != this.CurrentPage())
    {
        if (url == '')
            alert ('Sorry, the "' + this.label[i] + '" page is not yet available.');
        else
            location = url;
    }
}

Navbar.prototype.Show = function ()
{
    document.writeln ('<table class="navbar"><tr>');
    for (var i=0; i<this.NumButtons(); ++i)
    {
        document.write ('<td name="', this.url[i], '" onClick="', this.name, '.Goto(', i, ');"');
        if (this.url[i] != this.CurrentPage())
            document.write (' class="selectable"');
        document.writeln ('>', this.label[i], '</td>');
    }
    document.writeln ('</tr></table>');
}

Navbar.prototype.CurrentPage = function ()
{
    var locar = document.location.pathname.split('/');
    var currpage = locar[locar.length - 1];
    if (currpage == '') currpage = 'index.html';
    return currpage;
}