function selectCitydiv(obj){
oPopup = window.createPopup(); 
	var oBody = oPopup.document.body;

		var ss = oPopup.document.createStyleSheet();

		ss.addRule("a","color:#3c7411;text-decoration:none;"); 
		ss.addRule("a:hover","color:#CC3300;"); 

		oBody.innerHTML = getSelectCityInformation();
		var flash = document.getElementById("citydiv");
		var x,y;

			x = flash.offsetLeft;
			y = flash.offsetTop;
				//	alert(x);

		  oPopup.show(x+960,y+25,50,175,document.body);
		 

}

function getSelectCityInformation(){


		var returnValue = "";
				
				
							
				
				returnValue += "<div style='position:relative;border:1px #000000 solid;width:50px;z-index:80;font-size:10pt;padding:3px'>"

				returnValue += "<div>"//getselectCityValueByCityName(杭州)
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"杭州\")' >杭州</a>&nbsp;"
				returnValue += "</div>"

				returnValue += "<div>"
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"宁波\")'>宁波</a>&nbsp;"
				returnValue += "</div>"

				returnValue += "<div>"
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"温州\")'>温州</a>&nbsp;"
				returnValue += "</div>"

				returnValue += "<div>"
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"绍兴\")'>绍兴</a>&nbsp;"
				returnValue += "</div>"

				returnValue += "<div>"
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"嘉兴\")'>嘉兴</a>&nbsp;"
				returnValue += "</div>"

				returnValue += "<div>"
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"湖州\")'>湖州</a>&nbsp;"
				returnValue += "</div>"

				returnValue += "<div>"
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"金华\")'>金华</a>&nbsp;"
				returnValue += "</div>"

				returnValue += "<div>"
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"衢州\")'>衢州</a>&nbsp;"
				returnValue += "</div>"

				returnValue += "<div>"
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"丽水\")'>丽水</a>&nbsp;"
				returnValue += "</div>"

				returnValue += "<div>"
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"台州\")'>台州</a>&nbsp;"
				returnValue += "</div>"

				returnValue += "<div>"
				returnValue += "<a href='#' onmousedown='parent.getselectCityValueByCityName(\"舟山\")'>舟山</a>&nbsp;"
				returnValue += "</div>"
				
				

				
	return returnValue;
		

}
//写cookies函数 
function SetCookie(name,value)//两个参数，一个是cookie的名子，一个是值
{
    var Days = 30; //此 cookie 将被保存 30 天
    var exp  = new Date();    //new Date("December 31, 9998");
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)//取cookies函数        
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return unescape(arr[2]); return null;

}
function delCookie(name)//删除cookie
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
function getselectCityValueByCityName(CityName){
document.getElementById("cityinfo").innerHTML="城市:"+CityName;
 var key ="CityName="+CityName;
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
				http_request = new XMLHttpRequest();
			}
			
			else if (window.ActiveXObject) { // IE
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			http_request.open("post","/zje/getWeather.jsp",true);
			http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");	
			http_request.onreadystatechange =function()
			
			{ 
				if(http_request.readyState == 4)
					
				      { 
					 if(http_request.status == 200 && http_request.responseText)
						{
						
							var weatherStr,weatherinfo;
							weatherStr= http_request.responseText;
							if(weatherStr!=null){
							  weatherStr = weatherStr.split("##");
							   weatherinfo = weatherStr[0]+"  "+weatherStr[1];
							  selectWeatherByPic(weatherStr[1]);
							}
							document.getElementById("cityinfoweather").innerHTML=weatherinfo;
                            SetCookie("cityname",CityName);
							//SetCookie("cityinfoweather1",weatherinfo);
						}
					 }
				} 
		     http_request.send(key); 
	  if(parent.oPopup!=undefined){
		oPopup.hide();
		oPopup = null;}
		
	
}
/*
通过天气变化取图片
*/
function selectWeatherByPic(weather){
   var WeahterPic;
   if(weather!=null){
     
	    if(weather.indexOf("大雪")!=-1 || weather.indexOf("暴雪")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_1.gif>";
		}else if(weather.indexOf("中雪")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_2.gif>";
		}else if(weather.indexOf("雪")!=-1 || weather.indexOf("有雪")!=-1 || weather.indexOf("小雪")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_4.gif>";
		}else if(weather.indexOf("雨夹雪")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_5.gif>";
		}else if(weather.indexOf("大雨")!=-1 || weather.indexOf("暴雨")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_6.gif>";
		}else if(weather.indexOf("中雨")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_7.gif>";
		}else if(weather.indexOf("雷雨")!=-1 || weather.indexOf("雷阵雨")!=-1 || weather.indexOf("阵雨")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_8.gif>";
		}else if(weather.indexOf("雨")!=-1 || weather.indexOf("小雨")!=-1 || weather.indexOf("有雨")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_9.gif>";
		}else if(weather.indexOf("大雾")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_10.gif>";
		}else if(weather.indexOf("雾")!=-1 || weather.indexOf("有雾")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_11.gif>";
		}else if(weather.indexOf("阴")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_12.gif>";
		}else if(weather.indexOf("多云")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_13.gif>";
		}else if(weather.indexOf("云")!=-1 || weather.indexOf("有云")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_14.gif>";
		}else if(weather.indexOf("晴")!=-1){ 
		   WeahterPic = "<img src=/zje/images/weather/weather_15.gif>";
		}
		 document.getElementById("weatherPic").innerHTML=WeahterPic;
         // SetCookie("WeahterPic1",WeahterPic);
   
   }
}

function swf(file,w,h) {
//document.write('<div style=\"float:left\">')
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="'+h+'">');
document.write('<param name="movie" value="'+file+'">');
document.write('<param name="quality" value="high">');
document.write('<param name="wmode" value="transparent">');
document.write('<param name="menu" value="false">');
document.write('<embed src="'+file+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>');
document.write('</object>');
//document.write('</div>')



/*

var flash = document.getElementById("flashdiv");
var x,y;

	x = flash.offsetLeft;
	y = flash.offsetTop;


var logo = document.createElement("div");
  

	
	  with(logo){

		  style.position	=	"relative";
		  style.width		=	"143px";
		 style.height		=	"0px";
			style.left		=	x;		
		 style.top			=   y-100;
		// style.backgroundImage    = "/zje/images/logo.gif";

		//  style.border		=	"1px #000 solid";
		 //style.float		=	"left";
	  }
	logo.innerHTML = "<img src='/zje/images/logo.gif'/>";
	
	flash.insertBefore(logo);
	logo.style.height="0px"
	//alert(logo.style.height);

	
*/
}







