﻿Type.registerNamespace("Lush");

/// DEALS WITH THE COLLAPSING/EXPANDING OF LISTS SUCH AS THE LINKS PAGE
Lush.CollapsingList = function() {
    this._listItems = new Array();
}

Lush.CollapsingList.prototype = {
    addItem: function(headerElement, listElement) {
        //Add it to our list of controls
        Array.add(this._listItems, new Lush.CollapsingListItem(headerElement, listElement));
        headerElement.collapsingListMgr = this;
        listElement.collapsingListMgr = this;
    },
    
    dispose: function() {
    }
}
Lush.CollapsingList.registerClass('Lush.CollapsingList', null, Sys.IDisposable);

//Internal class so we can store source/target for collapses
Lush.CollapsingListItem = function (headerElement, listElement) {
    this.header = headerElement;
    this.list = listElement;
    
    this.header.targetList = this.list;
    
    Sys.UI.DomElement.addCssClass(this.list, 'hidden');
    Sys.UI.DomElement.addCssClass(this.header, 'clickable');
    $addHandler(this.header, "click", this.headerClick);
}

Lush.CollapsingListItem.prototype = {
    headerClick: function(header) {
        Sys.UI.DomElement.toggleCssClass(this.targetList, 'hidden');
    },
    
    dispose: function() {
    }
}
Lush.CollapsingListItem.registerClass('Lush.CollapsingListItem', null, Sys.IDisposable);

// Notify ScriptManager that this is the end of the script.
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
