// JavaScript Document
jQuery.noConflict();
jQuery(document).ready(function(){
	//根据buyhub list的内容数量控制显示
	//给所有“收起”，“更多”添加事件
	var limitCount = 4;
	jQuery(".buyhubList").each(function(){
		var self = jQuery(this);
		var totalCount = self.find("ul li").length;
		
		if(totalCount > limitCount){
			var height = self.find("ul li").height();
			
			self.find("ul").css("height",height * limitCount + "px");
			self.find(".moreBuyhub span").text("更多").attr("title","更多").removeClass().addClass("expend_moreBuyhub");
			//绑定事件
			self.find(".moreBuyhub span").toggle(function(){
				jQuery(this).parents(".buyhubList").find("ul").animate({height:totalCount * height},500);
				jQuery(this).text("收起").attr("title","收起").removeClass().addClass("close_moreBuyhub");
			},function(){
				jQuery(this).parents(".buyhubList").find("ul").animate({height:height * limitCount},500);
				jQuery(this).text("更多").attr("title","更多").removeClass().addClass("expend_moreBuyhub");
			});
		}
		else{
			self.find(".moreBuyhub").remove();
		}
	});
});

