//绑定预处理时间
$(document).ready(
	function(){
		//滚动新闻
		setInterval('scrollNews("#scrollBox")',2000);
		//新闻切换
		$("div.tab>a").click(function(){tabNews(this);});
		//首页图片新闻切换
		$("div.slide>a").mouseover(function(){slideNews(this);});
		//医院协会切换
		$("h3.n>a").click(function(){toggleHospital(this);});
		//专家团滚动
		$(".expert .stroll").jCarouselLite({
			auto: 1000,
			speed: 1000
		});
		$(".stroll").css({width:"1500px"});
	}
)

//滚动新闻
function scrollNews(obj){
	$(obj).find("li:first").animate({
		marginTop:"-25px"
	},500,function(){
		$(this).css({marginTop:"0px"}).find("li:first");
		$(this).appendTo($(obj));
	});
}
//切换新闻
function tabNews(obj){
	module = $(obj).parents(".module");
	$(obj).parent("div.tab").find("a").each(
		function(){
			if(obj==this){
				$(this).addClass("tab");
				$(module).find("div[rel=tab"+$(this).attr("rel")+"]").show();
			}else{
				$(this).removeClass("tab");
				$(module).find("div[rel=tab"+$(this).attr("rel")+"]").hide();
			}
		}	
	);
}
//首页图片新闻切换
function slideNews(obj){
	$("a.swf>img").attr("src",$(obj).attr("rel"));
	$("a.swf").attr("href",$(obj).attr("href"));
	$("div.slide>a").removeClass("hover");
	$(obj).addClass("hover");
	$("#wrapL>.a>.content>h5").text($(obj).attr("title"));
}
//医院协会切换
function toggleHospital(obj){
	rel = $(obj).attr("rel");
	if(rel==1){		
		$(obj).parent("h3").removeClass("n-2");
	}else{
		$(obj).parent("h3").addClass("n-2");
	}
	$("div.n>table").hide();
	$("table#n-"+rel).show();
}
