function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


$(document).ready(function(){
   //友情链接
   $(".flink_an").click(function(){
		$(".flink_show").show();
   });
   $(".flink_show").mouseover(function(){
		$(this).show();
   });
   $(".flink_show").mouseout(function(){
		$(this).hide();
   });
   $(".flink_show a").mouseout(function(){
		$(".flink_show").show();
   });
   $(".flink_box").click(function(){
		$(".flink_show").show();
   });
})
/*顶部鼠标移上与移出效果*/
$(function(){
	$("#gupiao").css({background:"#c12708" }); 
	$("#gupiao a").css({ color:"#fff"}); 
	$("#index_top_nav div").mouseover(function(){
			$(this).css({"background":"#c12708"}).siblings().css({background: "" });
			var index=$("#index_top_nav div").index(this);
			$("#gupiao a").css({ color:"#757b82"}); 
			$("#index_top_nav div:eq("+index+") a").css({ color:"#fff"}); 
			
		}).mouseout(function(){
			$(this).css({"background":""});
				var index=$("#index_top_nav div").index(this);
			$("#index_top_nav div:eq("+index+") a").css({ color:"#757b82"}); 
			$("#gupiao").css({"background":"#c12708"});
			$("#gupiao a").css({ color:"#fff"}); 
		})
});

/*添加和修改(已完成)-----------2011-01-12-------------*/
var timeout;
			function morecityon()
			{
				clearTimeout(timeout)
				e=document.getElementById("showcity");
				var t=e.offsetTop; 
				var l=e.offsetLeft; 
				while(e=e.offsetParent){ 
					t+=e.offsetTop; 
					l+=e.offsetLeft; 
				} 
				document.getElementById("Layer1").style.left=l-50+"px";
				document.getElementById("Layer1").style.top=t+15+"px";

				document.getElementById("Layer1").style.display="block";
				document.getElementById("showcity").style.cursor="pointer"; 
			}

			function morecityout()
			{
				timeout=setTimeout('document.getElementById("Layer1").style.display="none"',100);
				document.getElementById("showcity").style.cursor="pointer"; 
			}
			
			var timeout2;
			function morecityon2()
			{
				clearTimeout(timeout2)
				e=document.getElementById("showcity2");
				var t=e.offsetTop; 
				var l=e.offsetLeft; 
				while(e=e.offsetParent){ 
					t+=e.offsetTop; 
					l+=e.offsetLeft; 
				} 
				document.getElementById("Layer2").style.left=l-50+"px";
				document.getElementById("Layer2").style.top=t+15+"px";

				document.getElementById("Layer2").style.display="block";
				document.getElementById("showcity2").style.cursor="pointer"; 
			}

			function morecityout2()
			{
				timeout2=setTimeout('document.getElementById("Layer2").style.display="none"',100);
				document.getElementById("showcity2").style.cursor="pointer"; 
			}
			
			
			
			var timeout3;
			function morecityon3()
			{
				clearTimeout(timeout3)
				e=document.getElementById("showcity3");
				var t=e.offsetTop; 
				var l=e.offsetLeft; 
				while(e=e.offsetParent){ 
					t+=e.offsetTop; 
					l+=e.offsetLeft; 
				} 
				document.getElementById("Layer3").style.left=l-50+"px";
				document.getElementById("Layer3").style.top=t+15+"px";

				document.getElementById("Layer3").style.display="block";
				document.getElementById("showcity3").style.cursor="pointer"; 
			}

			function morecityout3()
			{
				timeout3=setTimeout('document.getElementById("Layer3").style.display="none"',100);
				document.getElementById("showcity3").style.cursor="pointer"; 
			}
			
			
			var timeout4;
			function morecityon4()
			{
				clearTimeout(timeout4)
				e=document.getElementById("showcity4");
				var t=e.offsetTop; 
				var l=e.offsetLeft; 
				while(e=e.offsetParent){ 
					t+=e.offsetTop; 
					l+=e.offsetLeft; 
				} 
				document.getElementById("Layer4").style.left=l-50+"px";
				document.getElementById("Layer4").style.top=t+15+"px";

				document.getElementById("Layer4").style.display="block";
				document.getElementById("showcity4").style.cursor="pointer"; 
			}

			function morecityout4()
			{
				timeout4=setTimeout('document.getElementById("Layer4").style.display="none"',100);
				document.getElementById("showcity4").style.cursor="pointer"; 
			}
