var ts = Math.random();
document.writeln('<style>');
document.writeln('#header-menu{height:26px;background-color:#666666;width:1002px;margin:0 auto;}');
document.writeln('#header-menu-inner{height:25px;background-color:#f6f6f7;position:relative;}');
document.writeln('#header-menu-company{background-color:#666666;position:absolute;padding-left:30px;width:712px;top:1px;height:24px;text-align:left;}');
document.writeln('#header-menu-loginbox{background-color:#f6f6f7;position:absolute;left:712px;}');
document.writeln('#header-main{width:1002px;height:87px;margin:0 auto;position:relative;overflow:hidden;}');
document.writeln('#header-logo{position:absolute;width:777px;top:0px;overflow:hidden;}');
document.writeln('#header-weather{position:absolute;left:777px;top:0px;width:220px;}');
document.writeln('#apDiv1 {position:absolute;left:-600px;/*top:248px;*/width:720px;height:80px;z-index:3000;display:none;}');
document.writeln('.pic_click {cursor:pointer;}');
document.writeln('.weather{font-size: 12px;color: #333333;font-family: Arial, Helvetica, sans-serif;}');
// newslist.css
document.writeln('.toptbs a {color: #FFFFFF;text-decoration: none;border: none;font-size: 10pt;}');
document.writeln('.toptbs a:hover {text-decoration: none;color: #FFFF00;}');
// ctshome.css
document.writeln('.header-style53 {color: #CCCCCC}');
document.writeln('.topmember a {font-size: 12px;text-decoration: none;color: #333333;}');
document.writeln('.topmember a:hover {Text-decoration: none;color: #3573ba;}');
document.writeln('</style>');
// End of CSS Setting
document.writeln('<div id="header-menu">');
document.writeln('<div id="header-menu-inner">');
document.writeln('<div id="header-menu-company"><span class="toptbs"><a href="http://www.tbs.org.tw/" target="_blank"><img src="http://home.cts.com.tw/images/tbs_logo.gif" alt="tbs_logo" width="50" height="22" border="0" align="absmiddle" class="toptbs" longdesc="http://www.tbs.org.tw/">　</a><a href="http://www.tbs.org.tw/" target="_blank" class="toptbs">公廣集團</a><span class="header-style53">│</span><a href="http://www.cts.com.tw/" target="_blank">中華電視公司</a><span class="header-style53">│</span><a href="http://ctse.cts.com.tw/" target="_blank">華視文化公司</a><span class="header-style53">│</span><a href="http://ccef.cts.com.tw/foundation/" target="_blank">華視文教基金會</a><span class="header-style53">│<a href="http://ccef.cts.com.tw/" target="_blank">華視訓練中心</a>│</span><a href="http://www.mediapark.com.tw/" target="_blank">華視媒體園區</a></span></div>');
document.writeln('<div id="header-menu-loginbox"><table width="290" height="25" border="0" align="right" cellpadding="0" cellspacing="0"><tr>');
document.writeln('<td width="26" background="http://home.cts.com.tw/images/top_bar2_02.gif"><img src="http://home.cts.com.tw/images/top_bar2_01.gif" width="26" height="25"></td>');
document.writeln('<td width="259" background="http://home.cts.com.tw/images/top_bar2_02.gif">');
document.writeln('<div align="center"><table width="90%" border="0" cellspacing="0" cellpadding="0"><tr><td><div align="right"><img src="http://home.cts.com.tw/images/add_home_icon.gif" width="15" align="absmiddle" height="16"> <span class="topmember"><a href="#" ONCLICK="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://www.cts.com.tw\');">設為首頁</a></span><span class="style3">│</span><img src="http://home.cts.com.tw/images/rarrow_gr_icon.gif" width="9" height="9" align="absmiddle"> <span class="topmember"><a href="http://www.cts.com.tw/default.aspx?ch=memb" target="_blank">會員中心</a></span><!--<span class="style3">│</span><img src="http://home.cts.com.tw/images/rarrow_red_icon.gif" width="9" height="9" align="absmiddle"> <span class="topmember"><a href="#">註冊</a></span>--><span class="style3">│</span> <img src="http://home.cts.com.tw/images/home_icon.gif" width="15" height="16" align="absmiddle"><span class="topmember"><a href="http://www.cts.com.tw/"> 回首頁</a></span></div></td></tr></table></div>');
document.writeln('</td></tr></table></div>'); // End of header-menu-loginbox
document.writeln('</div>');// End of header-menu-inner
document.writeln('</div>');// End of header-menu
document.writeln('<div id="header-main">');
document.writeln('<div id="header-logo">');
// Header Logo Flash
document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="777" height="87">');
document.writeln('<param name="movie" value="http://home.cts.com.tw/f/top_20090609_01.swf?t=_1268422201"><param name="quality" value="high"><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent">');
document.writeln('<embed src="http://home.cts.com.tw/f/top_20090609_01.swf?t=_1268422201" allowScriptAccess="always" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="777" height="87"></embed>');
document.writeln('</object>');
// End of Header Logo Flash
document.writeln('</div>');// End of header-logo
document.writeln('<div id="header-weather">');

