﻿
function GetXmlHttpObject() {
    var xHttp = null;
    try {
        xHttp.setRequestHeader("If-Modified-Since", "0");
        xHttp.setRequestHeader("Cache-Control", "no-cache");
        xHttp = new XMLHttpRequest();
    }
    catch (e) {
        if (document.all) {
            try {
                xHttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e) {
                xHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
        else {
            xHttp =new XMLHttpRequest();


        }
       
    }
    return xHttp;
}

var xmlHttp = null;


function CheckUserState(typeid,m) {
//    xmlHttp = null;
//    xmlHttp = GetXmlHttpObject();
//    if (xmlHttp == null) {
//        alert("您的浏览器不支持AJAX！");
//        return;
//    }
//    var url = "mingshi.aspx?infoID=" + typeid+"&m="+m;

//    xmlHttp.open("GET", url, true);
//    xmlHttp.onreadystatechange = abcf;
    //    xmlHttp.send(null);
    window.location.href = "teacherpersonal.aspx?teacherID=" + m;


}

//function abcf() {
//    if (xmlHttp.readyState == 4) {

//        var responsetext = xmlHttp.responseText;
//        $('video').innerHTML = responsetext;
//       

//    }
//}
function Scroe(temp,value) {
    xmlHttp = null;
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("您的浏览器不支持AJAX！");
        return;
    }
    var url = "Four/Scroe.aspx?temp=" + temp + "&value=" + value;

    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = ScroeBack;
    xmlHttp.send(null);
}
function ScroeBack() {
    if (xmlHttp.readyState == 4) {
        var responsetext = xmlHttp.responseText;
        if (responsetext == "1") {
            setTimeout(ab(), 3000);
        }
        else if (responsetext == "0") {
            alert("您已经评价过了");
        }
        else {
            alert("评分失败");
        }
    }
}
function pingfen(temp){
 $('#demo1').rater(null, { maxvalue: 5, curvalue: 3 }, function (el, value) {
     $("#demo2").html("<font color=\"red\" style=\"font-size:14px;\">" + (value*2) + "分</font>");
     tijiao(temp, (value * 2))
 });
}
function tijiao(temp, value) {
    Scroe(temp, value);
}

function ab() {
    alert("正在提交请稍后...");
    window.location = window.location;
    //window.close();
}
//单击视频是执行的函数
function diaoyong(temp) {
    xmlHttp = null;
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("您的浏览器不支持AJAX！");
        return;
    }
    var url = "Four/Relatedvideo.aspx?temp=" + temp;
    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = VideoBack;
    xmlHttp.send(null);
}
function VideoBack() {
    if (xmlHttp.readyState == 4) {
        var responsetext = xmlHttp.responseText;
        document.getElementById("video_introduction").innerHTML = "";
        document.getElementById("video_introduction").innerHTML = responsetext;
        document.getElementById("main1").innerHTML = "";
        document.getElementById("main2").style.display = "block";
    }
}
function imgFace(x,y) {
    xmlHttp = null;
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("您的浏览器不支持AJAX！");
        return;
    }
    var url = "Four/ImageFaceQQ.aspx?x="+x+"&y="+y;
    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = imgFaceBack;
    xmlHttp.send(null);
}
function imgFacePage(currentPage,rowCount,colCount,x,y) {
    xmlHttp = null;
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("您的浏览器不支持AJAX！");
        return;
    }
    var url = "Four/ImageFaceQQ.aspx?currentPage=" + currentPage + "&rowCount=" + rowCount + "&colCount=" + colCount+"&x="+x+"&y="+y;
    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = imgFaceBack;
    xmlHttp.send(null);
}
function imgFaceBack(e) {
    if (xmlHttp.readyState == 4) {
        if (xmlHttp.status == 200) {
   
            var strs = xmlHttp.responseText;
            var str = strs.split(",");
            LeftLimt = str[1];
            RightLimt = str[2];
            x = str[6];
            y = str[7];
            var sb = "<table id=\"tblFace\" cellpadding=\"1\" cellspacing=\"1\">" + str[0] + "</table><div id=\"divShowBig\" style=\"width: 86px; height: 86px; border: 1px #0000FF solid; display: none; position: absolute; z-index: 999; background-color: #FFFFFF;\"></div><div id='navigation'>" + str[3] + "&nbsp;&nbsp;<a href='javascript:imgFacePage(" + str[4] + ",8,9,x,y)' id='linkPrev'>上一页</a>&nbsp;&nbsp;&nbsp;<a href='javascript:imgFacePage(" + str[5] + ",8,9,x,y)' id='linkNext'>下一页</a></div>";
            var tooltip = "<div id='tooltip'>" + sb + "<\/div>"; //创建 div 元素
            $("body").append(tooltip); //把它追加到文档中						 
            $("#tooltip").css({
                "top": y + "px",
                "left": x + "px"
            }).show("fast");   //设置x坐标和y坐标，并且显示
         
        }
    }
}
var newsID = 0;
var number = 0;
function NewsorWebPingLun(ID, newsIDorWeb, textID) {
    newsID = newsIDorWeb;
    number = textID;
    var CommentNewCount = '' + document.getElementById("textarea" + ID).value;
    var temp = '';
    splitstring = CommentNewCount.split(" ");
    for (i = 0; i < splitstring.length; i++)
        temp += splitstring[i];

    if (temp == "") {
        alert("请输入数据");
        document.getElementById("textarea" + ID).focus();
        document.getElementById("textarea" + ID).value = "";
        return false;
    }
    xmlHttp = null;
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("您的浏览器不支持AJAX！");
        return;
    }
    var url = "CommonNewsPinglun/NewsPingLun.aspx?CommentNewCount=" + temp + "&newsIDorWeb=" + newsIDorWeb;

    xmlHttp.open("GET", url, true);
    xmlHttp.onreadystatechange = NewsorWebPingLunBack;
    xmlHttp.send(null);
}
function NewsorWebPingLunBack() {
    if (xmlHttp.readyState == 4) {
        if (xmlHttp.status == 200) {
            var count = xmlHttp.responseText;
            if (count =="1") {
                window.location.href = "Comment on.aspx?newsIDorWeb=" + newsID + "&number=" + number;
                return true;
            }
            else {
                return false;
            }
        }
    }
}








