$(document).ready(function() {


    $("#menu li").hover(function(){
        $(this).find('ul').fadeIn();
        $(this).addClass('hover');
        },function(){
        $(this).find('ul').fadeOut();
        $(this).removeClass('hover');
    });

    $(".menu_en li").hover(function(){
        $(this).find('ul').fadeIn();
        $(this).addClass('hover');
        },function(){
        $(this).find('ul').fadeOut();
        $(this).removeClass('hover');
    });

    $("#sch_box").click(function() {
        event.stopPropagation();
        $("#sch_main").slideToggle();
    });

    ResizeWindow();

    $(window).resize(function() {
        ResizeWindow();
    });

    $("#neiye_bg").parallax("50%", .5);

    $(".left_menu li li").click(function() {
        $(this).siblings('li').removeClass('selected');  // 删除其他兄弟元素的样式
        $(this).addClass('selected');                            // 添加当前元素的样式
    });
});
function ResizeWindow(){
    if($(window).width() >= 1600){
        $(".widthx").addClass("width100");
    }else{
        $(".widthx").removeClass("width100");
    }
}
function openclose(divid){
    var get_char = divid.charAt(0);
    if (get_char != "."){
        $("#"+divid).toggle()
    }
    else{
        $(divid).toggle()
    }
}

function nav2menu(mnid,mnopenorclose){
    if(mnopenorclose==1){
        $("#menu"+mnid).show();
    }else{
        $("#menu"+mnid).hide();
    }
}

function navmenu(mnid,mncount){

    $("#menu"+mnid).toggle();
    for(i=1;i<=mncount;i++){
        if(i != mnid){
        $("#menu"+i).hide();
        }
    }
}

function LabChange(DivId,Nowid,AllCount){
    for(i=1;i<=AllCount;i++){
        $("#"+DivId+i).hide();
    }
    $("#"+DivId+Nowid).show();
}

function LabChange1(DivId,Nowid,AllCount){
    for(i=1;i<=AllCount;i++){
        $("#"+DivId+i).fadeOut();
    }
    $("#"+DivId+Nowid).fadeIn();
}

//加入收藏
function AddFavorite(sURL, sTitle) {
        sURL = encodeURI(sURL);
    try{
        window.external.addFavorite(sURL, sTitle);
    }catch(e) {
        try{
            window.sidebar.addPanel(sTitle, sURL, "");
        }catch (e) {
            alert("加入收藏失败，请使用Ctrl+D进行添加,或手动在浏览器里进行设置.");
        }
    }
}
//设为首页
function SetHome(url){
    if (document.all) {
        document.body.style.behavior='url(#default#homepage)';
        document.body.setHomePage(url);
    }else{
        alert("您好,您的浏览器不支持自动设置页面为首页功能,请您手动在浏览器里设置该页面为首页!");
    }
}

function showEmail(e,tit){
  html='<br />信箱地址：<br /><strong>'+e+'@lzu.edu.cn</strong><br /><br />如果您已经安装邮件客户端或者APP，<br />可 <a href="mailto:'+e+'@lzu.edu.cn"><strong>点击这里</strong></a> 直接发送邮件。';
  dlg = new Dialog(html, {modal: false, height: 200, title: tit }).show();
}