document.writeln('<table width="224" cellspacing="0" cellpadding="0" border="0">');
document.writeln('<tr><td height="11"><img width="4" height="11" alt="" src="http://news.cts.com.tw/images/weather_box_01_s.gif"/></td><td><img width="215" height="11" alt="" src="http://news.cts.com.tw/images/weather_box_02_s.gif"/></td>');
document.writeln('<td><img width="5" height="11" alt="" src="http://news.cts.com.tw/images/weather_box_03_s.gif"/></td></tr>');
document.writeln('<tr><td height="50"><img width="4" height="50" alt="" src="http://news.cts.com.tw/images/weather_box_04.gif"/></td>');
document.writeln('<td background="http://news.cts.com.tw/images/weather_box_05.gif"><table width="215" cellspacing="1" cellpadding="1" border="0" align="center">');
document.writeln('<tr><td width="45" rowspan="3"><div align="center" id="weather-icon-hold"><img width="43" height="42" alt="" src="http://news.cts.com.tw/images/w_icon.gif"/></div></td>');
document.writeln('<td width="170" height="15" class="weather" align="absmiddle"><span id="city-location"></span>');
document.writeln('<img width="15" height="15" border="0" align="absmiddle" name="Image11" src="http://news.cts.com.tw/images/weather_ch_icon1.gif" class="pic_click" id="location-selector" onClick="return weather_toggle();" />');
document.writeln('<a href="http://news.cts.com.tw/cts/life/201003/201003120427585.html" target="_blank"><img width="86" height="19" align="absmiddle" src="http://news.cts.com.tw/images/weather_icon.gif" border="0" /></a></td>');
document.writeln('</tr><tr><td height="5" background="http://news.cts.com.tw/images/dot.gif"/></tr><tr>');
document.writeln('<td height="15" class="weather">');
/* 地區選項 */
document.writeln('<div style="position:absolute;z-index:300;"><div id="apDiv1" class="weather" style="z-index:300;">');
document.writeln('<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td height="40" background="http://news.cts.com.tw/images/weath_bg.jpg">');
document.writeln('<table width="100%" cellspacing="1" cellpadding="1" border="0" align="center" class="box3"><tr>');
	document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'taipei_c\');">台北市</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'kaohsiung_c\');">高雄市</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'keelung\');">基隆地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'taipei\');">台北地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'taoyuen\');">桃園地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'hsinchu\');">新竹地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'miaoli\');">苗栗地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'taichung\');">台中地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'changhua\');">彰化地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'nantou\');">南投地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'yunlin\');">雲林地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'chiayi\');">嘉義地區</a></div></td>');
			document.writeln('</tr><tr>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'tainan\');">台南地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'kaohsiung\');">高雄地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'pingtung\');">屏東地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'hengchun\');">恆春半島</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'ilan\');">宜蘭地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'hualien\');">花蓮地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'taitung\');">台東地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'penghu\');">澎湖地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'kinmen\');">金門地區</a></div></td>');
		document.writeln('<td class="topmember"><div align="left"><a href="#" onClick="return location_change(\'matsu\');">馬祖地區</a></div></td>');
				document.writeln('<td>&nbsp;</td>');
			document.writeln('<td>&nbsp;</td>');
	document.writeln('</tr>');
