/**
 * pageObject stuff
 */

if (!pageObject)
{
    var pageObject = {};
}

pageObject.getId = function()
{
    return this.id;
}

pageObject.getRef = function()
{
    return this.ref;
}

pageObject.getLang = function()
{
    return this.lang;
}

pageObject.getTitle = function()
{
    return this.title;
}

pageObject.getAuthor = function()
{
    return this.author;
}

pageObject.getKeywords = function()
{
    return this.keywords;
}

pageObject.getThread = function()
{
    return this.thread;
}

pageObject.getTags = function()
{
    return this.tags;
}

pageObject.hasTag = function(tag)
{
    return (this.tags.indexOf(tag) != -1);
}

pageObject.getTopic = function()
{
    return this.topic;
}

pageObject.setTopic = function(topic)
{
    this.topic = topic;
}

pageObject.getMarker = function()
{
    return this.marker;
}

pageObject.setMarker = function(marker)
{
    this.marker = marker;
}

pageObject.setMarkerParameter = function(name, value)
{
    if (typeof this.marker != "object")
    {
        this.marker = {};
    }
    this.marker[name] = value;
}

pageObject.getMarkerParameter = function(name)
{
    if (typeof this.marker == "object")
    {
        return this.marker[name];
    }
    return null;
}

/**
 * Accessibility stuff
 */

function accessiblePopup(elt, width, height)
{
    if (!width)
    {
        width = screen.width;
    }
    if (!height)
    {
        height = screen.height;
    }
    var left = Math.floor((screen.width - width) / 2);
    var top = Math.floor((screen.height - height) / 2);
    var popupWindow = window.open(
        elt.getAttribute('href'),
        elt.getAttribute('title'),
        "top=" + top + ", left=" + left + ", width=" + width + ", height=" + height + ", menubar=yes, toolbar=yes, resizable=yes, scrollbars=yes"
    );
    popupWindow.focus();
    return false;
}

function accessiblePrint(elt)
{
    if (window.print)
    {
        window.print();
    }
    else
    {
        window.location.href = elt.getAttribute('href');
    }
}

function accessibleAddToFavorite(elt)
{
    if (window.sidebar && window.sidebar.addPanel)
    {
        window.sidebar.addPanel(document.title, document.location.href, '');
    }
    else if (document.all && window.external)
    {
        window.external.AddFavorite(document.location.href, document.title);
    }
    else
    {
        window.location.href = elt.getAttribute('href');
    }
}
