var XMLHttpReq;
//创建XMLHttpRequest对象     
function createXMLHttpRequest() {
    if (window.XMLHttpRequest) { //Mozilla 浏览器
        XMLHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) { // IE浏览器
        try {
            XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) { }
        }
    }
}

/*通过ajax获取学院信息*/
function Ajax_GetCollegeInfo() { 
    createXMLHttpRequest();
    /*为了避免浏览器读取缓存数据，加一个时间戳*/
    var timestamp = (new Date()).getTime();
    var url = "/CollegeInfo/GetCollegeInfo.php?collegeNumber=" + encodeURI(current_index) + "&timestamp=" + timestamp;
    XMLHttpReq.open("GET", url, true);
    XMLHttpReq.onreadystatechange = processCollegeInfoResponse; //指定响应函数
    XMLHttpReq.send(null);  // 发送请求
}

/*处理学院信息返回的函数*/
function processCollegeInfoResponse() {
    if (XMLHttpReq.readyState == 4) { // 判断对象状态
        if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
            DisplayCollegeInfoInfo();
            //setTimeout("sendRequest()", 1000);
        } else { //页面不正常
            alert(XMLHttpReq.status);
            window.alert("您所请求的页面有异常。");
        }
    }
}

/*显示修改后的学院信息*/
function DisplayCollegeInfoInfo() { 
    /*使用JSON数据格式*/ 
    var collegeInfo = eval('(' + XMLHttpReq.responseText + ')');
    var collegeNumber = collegeInfo["collegeNumber"];
    document.getElementById("collegeNumber_" + current_index).innerHTML = collegeNumber;
    var collegeName = collegeInfo["collegeName"];
    document.getElementById("collegeName_" + current_index).innerHTML = collegeName;
    var collegeBirthDate = collegeInfo["collegeBirthDate"];
    document.getElementById("collegeBirthDate_" + current_index).innerHTML = collegeBirthDate;
    var collegeMan = collegeInfo["collegeMan"];
    document.getElementById("collegeMan_" + current_index).innerHTML = collegeMan;
    var collegeTelephone = collegeInfo["collegeTelephone"];
    document.getElementById("collegeTelephone_" + current_index).innerHTML = collegeTelephone;
    var collegeMemo = collegeInfo["collegeMemo"];
    document.getElementById("collegeMemo_" + current_index).innerHTML = collegeMemo;
}
/*通过ajax获取专业信息*/
function Ajax_GetSpecialFieldInfo() { 
    createXMLHttpRequest();
    /*为了避免浏览器读取缓存数据，加一个时间戳*/
    var timestamp = (new Date()).getTime();
    var url = "/SpecialFieldInfo/GetSpecialFieldInfo.php?specialFieldNumber=" + encodeURI(current_index) + "&timestamp=" + timestamp;
    XMLHttpReq.open("GET", url, true);
    XMLHttpReq.onreadystatechange = processSpecialFieldInfoResponse; //指定响应函数
    XMLHttpReq.send(null);  // 发送请求
}

/*处理专业信息返回的函数*/
function processSpecialFieldInfoResponse() {
    if (XMLHttpReq.readyState == 4) { // 判断对象状态
        if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
            DisplaySpecialFieldInfoInfo();
            //setTimeout("sendRequest()", 1000);
        } else { //页面不正常
            alert(XMLHttpReq.status);
            window.alert("您所请求的页面有异常。");
        }
    }
}

