(function () {
    /**
     * Initialize click-logic on the splash page
     * @module Allthat.GUI
     * @class Splash
     */
    var G = Allthat.namespace('Allthat.GUI'),
        W = Allthat.namespace('Allthat.Widget');
    
    G.Splash = new Class({
        Implements : [Events],
        initialize : function () {
            if (G.pageFinder.whereAmI() !== 'splash') { return; }
            this.initiazeLoginPopupWindow();
            this.initializeForgotPasswordUserNameCopy();
            
            this.fireEvent('initialize');
        },
                
        initiazeLoginPopupWindow : function () {
            $('login_popup_link').addEvent('click', function () {
                return W.Popup.create($('login_popup_link'), {
                    uniqueId : 'login_popup_link', 
                    toggleSelector : '#login_popup_link', 
                    closeSelector : '#login_popup_close', 
                    targetId : 'login_outer',  
                    leftOffset : 0, 
                    group : 'nav', 
                    execute : G.selectUsername
                });
            });
        },
        
        initializeForgotPasswordUserNameCopy : function () {
            $$('#forgot_password a')[0].addEvent('click', function (e) {
                e.preventDefault();

                $('forgot_email').set('value', $('login_username').get('value'));
                $('forgot_password').submit();

                return false;
            });
        }
    });
    
})();