document.writeln('</table></td></tr></table>');
document.writeln('</div></div>');
/* /地區選項 */
document.writeln('<div id="city-weather"></div></td>');
document.writeln('</tr></table></td><td><img width="5" height="50" alt="" src="http://news.cts.com.tw/images/weather_box_06.gif"/></td>');
document.writeln('</tr><tr><td><img width="4" height="4" alt="" src="http://news.cts.com.tw/images/weather_box_07.gif"/></td><td><img width="215" height="4" alt="" src="http://news.cts.com.tw/images/weather_box_08.gif"/></td>');
document.writeln('<td><img width="5" height="4" alt="" src="http://news.cts.com.tw/images/weather_box_09.gif"/></td></tr><tr><td height="23"> </td><td valign="bottom"><div align="center"><!--<span class="style48"><font size="2">最新：</font></span><span class="newstitle"><a class="newstitle" href="http://news.cts.com.tw/topic/index60.html" target="_blank">痞子英雄掀金鐘炫風</a></span></div>--></td><td> </td></tr></table>');
document.writeln('<div style="display:none;"> id="hidden-weather-info"');
	document.writeln('<div id="city-taipei_c"><span onClick="return weather_toggle();" class="pic_click">台北市</span></div>');
	document.writeln('<div id="city-weather-taipei_c">降雨率 20% 　21°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-taipei_c"><img width="43" height="42" alt="晴轉多雲" src="http://news.cts.com.tw/images/w_icon07.gif"/></div>');
	document.writeln('<div id="city-kaohsiung_c"><span onClick="return weather_toggle();" class="pic_click">高雄市</span></div>');
	document.writeln('<div id="city-weather-kaohsiung_c">降雨率 10% 　24°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-kaohsiung_c"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-keelung"><span onClick="return weather_toggle();" class="pic_click">基隆地區</span></div>');
	document.writeln('<div id="city-weather-keelung">降雨率 30% 　21°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-keelung"><img width="43" height="42" alt="晴轉多雲局部短暫陣雨" src="http://news.cts.com.tw/images/w_icon10.gif"/></div>');
	document.writeln('<div id="city-taipei"><span onClick="return weather_toggle();" class="pic_click">台北地區</span></div>');
	document.writeln('<div id="city-weather-taipei">降雨率 30% 　21°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-taipei"><img width="43" height="42" alt="晴轉多雲局部短暫陣雨" src="http://news.cts.com.tw/images/w_icon10.gif"/></div>');
	document.writeln('<div id="city-taoyuen"><span onClick="return weather_toggle();" class="pic_click">桃園地區</span></div>');
	document.writeln('<div id="city-weather-taoyuen">降雨率 30% 　21°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-taoyuen"><img width="43" height="42" alt="晴轉多雲局部短暫陣雨" src="http://news.cts.com.tw/images/w_icon10.gif"/></div>');
	document.writeln('<div id="city-hsinchu"><span onClick="return weather_toggle();" class="pic_click">新竹地區</span></div>');
	document.writeln('<div id="city-weather-hsinchu">降雨率 30% 　24°c ~ 29°c</div>');
	document.writeln('<div id="weather-icon-hsinchu"><img width="43" height="42" alt="晴轉多雲局部短暫陣雨" src="http://news.cts.com.tw/images/w_icon10.gif"/></div>');
	document.writeln('<div id="city-miaoli"><span onClick="return weather_toggle();" class="pic_click">苗栗地區</span></div>');
	document.writeln('<div id="city-weather-miaoli">降雨率 30% 　24°c ~ 29°c</div>');
	document.writeln('<div id="weather-icon-miaoli"><img width="43" height="42" alt="晴轉多雲局部短暫陣雨" src="http://news.cts.com.tw/images/w_icon10.gif"/></div>');
	document.writeln('<div id="city-taichung"><span onClick="return weather_toggle();" class="pic_click">台中地區</span></div>');
	document.writeln('<div id="city-weather-taichung">降雨率 20% 　22°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-taichung"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-changhua"><span onClick="return weather_toggle();" class="pic_click">彰化地區</span></div>');
	document.writeln('<div id="city-weather-changhua">降雨率 20% 　22°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-changhua"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-nantou"><span onClick="return weather_toggle();" class="pic_click">南投地區</span></div>');
	document.writeln('<div id="city-weather-nantou">降雨率 30% 　21°c ~ 29°c</div>');
	document.writeln('<div id="weather-icon-nantou"><img width="43" height="42" alt="晴轉多雲局部短暫陣雨" src="http://news.cts.com.tw/images/w_icon10.gif"/></div>');
	document.writeln('<div id="city-yunlin"><span onClick="return weather_toggle();" class="pic_click">雲林地區</span></div>');
	document.writeln('<div id="city-weather-yunlin">降雨率 20% 　22°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-yunlin"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-chiayi"><span onClick="return weather_toggle();" class="pic_click">嘉義地區</span></div>');
	document.writeln('<div id="city-weather-chiayi">降雨率 20% 　22°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-chiayi"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-tainan"><span onClick="return weather_toggle();" class="pic_click">台南地區</span></div>');
	document.writeln('<div id="city-weather-tainan">降雨率 10% 　23°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-tainan"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-kaohsiung"><span onClick="return weather_toggle();" class="pic_click">高雄地區</span></div>');
	document.writeln('<div id="city-weather-kaohsiung">降雨率 10% 　24°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-kaohsiung"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-pingtung"><span onClick="return weather_toggle();" class="pic_click">屏東地區</span></div>');
	document.writeln('<div id="city-weather-pingtung">降雨率 10% 　24°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-pingtung"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-hengchun"><span onClick="return weather_toggle();" class="pic_click">恆春半島</span></div>');
	document.writeln('<div id="city-weather-hengchun">降雨率 10% 　24°c ~ 30°c</div>');
	document.writeln('<div id="weather-icon-hengchun"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-ilan"><span onClick="return weather_toggle();" class="pic_click">宜蘭地區</span></div>');
	document.writeln('<div id="city-weather-ilan">降雨率 20% 　20°c ~ 29°c</div>');
	document.writeln('<div id="weather-icon-ilan"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-hualien"><span onClick="return weather_toggle();" class="pic_click">花蓮地區</span></div>');
	document.writeln('<div id="city-weather-hualien">降雨率 20% 　22°c ~ 29°c</div>');
	document.writeln('<div id="weather-icon-hualien"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-taitung"><span onClick="return weather_toggle();" class="pic_click">台東地區</span></div>');
	document.writeln('<div id="city-weather-taitung">降雨率 10% 　26°c ~ 34°c</div>');
	document.writeln('<div id="weather-icon-taitung"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-penghu"><span onClick="return weather_toggle();" class="pic_click">澎湖地區</span></div>');
	document.writeln('<div id="city-weather-penghu">降雨率 20% 　23°c ~ 28°c</div>');
	document.writeln('<div id="weather-icon-penghu"><img width="43" height="42" alt="多雲" src="http://news.cts.com.tw/images/w_icon03.gif"/></div>');
	document.writeln('<div id="city-kinmen"><span onClick="return weather_toggle();" class="pic_click">金門地區</span></div>');
	document.writeln('<div id="city-weather-kinmen">降雨率 30% 　17°c ~ 22°c</div>');
	document.writeln('<div id="weather-icon-kinmen"><img width="43" height="42" alt="多雲短暫陣雨" src="http://news.cts.com.tw/images/w_icon10.gif"/></div>');
	document.writeln('<div id="city-matsu"><span onClick="return weather_toggle();" class="pic_click">馬祖地區</span></div>');
	document.writeln('<div id="city-weather-matsu">降雨率 40% 　16°c ~ 22°c</div>');
	document.writeln('<div id="weather-icon-matsu"><img width="43" height="42" alt="多雲短暫陣雨" src="http://news.cts.com.tw/images/w_icon10.gif"/></div>');
