﻿


function checkinit(objt, str) {
    // alert(objt.value+"\n"+str);
   
    if(objt.value==str)
    {
        objt.style.color = "#666";
        objt.value = "";
    }
}

function checkinit1(objt, str) {
    // alert(objt.value+"\n"+str);
    if (objt.value == "") {
        objt.style.color = "#666";
        objt.value = str;
    }
   
}

var innerContent = "";
var obj1, obj2, xmlHttpcomment;
function checkInputComment(objuname,objcontent) {

    obj1 = objuname;
    obj2 = objcontent;
    if (obj1.value.length == 0 ) {
        alert("请填写你的网名！");
        obj1.focus();
        return false;
    }
    if (obj2.value.length == 0 || obj2.value == "请填写详细的评论内容") {
        alert("请填写评论内容！");
        obj2.focus();
        return false;
    }
    Url = "/AjaxPage/commentadd.aspx?username=" + escape(obj1.value) + "&text=" + escape(obj2.value);
    if (window.ActiveXObject) {
        xmlHttpcomment = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttpcomment = new XMLHttpRequest();
    }
    else {
        alert("对象创建失败");
    }
    xmlHttpcomment.onreadystatechange = CommentSuc;
    xmlHttpcomment.open("GET", Url, true);
    innerContent = document.getElementById("div_comment_subject_inner").innerHTML;
   // alert(innerContent);
    document.getElementById("div_comment_subject_inner").innerHTML = "正在提交...";
    xmlHttpcomment.send(null);

}

function CommentSuc() {

    if (xmlHttpcomment.readyState == 4) {
        if (xmlHttpcomment.status == 200) {
            
           // obj1 = document.getElementById("txtcommenttitle");
            obj2 = document.getElementById("areacommentcontent");
            obj2.value = "";
            document.getElementById("div_comment_subject_inner").innerHTML = innerContent;
            alert("感谢您的评论,客服工作人员会尽快审核！");
        } else {
        alert("服务器繁忙，请稍候再试！");
        document.getElementById("div_comment_subject_inner").innerHTML = innerContent;
        }

    }
    else {
        //document.getElementById("div_commentlist").innerHTML = "正在读取数据...";
    }

    
    //alert(document.getElementById("div_comment_subject_inner").innerHTML);

}
   