/*显示修改后的专业信息*/
function DisplaySpecialFieldInfoInfo() { 
    /*使用JSON数据格式*/ 
    var specialFieldInfo = eval('(' + XMLHttpReq.responseText + ')');
    var specialFieldNumber = specialFieldInfo["specialFieldNumber"];
    document.getElementById("specialFieldNumber_" + current_index).innerHTML = specialFieldNumber;
    var specialFieldName = specialFieldInfo["specialFieldName"];
    document.getElementById("specialFieldName_" + current_index).innerHTML = specialFieldName;
    var specialCollegeNumber = specialFieldInfo["specialCollegeNumber"];
    document.getElementById("specialCollegeNumber_" + current_index).innerHTML = specialCollegeNumber;
    var specialBirthDate = specialFieldInfo["specialBirthDate"];
    document.getElementById("specialBirthDate_" + current_index).innerHTML = specialBirthDate;
    var specialMan = specialFieldInfo["specialMan"];
    document.getElementById("specialMan_" + current_index).innerHTML = specialMan;
    var specialTelephone = specialFieldInfo["specialTelephone"];
    document.getElementById("specialTelephone_" + current_index).innerHTML = specialTelephone;
    var specialMemo = specialFieldInfo["specialMemo"];
    document.getElementById("specialMemo_" + current_index).innerHTML = specialMemo;
}
/*通过ajax获取班级信息*/
function Ajax_GetClassInfo() { 
    createXMLHttpRequest();
    /*为了避免浏览器读取缓存数据，加一个时间戳*/
    var timestamp = (new Date()).getTime();
    var url = "/ClassInfo/GetClassInfo.php?classNumber=" + encodeURI(current_index) + "&timestamp=" + timestamp;
    XMLHttpReq.open("GET", url, true);
    XMLHttpReq.onreadystatechange = processClassInfoResponse; //指定响应函数
    XMLHttpReq.send(null);  // 发送请求
}

/*处理班级信息返回的函数*/
function processClassInfoResponse() {
    if (XMLHttpReq.readyState == 4) { // 判断对象状态
        if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
            DisplayClassInfoInfo();
            //setTimeout("sendRequest()", 1000);
        } else { //页面不正常
            alert(XMLHttpReq.status);
            window.alert("您所请求的页面有异常。");
        }
    }
}

/*显示修改后的班级信息*/
function DisplayClassInfoInfo() { 
    /*使用JSON数据格式*/ 
    var classInfo = eval('(' + XMLHttpReq.responseText + ')');
    var classNumber = classInfo["classNumber"];
    document.getElementById("classNumber_" + current_index).innerHTML = classNumber;
    var className = classInfo["className"];
    document.getElementById("className_" + current_index).innerHTML = className;
    var classSpecialFieldNumber = classInfo["classSpecialFieldNumber"];
    document.getElementById("classSpecialFieldNumber_" + current_index).innerHTML = classSpecialFieldNumber;
    var classBirthDate = classInfo["classBirthDate"];
    document.getElementById("classBirthDate_" + current_index).innerHTML = classBirthDate;
    var classTeacherCharge = classInfo["classTeacherCharge"];
    document.getElementById("classTeacherCharge_" + current_index).innerHTML = classTeacherCharge;
    var classTelephone = classInfo["classTelephone"];
    document.getElementById("classTelephone_" + current_index).innerHTML = classTelephone;
    var classMemo = classInfo["classMemo"];
    document.getElementById("classMemo_" + current_index).innerHTML = classMemo;
}
/*通过ajax获取学生信息*/
function Ajax_GetStudent() { 
    createXMLHttpRequest();
    /*为了避免浏览器读取缓存数据，加一个时间戳*/
    var timestamp = (new Date()).getTime();
    var url = "/Student/GetStudent.php?studentNumber=" + encodeURI(current_index) + "&timestamp=" + timestamp;
    XMLHttpReq.open("GET", url, true);
    XMLHttpReq.onreadystatechange = processStudentResponse; //指定响应函数
    XMLHttpReq.send(null);  // 发送请求
}

/*处理学生信息返回的函数*/
function processStudentResponse() {
    if (XMLHttpReq.readyState == 4) { // 判断对象状态
        if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
            DisplayStudentInfo();
            //setTimeout("sendRequest()", 1000);
        } else { //页面不正常
            alert(XMLHttpReq.status);
            window.alert("您所请求的页面有异常。");
        }
    }
}

