/**
 * @author Administrator
 */           var xmlHttp;
		function createXmlHttp()
		{
			if(window.ActiveXObject)
			{	
			    try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}	catch(e){}
			}
			else if(window.XMLHttpRequest)
			{
				
				try{xmlHttp=new XMLHttpRequest();}catch(e){}
				
			}
		}
			function gb2utf8(data){ 
			   var glbEncode = []; 
			   gb2utf8_data = data; 
			   execScript("gb2utf8_data = MidB(gb2utf8_data, 1)", "VBScript"); 
			   var t=escape(gb2utf8_data).replace(/%u/g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace(/%([A-Z].)%(.{2})/g,"@$1$2"); 
			   t=t.split("@"); 
			   var i=0,j=t.length,k; 
			   while(++i<j) { 
			      k=t[i].substring(0,4); 
			      if(!glbEncode[k])  
			      { 
			         gb2utf8_char = eval("0x"+k); 
			         execScript("gb2utf8_char = Chr(gb2utf8_char)", "VBScript"); 
			         glbEncode[k]=escape(gb2utf8_char).substring(1,6); 
			      } 
			      t[i]=glbEncode[k]+t[i].substring(4); 
			   } 
			   gb2utf8_data = gb2utf8_char = null; 
			   return unescape(t.join("%")); 
			} 
			function sendxmlHttp(weathercity)
			{
			    document.getElementById("test").innerHTML="loading..."  ;
				if(!weathercity)
				{
					httpstr="http://weather.tq121.com.cn/mapanel/index1.php?city=长春"	
				}
				else
				{
					//httpstr="http://weather.tq121.com.cn/mapanel/index1.php?city="+weathercity;
					httpstr="http://weather.tq121.com.cn/mapanel/index1.php?city=长春"
				}
				createXmlHttp();
				xmlHttp.open("GET",httpstr,true);
				xmlHttp.onreadystatechange=callbackWeather;
				xmlHttp.send(null);
			}
			function callbackWeather()
			{
				if(xmlHttp.readyState==4)
				if(xmlHttp.status==200)
				{
					var TextDoc=gb2utf8(xmlHttp.responseBody);
					//var pat = /[^\x00-\xff]+/g; //这个是双字节的。就是说带标点符号
					var pat =/"weather">[\u4e00-\u9fa5]+<\/td>/; //这个好象带中文的。
					var pat1 =/"weatheren">\S*<\/td>/; //这个好象带中文的。
					var pat2=/<span class="big-cn">[\u4e00-\u9fa5]+<\/span>/
					var str="<div id="+TextDoc.match(pat);
					var str1="<div id="+TextDoc.match(pat1);
					var str2=TextDoc.match(pat2);
					var patt1=/td/g;
					document.getElementById("test").innerHTML=str2;
					document.getElementById("tester").innerHTML=str.replace(patt1,"div");
					document.getElementById("testsan").innerHTML=str1.replace(patt1,"div");
				}
			}
			//Cookie日期修正函数 function FixCookieDate(date)
			function FixCookieDate(date){
				var base = new Date(0);
				var skew = base.getTime();
				if (skew > 0)date.setTime(date.getTime() - skew);
			}
			function myCustomize(city)
			{
				if(city == "")
				{
					alert("请选择城市");
					return false;
				}
				var expdate = new Date();
				FixCookieDate(expdate);//修正MAC机器的BUG
				expdate.setTime(expdate.getTime() + (1000*60*60*24*365));//设置Cookie的有效期为1年
				setcookie(city,expdate);
			}
			function setcookie(cityname,date)
			{
					document.cookie="userSelect="+ escape(cityname)+";expires="+date+";"+"domain=dodoshop.com.cn";
					alert("定制成功！");
					
			}
			//获取Cookie函数 function GetCookie()
				function GetCookie(){
						var result;
						var start;
						var end;
						var names="userSelect=";
						var city;
						result=document.cookie;
						start=result.indexOf("userSelect");
						start=(start+names.length);
						end=result.indexOf(";",start);
						if(end==-1)
						end=result.length;
						city=result.substring(start,end);	
						if(city!="")	
						{
						    sendxmlHttp(city);
						}
						else
						{
						city=unescape(city);
							sendxmlHttp("");
						}
					}
					function display()
					{
						GetCookie();
					}