// JavaScript Document
function LoadHtml(id)
{
    $(".llyy").load("/index.php/list/ajax/id/"+id);
}

(function($){
    $.fn.extend({
        Scroll:function(opt,callback){
            //参数初始化
            if(!opt) var opt={};
            var _this=this.eq(0).find("ul:first");
            var        lineH=_this.find("li:first").height(), //获取行高
            line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), //每次滚动的行数，默认为一屏，即父容器高度
            speed=opt.speed?parseInt(opt.speed,10):5000, //卷动速度，数值越大，速度越慢（毫秒）
            timer=opt.timer?parseInt(opt.timer,10):3000; //滚动的时间间隔（毫秒）
            if(line==0) line=1;
            var upHeight=0-line*lineH;
            //滚动函数
            scrollUp=function(){
                _this.animate({
                    marginTop:upHeight
                },speed,function(){
                    for(i=1;i<=line;i++){
                        _this.find("li:first").appendTo(_this);
                    }
                    _this.css({
                        marginTop:0
                    });
                });
            }
            //鼠标事件绑定
            _this.hover(function(){
                clearInterval(timerID);
            },function(){
                timerID=setInterval("scrollUp()",timer);
            }).mouseout();
        }
    })
})(jQuery);

(function($){
    $.fn.extend({
        Scrolltwo:function(opt,callback){
            //参数初始化
            if(!opt) var opt={};
            var _this=this.eq(0).find("ul:first");
            var        lineH=_this.find("li:first").width(), //获取行高
            line=opt.line?parseInt(opt.line,10):parseInt(this.width()/lineH,10), //每次滚动的行数，默认为一屏，即父容器高度
            speed=opt.speed?parseInt(opt.speed,10):5000, //卷动速度，数值越大，速度越慢（毫秒）
            timer=opt.timer?parseInt(opt.timer,10):3000; //滚动的时间间隔（毫秒）
            if(line==0) line=1;
            var upHeight=0-line*lineH;
            //滚动函数
            scrolltwoUp=function(){
                _this.animate({
                    marginLeft:upHeight
                },speed,function(){
                    for(i=1;i<=line;i++){
                        _this.find("li:first").appendTo(_this);
                    }
                    _this.css({
                        marginLeft:0
                    });
                });
            }
            //鼠标事件绑定
            _this.hover(function(){
                clearInterval(timerID);
            },function(){
                timerID=setInterval("scrolltwoUp()",timer);
            }).mouseout();
        }
    })
})(jQuery);

(function($){
    $.fn.extend({
        Scrollone:function(opt,callback){
            //参数初始化
            if(!opt) var opt={};
            var _this=this.eq(0).find("ul:first");
            var        onelineH=_this.find("li:first").height(), //获取行高
            oneline=opt.oneline?parseInt(opt.oneline,10):parseInt(this.height()/onelineH,10), //每次滚动的行数，默认为一屏，即父容器高度
            onespeed=opt.speed?parseInt(opt.onespeed,10):5000, //卷动速度，数值越大，速度越慢（毫秒）
            onetimer=opt.timer?parseInt(opt.onetimer,10):3000; //滚动的时间间隔（毫秒）
            if(oneline==0) oneline=1;
            var upHeight=0-oneline*onelineH;
            //滚动函数
            scrolloneUp=function(){
                _this.animate({
                    marginTop:upHeight
                },onespeed,function(){
                    for(i=1;i<=oneline;i++){
                        _this.find("li:first").appendTo(_this);
                    }
                    _this.css({
                        marginTop:0
                    });
                });
            }
            //鼠标事件绑定
            _this.hover(function(){
                clearInterval(timerID);
            },function(){
                timerID=setInterval("scrolloneUp()",timer);
            }).mouseout();
        }
    })
})(jQuery);

$(document).ready(function(){
//    $("#scrollDiv").Scroll({
//        line:1,
//        speed:4000,
//        timer:3500
//    });
    //    $("#scrollDiv").YlMarquee({
    //        visible:1,
    //        step:2,
    //        vertical:true
    //    });
////    $("#scrollDivone").Scrollone({
////        line:1,
////        speed:4000,
////        timespan:3500
////    });

    $(function(){
        //单行应用@Mr.Think
        var _wrap=$('#runtopic');//定义滚动区域
        var _interval=3000;//定义滚动间隙时间
        var _moving;//需要清除的动画
        _wrap.hover(function(){
            clearInterval(_moving);//当鼠标在滚动区域中时,停止滚动
        },function(){
            _moving=setInterval(function(){
                var _field=_wrap.find('li:first');//此变量不可放置于函数起始处,li:first取值是变化的
                var _h=_field.height();//取得每次滚动高度
                _field.animate({
                    marginTop:-_h+'px'
                    },5000,function(){//通过取负margin值,隐藏第一行
                    _field.css('marginTop',0).appendTo(_wrap);//隐藏后,将该行的margin值置零,并插入到最后,实现无缝滚动
                })
            },_interval)//滚动间隔时间取决于_interval
        }).trigger('mouseleave');//函数载入时,模拟执行mouseleave,即自动滚动
    });

    $(function(){
        //单行应用@Mr.Think
        var _onewrap=$('#linkpic');//定义滚动区域
        var _oneinterval=3000;//定义滚动间隙时间
        var _onemoving;//需要清除的动画
        _onewrap.hover(function(){
            clearInterval(_onemoving);//当鼠标在滚动区域中时,停止滚动
        },function(){
            _onemoving=setInterval(function(){
                var _onefield=_onewrap.find('li:first');//此变量不可放置于函数起始处,li:first取值是变化的
                var _oneh=_onefield.height();//取得每次滚动高度
                _onefield.animate({
                    marginTop:-_oneh+'px'
                    },3000,function(){//通过取负margin值,隐藏第一行
                    _onefield.css('marginTop',0).appendTo(_onewrap);//隐藏后,将该行的margin值置零,并插入到最后,实现无缝滚动
                })
            },_oneinterval)//滚动间隔时间取决于_interval
        }).trigger('mouseleave');//函数载入时,模拟执行mouseleave,即自动滚动
    });
    //    function uppic(){
    //        $("#scrollDivone").Scrollone({
    //            line:1,
    //            speed:4000,
    //            timespan:3500
    //        }),
    //        setTimeout(function(){
    //            uppic();
    //        },1000);
    //    }
    ////    uppic();
    //    window.setInterval(function(){$("#scrollDivone").Scrollone({
    //        line:1,
    //        speed:2000,
    //        timespan:3500
    //    })},"2000");
    //    $("#scrollDivone").YlMarquee({
    //        visible:1,
    //        step:2,
    //        vertical:true
    //    });
    $("#mq").YlMarquee({
        visible:3,
        step:2
    });


    $(".llyy").load("/index.php/list/ajax/id/124");
})
