$(function(){
	var honorcotainer=$("#honorshow");
	var honorleft=honorcotainer.find(".honorleft");
	var honorright=honorcotainer.find(".honorright");
	var currenthonor=null;
	honorleft.find("li").find("a").click(function(){
		if($(this).parent().is("[class*='now']")){return false;}
		$(this).parent().addClass("now").siblings().removeClass();
		var nownum=$(this).attr("rel");
		if(currenthonor){
			currenthonor.animate({
				left:-320
			},{duration:200,easing:"easeInQuint",queue:false,complete:function(){$(this).css("left","320px")}})
			.fadeOut(200);
		}
		honorright.find("li").eq(nownum).show().delay(130).animate({
			left:0
		},{duration:450,easing:"easeOutQuint"});
		currenthonor=honorright.find("li").eq(nownum);
		
		return false;
	})
	
	honorleft.find("li:first").find("a").trigger("click");
	
	var honorscroller=honorleft;
	var honorscrollitem=honorscroller.find("li");
	var honorcontainer=honorscroller.find("ul");
	var nscroll=5;//num per move;
	var scroll_step=27*nscroll;
	var moving=false;//moving now?;
	var maxtop=(honorscrollitem.length-10)*27;
	honorscroller.find("a.honorup").css("visibility","hidden");
	if(maxtop<=0){honorscroller.find("a.honordown").css("visibility","hidden");}
	honorscroller.find("a.honordown").click(function(){
		if(!moving){
			moving=true;
			var ntop=parseInt(honorcontainer.css("top"));
			ntop=ntop-scroll_step>-1*maxtop?ntop-scroll_step:-1*maxtop;
			honorcontainer.animate({
				top:ntop
			},300,"easeInSine",function(){
				moving=false;
			});
		}
		if(ntop=maxtop){
			$(this).css("visibility","hidden");
		}
		if(honorscroller.find("a.honorup:hidden")){
			honorscroller.find("a.honorup").css("visibility","visible");
		}
		return false;
	});
	honorscroller.find("a.honorup").click(function(){
		if(!moving){
			moving=true;
			var ntop=parseInt(honorcontainer.css("top"));
			ntop=ntop+scroll_step<0?ntop+scroll_step:0;
			honorcontainer.animate({
				top:ntop
			},300,"easeInSine",function(){
				moving=false;
			});
		}
		if(ntop==0){
			$(this).css("visibility","hidden");
		}
		if(honorscroller.find("a.honordown:hidden")){
			honorscroller.find("a.honordown").css("visibility","visible");
		}
		return false;
	});
})
