var MoZhe = new Object();

MoZhe.Browser = {
        ie: /msie/.test(window.navigator.userAgent.toLowerCase()),
        moz: /gecko/.test(window.navigator.userAgent.toLowerCase()),
        opera: /opera/.test(window.navigator.userAgent.toLowerCase())
};

MoZhe.$ = function(s)
{
        return (typeof s == 'object') ? s: document.getElementById(s);
};

MoZhe.JsLoader = {
        load: function(sUrl, fCallback)
        {
                var _script = document.createElement('script');
                _script.setAttribute('type', 'text/javascript');
                _script.setAttribute('src', sUrl);
                document.getElementsByTagName('head')[0].appendChild(_script);

                if (MoZhe.Browser.ie)
                {
                        _script.onreadystatechange = function()
                        {
                                if (this.readyState=='loaded' || this.readyState=='complete')
                                {
                                        fCallback();
                                }
                        };
                }
                else if (MoZhe.Browser.moz)
                {
                        _script.onload = function()
                        {
                                fCallback();
                        };
                }
                else
                {
                        fCallback();
                }
        }
};


MoZhe.Weather = { 
	
	_print: function( City , ShowID )
	{
		//City = 49;
		MoZhe.JsLoader.load("http://weather.news.qq.com/inc/minisite_"+ City +".js", function()
		{
				HunanCity_EN = [
					"Null" ,
					"Changsha" ,
					"Zhangjiajie" ,
					"Yueyang" ,
					"Huaihua" ,						
					"Shaoyang" ,
					"Yiyang" ,
					"Chenzhou" ,
					"Nanyue" ,
					"Zhuzhou" ,
					"Xiangtan" ,
					"Hengyang" ,
					"Loudi" ,
					"Changde" 
				];
				HunanCity_ZH = [
					"Null" ,
					"长沙" ,
					"张家界" ,
					"岳阳" ,
					"怀化" ,						
					"邵阳" ,
					"益阳" ,
					"郴州" ,
					"南岳" ,
					"株洲" ,
					"湘潭" ,
					"衡阳" ,
					"娄底" ,
					"常德" 
				];
				
				try
				{
						
						var CityWealth = __minisite__weather__.split(" ") ;
						var CityWealthShow_ADD = null ;
						
						for( i = 1 ; i <= HunanCity_ZH.length ; i ++ )
						{
							if( CityWealth[0] == HunanCity_ZH[i] )
							{
								CityWealthShow_ADD = HunanCity_EN[i] ;
							
							}
							//alert(CityWealth[0]);
						}
						
						
						MoZhe.$( ShowID ).innerHTML = CityWealthShow_ADD ;
						MoZhe.$( ShowID + "2").innerHTML = "Degree: " + CityWealth[1] ;
						MoZhe.$( ShowID + "1").innerHTML = CityWealth[2] ;
						
						
						
						//MoZhe.$(ShowID).innerHTML = __minisite__weather__;
						
				}
				catch (e)
				{
				}
		});
    },

	print: function( City , ShowID)
	{
		MoZhe.Weather._print( City , ShowID);
	}
};



/////////////  list  伸缩


var mh = 0;//最小高度
var step = 10;//每次变化的px量
var ms = 1;//每隔多久循环一次
function toggle(oo){
o = document.getElementById( oo );
if (!o.tid)o.tid = "_" + Math.random() * 100;
if (!window.toggler)window.toggler = {};
if (!window.toggler[o.tid]){
window.toggler[o.tid]={
obj:o,
//maxHeight:o.offsetHeight,
maxHeight:o.scrollHeight+mh, //这里改动处
minHeight:mh,
timer:null,
// action:1
action:-1 //这里改动处
};
}
o.style.height = 0 + "px";
if (window.toggler[o.tid].timer)clearTimeout(window.toggler[o.tid].timer);
window.toggler[o.tid].action *= -1;
window.toggler[o.tid].timer = setTimeout("anim('"+o.tid+"')",ms );
}
function anim(id){
var t = window.toggler[id];
var o = window.toggler[id].obj;
if (t.action < 0){
if (o.offsetHeight <= t.minHeight){
clearTimeout(t.timer);
return;
}
}
else{
if (o.offsetHeight >= t.maxHeight){
clearTimeout(t.timer);
return;
}
}
o.style.height = (parseInt(o.style.height, 10) + t.action * step) + "px";
window.toggler[id].timer = setTimeout("anim('"+id+"')",ms );
}

