﻿function initializeLoginForm() {
    if ($('.TbUsername').val() == null || $('.TbUsername').val() == '') {
        $('.tbUsername_fake').css('z-index', '2');
        $('.TbUsername').css('z-index', '1');
    }
    else {
        $('.tbUsername_fake').css('z-index', '1');
        $('.TbUsername').css('z-index', '2');
    }

    if ($('.TbPassword').val() == null || $('.TbPassword').val() == '') {
        $('.tbPassword_fake').css('z-index', '2');
        $('.TbPassword').css('z-index', '1');
    }
    else {
        $('.tbPassword_fake').css('z-index', '1');
        $('.TbPassword').css('z-index', '2');
    }

    $('.tbUsername_fake').bind('click', function () {
        $(this).css('z-index', '1');
        $('.TbUsername').css('z-index', '2').focus();
    });
    $('.TbUsername').live('blur', function () {
        if ($(this).val().length == 0) {
            $('.tbUsername_fake').css('z-index', '2');
            $(this).css('z-index', '1');
        }
    });

    $('.tbPassword_fake').live('click', function () {
        $(this).css('z-index', '1');
        $('.TbPassword').css('z-index', '2').focus();
    });

    $('.TbPassword').live('focus', function () {
        $(this).css('z-index', '1');
        $('.TbPassword').css('z-index', '2');
    });

    $('.TbPassword').live('blur', function () {
        if ($(this).val().length == 0) {
            $('.tbPassword_fake').css('z-index', '2');
            $(this).css('z-index', '1');
        }
    });
}
