﻿/// <reference name="MicrosoftAjax.js"/>

Type.registerNamespace("BandSite");

BandSite.Biography = function(element) {
    BandSite.Biography.initializeBase(this, [element]);
}

BandSite.Biography.prototype = {
    initialize: function() {
        BandSite.Biography.callBaseMethod(this, 'initialize');
        
        // Add custom initialization here
        var that = this;
        
        $addHandlers(this._bandBioDiv, { click: this._bandBioDivClicked }, this);
        
        this._biographyListView.add_itemClicked(
            function(sender, e) {
                that._biographyViewPanelSet.showPanel('LoadingPanel');
                setTimeout(function() {
                    that._biographyViewPanelSet.showPanel('BandMemberBioPanel');
                }, 1000);        
            
                that._biographyDetails.set_itemID(e.id);
                that._biographyDetails.loadItem();                
            }
        );

//        if (this._biographyCount > 0) {
//            // this.loadBiography(this._biography1ID);
//            this._biographyDetails.set_itemID(this._biography1ID);
//            this._biographyDetails.loadItem();
//            
//            // this._biographyViewPanelSet.showPanel('BiographyViewPanel');
//        } else {
//            // this._biographyViewPanelSet.showPanel('NoBiographyPanel');
//        }

        

    },
    dispose: function() {        
        //Add custom dispose actions here
        BandSite.Biography.callBaseMethod(this, 'dispose');
    },
    
    _bandBioDivClicked: function() {
        var that = this;
        this._biographyViewPanelSet.showPanel('LoadingPanel');
        setTimeout(function() {
            that._biographyViewPanelSet.showPanel('BandBioPanel');
        }, 1000);
    }
}
BandSite.Biography.createProperty("bandID");
BandSite.Biography.createProperty("biographyViewPanelSet");
BandSite.Biography.createProperty("biographyListView");
BandSite.Biography.createProperty("biographyDetails");
//BandSite.Biography.createProperty("biographyCount");
//BandSite.Biography.createProperty("biography1ID");
BandSite.Biography.createProperty("bandBioDiv");
BandSite.Biography.registerClass('BandSite.Biography', Sys.UI.Control);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
