﻿// JavaScript Document

function submitLogin() {
    var SystemType = document.getElementById("SystemType").value;
    if (SystemType == "student") {
        document.getElementById("form1").action = "http://lms.euibe.com/EuibeStudent/login.aspx";

    }
    if (SystemType == "teacher") {
        document.getElementById("form1").action = "http://educenter.euibe.com/Teacher/Login.aspx";
    }
    document.getElementById("form1").submit();

}

function secBoard(tabadnum) {
    Num = parseInt(tabadnum) + 1;
    $("#Lbtn div").attr("class", "left_01_btn_b");
    $("#Lbtn div:nth-child(" + Num + ")").attr("class", "left_01_btn_a");


    if (tabadnum == 1) {
        document.getElementById("tabtitle").innerHTML = "教学辅助平台";
        document.getElementById("SystemType").value = "teacher";
    }
    else {
        document.getElementById("tabtitle").innerHTML = "学 习 平 台";
        document.getElementById("SystemType").value = "student";
    }
}

function AlertTextFocus(txtInput, Text) {
    if (txtInput.value == Text) {
        txtInput.value = "";
    }
}

function AlertTextBlur(txtInput, Text) {
    if (txtInput.value == "") {
        txtInput.value = Text;
    }
}


function keySub(e) {
    var msie = (document.all) ? true : false;
    var keycode;
    if (!msie) keycode = e.which;
    else keycode = event.keyCode;
    if (keycode == 13) {
        submitLogin();
    }
}
function keySub2(e) {
    var msie = (document.all) ? true : false;
    var keycode;
    if (!msie) keycode = e.which;
    else keycode = event.keyCode;
    if (keycode == 13) {
        document.getElementById('txtPassword').focus();
    }
}

function SubmitForm(ctr, form) {
    if ($("#_" + ctr).val() == "") {
        $("#_" + ctr).focus();
        return false;
    }
    $("#" + ctr).val(escape($("#_" + ctr).val()));
    $("#" + form)[0].submit();
}

function Iframe_Load() {
    $("#Iframe1").attr("src", "uniform/header.html");
    $("#Iframe1").load(function() {
        $("#Iframe2").attr("src", "uniform/banner_new.htm");
        $("#Iframe2").load(function() {
            $("#Iframe3").attr("src", "uniform/LeftBar.html");
            $("#Iframe3").load(function() {
                $("#Iframe4").attr("src", "uniform/ScrollingPics.html");
                $("#Iframe4").load(function() {
                    $("#Iframe5").attr("src", "uniform/RightBar_A.html");
                    $("#Iframe5").load(function() {
                        $("#Iframe6").attr("src", "uniform/RightBar_B.html");
                        $("#Iframe6").load(function() {
                            $("#Iframe7").attr("src", "uniform/footer.html");
                        })
                    })
                })
            })
        })
    })
}

function hidepagehead() {
    document.getElementById("pagehead_cnt").style.display = "none";
    document.body.style.background = "none";
}

//new
function changeMenuBg(n) {
    var mn = document.getElementById("menuLink").getElementsByTagName("td");
    window.parent.document.getElementById("time02").value = 1;
    for (i = 0; i < mn.length; i++) {
        mn[i].style.background = (i == n) ? "url(../images/menu_bg111009.jpg) no-repeat 50% bottom" : "none";
    }
}
function changeMenuBgPrt(n){
    var mn = document.getElementById("topiframe").contentWindow.document.getElementById("menuLink").getElementsByTagName("td");
    for (i = 0; i < mn.length; i++) {
        mn[i].style.background = (i == n) ? "url(../images/menu_bg111009.jpg) no-repeat 50% bottom" : "none";
    }
}
function changeMenuJt(n) {
    if (window.parent.document.getElementById("headmark").value == 0) {
        return;
    }
    var jt = window.parent.document.getElementById("topiframe").contentWindow.document.getElementById("menuLink").getElementsByTagName("h1");
    for (i = 0; i < jt.length; i++) {
        jt[i].style.background = (i == n) ? "url(../images/menu_jt111009.gif) no-repeat 50% bottom" : "none";
    }
}
function chooseMenu2j(n) {
    if (window.parent.document.getElementById("headmark").value == 0) {
        return;
    }
    window.parent.document.getElementById("menu_cnt").style.display = "block";
    for (i = 1; i < 9; i++) {
        if (i > 2) {
            continue
        }
        window.parent.document.getElementById("menuiframe").contentWindow.document.getElementById("menu2j_0"+i).style.display = (i==n)?"block":"none";
    }
}
function js() {
    if (window.parent.document.getElementById("time").value == 0) {
        window.parent.document.getElementById("menu_cnt").style.display = "none";
        changeMenuJt(99);
    }
}
function hideMenu2j() {
    window.parent.document.getElementById("time").value = 0;
    window.parent.document.getElementById("time02").value = 0;
    setTimeout("js()", 1000);
}
function stopHide() {
    window.parent.document.getElementById("time").value = 1;
    window.parent.document.getElementById("time02").value = 1;
}
function changeSite() {
    var site = window.parent.document.getElementById("site").value;
    if (window.parent.document.getElementById("time02").value == 0) {
        changeMenuBg(site);
    }
}
function statrcs() {
    setTimeout("changeSite()", 1000);
}
//end
