﻿// JScript 文件
        function scrollNews(selector,Entry,time,StartIndex)
        {
        var _self=this;
        this.Selector=selector;
        this.Entry=Entry;
        this.time = time;
        this.i=StartIndex||0;
        this.Count=$(this.Selector+" ul li").length;
        $(this.Selector+" ul li").hide();//全部隐藏
        $(this.Selector+" ul li").eq(this.i).show();//第i个显示
        $(this.Selector).bind("mouseenter",function(){
                if(_self.sI){clearInterval(_self.sI);}
        }).bind("mouseleave",function(){
                _self.showIndex(_self.i++);
        })
        /*生成激活OL项目*/
        for(var j=0;j<this.Count;j++)
            $(this.Selector+" .activeOL").append('<li><a onclick="'+this.Entry+'.showIndex('+j+');" href="#"><img src="images/crystal.gif"></a></li>');
        $(this.Selector+" ol li a").eq(this.i).addClass("active");
        this.sI=setInterval(this.Entry+".showIndex(null)",this.time);
        
        this.GetSelector=function(){return this.Selector;}
        this.showIndex=function(index)
        {
            this.i++;//显示下一个
            if(this.sI){clearInterval(this.sI);}
            this.sI=setInterval(this.Entry+".showIndex()",this.time);
            if (index!=null)
            {
                this.i=index;
            }
            if(this.i==this.Count)
                this.i=0;
            $(this.Selector+" ul li").hide();
            $(this.Selector+" ul li").eq(this.i).slideDown();
            $(this.Selector+" ol li a").removeClass("active");
            $(this.Selector+" ol li a").eq(this.i).addClass("active");
        }
        }
        /**滚动新闻展示效果
        // 参数1：ID    		
        // 参数2：实例化对象的名称（跟var 后的相同）
        // 参数3：间隔时间      
        // 参数4：初始化时，默认哪个先显示
        **/
        var s=new scrollNews("#newsScroll","s", 2000 , 0);

