$(document).ready(function(){
    //Sign in button handler - Show the login box
    $("#member-actions-sign-in a").click(function(){
            $('#member-login').fadeIn('slow');
            $('#member-actions ul').fadeOut('slow');
            return false;
    });

    //Close button handler - Hide login box
    $("#member-login a.close").click(function(){
            $('#member-login').fadeOut('fast');
            $('#member-actions ul').fadeIn('fast');
            return false;
    });

    //Hide login box on load
    $("#member-login").hide();

    //Login box labels
    $(".label input").each(function(){
            var defaultLabel = $(this).attr('title');
            //Set the value to be the default label
            $(this).val(defaultLabel);
            //if it's a password input convert it to text for now
            /*if($(this).parents('div').hasClass('password')){
                            $(this).clone().addClass('temp').attr('type','text').bind('click',function(){
                                    $(this).hide().siblings('input').show().focus();
                            }).appendTo('.password');
                            $(this).hide();
            }*/
            //on focus delete the label
            $(this).focus(function(){
                    if($(this).val() == defaultLabel) {
                            $(this).val('');
                    }
                    /*if($(this).parents('div').hasClass('password')){
                            $(this).hide().siblings('input').show().focus();
                    }*/


            });
            //on blur replace the label if empty
            $(this).blur(function(){
                    if($(this).val() == defaultLabel || $(this).val() == '') {
                            $(this).val(defaultLabel);
                    }
                    /*if($(this).parents('div').hasClass('password')){
                            $(this).hide().siblings('input').addClass('error');
                    }*/
            });
    });
});
