﻿//读取广告模块
//**************************
//视窗首页="Gxbs"
//VIP影视="VIP"
//右江论坛="You_Forum"
//甜蜜蜜论坛="Love_Forum"
//**************************
function ReadAD(){
$.ajax({
	url: '../xml/CreateJSAD.asp',
	data:'adobj=Gxbs',
	success: function(xml){
		
		$(xml).find("Ad").each(function(i){
			var AdObject = $(this).children("AdObject").text();	//广告位置
			var Adname = $(this).children("Adname").text();	//广告名称
			var ADCode = $(this).children("ADCODE").text();	//广告代码
			ADCode = ADCode.replace(/\$\#\$/g,"'")
			var outCodes;
			if (ADCode.indexOf('RunScript:') > 0){
				outCodes = ADCode.split('RunScript:');
				$("#"+AdObject).html(outCodes[0]);
				eval(outCodes[1]);
			}else{
			//显示内容
				$("#"+AdObject).html(ADCode);
			}
		});
	
	},
    error: function (){
      $("#msg_box").html("广告数据发生错误..");
    }
   });

}
/*选项卡:第一种形式 第二种形式 更换显示样式*/
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":"";
	con.style.display=i==cursel?"block":"none";
	}
}
//-->
/*---------------------主导航的JS---------------------------------*/
function ch_barexp(id){
	for(i=0;i<6;i++){
	document.getElementById("ch_bar_"+i).className = "ch_bar_out";
	}
	document.getElementById("ch_bar_"+id).className = "ch_bar_on";
}
//常用工具那里的滑动js
function expit(id){
	for(i=0;i<5;i++){
	document.getElementById("expcon"+i).style.display = "none";
	//document.getElementById("exbtn"+i).className = "clicktools_bar";
	};
	document.getElementById("expcon"+id).style.display = "block";
	//document.getElementById("exbtn"+id).className = "clicktools_bar_on";
}
//上网企业使用的选项卡 i<N  N为上网企业的个数+1
function vidiexp(id){
for(i=0;i<NavLinkMax;i++){
	document.getElementById("vidi_"+i).className = "";
}
	document.getElementById("vidi_"+id).className = "exped";
}
//图片展示
function showflashslide(pics,links,texts){
	var focus_width=300;
	var focus_height=220;
	var text_height=20;
	var swf_height = focus_height+text_height;
	var out2html = ''
	out2html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">';
	out2html += '<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="GxbsApp/Template/flash/pixviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#F7F7F7">';
	out2html += '<param name="menu" value="false"><param name=wmode value="opaque">';
	out2html += '<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">';
	out2html += '<embed src="GxbsApp/Template/flash/pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	out2html += '</object>';
	$("#left_flash").html(out2html);
}
//显示当前时间
function nowtime(){
	today=new Date();
	var hours = today.getHours();
	var minutes = today.getMinutes();
	var seconds = today.getSeconds();
	var timeValue = "";
	timeValue += (hours >= 12) ? " 下午 " : " 上午 ";
	//timeValue += ((hours >12) ? hours -12 :hours); 
	//timeValue += ((minutes < 10) ? ":0" : ":") + minutes+"";
	function initArray(){
		this.length=initArray.arguments.length
		for(var i=0;i<this.length;i++)
		this[i+1]=initArray.arguments[i]
	}
	var d=new initArray("<FONT COLOR=yellow>星期日</font>","星期一","星期二","星期三","星期四","星期五","<FONT COLOR=yellow>星期六</font>"); 
	$(".header_h_l").html(today.getFullYear() + "年" + (today.getMonth()+1) + "月" + today.getDate() + "日 " + d[today.getDay()+1] + " " + timeValue ); 
}

//显示天气预报
function showWeather(locale){
$.ajax({
	url: 'gxbsapp/weather/GetWeather.asp',
	data: "c="+locale,
	success: function(xml){
		$(xml).find("Error").each(function(i){
			var Error = $(this).text();					//错误代码
			var OutHtml = "";
			var TomorrowHtml = "";
			if (Error == 0){
				//显示下周的天气预报
/*				$(xml).find("Day").each(function(i){
					var info_0 = unescape($(this).children("info_0").text());	//日期
					var info_1 = unescape($(this).children("info_1").text());	//图标
					var info_2 = unescape($(this).children("info_2").text());	//天气情况
					var info_3 = unescape($(this).children("info_3").text());	//最高温度
					var info_4 = unescape($(this).children("info_4").text());	//最低温度
					var info_5 = unescape($(this).children("info_5").text());	//风向
					//替换成页面所需要的数据
					info_1 = info_1.replace(/<a (.+?)>(.*?)<\/a>/ig,"$2");			//清除超链接
					info_1 = info_1.replace(/\/m\/i\/icon_weather\/42x30/g,'icon')	//替换成本地地址
					info_3 = info_3.replace(/高温/g,'最高温度')
					info_4 = info_4.replace(/低温/g,'最低温度')
					//显示内容
					OutHtml += info_0 + ":" + info_2 + ":" + info_1 + ":" + info_3 + ":" + info_4 + ":" + info_5  + "<br>";
				});
				$("#msg_box").html(OutHtml);*/
				//显示明天的天气预报
				$(xml).find("Tomorrow").each(function(i){
					var info_0 = $(this).children("info_0").text();	//日期
					var info_1 = $(this).children("info_1").text();	//图标
					var info_2 = $(this).children("info_2").text();	//天气情况
					var info_3 = $(this).children("info_3").text();	//温度
					var info_4 = $(this).children("info_4").text();	//风向
					var info_5 = $(this).children("info_5").text();	//风向
					//替换成页面所需要的数据
					info_1 = info_1.replace(/<a (.+?)>(.*?)<\/a>/ig,"$2");
					info_1 = info_1.replace(/&nbsp;&nbsp;/ig,"&nbsp;");
					info_1 = info_1.replace(/\/m\/i\/icon_weather\/42x30/g,'gxbsapp/weather/icon')	//替换成本地地址
					//显示内容
					TomorrowHtml += info_0 + "&nbsp;" + info_1 + "&nbsp;" + info_2 + "&nbsp;" + info_3 + "&nbsp;" + info_4 ;
				});
			  $(".header_h_r").html(TomorrowHtml);
			}else{
			  $(".header_h_r").html("读取天气预报发生错误！");
			}
		});
		
	},
    error: function (){
	  $(".header_h_r").html("天气预报采集发生错误！");
    }
   });
}

//自动网页数据
function updateSitePage(){
	$.get("gxbsapp/theme2009/CreateIndexXml.asp",{a:"c"},function(data){
		if (data == 'ok'){
			$.get("gxbsapp/theme2009/refresh_Theme.asp",{a:"index",c:"true"},function(data){
				$("#siteStat").text(data).fadeIn("slow",function(){
					setTimeout('$("#siteStat").fadeOut("slow");',1000);
				});
			});
		}
	});
}