﻿$(function() {
    $('#d_logo').click(function() {
        GoUrl('/');
    });
    
    AjaxTip.Hide();
});

//设置顶部菜单样式
function SetTopMenuClass(id) {
    $('#top_menus > li').each(function() {
        var currentID = $(this).attr('id');
        
        if (currentID == id) {
            $('#'+currentID +' > a').attr('class', 'v2');
        }
        else {
            $('#'+currentID +' > a').attr('class', '');
        }

    });
}

//用户登录
function UserLogin(){
    if ($('#tbUserName').val() == '' || $('#tbUserName').val() == '老钱庄论坛帐号') {
        Dialog.Tip('用户名不能为空', 'Alert', function() {
            $('#tbUserName').focus();
        });
        return;
    }
    if ($('#tbPassword').val() == '') {
        Dialog.Tip('密码不能为空', 'Alert', function() {
            $('#tbPassword').focus();
        });
        return;
    }
    AjaxRequest.Post('btLogin',function(content){
        if (content['Status'] == 'Success') {
            GoUrl(content['Url']);
            return;
            
        }
        else {
            Dialog.Tip(content['Tip'], content['Status']);
        }
    });
}

//用户退出
function UserLogout(url){
    AjaxRequest.Get(url,function(content){
        var returnUrl = StringHelper.Clear(location.href, '#');
        GoUrl(returnUrl);
    });
}
