$(function(){
		$("#logSel_in").toggle(function(){
			$(this).animate({"height":42},100)
		},function(){
				$(this).animate({"height":22},100)
			}
		)
		
		/*首页登录时选择用户类型*/
		$("#selWeb").click (function(){
			$("#userType").val("1");
			$(this).after($("#selAdv"));
			$("#logSel_in").height(22);
		})
		$("#selAdv").click (function(){
			$("#userType").val("2"); 
			$(this).after($("#selWeb"));
			$("#logSel_in").height(22);
		})
		/*刷新验证码*/
		$("#vg,#chgCode").click(function(){
			$("#chgCode").hide();
			$("#loading").show();
			$("#vg").attr("src",'validateCode?a='+new Date());
			codeEvt=window.setInterval(codeStatic,250);
		});
		function codeStatic(){
			if ($("#vg").width){
				window.clearInterval(codeEvt);
				$("#loading").hide();
				$("#chgCode").show();
			}
		}
		
		/*活动滚动*/
        var $this = $("#scroll");
		var scrollTimer;
		$this.hover(function(){
			  clearInterval(scrollTimer);
		 },function(){
		   scrollTimer = setInterval(function(){
						 scrollNews( $this );
					}, 4000 );
		}).trigger("mouseleave");
		});

function scrollNews(obj){
   var $self = obj.find("ul:first"); 
   var lineHeight = $self.find("li:first").height()+9; //获取行高
   $self.animate({ "marginTop" : -lineHeight +"px" }, 600 , function(){
         $self.css({marginTop:0}).find("li:first").appendTo($self); //appendTo能直接移动元素
   })
}
