﻿/// <reference name="MicrosoftAjax.js"/>

Type.registerNamespace("BandSite");

BandSite.Guestbook = function(element) {
    BandSite.Guestbook.initializeBase(this, [element]);
}

BandSite.Guestbook.prototype = {
    initialize: function() {
        BandSite.Guestbook.callBaseMethod(this, 'initialize');
        
        // Add custom initialization here
        var that = this;
        this._commentList.set_foreignID(this._bandID);
        // this._commentList.loadList();
        
        this._commentList.add_constructingNewComment(
            function(sender, e) {
                e.item.IsGuestbookComment = true;
            }
        );
        
        this._commentList.add_listLoaded(
            function(sender, e) {
                that._panelSet.showPanel("GuestbookPanel");
            }
        );
    },
    dispose: function() {        
        //Add custom dispose actions here
        BandSite.Guestbook.callBaseMethod(this, 'dispose');
    },
    
    // So we can "lazy-load" the section only when its menu button is clicked on...
    resetSection: function() {
        this._panelSet.showPanel("LoadingPanel");
        this._commentList.loadList();    
    }
}
BandSite.Guestbook.createProperty("bandID");
BandSite.Guestbook.createProperty("panelSet");
BandSite.Guestbook.createProperty("commentList");
BandSite.Guestbook.registerClass('BandSite.Guestbook', Sys.UI.Control);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
