﻿//检测是否已登录
function checkislogin() {
    $.ajax({
        url: "/ajax.aspx?q=checkcookie&time=" + new Date().toString(),
        type: 'GET',
        timeout: 30000,
        beforeSend: function() {
            $("#login").html("装载中...");
        },
        error: function() {//未登录            
            $("#login").html("<a href=\"/login.aspx?returnurl=http://www.meilieasy.com/zengsong/\">登录</a> | <a href=\"/Register.shtml\">注册</a> ");
        },
        success: function() {
            var $result = Number(arguments[0].split("-|-")[0]);
            if ($result > 0) {
                //已登录,直接显示会员名
                $("#login").html(arguments[0].split("-|-")[1] + ",您好!&nbsp;<a href=\"/Members/\" target=\"_blank\">账户</a>&nbsp;|&nbsp;<a href=\"/logout.aspx\">[退出]</a>");
            }
            else {
                $("#login").html("<a href=\"/login.aspx?returnurl=http://www.meilieasy.com/zengsong/\">登录</a> | <a href=\"/Register.shtml\">注册</a> ");
            }
        }
    });
}

//获取该心得贴子的回复数
function getreply($topicid) {
    $.ajax({
        url: "/ajax.aspx?q=getreply&tid=" + $topicid + "&time=" + new Date().toString(),
        type: 'GET',
        timeout: 30000,
        beforeSend: function() {
            $("#bbscomment").html("装载中...");
        },
        error: function() {//获取回复数失败
            $("#bbscomment").html("获取信息失败");
        },
        success: function() {
            var $result = arguments[0];
            $("#bbscomment").html($result);
        }
    });
}

//获取该类别的相关试用心得
function getxglist($classid) {
    $.ajax({
        url: "/ajax.aspx?q=getxglist&classid=" + $classid+ "&time=" + new Date().toString(),
        type: 'GET',
        timeout: 30000,
        beforeSend: function() {
            $("#xglist").html("装载中...");
        },
        error: function() {//获取回复数失败
            $("#xglist").html("获取列表失败");
        },
        success: function() {
            var $result = arguments[0];
            $("#xglist").html($result);
        }
    });
}