jQuery( function($) {
	// news ,event ,video
//		var bgValue = $(".tab_news_event_video .top").find("input").eq(0).val();//获取背景图片地址
//	var isEn = $(".tab_news_event_video .top").find("input").eq(1).val();//判断是否是英文（0 CHN 1 EN）
//	$(".tab_news_event_video .top").eq(0).css("background", bgValue);
//	var bgTemp = "";
//	if(bgValue != null && bgValue != ""){
//		bgTemp = bgValue.substring(0, bgValue.lastIndexOf("/"));
//	}
	newsLoadding = $(".subwindow .article_content").eq(0).html();
	var news=$(".tab_news_event_video .content .articles div"),
	themes=$(".tab_news_event_video #themes div"),
	events=$(".tab_news_event_video #events div");
	var content = $(".tab_news_event_video .content").eq(0);
	var contentFooter =  $(".tab_news_event_video").eq(0).find(".footer").eq(0);
	var more = $(".tab_news_event_video .top .more").eq(0);
	//setMoreOver();

	$(".tab_news_event_video .top .title .new").mouseover(//new 单击事件
			function() {
//				if(isEn == "1"){
//					$(".tab_news_event_video .top").find("input").val(
//						bgTemp + "/news_event_videoEn_bg.gif) no-repeat");
//					$(this).parent().parent().css("background",
//						bgTemp + "/news_event_videoEn_bg.gif) no-repeat");
//				}else{
//					$(".tab_news_event_video .top").find("input").val(
//							bgTemp + "/news_event_video_bg.gif) no-repeat");
//					$(this).parent().parent().css("background",
//							bgTemp + "/news_event_video_bg.gif) no-repeat");
//				}
//				content.css("border", "1px #d6d828 solid");
//				content.css("border-bottom", "none");
//				contentFooter.css("background", bgTemp
//						+ "/news_footer_bg.gif) repeat-x");
//				if(isEn == "1"){
//					//more.html("<div><a href='/newsDetail_1_1.htm'><b><img class='nav_img' border='0' src='template/semicon/images/moreEn.gif'/></b></a></div>");
//				}else{
//					//more.html("<div><a href='/newsDetail_1_1.htm'><b><img class='nav_img' border='0' src='template/semicon/images/more.gif'/></b></a></div>");
//				}
				//setMoreOver();
				$(this).addClass("focus");
				$(".tab_news_event_video .top .title .title_theme").removeClass("focus");
				$(".tab_news_event_video .top .title .events_tt").removeClass("focus");
				var text_h=$("#news_div div h2").html(),text_c=$("#news_div div").html();
				$(this).html(text_h);
				$(".tab_news_event_video .content .articles").eq(0).html(newsLoadding);
				setTimeout(function (){$(".tab_news_event_video .content .articles").eq(0).html(text_c);},500);
				
				news.css("display","block");
				//var __img=newsss.getElementsByTagName("img")[0];__img.src="template/fpd/images/111104.jpg";
				
//				$.ajax({type:"post",
//		            	  url:"eventlist_1.htm",
//		            	  cache:false,
//		            	  dataType:"html",
//		            	  success:function(data){$(".tab_news_event_video .content .articles").eq(0).html(data);}
//		        }); 
			});
	$(".tab_news_event_video .top .title .title_theme").mouseover(//theme单击事件
			function() {
//				if(isEn == "1"){
//					$(".tab_news_event_video .top").find("input").val(
//						bgTemp + "/theme_news_event_videoEn_bg.gif) no-repeat");
//					$(this).parent().parent().css("background",
//						bgTemp + "/theme_news_event_videoEn_bg.gif) no-repeat");
//				}else{
//					$(".tab_news_event_video .top").find("input").val(
//							bgTemp + "/theme_news_event_video_bg.gif) no-repeat");
//					$(this).parent().parent().css("background",
//							bgTemp + "/theme_news_event_video_bg.gif) no-repeat");
//				}
//				content.css("border", "1px #395DA5 solid");
//				content.css("border-bottom", "none");
//				contentFooter.css("background", bgTemp
//						+ "/theme_footer_bg.gif) repeat-x");
//				if(isEn == "1"){
//					//more.html("<div><a href='/newsDetail_4_1.htm'><b><img class='nav_img' border='0' src='template/semicon/images/thememoreEn.gif'/></b></a></div>");
//				}else{
//					//more.html("<div><a href='/newsDetail_4_1.htm'><b><img class='nav_img' border='0' src='template/semicon/images/thememore.gif'/></b></a></div>");
//				}
				$(this).addClass("focus");
				$(".tab_news_event_video .top .title .new").removeClass("focus");
				$(".tab_news_event_video .top .title .events_tt").removeClass("focus");
				var text_h=$("#themes div h2").html(),text_c=$("#themes div").html();
				$(this).html(text_h);
				$(".tab_news_event_video .content .articles").eq(0).html(newsLoadding);
				setTimeout(function (){$(".tab_news_event_video .content .articles").eq(0).html(text_c);},500);
				//setMoreOver();
//				$.ajax({type:"post",
//	            	  url:"eventlist_4.htm",
//	            	  cache:false,
//	            	  dataType:"html",
//	            	  success:function(data){$(".tab_news_event_video .content .articles").eq(0).html(data);}
//	        }); 
				
			});
	$(".tab_news_event_video .top .title .events_tt").mouseover(//event 单击时间
			function() {
//				if(isEn == "1"){
//					$(".tab_news_event_video .top").find("input").val(
//						bgTemp + "/event_news_videoEn.gif) no-repeat");
//					$(this).parent().parent().css("background",
//						bgTemp + "/event_news_videoEn.gif) no-repeat");
//				}else{
//					$(".tab_news_event_video .top").find("input").val(
//							bgTemp + "/event_news_video.gif) no-repeat");
//					$(this).parent().parent().css("background",
//							bgTemp + "/event_news_video.gif) no-repeat");
//				}
//				content.css("border", "1px #A24C59 solid");
//				content.css("border-bottom", "none");
//				contentFooter.css("background", bgTemp
//						+ "/events_footer_bg.gif) repeat-x");
//				if(isEn=="1"){
//					//more.html("<div><a href='/newsDetail_2_1.htm'><b> <img class='nav_img' border='0' src='template/semicon/images/more_eventEn.gif'/></b></a></div>");
//				}else{
//					//more.html("<div><a href='/newsDetail_2_1.htm'><b> <img class='nav_img' border='0' src='template/semicon/images/more_event.gif'/></b></a></div>");
//				}
				$(this).addClass("focus");
				$(".tab_news_event_video .top .title .title_theme").removeClass("focus");
				$(".tab_news_event_video .top .title .new").removeClass("focus");
				var text_h=$("#events div h2").html(),text_c=$("#events div").html();
				$(this).html(text_h);
				$(".tab_news_event_video .content .articles").eq(0).html(newsLoadding);
				setTimeout(function (){$(".tab_news_event_video .content .articles").eq(0).html(text_c);},500);
//				$.ajax({type:"post",
//	            	  url:"eventlist_2.htm",
//	            	  cache:false,
//	            	  dataType:"html",
//	            	  success:function(data){
//						$(".tab_news_event_video .content .articles").eq(0).html(data);
//						if(data){
//							init();
//							}
//						}
//				}); 
			});
	$(".tab_news_event_video .top .title .video").click(//video 单击时间
			function() {
				if(isEn == "1"){
					$(".tab_news_event_video .top").find("input").val(
						bgTemp + "/video_news_evnetEn_bg.gif) no-repeat");
					$(this).parent().parent().css("background",
						bgTemp + "/video_news_evnetEn_bg.gif) no-repeat");
				}else{
					$(".tab_news_event_video .top").find("input").val(
							bgTemp + "/video_news_evnet_bg.gif) no-repeat");
					$(this).parent().parent().css("background",
							bgTemp + "/video_news_evnet_bg.gif) no-repeat");
				}
				content.css("border", "1px #6B6B6B solid");
				content.css("border-bottom", "none");
				contentFooter.css("background", bgTemp
						+ "/videos_footer_bg.gif) repeat-x");
				//more.html("");
				$(".tab_news_event_video .content .articles").eq(0).html(newsLoadding);
//				$.ajax({type:"post",
//	            	  url:"eventlist_3.htm",
//	            	  cache:false,
//	            	  dataType:"html",
//	            	  success:function(data){$(".tab_news_event_video .content .articles").eq(0).html(data);}
//	        }); 
			});

	
});
$(window).scroll(function(){
	var win = $(".subwindow").eq(0);
	var h = $(window).scrollTop()+(($(window).height() - parseInt(win.css("height")))/2);
	var w = $(window).scrollLeft()+(($(window).width() - parseInt(win.css("width")))/2);
	win.css("top", h);
	win.css("left", w);
	win.css("z-index", 9999);
});
//
function setMoreOver(){
	$(".tab_news_event_video .more .nav_img").mouseover(function(){
		 //alert(123);
		 var srcTemp = $(this).attr("src");
		 srcTemp = srcTemp.substring(0,srcTemp.lastIndexOf("."));
		 $(this).attr("src",srcTemp+"_over.gif");
	});

	$(".tab_news_event_video .more .nav_img").mouseout(function(){
		 var srcTemp = $(this).attr("src");
		 srcTemp = srcTemp.substring(0,srcTemp.lastIndexOf("_"));
		 $(this).attr("src",srcTemp+".gif");
	});
}

