/**
 * UCMVC Native Database Authentication JavaScript.
 * This file should be rendered on any page where user
 * authentication is processed).
 *
 * @author Kyle B. Thomas <k.thomas@unmarkedconsulting.com>
 * @copyright Copyright (c) 2008-2009, Kyle B. Thomas. All rights reserved.
 * @category UCMain
 * @package UCMain_JS
 */
$(document).ready(function() {
    var loginClick = 0;
    var passwordClick = 0;

    /**
     * Clear the contents of the e-mail login field when clicked.
     */
    $('#loginEmail').click(function() {
        if (loginClick == 0) {
            loginClick++;
            $(this).val('');
        }
        return false;
    });

    /**
     * Clear the contents of the password login field when focused.
     */
    $('#loginPassword').focus(function() {
        if (passwordClick == 0) {
            passwordClick++;
            $('.pass').html('<input name="password" type="password" id="loginPassword" value="" />');
            setTimeout("$('#loginPassword').focus();", 100);
        }
        return false;
    });

    /**
     * Clear the contents of the password login field when clicked.
     */
    $('#loginPassword').click(function() {
        if (passwordClick == 0) {
            passwordClick++;
            $(this).val('');
            $('.pass').html('<label for="password">Password:</label><input name="password" type="password" id="loginPassword" value="" />');
            $('#loginPassword').focus();
        }
        return false;
    });
});
