﻿$(document).ready(function () {
    $(".indscreenwid img,.height1161 img").each(function () {
        //alert(this.height);
        //confirm($(this).attr("src"));
        if ($(this).height() == 0) { return; }
        //这里修改图片的框架 只对图片添加框架
        if (this.parentElement.tagName == "A") {
            $(this).parent().wrap("<div class=img_box style=width:" + $(this).width() + "px;height:" + $(this).height() + "px;overflow:hidden></div>");
        } else {
            $(this).wrap("<div class=img_box style=width:" + $(this).width() + "px;height:" + $(this).height() + "px;overflow:hidden></div>");
        }
    })
    //loading 广告

    get_gg();
})
 
 var search_name="mlgoo.com";
        $(document).ready(function(){
            //图片延时加载
            $(".indscreenwid img,.indtaodyrig img,.indtaodymid img,.indgroomtopic img").lazyload({ placeholder: "", effect: "fadeIn" });

            //主栏
            creat_tabs(".indmenulist","li","hovermenu",".indmenusub .indmenukey");
            //滑动条模块
            creat_tabs(".tabs01","li","hovera");
            //
            creat_tabs(".tabs02","li","hovera",".tabs02_content");
            creat_tabs(".tabs03","li","hovera",".tabs03_content");
            creat_tabs(".tabs04","li","hovera",".tabs04_content");
            creat_tabs(".tabs05","li","hovera",".tabs05_content");
            
            
			//搜索模块
			$(".tabs01 li").click(function(){
				search_name=$(this).attr("title");
            })
			
			//搜索模块
			$(".tabs01 select").change(function(){
				search_name=$(this).val();
            })
			
            $(".indsearchbut input").click(function(){
                var search_str=$(".indsearchinput input").eq(0).val();
                search_str=escape(search_str);
                document.location.href="http://search.mlgoo.com/index.aspx?wd=site%3A"+search_name+"%20"+search_str;
            
            })
        })

        
        $(document).ready(function() {
            var currentIndex = 0;
            var DEMO; //函数对象
            var currentID = 0; //取得鼠标下方的对象ID
            var pictureID = 0; //索引ID
            $(".indbanNew li").eq(0).show(); //默认
            autoScroll();
            $(".indbanpage li").hover(function() {
                 StopScrolll();
                $(".indbanpage li").removeClass("hoverjs")//所有的li去掉当前的样式加上正常的样式
                $(this).addClass("hoverjs"); //而本身则加上当前的样式去掉正常的样式
                currentID = $(this).attr("id"); //取当前元素的ID
                pictureID = currentID.substring(currentID.length - 1); //取最后一个字符
                $(".indbanNew li").eq(pictureID).fadeIn("slow"); //本身显示
                $(".indbanNew li").not($(".indbanNew li")[pictureID]).hide(); //除了自身别的全部隐藏
                //$("#ifocus_tx li").hide();
                //$("#ifocus_tx li").eq(pictureID).show();
             }, function() {
                 //当鼠标离开对象的时候获得当前的对象的ID以便能在启动自动时与其同步
                currentID = $(this).attr("id"); //取当前元素的ID
                pictureID = currentID.substring(currentID.length - 1); //取最后一个字符
                currentIndex = pictureID;
                autoScroll();
             });
             
             function autoScroll() {
                 $(".indbanpage li:last").removeClass("hoverjs");
                // $("#ifocus_tx li:last").hide();
                 $(".indbanpage li").eq(currentIndex).addClass("hoverjs");
                 $(".indbanpage li").eq(currentIndex - 1).removeClass("hoverjs");
                // $("#ifocus_tx li").eq(currentIndex).show();
                // $("#ifocus_tx li").eq(currentIndex - 1).hide();
                 $(".indbanNew li").eq(currentIndex).fadeIn("slow");
                 $(".indbanNew li").eq(currentIndex - 1).hide();
                 currentIndex++; currentIndex = currentIndex >= 5 ? 0 : currentIndex;
                 DEMO = setTimeout(autoScroll, 5000);
             }

             function StopScrolll()//当鼠标移动到对象上面的时候停止自动滚动
            {
                 clearTimeout(DEMO);
            }
     });
