function setTab(name,cursel,n){
	for(i=1;i<=n;i++){
		var menu=document.getElementById(name+i);
		var con=document.getElementById("con_"+name+"_"+i);
		menu.className=i==cursel?"href":"";
		con.style.display=i==cursel?"block":"none";
	}
}
function changeSize(obj){
	if(obj.clientWidth>obj.clientHeight)
		obj.style.width='150px';
	else
		obj.style.height='110px';
}
function loadLightBox(){
	$('a[rel*=lightbox]').lightBox();
}
function loadPaihang(){
	var myChart = new FusionCharts("./includes/FusionCharts/Column3D.swf", "myChartId", "100%", "190", "0", "0"); 
	myChart.setDataURL("./includes/paihang.php?action=list1&temp="+Math.random());  
	myChart.render("paihang_chexing_obj");

	var myChart = new FusionCharts("./includes/FusionCharts/Column3D.swf", "myChartId", "100%", "190", "0", "0"); 
	myChart.setDataURL("./includes/paihang.php?action=list2&temp="+Math.random());  
	myChart.render("paihang_changshang_obj");
}
function loadPaihang2(){
	//厂商数据
	swfobject.embedSWF(
		"./includes/open-flash-chart.swf", 
		"paihang_changshang_obj", 
		"100%", 
		"190", 
		"9.0.0", 
		"expressInstall.swf", 
		{
			"data-file":"./includes/paihang.php?action=list1&" + Math.random()
		}
	);
	//厂商数据
	swfobject.embedSWF(
		"./includes/open-flash-chart.swf", 
		"paihang_chexing_obj", 
		"100%", 
		"190", 
		"9.0.0", 
		"expressInstall.swf", 
		{
			"data-file":"./includes/paihang.php?action=list2&" + Math.random()
		}
	);
}
function closeDiv()
{
	document.getElementById('downmsg_emessage').style.display='none';
	document.getElementById('downmsg_emessage').innerHTML = "";
}

function showHideDiv()
{
	var ct = document.getElementById('donwmsg_content');
	var btn = document.getElementById('msg_hidden_btn');
	if(ct.style.display!="none"){
	  ct.style.display = "none"
	  btn.className="msg-hidden-btn-2";
	}else{
	  ct.style.display="block";
	  btn.className="msg-hidden-btn-1";
	}

}
function updateNewsCounter(){
	$.ajax({
		type: "GET",
		data:{
			new_id:$("#new_id").val()
		},
		url:"/details.php?action=counter&temp="+Math.random(),
		success:function (data, status){
		}
	}); 

}
function startSearch(){
	document.news_search.submit();
}
function inputTips(o,text){
	var box = $(o),
		tem = text,
		curr = null;
	box.val(tem);
	box.focus(function(){
		curr = $(this).val();
		$(this).val( curr == tem ? "" : curr );
	})
	box.blur(function(){
		curr = $(this).val();
		$(this).val( curr == "" ? tem : curr );
	})
}
function showSlider(o){
	var box = $(o.box),
		c = $(o.cont),
		n = $(o.num),
		t = $(o.txt),
		len = n.length,
		sv = null,
		curr = 0;	
	function move(i){
		c.eq(i).stop(false,false).fadeIn().siblings().fadeOut();
		t.eq(i).stop(false,false).fadeIn().siblings().fadeOut();
		n.eq(i).addClass("on").siblings().removeClass("on");
	}
	function setInt(){
		if(sv){ clearInterval(sv); }
		sv = setInterval(function(){
			if(curr == len -1){
				curr = -1;
			}
			move(++curr);
		},3000)
	}
	function clearInt(){
		if(sv){ clearInterval(sv); }
	}
	return {
		init : function(){
			n.click(function(){
				curr = $(this).index();
				move(curr);
			})
			box.hover(clearInt,setInt);
			setInt();
		}
	}
}
function showTab(t,c,e){
	var t = $(t),
		c = $(c);
		
	t.each(function(i){
		$(this)[e](function(){
			$(this).addClass("on").siblings().removeClass("on");
			c.eq(i).show().siblings().hide();
		})
	})		
}

