$(function(){
	showTimes('times');
	if($("#news_focus_pic").length>=1){
		_scorll(30,'news_focus_pic','jsweb9_cn_left1','jsweb9_cn_left2');
 	}
	var index=0;
	var timer=setInterval(autoShowImg,3000);
	$("div.focus").hover(function(){
		clearInterval(timer);							   
	},function(){
		timer=setInterval(autoShowImg,3000);
	});
	var count=$("div.fs_cont_num s").length-1;
	$("div.fs_cont_num s").hover(function(){
		index=$("div.fs_cont_num s").index(this);
		showImg(index);
	});
	function showImg(index){
  		for(i=0;i<=count;i++){
 			if(i==index){
				$("div.fs_img img").stop(false,true).eq(i).fadeIn('normal');
				$("div.fs_cont_num s").eq(i).addClass('hover');
				$("div.f_news_name").eq(i).show();
			}else{
				$("div.fs_img img").stop(false,true).eq(i).fadeOut('normal');
				$("div.fs_cont_num s").eq(i).removeClass('hover');
				$("div.f_news_name").eq(i).hide();
			}	
		}
	}
	function autoShowImg(){
		if(index>=count){
			index=0;	
		}else{
			index++;	
		}
		showImg(index);
	}
	$("ul.tab li").hover(function(){
 		var parent=$(this).parent().parent().attr('class').replace(' clearfix','');
		$(this).addClass('on').siblings().removeClass('on');
		var p=$("div."+parent+" ul.tab li").index(this);
		$("div."+parent +"> div.index_tab").hide().eq(p).show();
	});
	$("div.tit li").hover(function(){
 		var parent=$(this).parent().parent().parent().attr('class');
		$(this).addClass('cur').siblings().removeClass('cur');
		var p=$("div."+parent+" div.tit li").index(this);
 		$("div."+parent).find(".js_test").hide().eq(p).show();
	});
/*
	var $this = $("div.vlist");
	var scrollTimer;
	$this.hover(function(){
		clearInterval(scrollTimer);
	},function(){
		scrollTimer = setInterval(function(){
				 scrollNews( $this );
			}, 3000 );
	}).trigger("mouseleave");
*/
	$("#keywords").focus(function(){
 		if(this.defaultValue==$(this).val()){
			$(this).val('');	
		}							  
	});
	$("#keywords").blur(function(){
 		if($(this).val()==''){
			$(this).val(this.defaultValue);	
		}							  
	});
	$("input.btn").click(function(){
		var url=$(this).attr('url');
		if(document.getElementById('keywords').defaultValue!=$("#keywords").val()){
			var key=encodeURI($("#keywords").val());
			location.href=url+'?key='+key;	
		}else{
			$("#keywords").focus();	
		}							  
	});
	$("div.search_hot a").click(function(){
		var key=$(this).text();
		$("#keywords").val(key).focus();
		return false;
	});
	$("div.oth_main span.r a").hover(function(){
		var index = $("div.oth_main span.r a").index(this);
		$(this).addClass("cur").siblings().removeClass("cur");
		$("div.oth_lump_con ul").eq(index).show().siblings().hide();
	});
	$("#jyhdid").hover(function(){
		//var hdDiv = document.getElementById("hdak");
		//hdDiv.style.left=$("#jyhdid").offset().left+2;
		//hdDiv.style.top=$("#jyhdid").offset().top+$("#jyhdid").height()-2;
		//hdDiv.style.display="block";
		$("#hdak").css("left",$("#jyhdid").offset().left+2);
		$("#hdak").css("top",$("#jyhdid").offset().top+$("#jyhdid").height()-2);
		$("#hdak").css("display","block");
	});
	$("#jyhdid").mouseout(function(){
		var hdDiv = document.getElementById("hdak");
		hdDiv.style.display="none";
	});
	$("#hdak").mouseover(function(){
		var hdDiv = document.getElementById("hdak");
		hdDiv.style.display="block";
	});
	$("#hdak").mouseout(function(){
		var hdDiv = document.getElementById("hdak");
		hdDiv.style.display="none";
	});
});
/*
function scrollNews(obj){
    var $self=obj.find("ul:first");
	var lineWidth=$self.find("li:first").width();
	 $self.animate({ "marginLeft" : -lineWidth +"px" },1000,function(){
	       $self.css({marginLeft:0}).find("li:first").appendTo($self);
	});
}
*/
function showTimes(obj){
	calendar = new Date();
	day = calendar.getDay();
	month = calendar.getMonth();
	date = calendar.getDate();
	year = calendar.getFullYear();
	if (year< 100) year = 1900 + year;
	cent = parseInt(year/100);
	g = year % 19;
	k = parseInt((cent - 17)/25);
	i = (cent - parseInt(cent/4) - parseInt((cent - k)/3) + 19*g + 15) % 30;
	i = i - parseInt(i/28)*(1 - parseInt(i/28)*parseInt(29/(i+1))*parseInt((21-g)/11));
	j = (year + parseInt(year/4) + i + 2 - cent + parseInt(cent/4)) % 7;
	l = i - j;
	emonth = 3 + parseInt((l + 40)/44); 
	edate = l + 28 - 31*parseInt((emonth/4));
	emonth--;
	var dayname = new Array ("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
	var monthname =
	new Array ("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月" );
	var str=year +"年"+monthname[month]+date + "日"+" "+dayname[day];
	$("#"+obj).html(str);	
}
function _scorll(number,content,left,right){
	var speed=number//速度数值越大速度越慢
 	var jsweb9_cn_left=document.getElementById(content);
	var jsweb9_cn_left2=document.getElementById(right);
	var jsweb9_cn_left1=document.getElementById(left);
	jsweb9_cn_left2.innerHTML=jsweb9_cn_left1.innerHTML
	function Marquee3(){
		if(jsweb9_cn_left2.offsetWidth-jsweb9_cn_left.scrollLeft<=0)
			jsweb9_cn_left.scrollLeft-=jsweb9_cn_left1.offsetWidth
		else{
			jsweb9_cn_left.scrollLeft++
		}
	}
	var MyMar3=setInterval(Marquee3,speed)
	jsweb9_cn_left.onmouseover=function() {clearInterval(MyMar3)}
	jsweb9_cn_left.onmouseout=function() {MyMar3=setInterval(Marquee3,speed)}	
}
function msgTips(status,msg){//信息提示
  	var html='<div class="msgbox"><span class="msg_'+status+'">'+msg+'</span><span class="msg_right"></span></div>';
 	$("body").prepend(html);
	showDiv($(".msgbox"));
	center($(".msgbox"));
	setTimeout(clearMsg,1000)
}
function clearMsg(){
	$("div.msgbox").remove();
}
function showDiv(obj){
	$(obj).show();center(obj);
	$(window).scroll(function(){center(obj);});
	$(window).resize(function(){center(obj);}); 
}
function center(obj){
	var windowWidth = document.documentElement.clientWidth;   
	var windowHeight = document.documentElement.clientHeight;   
	var popupHeight = $(obj).height();   
	var popupWidth = $(obj).width();    
	$(obj).css({   
		"position": "absolute",   
		"top": (windowHeight-popupHeight)/2+$(document).scrollTop(),   
		"left": (windowWidth-popupWidth)/2   
	});  
}
function checkLog(){
	var username=$.trim($("#username").val());
	var password=$.trim($("#password").val());
	var vercode=$.trim($("#vercode").val());
	if(username==''){
		msgTips('error','用户名不能为空');
		$("#username").focus();
		return false;
	}
	if(password==''){
		msgTips('error','密码不能为空');
		$("#password").focus();
		return false;
	}
	if(vercode==''){
		msgTips('vercode','验证码不能为空');
		$("#vercode").focus();
		return false;
	}
}
function my_alertWidth(id){
	$.post("/cms/sx/poll_detail.jsp",{id:id},function(msg){
		$("body").prepend(msg);
	});
	var mybg="<div id='filter'></div>";
	var h=$("body").height();
	$("body").append(mybg);
	$("div#filter").height(h);
}
function close_pop(){
	$("div#filter").remove();
	$("#popWindow").remove();
}