document.writeln('</div>');// End of hidden-weather-info
document.writeln('</div>');// End of header-weather
document.writeln('</div>');// End of header-main

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // NOTE Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

/*** Main Code for Weather ***/
var location_selector_open = true;
var city_log = 'taipei';
function weather_toggle(){
	$("#apDiv1").slideToggle("fast",location_selector_ex());
	return false;
}
function location_selector_ex(){
	//alert($("#apDiv1").css("display"));
	if( $("#apDiv1").css("display") == "block" )
		$("#location-selector").attr("src","http://news.cts.com.tw/images/weather_ch_icon1.gif");
	else
		$("#location-selector").attr("src","http://news.cts.com.tw/images/weather_ch_icon2.gif");
}
function location_change( city ){
	$.cookie('cts-weather', city, { expires: 31, path: '/', domain:'.cts.com.tw' });
	$("#city-location").html($("#city-"+city).html());
	$("#city-weather").html($("#city-weather-"+city).html());
	$("#weather-icon-hold").html($("#weather-icon-"+city).html());
	weather_toggle();
	return false;
}
if($.cookie('cts-weather') == null)
	$.cookie('cts-weather', city_log, { expires: 31, path: '/', domain:'.cts.com.tw' });
else
	city_log = $.cookie('cts-weather');
$("#city-location").html($("#city-"+city_log).html());
$("#city-weather").html($("#city-weather-"+city_log).html());
$("#weather-icon-hold").html($("#weather-icon-"+city_log).html());
/*** End for Weather ***/