/*显示修改后的学生信息*/
function DisplayStudentInfo() { 
    /*使用JSON数据格式*/ 
    var student = eval('(' + XMLHttpReq.responseText + ')');
    var studentNumber = student["studentNumber"];
    document.getElementById("studentNumber_" + current_index).innerHTML = studentNumber;
    var studentName = student["studentName"];
    document.getElementById("studentName_" + current_index).innerHTML = studentName;
    var studentPassword = student["studentPassword"];
    document.getElementById("studentPassword_" + current_index).innerHTML = studentPassword;
    var studentSex = student["studentSex"];
    document.getElementById("studentSex_" + current_index).innerHTML = studentSex;
    var studentClassNumber = student["studentClassNumber"];
    document.getElementById("studentClassNumber_" + current_index).innerHTML = studentClassNumber;
    var studentBirthday = student["studentBirthday"];
    document.getElementById("studentBirthday_" + current_index).innerHTML = studentBirthday;
    var studentState = student["studentState"];
    document.getElementById("studentState_" + current_index).innerHTML = studentState;
    var studentPhoto = student["studentPhoto"];
    document.getElementById("studentPhoto_" + current_index).innerHTML = "<img width='50px' height='50px' src=\"" + studentPhoto + "\" />";
    var studentTelephone = student["studentTelephone"];
    document.getElementById("studentTelephone_" + current_index).innerHTML = studentTelephone;
    var studentEmail = student["studentEmail"];
    document.getElementById("studentEmail_" + current_index).innerHTML = studentEmail;
    var studentQQ = student["studentQQ"];
    document.getElementById("studentQQ_" + current_index).innerHTML = studentQQ;
    var studentAddress = student["studentAddress"];
    document.getElementById("studentAddress_" + current_index).innerHTML = studentAddress;
    var studentMemo = student["studentMemo"];
    document.getElementById("studentMemo_" + current_index).innerHTML = studentMemo;
}
/*通过ajax获取教师信息*/
function Ajax_GetTeacher() { 
    createXMLHttpRequest();
    /*为了避免浏览器读取缓存数据，加一个时间戳*/
    var timestamp = (new Date()).getTime();
    var url = "/Teacher/GetTeacher.php?teacherNumber=" + encodeURI(current_index) + "&timestamp=" + timestamp;
    XMLHttpReq.open("GET", url, true);
    XMLHttpReq.onreadystatechange = processTeacherResponse; //指定响应函数
    XMLHttpReq.send(null);  // 发送请求
}

/*处理教师信息返回的函数*/
function processTeacherResponse() {
    if (XMLHttpReq.readyState == 4) { // 判断对象状态
        if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
            DisplayTeacherInfo();
            //setTimeout("sendRequest()", 1000);
        } else { //页面不正常
            alert(XMLHttpReq.status);
            window.alert("您所请求的页面有异常。");
        }
    }
}

/*显示修改后的教师信息*/
function DisplayTeacherInfo() { 
    /*使用JSON数据格式*/ 
    var teacher = eval('(' + XMLHttpReq.responseText + ')');
    var teacherNumber = teacher["teacherNumber"];
    document.getElementById("teacherNumber_" + current_index).innerHTML = teacherNumber;
    var teacherName = teacher["teacherName"];
    document.getElementById("teacherName_" + current_index).innerHTML = teacherName;
    var teacherPassword = teacher["teacherPassword"];
    document.getElementById("teacherPassword_" + current_index).innerHTML = teacherPassword;
    var teacherSex = teacher["teacherSex"];
    document.getElementById("teacherSex_" + current_index).innerHTML = teacherSex;
    var teacherBirthday = teacher["teacherBirthday"];
    document.getElementById("teacherBirthday_" + current_index).innerHTML = teacherBirthday;
    var teacherArriveDate = teacher["teacherArriveDate"];
    document.getElementById("teacherArriveDate_" + current_index).innerHTML = teacherArriveDate;
    var teacherCardNumber = teacher["teacherCardNumber"];
    document.getElementById("teacherCardNumber_" + current_index).innerHTML = teacherCardNumber;
    var teacherPhone = teacher["teacherPhone"];
    document.getElementById("teacherPhone_" + current_index).innerHTML = teacherPhone;
    var teacherPhoto = teacher["teacherPhoto"];
    document.getElementById("teacherPhoto_" + current_index).innerHTML = "<img width='50px' height='50px' src=\"" + teacherPhoto + "\" />";
    var teacherAddress = teacher["teacherAddress"];
    document.getElementById("teacherAddress_" + current_index).innerHTML = teacherAddress;
    var teacherMemo = teacher["teacherMemo"];
    document.getElementById("teacherMemo_" + current_index).innerHTML = teacherMemo;
}
/*通过ajax获取课程信息*/
function Ajax_GetCourseInfo() { 
    createXMLHttpRequest();
    /*为了避免浏览器读取缓存数据，加一个时间戳*/
    var timestamp = (new Date()).getTime();
    var url = "/CourseInfo/GetCourseInfo.php?courseNumber=" + encodeURI(current_index) + "&timestamp=" + timestamp;
    XMLHttpReq.open("GET", url, true);
    XMLHttpReq.onreadystatechange = processCourseInfoResponse; //指定响应函数
    XMLHttpReq.send(null);  // 发送请求
}