// JavaScript Document
function changePic(flag) {
	var array = $("#pic_array").val().toString().split(",");
	var tempIndex = $("#temp_index").val();
	
	var pic = $(".middle .banner_index .big_pic").find(".pic").find("img")
			.eq(0);
	if (flag) {
		tempIndex++;
		$("#previous_bg").show();
		if (tempIndex == array.length - 1) {
			$("#nest_bg").hide();
		}
	} else {
		tempIndex--;
		$("#nest_bg").show();
		if (tempIndex == 0) {
			$("#previous_bg").hide();
		}
	}
	$("#temp_index").val(tempIndex);
	var picSrc = pic.attr("src");
	pic.hide();
	pic.attr("src", picSrc.substring(0, picSrc.lastIndexOf("/")) + "/"
			+ array[tempIndex]);
	pic.show("fast");

}
/**
 * 关闭弹出框
 * 
 * @return
 */
function colosWin() {
	$(".subwindow").eq(0).hide();
	$(".win_shadow").eq(0).hide();
}


/**
 * 显示文章
 * 
 * @param url
 * @return
 */
function showArticleConent(url) {
	if(url.indexOf("http:")>=0){
		window.open(url);
		return;
	}
	var shadow = $(".win_shadow").eq(0);
	shadow.css("height", $(document).height() + "px");
	shadow.css("width", $(window).width() + "px");
	shadow.css("top", 0);
	shadow.css("left", 0);
	shadow.css("z-index", 8888);
	shadow.show();
	var win = $(".subwindow").eq(0);
	var h = $(window).scrollTop()+(($(window).height() - parseInt(win.css("height")))/2);
	var w = $(window).scrollLeft()+(($(window).width() - parseInt(win.css("width")))/2);
	win.css("top", h);
	win.css("left", w);
	win.css("z-index", 9999);
	$(".subwindow .article_content").eq(0).html(newsLoadding);
	win.show(500);
	//time1 = setInterval(function(){autoGo(win,692);},10);
	$.ajax({type:"post",
    	  url:url+'_0',
    	  cache:false,
    	  dataType:"html",
    	  success:function(data){$(".subwindow .article_content").eq(0).html(data);}
	}); 
}

/**
 * 
 * @return
 */
function autoGo(obj,wid){
	var w =  obj.css("width");
	w=w.substring(0,w.indexOf("p"));
	if(w>=wid){
		clearInterval(time1);
	}else{
		w = parseInt(w)+12;
		obj.css("width",w+"px");
		var h = ($(window).height() - parseInt(obj.css("height"))) / 2;
		var w = ($(window).width() - parseInt(obj.css("width"))) / 2;
		obj.css("top", h);
		obj.css("left", w);
	}
}
