
$(document).ready(function() {

    $(function(){
        $('#username').focus();
    });

    $('#submit').click(function() {
        jajax('/code/auth/login', {
            formid:'loginForm',
            fun:function(result) {
                if  (result.status == 1){
                    document.location.href=result.redirect;
                } else {
                    if (typeof result.messages != 'undefined') {
                        $('#errorBox').html(result.messages.join('<br/>'));
                        $('.message-box .error-msg').show();
                        if($.browser.msie && $.browser.version==6){
                               switch(result.messages.length){
                                   case 2:
                                       $(".coner.for-error-msg.bl").css("margin-bottom","2px");
                                       $(".coner.for-error-msg.br").css("margin-bottom","0px");

                                       $(".coner.for-fff-parent.bl").css("margin-bottom","-1px");
                                       $(".coner.for-fff-parent.br").css("margin-bottom","-1px");
                                       break;
                                   case 1:
                                       $(".coner.for-error-msg.bl").css("margin-bottom","1px");
                                       $(".coner.for-error-msg.br").css("margin-bottom","-1px");

                                       $(".coner.for-fff-parent.bl").css("margin-bottom","-2px");
                                       $(".coner.for-fff-parent.br").css("margin-bottom","-2px");
                                       break;
                                   default:
                                       break;
                               }
                        }
                    }
                }
            }
        });
        return false;
    });

});

