﻿/// <reference name="MicrosoftAjax.js"/>

Type.registerNamespace("BandSite");

BandSite.Home = function(element) {
    BandSite.Home.initializeBase(this, [element]);
}

BandSite.Home.prototype = {
    initialize: function() {
        BandSite.Home.callBaseMethod(this, 'initialize');
        
        // Add custom initialization here
        var that = this;

        $addHandlers(this._latestReleaseDiv, {click: this._latestReleaseClicked}, this);
        $addHandlers(this._latestGalleryDiv, {click: this._latestGalleryClicked}, this);
        
        this._futureShowGrid.add_itemClicked(
            function(sender, e) {
                $find("ShowSection").selectFutureShow(e.id);                
                $find("MenuPanel").selectPage("Shows");
            }
        );

    },
    dispose: function() {        
        //Add custom dispose actions here
        BandSite.Home.callBaseMethod(this, 'dispose');
    },
    
    _latestReleaseClicked: function() {
        $find("MusicSection").loadAlbum(this._latestReleaseID);
        $find("MenuPanel").selectPage("Music");
    },
    
    _latestGalleryClicked: function() {
        $find("MenuPanel").selectPage("Photos");
        $find("PhotoSection").loadGallery(this._latestGalleryID);
    }
    
}
BandSite.Home.createProperty("bandID");
BandSite.Home.createProperty("futureShowGrid");
BandSite.Home.createProperty("latestReleaseDiv");
BandSite.Home.createProperty("latestReleaseID");
BandSite.Home.createProperty("latestGalleryDiv");
BandSite.Home.createProperty("latestGalleryID");
BandSite.Home.registerClass('BandSite.Home', Sys.UI.Control);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
