
// 保存函数
var sightid=document.getElementById("sightid").value;
var AllComments=document.getElementById("AllComments");
var ajaxobj=new AJAXRequest;
	
function SaveComment() {
	var fullname=document.getElementById("fullname");
	var comment=document.getElementById("comment");
	var email=document.getElementById("email");

    if (comment.value==""){
        alert("评论不能为空，请重新输入！");
	    comment.focus();
	    return false;
    }
	// 创建AJAXRequest对象，详细使用见文章开始的链接
    ajaxobj.url="savegetcom.asp";
    ajaxobj.content="fullname="+escape(fullname.value)+"&comment="+escape(comment.value)+"&email="+escape(email.value)+"&sightid="+escape(sightid);
    ajaxobj.callback=function(xmlObj)
	{
        // 显示反馈信息
        AllComments.innerHTML=xmlObj.responseText;
    }
    ajaxobj.send();
	fullname.value = ""
	comment.value = ""
	email.value = ""
}

function GetComment()
{
    // 创建AJAXRequest对象
	//var ajaxobj=new AJAXRequest;
    // 提示用户正在恢复
    //AutoSaveMsg.innerHTML="正在恢复，请稍候……"
    ajaxobj.url="savegetcom.asp";
    ajaxobj.content="action=restore&sightid="+escape(sightid);
    ajaxobj.callback=function(xmlObj)
	{
        //AutoSaveMsg.innerHTML="恢复最后保存成功";
        // 如果内容为空则不改写textarea的内容
        if(xmlObj.responseText!="")
		{
            AllComments.innerHTML=xmlObj.responseText;
        }
    }
    ajaxobj.send()
}

