﻿function PrepareActivityComment(activityID, page) {
    var ajax = new Ajax();
    var url = "ActivityComment.aspx?ActivityID=" + activityID + "&Page=" + page;
    ajax.RequestURL(url, DealActivityComment);
}
function DealActivityComment(commentContent) {
    var divObj = document.getElementById("Comment-Box");
    divObj.innerHTML = commentContent.substr(0, commentContent.lastIndexOf("#"));
}


function PostActivityComment(activityID, page) {
    var editorName = "Content";
    var commentObj = document.getElementById(editorName);
    var commentContent = commentObj.value;
    if (commentContent.length < 1) {
        alert("请输入评论内容");
        return;
    }
    var url = document.location.href;
    var postData = "CommentActivityID=" + activityID + "&CommentContent=" + escape(commentContent) + "&Action=Comment";
    var ajax = new Ajax();
    ajax.PostURL(url, postData, DealActivityComment1);
}
function DealActivityComment1(content) {
    var alertMessage = "您还没有登陆！";
    if (content == "1") {
        alertMessage = "提交成功，正在审核中..";
       // PrepareActivityComment(activityID);
    }
    else {
        if (content == "2") {
            alertMessage = "您提交的频率过快！";
        }
        else if (content == "3") {
            alertMessage = "请输入评论内容！";
        }
    }
    alert(alertMessage);
}

function GoActivityPage(page) {
    PrepareActivityComment(activityID, page);
}


function PrepareLogin() {
    var userName = document.getElementById("UserName");
    var password = document.getElementById("Password");
    if (userName.value == '') {
        alert("请输入用户名！");
        return;
    }
    if (password.value == '') {
        alert("请输入密码！");
        return;
    }
    var url = document.location.href;
    var postData = "UserName=" + userName.value + "&Password=" + password.value + "&Action=Login";
    var ajax = new Ajax();
    ajax.PostURL(url, postData, DealLogin);
}
function DealLogin(name) {
    if (name == "1") {
        alert("登陆失败！");
        return;
    }
    var divObj = document.getElementById("name-ajax");
    divObj.innerHTML = name;
}


//复制网址
function CopyAddress() {
    clipboardData.setData('text', document.title + window.location.href);
    alert("复制成功，您可以将此链接粘贴到QQ、MSN等发送给你的好友！");
}