﻿//======================================================================
//
//        Copyright (C) 苏州逸仙软件    
//        All rights reserved
//
//        filename :$safeitemrootname$
//        description :
//
//        created by 周济 at  $time$
//        mail:13912699233@139.com
//
//======================================================================




/*
*/

function LoadXX(intID) {
    var JZdd = $("#zzxxDIVdd");
    var JZ = $("#zzxxDIV");
    JZdd.show();
    JZ.load("public/load_xx.aspx?classid=" + intID + " #load", function() {
        JZdd.hide();
    });


}
function zxzx(obj, key) {
    var nd1 = $("#zx1");
    var nd2 = $("#zx2");
    var nd3 = $("#zx3");
    nd1.attr("class", "");
    nd2.attr("class", "");
    nd3.attr("class", "");
    var $this = $(obj);
    $this.attr("class", "tab_this")


    var obj1 = $("#ulzx" + key);

    $(".ClassZX").hide();

    if (obj1.attr("kg") == "on") {
        obj1.show();
    } else {
        obj1.load("public/index_New.aspx?stype=zx&classid=" + key + " #load", function() {
            $(this).attr("kg", "on");

        });
        obj1.show();
    }
}
function zxzxmk(obj, key) {
    var nd1 = $("#zxmk0");
    var nd2 = $("#zxmk1");
    var nd3 = $("#zxmk2");
    nd1.attr("class", "");
    nd2.attr("class", "");
    nd3.attr("class", "");
    var $this = $(obj);
    $this.attr("class", "tab_this")


    var obj1 = $("#ulmk" + key);

    $(".ClassMK").hide();

    if (obj1.attr("kg") == "on") {
        obj1.show();
    } else {
        obj1.load("public/load_xx.aspx?classid=" + key + " #load", function() {
            $(this).attr("kg", "on");

        });
        obj1.show();

    }
}

function zy(obj, key) {
    var nd1 = $("#zy1");
    var nd2 = $("#zy2");
    var nd3 = $("#zy3");
    nd1.attr("class", "");
    nd2.attr("class", "");
    nd3.attr("class", "");
    var $this = $(obj);
    $this.attr("class", "tab_this")


    var obj1 = $("#zyDiv" + key);

    $(".yx_work_listbox").hide();

    if (obj1.attr("kg") == "on") {
        obj1.show();
    } else {
        obj1.load("public/index_Down.aspx?classid=" + key + " #load", function() {
            $(this).attr("kg", "on");

        });
        obj1.show();

    }
}

function NewDown(obj, key) {

    var nd1 = $("#NewDownID1");
    var nd2 = $("#NewDownID2");
    nd1.attr("class", "");
    nd2.attr("class", "");
    var $this = $(obj);
    $(".ClassND").hide();
    $this.attr("class", "tab_this")
    if (key == 1) {
        var obj1 = $("#ulNew1ID");
        if (obj1.attr("kg") == "on") {
            obj1.show();
        } else {
            obj1.load("public/index_New.aspx?stype=nd&classid=1 #load", function() {
                $(this).attr("kg", "on");

            });
            obj1.show();
        }
    } else {
        var obj2 = $("#ulNew2ID");
        if (obj2.attr("kg") == "on") {
            obj2.show();
        } else {
            obj2.load("public/index_New.aspx?stype=nd&classid=2 #load", function() {
                $(this).attr("kg", "on");

            });
            obj2.show();
        }
    }



}

