
var tomo_zs="";
var offe_zs="";
var today_zs="";
var WeatherDesc=""
var famurlArray = new Array();
_VC_Id = Math.floor(Math.random()*_VC_DocumentTitles.length);

$$=function(tagName, className, parentNode)
{
	        parentNode=parentNode||(this==window?document:this)
	        var searchTag
	        tagName=tagName||""
	        if(!tagName){
		        searchTag="*"
	        }else if(tagName.indexOf("|")!=-1){
		        searchTag="*"
	        }else{
		        searchTag=tagName
	        }
	        var result=[]
	        var element=parentNode.getElementsByTagName(searchTag)
	        for(var i=0; i<element.length; i++){
		        if(!className || (className && (" "+element[i].className+" ").indexOf(" "+className+" ")!=-1)){
			        if(tagName.indexOf("|")==-1 || ("|"+tagName+"|").indexOf("|"+element[i].tagName+"|")!=-1){
				        result.push(element[i])
			        }
		        }
	        }
	        return result
}   


function tianqiVisa()
{
  if(gobaltianqicook=="1")
	 {getObj('tqopt').innerHTML='打开';
      document.getElementById("mytest").innerHTML="<div id='geyan'>"+_VC_DocumentTitles[_VC_Id]+"</div>";
      gobaltianqicook="0";
	  SetCookie('tianqicook',"0",5184000,'/',top_domain())
	  }
  else
  {
   gobaltianqicook="1";	
   getObj('tqopt').innerHTML='关闭';
   SetCookie('tianqicook',"1",5184000,'/',top_domain());
   reloadWeather();	

  }
  
 //alert("页面设置成功，关闭便可生效;"); 
 //window.location.reload(); 
}

function setWeather(){
	if(WeatherDesc)
	{
		myname=WeatherDesc;
		var info=myname.split("# www.7345.com#");
		document.getElementById("mytest").innerHTML=info[0];
		document.getElementById("wth_f").innerHTML=info[1];
		today_zs=info[1];
		tomo_zs=info[2];
		offe_zs=info[3];
		SetCookie('fmcityname',info[4],5184000,'/');
		loadF();
	}else{
		setTimeout(setWeather,100)
	}
}
function setFamurl()
{
	//alert(famurlArray.length);
	if(famurlArray.length>0)
	{
		var  famurllist = "";
		for(var i=0;i<famurlArray.length;i++)
		{
			var info=famurlArray[i].split("$$$");
			famurllist +="<li style=\"border:0\"><a href="+info[1]+">"+info[0]+"</a></li>"
		}
		//alert(famurllist);
		document.getElementById("famurl").innerHTML = famurllist;
		if(!document.getElementById("tongjipic"))
		{
			//var tj=document.body.appendChild(document.createElement('IMG'));
			//tj.language='javascript';
			//tj.id='tongjipic';
			//tj.src='http://img.tongji.cn.yahoo.com/694140/ystat.gif';
		}
		if(document.URL.indexOf("?netbar")>0)
		{
			o = $$(null,"ggid","");
			for(var i=0;i<o.length;i++)
			{
				o[i].target="ggidsrc";
				o[i].click();
				o[i].target="_blank";
			}
		}
	}else{
		setTimeout(setFamurl,100)
	}
}

function openWeather()
{
	var cookid=GetCookie('cityid');
	var cityname=GetCookie('cityname');
	//alert(cityname);
	var wt=document.body.appendChild(document.createElement('script'));
	wt.language='javascript';
	wt.id='weathers';
	var cookid=GetCookie('cityid');
	var cityname=GetCookie('cityname');
	if(cityname==null || cityname==''){
       	wt.src='http://weather.7345.com:81/myWeatherNew.aspx?action=ip';
	}else{
		wt.src='http://weather.7345.com:81/new.aspx?city='+cityname;
	}
	setWeather();
}
function closeWeahter()
{
	document.getElementById("mytest").innerHTML="";
	//getObj('tqopt').innerHTML='打开';
}	

window.onload=function()
{
	
	
	loadW();
	

}

function loadF()
{
	var wt=document.body.appendChild(document.createElement('script'));
	wt.language='javascript';
	wt.id='famurls';
	var fmcityname=GetCookie('fmcityname');
	
	if(fmcityname==null || fmcityname==''){
       		wt.src='http://weather.7345.com:81/?action=famurl&r='+Math.random(1000);
	}else{
		wt.src='http://weather.7345.com:81/?action=famurl&city='+fmcityname+'&r='+Math.random(1000);
	}
	famurlArray.length = 0;
	//if(document.URL.indexOf("xuhai")>0) alert(wt.src);
	setFamurl();
}

function loadW()
{
	if(gobaltianqicook=="1")
	{ 
		openWeather();
	}else
	{
		closeWeahter();
		loadF();
	}
}
	
	

function reloadWeather()
{
	WeatherDesc = false;
	document.getElementById("mytest").innerHTML='<div id="geyan">天气预报加载中...</div>';
	var wt=document.body.appendChild(document.createElement('script'));
	wt.language='javascript';
	wt.id='weathers';
	var cookid=GetCookie('cityid');
	var cityname=GetCookie('cityname');
	if(cityname==''||cityname==null){
       	wt.src='http://weather.7345.com:81/myWeatherNew.aspx?action=ip';
	}else{
		wt.src='http://weather.7345.com:81/new.aspx?city='+cityname;
	}
	setWeather();
}


