$(document).ready(function(){
	$('.tabs').mouseover(function(){
		if(!$(this).hasClass('on')){
			$(this).addClass('on').siblings('.tabs').removeClass('on');
			var theId = $(this).attr('id');
			if(theId == 'news'){
				$('#newlist').show().siblings('ul').hide();
			}
			if(theId == 'notice'){
				$('#noticelist').show().siblings('ul').hide();
			}
			if(theId == 'active'){
				$('#activelist').show().siblings('ul').hide();
			}
		}
	});
	$('.hotDmList li').mouseover(function(){
		$(this).addClass('now').siblings().removeClass('now');
		$(this).children().find('.hotDmName').show();
	});
	$('.hotDmList li').mouseout(function(){
		$(this).removeClass('now');
		$(this).children().find('.hotDmName').hide();
	});
	$('.ycad').click(function(){
		$(this).next('ul').toggle();
		if($(this).hasClass('dj')){
			$(this).parent().addClass('spEnter').removeClass('spEnterCl');
			$(this).removeClass('dj').css("top","71px");
		}else{
			$(this).parent().removeClass('spEnter').addClass('spEnterCl');
			$(this).addClass('dj').css("top","0");
		}
	});
	var i = $('.hotGameUpContent a');
	$('.hotGameUpContent a').click(function(){
		var a = $('.hotUpContent');
		if(!($(this).hasClass('current'))){
			$(i).removeClass('current');
			$(this).addClass('current');
			$('.hotUpContent:eq(' + $(i).index(this) + ')').removeClass('hide').siblings().addClass('hide');;
						
		}
	});
	$(".showHide").click(function(){
		if($(this).parent().hasClass("noSon")){
			$("#moreInfo").slideDown(3000);
			$(".showHide").text("[收缩]");
			$(this).parent().removeClass("noSon");
		}else{
			$("#moreInfo").slideUp(3000);
			$(".showHide").text("[展开]");
			$(this).parent().addClass("noSon");
		}
	});
	$('#moreLoginGame').mouseover(function(){
		$('.loginMore').slideDown(500);
		$(this).text('隐藏');
	});
});
//滚动插件
(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):500, //卷动速度，数值越大，速度越慢（毫秒）
                        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);


$(document).ready(function(){
			$("#scrollDiv").Scroll({line:1,speed:2000,timer:3000});
	});
//显示所有游戏
$(document).ready(function(){
	$("#dh_game").css({"visibility":"hidden"});
	$("#arrow").hover(function(){
		//$(this).offset().left 当前对象的左边界
		var ileft = $(this).offset().left + $(this).width() - $('#dh_game').width()/2 + 4;
		$("#dh_game").css({"visibility":"visible","margin-left":ileft});
	}, function(){
		$('#dh_game').css({"visibility":"hidden"});;
	});

	$("#dh_game").hover(function(){
		$(this).css({"visibility":"visible"});
	},function(){
		$(this).css({"visibility":"hidden"});
	});
});