$(function() {


   
    //把名师处的图文混排资料,转换成纯粹的文本,并且截取字符串
    $(".MSJS").each(function() {
        $this = $(this);
        var s = $this.text();
        if (s.length > 0) {
            s = s.substring(0, 50);
            s += "...";
        }
        $this.html(s);
        $this.show();
    });
    //加载在线学习页签资料
    LoadXX(1);
    //初始化在线学习的效果     
    var zxxxUL = $("#zxxxUL li");
    zxxxUL.css("cursor", "pointer");
    zxxxUL.mouseover(function() {
        var $this = $(this);
        //alert($this.attr("SID"));
        LoadXX($this.attr("SID"));
        $("#zxxxUL li").attr("class", "");
        $this.attr("class", "online-tabthis");
    });



    //加载科目下拉框  
    $.getJSON("public/load_data.aspx?stype=1", function(json) {
        var s = "<option value=\"0\" selected=\"selected\">请选择</option>";
        $.each(json.root, function(a, b) {
            s += "<option value=\"" + b.ClassID + "\">" + b.ClassName + "</option>";
        });
        $("#DropDownList1").html(s);
    })

    //触发科目下拉框
    $("#DropDownList1").change(function() {
        $.getJSON("public/load_data.aspx?stype=2&classid=" + $(this).val(), function(json) {
            var s = "<option value=\"0\" selected=\"selected\">请选择</option>";
            $.each(json.root, function(a, b) {
                s += "<option value=\"" + b.ID + "\">" + b.Title + "</option>";
            });
            $("#DropDownList2").html(s);
        })
    });

    //查询课程的处理
    $("#butSelKC").click(function() {
        var km = $("#DropDownList1").val();
        var kc = $("#DropDownList2").val();
        var gjz = $("#keywords").val();
        gjz = $.trim(gjz);
        if (isNaN(kc)) kc = "0";
        if (kc == "0" && gjz == "") {
            $.yixianMsg("请选择课程,或者输入关键字后再查询");
            return false;
        }
        if (kc != "0") {
            location.href = "../KCTX/" + km + ".index_N.id=" + kc;
        } else {
            location.href = "../KCTX/yx.yixian.yx";
        }

    });
    //加载第二部分的内容资料
    $("#XBFdiv").load("public/load_index.aspx #load", function() {
        $("#XBFdivdd").hide();
    });
    //增加浮动广告
//    var floatAdStayTime = 8000;
//    function fadeOutAd() {
//        $("#yx-top-floatad").fadeOut("slow");
//    }
//    var timer = setTimeout(fadeOutAd, floatAdStayTime);
//    $("#yx-top-floatad").hover(function() {
//        clearTimeout(timer);
//    }, function() {
//        setTimeout(fadeOutAd, floatAdStayTime);
//    });
//    $("#yx-top-floatad").children("p").find("img").click(function() {
//        $("#yx-top-floatad").fadeOut("slow");
//    });
//    $("#yx-top-floatad").children("img").click(function() {

//        window.open("NewKCTX/index.aspx", "_blank");
//    });
    //背景关闭效果
    $("img.btn_closebg").click(function() {
        $(this).parents("#happy-new-year").hide();
        $('body').css('background', 'none');
    });
    //增加滚动调用
    $("#yx-studentvoice-scrollbox").mulMarquee({ direction: 'up', isEqual: false });

    //滚动学员报名
    $("#yx-olsign-box").Scroll({ line: 1, speed: 1000, timer: 4000 });

});




/***************************************************
100221 年后第一次改版,脚本如下
***************************************************/


//新闻和下载列表的切换加载


$(function() {
    $("#NewDownID1").click();
    $("#zx1").click();
    $("#zxmk1").click();
    $("#zy1").click();


    $("#yx-flashshow").slideshow({
        pauseSeconds: 4,
        width: 283,
        height: 204
    });
});



jQuery(document).ready(function() {
    var secType;
    var keyText = $("#keywords").val();
    var searchUrl;
    $("#sectype").change(function() {
        secType = $(this).val();
    });
    $("#keywords").change(function() {
        keyText = $(this).val();
    });
    $("#btn_bdsearch").click(function() {
        secType = $("#sectype").val();
        switch (secType) {
            case "0": //网页
                searchUrl = "http://www.baidu.com/s?cl=3&wd=" + keyText
                break
            case "1": //视频
                searchUrl = "http://video.baidu.com/v?ct=301989888&rn=20&pn=0&db=0&s=7&word=" + keyText
                break
            case "2": //新闻
                searchUrl = "http://news.baidu.com/ns?cl=2&rn=20&tn=news&word=" + keyText
                break
            case "3": //图片
                searchUrl = "http://image.baidu.com/i?tn=baiduimage&ct=201326592&cl=2&lm=-1&pv=&word=" + keyText + "&z=0"
                break
            default:
                searchUrl = "http://www.baidu.com/s?cl=3&wd=" + keyText
        }
        window.open(searchUrl + "&ie=utf-8", "_blank");
    });
   var miniboxTitle = "<a href=\"http://www.ksyx.net/Files/News3253.htm\" target=\"_blank\">逸仙大型公开课</a>";
    var miniboxContent = "<div id=\"mycontent\"><dl><dt><a href=\"http://www.ksyx.net/Files/News3253.htm\" target=\"_blank\"><img src=\"/skin/blue2/pic.jpg\" /></a></dt><dd>敬请您和您的朋友共同参与。现场将免费赠送您50元现金学习卡。<a href=\"http://www.ksyx.net/Files/News3253.htm\" target=\"_blank\">>>详细</a></dd></dl></div>";
    //$.miniBox({ windowSize: { width: 222, height: 123 }, position: "left", skin: "/skin/blue2/minibox.css", layerShow: [2, "titlebar_bg.gif", "#06274E", "#456508", "content_bg.gif"], toggleWindow: false, autoHide: { stayTime: 12000, style: "fade" }, titleHtml: miniboxTitle, content: { type: 0, source: miniboxContent} });
    //获取是否弹出框
//    $.get("public/load_data.aspx", { stype: "5" }, function(data) {
//    if (data == "true") {
//        $(function() { $.miniBox({ title: '在线留言', funcBtn: { close: true, min: false, max: false }, windowSize: { width: 220, height: 190 }, animiType: 'fade', content: { type: 1, source: 'leaveword.aspx'} }); }); 
//        }
    //    })
    //弹出框
        
});



/*
20100316 增加脚本



*/