/*处理课程信息返回的函数*/
function processCourseInfoResponse() {
    if (XMLHttpReq.readyState == 4) { // 判断对象状态
        if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
            DisplayCourseInfoInfo();
            //setTimeout("sendRequest()", 1000);
        } else { //页面不正常
            alert(XMLHttpReq.status);
            window.alert("您所请求的页面有异常。");
        }
    }
}

/*显示修改后的课程信息*/
function DisplayCourseInfoInfo() { 
    /*使用JSON数据格式*/ 
    var courseInfo = eval('(' + XMLHttpReq.responseText + ')');
    var courseNumber = courseInfo["courseNumber"];
    document.getElementById("courseNumber_" + current_index).innerHTML = courseNumber;
    var courseName = courseInfo["courseName"];
    document.getElementById("courseName_" + current_index).innerHTML = courseName;
    var courseTeacher = courseInfo["courseTeacher"];
    document.getElementById("courseTeacher_" + current_index).innerHTML = courseTeacher;
    var courseTime = courseInfo["courseTime"];
    document.getElementById("courseTime_" + current_index).innerHTML = courseTime;
    var coursePlace = courseInfo["coursePlace"];
    document.getElementById("coursePlace_" + current_index).innerHTML = coursePlace;
    var courseScore = courseInfo["courseScore"];
    document.getElementById("courseScore_" + current_index).innerHTML = courseScore;
    var courseMemo = courseInfo["courseMemo"];
    document.getElementById("courseMemo_" + current_index).innerHTML = courseMemo;
}
/*通过ajax获取选课信息*/
function Ajax_GetStudentSelectCourseInfo() { 
    createXMLHttpRequest();
    /*为了避免浏览器读取缓存数据，加一个时间戳*/
    var timestamp = (new Date()).getTime();
    var url = "/StudentSelectCourseInfo/GetStudentSelectCourseInfo.php?selectId=" + encodeURI(current_index) + "&timestamp=" + timestamp;
    XMLHttpReq.open("GET", url, true);
    XMLHttpReq.onreadystatechange = processStudentSelectCourseInfoResponse; //指定响应函数
    XMLHttpReq.send(null);  // 发送请求
}

/*处理选课信息返回的函数*/
function processStudentSelectCourseInfoResponse() {
    if (XMLHttpReq.readyState == 4) { // 判断对象状态
        if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
            DisplayStudentSelectCourseInfoInfo();
            //setTimeout("sendRequest()", 1000);
        } else { //页面不正常
            alert(XMLHttpReq.status);
            window.alert("您所请求的页面有异常。");
        }
    }
}