/*2010 01 -18 选项卡样式 star*/
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?"hover"+i:"";
con.style.display=i==cursel?"block":"none";
}
}
/*2011 01 -18 选项卡样式 end*/

// 滚动
function Scroll_x(o,pre,next,v,auto){
	//o:对象，pre:上一张按钮,next:下一张按钮,v:显示数量
	var me = $(o);
	
		var ul = me.find("ul");
		var li = ul.find("li");
	
	var w = li.outerWidth(true);
	var l = li.length;
	var max_l = null;
	var autoId = null;
	var default_n = 0;
	var isAuto = (auto==null) ? true : false;
	
	if(auto=="video"){
			isAuto = false;
		};
	init();
	function init(){
		
		if(l>v){
			
			var copy_li = '';
			if(auto!="video"){
				for(var i = 0;i<v;i++){
					ul.append(li.eq(i).clone());	
				};	
			}
			var new_l = ul.find("li").length;
			ul.width(new_l*w);
			max_l = new_l - v;
			if(auto=="video"){
				if(pre)$(pre).hide();
			};
			if(pre)$(pre).bind("click",function(){preFn(1);});
			if(next)$(next).bind("click",function(){nextFn(1);});
		}else{
			
			if(pre)$(pre).hide();
			if(next)$(next).hide();
		};
		
		if(isAuto){
			autoPlay();
		}
	};
	
	//自动播放
	function autoPlay(){
		
		if(!autoId){
			
			autoId = setInterval(function(){nextFn();},5000);
		};
	};
	
	//上一排
	function preFn(o){
		if(o&&autoId){
			clearInterval(autoId);	
			autoId = null;
		};
		if(default_n>0){
			default_n--;
			if(auto=="video"&&default_n<=0){
				if(pre)$(pre).hide();
				
			};
			if(auto=="video"&&default_n<=0){
				if(next)$(next).show();
			};
		}else{
				ul.css({"left":-l*w+"px"});
				default_n=l;
				default_n--;
			
		};
		move(o);
	};
	//下一排
	function nextFn(o){
		if(o&&autoId){
			clearInterval(autoId);	
			autoId = null;
		};
		if(default_n<l){
			default_n++;
			
			if(auto=="video"&&default_n>=max_l){
				
				if(next)$(next).hide();
			};
			if(auto=="video"&&default_n>0){
				
				if(pre)$(pre).show();
			};
		}else{
			ul.css({"left":0});
			default_n=0;
			default_n++;
		};
		move(o);
	}
	//移动
	function move(o){
		var pos= -default_n*w;
		ul.stop();
		ul.animate({"left":pos+"px"},function(){if(o&&isAuto){autoPlay();};});
	}
};


//7.2 活动页面焦点图
var focus_img = {
		init:function(img,num){
			this.div = $(img);
			this.num = $(num);
			this.li = this.div.find("li");
			this.l = this.li.length;
			if(this.l==1)return false;
			this.li.hide();
			this.c = 1;//当前序号
			var num_li = "";
			for(var i = 1;i<=this.l;i++){
				num_li += "<a href='javascript:void(0);'>"+i+"</a>"	
			};
			this.num.html(num_li);
			this.n_li = this.num.find("a");
			var that = this;
			this.n_li.bind("click",function(){that.showImg(this);})
			this.showImg();
			this.auto();
		},
		auto:function(){
			var that = this;
			this.autoId = setInterval(function(){that.c==that.l?that.c =1:that.c++;that.showImg();},3000);	
		},
		showImg:function(o){
			if(o){
				if($(o).html()==this.c)return false;
				this.c = $(o).html();
				var that = this;
				clearInterval(that.autoId);
				that.autoId = null;
			};
			this.n_li.removeClass("cur");
			this.li.hide();
			this.li.eq(this.c-1).fadeIn(250,function(){
													 if(o){that.auto();}
													 });
			this.n_li.eq(this.c-1).addClass("cur");
		}
};


function setNow(o){
	
	$("#jlbtu .dianjiove").removeClass("dianjiove");	
	$(o).addClass("dianjiove");
}








