﻿//----------------------------------------------
// NOTE: We use jQuery in compatibility mode due to the
//       ShareThis button including MooTools which breaks
//       jQuery.... doh!
//----------------------------------------------


jQuery.noConflict();


// Create the main namespace
var DeadLetter = {};

// Create the Forms & Controls namespace
DeadLetter.Forms = {};
DeadLetter.Controls = {};


//-----------------
// Namespace: DeadeLetter.Global
DeadLetter.Global = (function() {

    return {
        Initialise: function() {

            // Enables the Flowplayer jQuery Tools overlay function (lightboxing)
            jQuery("img[rel]").overlay({ expose: '#000', effect: 'apple' });

            // Executes the cufon dynamic text replacement method for IE
            Cufon.now();
        }
    };

})();


//-----------------
// Namespace: DeadeLetter.Controls.Login
DeadLetter.Controls.Login = (function() {

    //------
    // 
    var UsernameOnFocus = function() {
        this.emailCtrl.val("");
    };

    //------
    //
    var PasswordOnFocus = function() {
        if (this.emailCtrl.val() == "") {
            this.passwordCtrl.val("");
        }
    };

    return {
        //------
        // 
        InitialiseAuthenticated: function() {

        },

        //------
        // 
        InitialiseUnauthenticated: function(userTextId, passwordTextId) {
            this.emailCtrl = jQuery("#" + userTextId);
            this.emailCtrl.focus(jQuery.proxy(UsernameOnFocus, this));

            this.passwordCtrl = jQuery("#" + passwordTextId);
            this.passwordCtrl.focus(jQuery.proxy(PasswordOnFocus, this));
        }
    };

})();