/*显示修改后的选课信息*/
function DisplayStudentSelectCourseInfoInfo() { 
    /*使用JSON数据格式*/ 
    var studentSelectCourseInfo = eval('(' + XMLHttpReq.responseText + ')');
    var selectId = studentSelectCourseInfo["selectId"];
    document.getElementById("selectId_" + current_index).innerHTML = selectId;
    var studentNumber = studentSelectCourseInfo["studentNumber"];
    document.getElementById("studentNumber_" + current_index).innerHTML = studentNumber;
    var courseNumber = studentSelectCourseInfo["courseNumber"];
    document.getElementById("courseNumber_" + current_index).innerHTML = courseNumber;
}
/*通过ajax获取成绩信息*/
function Ajax_GetScoreInfo() { 
    createXMLHttpRequest();
    /*为了避免浏览器读取缓存数据，加一个时间戳*/
    var timestamp = (new Date()).getTime();
    var url = "/ScoreInfo/GetScoreInfo.php?scoreId=" + encodeURI(current_index) + "&timestamp=" + timestamp;
    XMLHttpReq.open("GET", url, true);
    XMLHttpReq.onreadystatechange = processScoreInfoResponse; //指定响应函数
    XMLHttpReq.send(null);  // 发送请求
}

/*处理成绩信息返回的函数*/
function processScoreInfoResponse() {
    if (XMLHttpReq.readyState == 4) { // 判断对象状态
        if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
            DisplayScoreInfoInfo();
            //setTimeout("sendRequest()", 1000);
        } else { //页面不正常
            alert(XMLHttpReq.status);
            window.alert("您所请求的页面有异常。");
        }
    }
}

/*显示修改后的成绩信息*/
function DisplayScoreInfoInfo() { 
    /*使用JSON数据格式*/ 
    var scoreInfo = eval('(' + XMLHttpReq.responseText + ')');
    var scoreId = scoreInfo["scoreId"];
    document.getElementById("scoreId_" + current_index).innerHTML = scoreId;
    var studentNumber = scoreInfo["studentNumber"];
    document.getElementById("studentNumber_" + current_index).innerHTML = studentNumber;
    var courseNumber = scoreInfo["courseNumber"];
    document.getElementById("courseNumber_" + current_index).innerHTML = courseNumber;
    var scoreValue = scoreInfo["scoreValue"];
    document.getElementById("scoreValue_" + current_index).innerHTML = scoreValue;
    var studentEvaluate = scoreInfo["studentEvaluate"];
    document.getElementById("studentEvaluate_" + current_index).innerHTML = studentEvaluate;
}
/*通过ajax获取新闻信息*/
function Ajax_GetNews() { 
    createXMLHttpRequest();
    /*为了避免浏览器读取缓存数据，加一个时间戳*/
    var timestamp = (new Date()).getTime();
    var url = "/News/GetNews.php?newsId=" + encodeURI(current_index) + "&timestamp=" + timestamp;
    XMLHttpReq.open("GET", url, true);
    XMLHttpReq.onreadystatechange = processNewsResponse; //指定响应函数
    XMLHttpReq.send(null);  // 发送请求
}

/*处理新闻信息返回的函数*/
function processNewsResponse() {
    if (XMLHttpReq.readyState == 4) { // 判断对象状态
        if (XMLHttpReq.status == 200) { // 信息已经成功返回，开始处理信息
            DisplayNewsInfo();
            //setTimeout("sendRequest()", 1000);
        } else { //页面不正常
            alert(XMLHttpReq.status);
            window.alert("您所请求的页面有异常。");
        }
    }
}

/*显示修改后的新闻信息*/
function DisplayNewsInfo() { 
    /*使用JSON数据格式*/ 
    var news = eval('(' + XMLHttpReq.responseText + ')');
    var newsId = news["newsId"];
    document.getElementById("newsId_" + current_index).innerHTML = newsId;
    var newsTitle = news["newsTitle"];
    document.getElementById("newsTitle_" + current_index).innerHTML = newsTitle;
    var newsContent = news["newsContent"];
    document.getElementById("newsContent_" + current_index).innerHTML = newsContent;
    var newsDate = news["newsDate"];
    document.getElementById("newsDate_" + current_index).innerHTML = newsDate;
    var newsPhoto = news["newsPhoto"];
    document.getElementById("newsPhoto_" + current_index).innerHTML = "<img width='50px' height='50px' src=\"" + newsPhoto + "\" />";
}

