var textOldOnload = window.onload;

window.onload = function()
{
    if (typeof textOldOnload == 'function')
    {
         textOldOnload();
    }

    window.textInstance = new text();
    textInstance.init();

}


text = function ()
{
    this.peopleContainer = null;
}

text.prototype.init = function()
{
    this.peopleContainer = document.getElementById('peopleContainer');
    if (!this.peopleContainer)
    {
        return;
    }

    this.assignPeopleBlockBehaviour();
}

text.prototype.assignPeopleBlockBehaviour = function ()
{
    var link = document.getElementById('peopleLink');
    if (!link)
    {
        return;
    }
    // assign handlers
    var inst = this;
    var params = { 'inst': this };

    link.blockUrl = link.href + '&block=people&random=' + Math.random();
    link.onclick = function()
    {
        var el = this;
        loadXmlHttp(el.blockUrl, inst.processPeopleBlockResponse, params);
        el = null;
        return false;
    }


}
text.prototype.processPeopleBlockResponse = function (xmlhttp, params)
{

    if (xmlhttp.readyState != 4)
    {
        return;
    }

    params.inst.peopleContainer.innerHTML = xmlhttp.responseText;
    params.inst.assignPeopleBlockBehaviour();

}


window.leafboxPostCallback = function(leafbox)
{
    // assign leafbox close call to main image
    var box = document.getElementById('fullImageBox');
    if (!box)
    {
        return;
    }
    var link = box.getElementsByTagName('a')[0];
    if (!link)
    {
        return;
    }
    link.onclick = function()
    {
        hideleafbox();
        return false;
    }
}