﻿var ajax = new Ajax();
var page=1;
ReadProductComment(page)
function PostProductComment()
{
    var str=getCookie("ProductComment"+productID);
    if(str=="")
    {         
        var commentObj=document.getElementById("productCommentContent");
        var commentContent = commentObj.value;
        if (commentContent.length < 1)
        {
            alert("请输入评论内容");
            return;
        }
        var url="ProductComment.aspx?Action=AddComment&ProductID=" + productID + "&CommentContent=" + escape(commentContent);
        ajax.RequestURL(url, DealPostProductComment);
    }
    else
    {
        alert("请不要频繁提交");
    } 
}
function DealPostProductComment(content)
{    
    alert(content);
    addCookie("ProductComment"+productID,"1",1);
    ReadProductComment(page)
}
function ReadProductComment(page)
{
    var url="ProductComment.aspx?Action=ReadComment&ProductID=" + productID+"&Page="+page;
    ajax.RequestURL(url,DealReadProductComment);
}
function DealReadProductComment(content)
{
    document.getElementById("productCommentAjax").innerHTML=content;
}
function GoPage(tempPage)
{
    page=tempPage;
    ReadProductComment(page);
}