var LCO = null;

// class definition
function MainLC()
{
    this.m_tocState = "site";
}

// member function prototypes
MainLC.prototype = new EventController();

MainLC.prototype.getTocState = function()
{
    return this.m_tocState;
}
MainLC.prototype.setTocState = function(tocState)
{
    this.m_tocState = tocState;
}

MainLC.prototype.handleEvent = function(source)
{
    if (source.getEvent() == "E_ADVANCE_SEARCH_SUBMIT")
    {
        var f = source.advancedTile.getElement();
        f.target = "mainFrame";
        source.advancedTile.processAdvanced(source.advancedTile.getElement());
        return true;
    }
    else if (source.getEvent() == "E_CANCEL_USERPREF")
    {
        var targetFrame = document.getElementById("mainFrame");
        targetFrame.contentWindow.location.href = "template.htm?view=home";
        return true;
    }
    else if (source.getEvent() == "E_ADVANCE_SEARCH_CANCEL")
    {
        var targetFrame = document.getElementById("mainFrame");
        targetFrame.contentWindow.location.href = "template.htm?view=home";
        return true;
    }
    else if (source.getEvent() == "E_BROWSE_VIEW")
    {
        // Since we are only storing state don't say we handled the event.
        this.m_tocState = "site";
        return false;
    }
    else if (source.getEvent() == "E_BROWSE_VIEW_CATEGORY")
    {
        // Since we are only storing state don't say we handled the event.
        this.m_tocState = "category";
        return false;
    }
    else if (source.getEvent() == "E_MULTI_PRINT")
    {
        var targetFrame = document.getElementById("mainFrame");
        targetFrame.contentWindow.location.href = "template.htm?view=print";
        return true;
    }
    else if (source.getEvent() == "E_PRINT_CANCEL")
    {
        var targetFrame = document.getElementById("mainFrame");
        targetFrame.contentWindow.location.href = "template.htm?view=home";
        return true;
    }
    else
    {
        return false;
    }
}


function MainLCInit()
{
    LCO = new MainLC();
}

