$("document").ready(function(){
    
    $("#header1_wrap a").mouseover(function(){
        $(this).animate({
            "padding-top":"+=2px"
        },100);
    });
    
    $("#header1_wrap a").mouseout(function(){
        $(this).animate({
            "padding-top":"-=2px"
        },100);
    });

    $("#account_wrap_top_username,#account_wrap_top_dd").mouseover(function(){
        $("#account_wrap_top_dd").show();
    });
    $("#account_wrap_top_username,#account_wrap_top_dd").mouseout(function(){
        $("#account_wrap_top_dd").hide();
    });
    
    getAccountDetail();
    
});

function clearValue(obj){
    if(obj.val()=="ค้นหา"){
        obj.val("");
    }
}

function getAccountDetail(){
    $.post("ajaxGetBalance.php",function(response){
        if(response!=""){
            response = $.parseJSON(response);
            expire = response.expire;
            balance = response.balance;
            maxFile = response.maxFile;
            nowFile = response.nowFile;
            income = response.income;
            $("#account_balance_ajax").html("ยอดเงิน "+balance+" Credit หมดอายุ "+expire);
            $("#account_filenum_ajax").html("ไฟล์: "+nowFile+"/unlimited");
            $("#account_income_ajax").html("รายได้: "+income+" Credit");
            setTimeout("getAccountDetail()",10000); //30 sec//
        }
    });
}

