var famurlArray = new Array(); 


//加载完网页后才加载名站
window.onload=function()
{
	loadFamurl();
}

function setFamurl()
{
	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]+" target=\"_blank\">"+info[0]+"</a></li>"
		}
		if(document.getElementById("famurl")) document.getElementById("famurl").innerHTML = famurllist;
		
	}else{
		setTimeout(setFamurl,100)
	}
}


function loadFamurl()
{
	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;
	setFamurl();
}


// cookies
function top_domain()
{
	var domain;
	var tmp=location.host.split('.');
	var i = tmp.length;
	var hz = tmp[(i-1)];
	var hz2 = tmp[(i-2)];
	if( hz2=='net' || hz2=='com' || hz2=='org'  )
	{
		return tmp[(i-3)]+"."+hz2+"."+hz;
	}
	return tmp[(i-2)]+"."+tmp[(i-1)];
}


function GetCookieVal(offset)
//获得Cookie解码后的值
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie(name)
//获得Cookie的原始值
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return GetCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

function SetCookie(name, value)
//设定Cookie值
{
var expdate = new Date();
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ))
document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
+((secure == true) ? "; secure" : "");
}
function DelCookie(name)
//删除Cookie
{
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
}

//modify end 