﻿
$(function() {
 
$("#btnSearch1").click(function() {
    var v = $("#txtSearch1").val();
    if (v.length == 0 || v == "请输入关键字") {
        $("#txtSearch1").val("请输入关键字");
        return;
    }

    location.href = "/MyChannel/Slist.aspx?keyword=" + escape(v);


});
});



//取得评论
function GetNewsbyPiD(pageIndex) {

    $.get("/ashx/GuestBook.ashx", { a: "" + Math.random() + "", cid: request("channel"), pIndex: pageIndex, type: "0" }, function(data) {
    $("#comment").html(data);
        getPage(pageIndex);
    });

}
function getPage(pageIndex) {
    $.get("/ashx/GuestBook.ashx", { a: "" + Math.random() + "", cid: request("channel"), pIndex: pageIndex, type: "2" }, function(data) {
    $(".t_fy").html(data);

    });
}

//添加留言
function addComment() {

    var content1 = $("#txtcomment").val();
    if (content1.length < 2 || content1.length > 200) {
        alert("评论内容在2-200字之间");
        return;
    }
    $.get("/ashx/GuestBook.ashx", { a: "" + Math.random() + "", cid: request("channel"), content: content1, type: "3" }, function(data) {
        if (data == "0")
            alert("您还未登录，不能评论");
        else if (data == "1") {
            alert("评论成功");
            $("#txtcomment").val("");
            scroll(0,0);
        }
        else if (data == "2")
            alert("评论失败");
        else
            alert(data);
    });
}
//取得评论总数
function GetNewsCount() {

    $.get("/ashx/GuestBook.ashx", { a: "" + Math.random() + "", cid: request("channel"), type: "4" }, function(data) {
    $(".b_right").html(data);
       
    });

}

//取得登录会员
function GetMember() {

    $.get("/ashx/GuestBook.ashx", { a: "" + Math.random() + "", cid: request("channel"),  type: "5" }, function(data) {
    $(".p_top").html(data);

    });

}
