var Default_pid="101010100"; //目的就是获取id
var Http_u="http://tool.114la.com/?ct=site&ac=ip_api";
var http_cookies_name="_weather_city4" //cookies名字
function qT_setCookiess(name,value){
	var Days = 5; //此 cookie 将被保存 5 小时
	var exp = new Date(); //new Date("December 31, 9998");
	exp.setTime(exp.getTime() + Days*60*60*1000);
	document.cookie = name + "="+ escape(value) +";path=/;expires="+ exp.toGMTString();
}
function qT_GetCookieVal(offset){
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function qT_GetCookie(name){
	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 qT_GetCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}	
function qT_loadJS(file,id,charset){
	var html_doc = document.getElementsByTagName('head')[0];
	js = document.createElement('script');
	js.setAttribute('type', 'text/javascript');
	js.setAttribute("charset",charset||"utf-8");
	js.setAttribute('src', file);
	if(id){js.id=id}
	html_doc.appendChild(js);
	js.onreadystatechange = function () {if(js.readyState == 'complete' || js.readyState =="loaded"){qT_goif()}};
	js.onload = function (){qT_goif()};
	return false;
}
function qT_goif(){
	
	var id_a
	if (typeof ILData != "undefined"){
		id_a=ILData[4];
		qT_setCookiess('cityids',id_a);qTwtsrc(id_a)
	}
	else qTwtsrc(13000)	
}	

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function qT_loadJS2(file,id,charset){
	
	var html_doc = document.getElementsByTagName('head')[0];
	js = document.createElement('script');
	js.setAttribute('type', 'text/javascript');
	js.setAttribute("charset",charset||"utf-8");
	js.setAttribute('src', file);
	if(id){js.id=id}
	html_doc.appendChild(js);
	js.onreadystatechange = function () {if(js.readyState == 'complete' || js.readyState =="loaded"){qT_goif2()}};
	js.onload = function (){qT_goif2()};
	return false;
}
function qT_goif2(){
	
	var id_a;
	if(typeof(cityid)=="undefined"){
		qTwtsrc(101010100)	
	}else{
		qT_setCookiess('qTcityids',cityid);	
		qTwtsrc(cityid);		
	}
}
//--------------------------------------------------------------------------

var qTcityid=qT_GetCookie(http_cookies_name);

if(isNaN(qTcityid) || qTcityid==null || (new String(qTcityid)).length<5 ){
	//power by qingtiandy.cn 
	//qq:314048526
	//From www.hao123.com
	//方法一
	qT_loadJS("http://tool.114la.com/?ct=site&ac=ip_api","qT_Weather_id","gb2312");
	
	//方法二 不可用
	//qT_loadJS2("http://weather.520.com/getcity/getarea.php","qT_Weather_id","gb2312");
	
}
else
	qTwtsrc(qTcityid)	
	

