﻿$(document).ready(function () {
    $("#loading").ajaxStart(function () { $(this).show(); });
    $("#loading").ajaxSuccess(function () { $(this).hide(); });

    //专业框变化事件
    $("#zyxx").change(GetZY);
});

//// 下列列表显示数据的方法
//function showZY(msg) {
//    var Options = '';
//    if (msg.d.length > 1) {
//        for (var i = 0; i < msg.d.length; i++) {
//            // 初始化专业目录
//            Options += '<option value=' + msg.d[i].ID + '>' + msg.d[i].Title + '</option>';
//        }
//    }
//    else {
//        Options += '<option value=-1 >无专业</option>';
//    }
//    $("#zyxx").html(Options);
//    GetZY();
//}


// 下列列表显示数据的方法
function showZY(msg) {
    var zy = eval(msg.d);
    var arr_zy = new Array();
    var j = 0;
    
    for (var i = 0; i < zy.length; i++) {
        arr_zy[j] = zy[i].ID + "_" + zy[i].Title;
        j++;
    }

    genDropDownList("#zyxx", arr_zy, "")

    GetZY();
}

// 根据下列列表选择的值调用后台方法返回Body内容
function GetZY() {
    //   var i = $("select[name='zyxx'] option[selected]").text();
    var i = $('#zyxx').val();

    // alert(i);
    postajax("ShowZYInfo.aspx/GetBody", "{'l_ID':'" + i + "'}", ShowZYInfo);
}

// 回传显示专业内容
function ShowZYInfo(msg) {
    $("#ZYBody").html(msg.d) ;

    // 设计表的奇偶行颜色不一样
    $("table tr:odd").addClass('yellow');

    $('table tr').hover(function () {
        $(this).addClass('hover');
    }, function () {
        $(this).removeClass('hover');
    });

    $('table tr:odd').hover(function () {
        $(this).removeClass('yellow');
        $(this).addClass('hover');
    }, function () {
        $(this).removeClass('hover');
        $(this).addClass('yellow');
    });
}
