window.onload = initialize;

function initialize()
{
    // initialize the DHTML History framework
    dhtmlHistory.initialize();
    // subscribe to DHTML history change events
    dhtmlHistory.addListener(historyChange);
}

function historyChange(url,complexObject)
{
    container=complexObject.container;
    options=complexObject.options;
    if(options.parameters && options.parameters.split('=')[0]=="mainlink")
    {
        url=url.split('?')[0];//remove the parameters added in mainlink
    }
    if (url == "")
    {
        window.location.href=window.location.href;//refresh the page
    }
    else
    {
        new Ajax.Updater(container,url,options);
    }
    return false;
}