function showRegister(){
    var regDiv = 'RegisterBox';
    if($('#'+regDiv).length == 0){
        $.get('register.php', function(data) {
            var div = $("<div id='"+regDiv+"'>").html('Loading');
            $('#BottomLine').prepend(div); 
            $('#'+regDiv).html(data);
            $('#'+regDiv).fadeIn('normal');   
        });  
    }else{
        if($('#'+regDiv).css('display') == 'none'){
            $('#'+regDiv).fadeIn('normal');  
        }else{
            $('#'+regDiv).fadeOut('normal');      
        }
    }    
}

function Register() {
    var form = 'RegForm';
    $.post("register.php?action=1",
           $('#'+form).serialize(),
           function(data){
               var res = eval('('+data+')');  
               if($("#RegStatus").css('display') != 'none'){    
                    $("#RegStatus").fadeOut('normal', function(){
                        $("#RegStatus").html(res.msg);
                        $("#RegStatus").fadeIn('normal');    
                    });    
               }
               else{
                    $("#RegStatus").html(res.msg);
                    $("#RegStatus").fadeIn('normal');    
               }

               if(res.status == 1) {
                document.location.href="/login.php";
               }
           }
        );
} 

function rand ( n )
{
  return ( Math.floor ( Math.random ( ) * n + 1 ) );
}

function reload_image(){
    var now = rand(10000);
    $('#auth_code').attr({ src: "img_auth.php?what="+now, alt: "Bot Captcha" });
}
