//===========================================================================
//基本設定
//==================== begin ================================================
topMargin = 112;
layerHeight = 23;
leftMargin = 90;
tableWidth = 200;
rowHeight = 22;
showWeekly = true;
path = '';
//====================  end  ================================================

//===========================================================================
//所有的menu
//==================== begin ================================================
menuNames = new Array('t','fo','so','int','e','life','sp','show');
titles = new Array('頭版新聞','焦點新聞','社會新聞','國際新聞','財經焦點','生活新聞','體育新聞','影視名人');
pages = new Array('today-t1.htm','today-fo1.htm','today-so0.htm','today-int0.htm','today-e1.htm','today-life1.htm','today-sp0.htm','today-show1.htm');
if (showWeekly)
{
	menuNames = menuNames.concat(new Array('weekly'));
	titles = titles.concat(new Array('新春專刊'));
	pages = pages.concat(new Array('today-weekly1.htm'));
}
else
{
	menuNames = menuNames.concat(new Array('supplement'));
	titles = titles.concat(new Array('生活藝文'));
	pages = pages.concat(new Array('today-fashion1.htm'));
}
menuNames2 = new Array('fashion','living','family','medicine','article','young','art','travel');

names = menuNames.concat(menuNames2);
menus = Array(names.length);
for (i=0; i<menus.length; i++)
{
	menus[i] = new Object();
	menus[i].name = names[i];
}
//====================  end  ================================================

//===========================================================================
//主選單
//==================== begin ================================================
document.write('<TABLE class=block2L cellSpacing=1 cellPadding=3 width=90 border=0>');
document.write('	<TR>');
document.write('		<TD bgColor=#333399>今日要聞</TD>');
document.write('	</TR>');
for (i=0; i<menuNames.length; i++)
{
	document.write('	<TR>');
	document.write('		<TD class=block2L_tda onMouseOver="showMenu(this,'+menuNames[i]+')" onMouseOut="hideMenu()" style=color:blue;cursor:pointer');
	document.write('				onClick="location.href=\''+path+pages[i]+'\'">'+titles[i]+'</TD>');
	document.write('	</TR>');
}
document.write('	<TR>');
document.write('		<TD bgColor=#cc6600><A class=block2La href="'+path+'Rnews.htm">專題報導</A></TD>');
document.write('	</TR>');
document.write('	<TR>');
document.write('		<TD bgColor=#666666>服務專區</TD>');
document.write('	</TR>');
document.write('	<TR>');
document.write('		<TD class=block2L_tdb><A class=block2La href="http://www.roclotto.com.tw/" target=_blank>樂透彩券</A></TD>');
document.write('	</TR>');
document.write('	<TR>');
document.write('		<TD class=block2L_tdb><A class=block2La href="'+path+'Nnews.htm">統一發票</A></TD>');
document.write('	</TR>');
document.write('	<TR>');
document.write('		<TD class=block2L_tdb><font color=blue><A onmouseover="this.style.cursor=\'pointer\';this.style.color=\'deepskyblue\'" ');
document.write('			onclick="window.open(\'http://www.libertytimes.com.tw/Service/Order.htm\',\'_new\',\'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=770,height=650\');" ');
document.write('			onmouseout="this.style.color=\'blue\'">訂報服務</A></FONT></TD>');
document.write('	</TR>');
document.write('	<TR>');
document.write('		<TD class=block2L_tdb><A href="http://www.libertytimes.com.tw/about/recruit.htm">求才專區</a></TD>');
document.write('	</TR>');
document.write('	<TR>');
document.write('		<TD class=block2L_tdb><A href="http://www.lscc.com.tw/" target=_blank>自由廣場<br>國際會議中心</a></TD>');
document.write('	</TR>');
document.write('</TABLE>');
//====================  end  ================================================

//===========================================================================
//所有的menu的項目，由PHP產生
//==================== begin ================================================

menu = getMenu('fo');
menu.layer = 1;
menu.menuLayer = 0;
menu.rows = new Array(12);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
	rows[0].text = '扁擬廢國統會 綠挺藍批';
	rows[0].link = 'today-fo1.htm';
																										
	rows[1].text = '新聞辭典／黑機關國統會 停擺近七年';
	rows[1].link = 'today-fo2.htm';
																										
	rows[2].text = '初一祈福 呂蘇游馬分頭上香';
	rows[2].link = 'today-fo3.htm';
																										
	rows[3].text = '日外相主張 由天皇參拜靖國神社';
	rows[3].link = 'today-fo4.htm';
																										
	rows[4].text = '除夕拜九廟 福袋中轎車';
	rows[4].link = 'today-fo5.htm';
																										
	rows[5].text = '阿扁紅包 18000個發了';
	rows[5].link = 'today-fo6.htm';
																										
	rows[6].text = '祈新願 香火繚繞喜迎春';
	rows[6].link = 'today-fo7.htm';
																										
	rows[7].text = '陳佑昇 舞弄藝陣 國際發光';
	rows[7].link = 'today-fo8.htm';
	rows[7].type = '自由之星 2005';
																										
	rows[8].text = '鄭文欽 七彩神仙 世界冠軍';
	rows[8].link = 'today-fo9.htm';
	rows[8].type = '自由之星 2005';
																										
	rows[9].text = '周利妠 為兒苦行 交安最行';
	rows[9].link = 'today-fo10.htm';
	rows[9].type = '自由之星 2005';
																										
	rows[10].text = '劉昊、林雲敏 另類家園 大愛相隨';
	rows[10].link = 'today-fo11.htm';
	rows[10].type = '自由之星 2005';
																										
	rows[11].text = '陳建仁 「醫」馬當先 總統獎勵';
	rows[11].link = 'today-fo12.htm';
	rows[11].type = '自由之星 2005';
																										
}
menu = null;

menu = getMenu('int');
menu.layer = 3;
menu.menuLayer = 0;
menu.rows = new Array(7);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
	rows[0].text = '波蘭展館倒塌 至少66死';
	rows[0].link = 'today-int1.htm';
																										
	rows[1].text = '科威特總理薩巴 宣誓繼任元首';
	rows[1].link = 'today-int2.htm';
																										
	rows[2].text = '美國華人 推動農曆春節放假';
	rows[2].link = 'today-int3.htm';
																										
	rows[3].text = 'PETA愛動物 使出非常手段';
	rows[3].link = 'today-int4.htm';
																										
	rows[4].text = '寵愛狗狗 日人花錢不手軟';
	rows[4].link = 'today-int5.htm';
																										
	rows[5].text = '當小河馬遇見老象龜…';
	rows[5].link = 'today-int6.htm';
																										
	rows[6].text = '《中英對照讀新聞》Food preservative cuts lung bug 食物防腐劑減少肺部病菌';
	rows[6].link = 'today-int7.htm';
																										
}
menu = null;

menu = getMenu('so');
menu.layer = 2;
menu.menuLayer = 0;
menu.rows = new Array(5);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
	rows[0].text = '新春傳佳音 索國遭挾 我兩船終獲釋';
	rows[0].link = 'today-so1.htm';
																										
	rows[1].text = '今天回娘家 善用替代道路';
	rows[1].link = 'today-so2.htm';
																										
	rows[2].text = '開春首日 北市光華橋走入歷史';
	rows[2].link = 'today-so3.htm';
																										
	rows[3].text = '西班牙破兒童色網 台網友入列';
	rows[3].link = 'today-so4.htm';
																										
	rows[4].text = '警犬當家 好年汪汪來';
	rows[4].link = 'today-so5.htm';
																										
}
menu = null;

menu = getMenu('life');
menu.layer = 5;
menu.menuLayer = 0;
menu.rows = new Array(3);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
	rows[0].text = '風城竹蓮寺 菩薩賜福 心誠則靈';
	rows[0].link = 'today-life1.htm';
	rows[0].type = '寺廟巡禮';
																										
	rows[1].text = '台北行天宮 去災解厄 永保安康';
	rows[1].link = 'today-life2.htm';
	rows[1].type = '寺廟巡禮';
																										
	rows[2].text = '鹿港天后宮 湄洲媽 過年當家';
	rows[2].link = 'today-life3.htm';
	rows[2].type = '寺廟巡禮';
																										
}
menu = null;

menu = getMenu('sp');
menu.layer = 6;
menu.menuLayer = 0;
menu.rows = new Array(7);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
	rows[0].text = '費德爾 澳網奪冠';
	rows[0].link = 'today-sp1.htm';
																										
	rows[1].text = '辛吉絲、布帕希 聯手演出大驚奇';
	rows[1].link = 'today-sp2.htm';
																										
	rows[2].text = '超級盃賭盤 唱衰海鷹';
	rows[2].link = 'today-sp3.htm';
																										
	rows[3].text = '小牛八連勝 追平馬刺';
	rows[3].link = 'today-sp4.htm';
																										
	rows[4].text = '《別克高球邀請賽》賈西亞、潘普林並列領先榜';
	rows[4].link = 'today-sp5.htm';
																										
	rows[5].text = '《環泰國國際自由車賽第五站》賴冠華 騎出個人最佳成績';
	rows[5].link = 'today-sp6.htm';
																										
	rows[6].text = '別說不認識貝克漢';
	rows[6].link = 'today-sp7.htm';
																										
}
menu = null;

menu = getMenu('e');
menu.layer = 4;
menu.menuLayer = 0;
menu.rows = new Array(7);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
	rows[0].text = '黃金商品 魅力無法擋';
	rows[0].link = 'today-e1.htm';
																										
	rows[1].text = '新玩意兒能源基金 高報酬高風險';
	rows[1].link = 'today-e2.htm';
																										
	rows[2].text = '美告別升息 美債最看好';
	rows[2].link = 'today-e3.htm';
																										
	rows[3].text = '印度股市萬點在望';
	rows[3].link = 'today-e4.htm';
																										
	rows[4].text = '陽光墨西哥 美洲經濟要角';
	rows[4].link = 'today-e5.htm';
																										
	rows[5].text = '土耳其一路猛飆 已破４萬點';
	rows[5].link = 'today-e6.htm';
																										
	rows[6].text = '越南變金磚 台商功勞大';
	rows[6].link = 'today-e7.htm';
																										
}
menu = null;

menu = getMenu('t');
menu.layer = 0;
menu.menuLayer = 0;
menu.rows = new Array(1);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
	rows[0].text = '總統：考慮廢國統會、國統綱領';
	rows[0].link = 'today-t1.htm';
																										
}
menu = null;

menu = getMenu('show');
menu.layer = 7;
menu.menuLayer = 0;
menu.rows = new Array(15);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
	rows[0].text = '蕭薔虔誠拜觀音 不求桃花不急嫁';
	rows[0].link = 'today-show1.htm';
																										
	rows[1].text = '李威放心中 陳怡蓉拜月老求紅線';
	rows[1].link = 'today-show2.htm';
																										
	rows[2].text = '田壘帶新歡出國 蕭亞軒出局';
	rows[2].link = 'today-show3.htm';
																										
	rows[3].text = '蔡依林夜飛義大利 老外粉絲要合照';
	rows[3].link = 'today-show4.htm';
																										
	rows[4].text = '賈靜雯上海團圓 初二不回娘家';
	rows[4].link = 'today-show5.htm';
																										
	rows[5].text = '美麗主播陪你過年 泡麵 零食當年夜飯';
	rows[5].link = 'today-show6.htm';
																										
	rows[6].text = '5566 183 Club 超旺 春節擠爆西門町';
	rows[6].link = 'today-show7.htm';
																										
	rows[7].text = '李安 最佳導演到手 小金人在望';
	rows[7].link = 'today-show8.htm';
																										
	rows[8].text = '玄彬 金宣兒 攜手送愛唐氏兒';
	rows[8].link = 'today-show9.htm';
																										
	rows[9].text = 'Rain 聲勢漲 宋慧喬 行情俏';
	rows[9].link = 'today-show10.htm';
																										
	rows[10].text = '李秉憲 桃花朵朵開 金惠秀 出嫁再等等';
	rows[10].link = 'today-show11.htm';
																										
	rows[11].text = '2005紅磡之最--巨星紅磡秀 型男大鬥法';
	rows[11].link = 'today-show12.htm';
																										
	rows[12].text = '捍衛深喉嚨 巨星有撇步';
	rows[12].link = 'today-show13.htm';
																										
	rows[13].text = '主播健健美 全靠動動樂';
	rows[13].link = 'today-show14.htm';
																										
	rows[14].text = '主播回娘家 紅包大嘴夠甜討歡喜';
	rows[14].link = 'today-show15.htm';
																										
}
menu = null;

if (showWeekly == false)
{
	menu = getMenu('supplement');
	menu.layer = 13;
	menu.menuLayer = 0;
	menu.rows = new Array(8);
	with (menu)
	{
		for (i=0; i<rows.length; i++)
			rows[i] = new Object();
	
		rows[0].text = '流行消費　　→';
		rows[0].submenu = 'fashion';
		rows[0].link = 'today-fashion1.htm';
	
		rows[1].text = '好品味　　　→';
		rows[1].submenu = 'living';
		rows[1].link = 'today-living1.htm';
	
		rows[2].text = '家庭兩性　　→';
		rows[2].submenu = 'family';
		rows[2].link = 'today-family1.htm';
	
		rows[3].text = '健康醫療　　→';
		rows[3].submenu = 'medicine';
		rows[3].link = 'today-medicine1.htm';
	
		rows[4].text = '自由副刊　　→';
		rows[4].submenu = 'article';
		rows[4].link = 'today-article1.htm';
	
		rows[5].text = '青春美　　　→';
		rows[5].submenu = 'young';
		rows[5].link = 'today-young1.htm';
	
		rows[6].text = '藝術文化　　→';
		rows[6].submenu = 'art';
		rows[6].link = 'today-art1.htm';
	
		rows[7].text = '休閒旅遊　　→';
		rows[7].submenu = 'travel';
		rows[7].link = 'today-travel1.htm';
	}
	menu = null;
}

menu = getMenu('fashion');
menu.layer = 13;
menu.parentMenu = 'supplement';
menu.menuLayer = 1;
menu.rows = new Array(0);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
}
menu = null;

menu = getMenu('living');
menu.layer = 14;
menu.parentMenu = 'supplement';
menu.menuLayer = 1;
menu.rows = new Array(0);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
}
menu = null;

menu = getMenu('family');
menu.layer = 15;
menu.parentMenu = 'supplement';
menu.menuLayer = 1;
menu.rows = new Array(0);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
}
menu = null;

menu = getMenu('medicine');
menu.layer = 16;
menu.parentMenu = 'supplement';
menu.menuLayer = 1;
menu.rows = new Array(0);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
}
menu = null;

menu = getMenu('article');
menu.layer = 17;
menu.parentMenu = 'supplement';
menu.menuLayer = 1;
menu.rows = new Array(0);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
}
menu = null;

menu = getMenu('young');
menu.layer = 18;
menu.parentMenu = 'supplement';
menu.menuLayer = 1;
menu.rows = new Array(0);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
}
menu = null;

menu = getMenu('art');
menu.layer = 19;
menu.parentMenu = 'supplement';
menu.menuLayer = 1;
menu.rows = new Array(0);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
}
menu = null;

menu = getMenu('travel');
menu.layer = 20;
menu.parentMenu = 'supplement';
menu.menuLayer = 1;
menu.rows = new Array(0);
with (menu)
{
	for (i=0; i<rows.length; i++)
		rows[i] = new Object();
																
}
menu = null;

if (showWeekly)
{
	menu = getMenu('weekly');
	menu.layer = 8;
	menu.menuLayer = 0;
	menu.rows = new Array(9);
	with (menu)
	{
		for (i=0; i<rows.length; i++)
			rows[i] = new Object();
																	
		rows[0].text = '我要變成大美人！<br>煥然一新 愛美大作戰';
		rows[0].link = 'today-weekly1.htm';
																											
		rows[1].text = 'America\'s Sweethearts<br>美國甜心 狂放小辣椒';
		rows[1].link = 'today-weekly2.htm';
																											
		rows[2].text = '吃不完的年菜<br>加點料變好料';
		rows[2].link = 'today-weekly3.htm';
																											
		rows[3].text = '風水大師 解讀農民曆《初二篇》';
		rows[3].link = 'today-weekly4.htm';
																											
		rows[4].text = '趁著新年，許個願吧';
		rows[4].link = 'today-weekly5.htm';
																											
		rows[5].text = '你的心願，並定實現';
		rows[5].link = 'today-weekly6.htm';
																											
		rows[6].text = '謹慎飲食 過年不忘護腎行動';
		rows[6].link = 'today-weekly7.htm';
																											
		rows[7].text = '塞車無聊嗎？做做肩頸運動吧！';
		rows[7].link = 'today-weekly8.htm';
																											
		rows[8].text = '有愛有平安 才有快樂人生';
		rows[8].link = 'today-weekly9.htm';
																											
	}
	menu = null;
}
//====================  end  ================================================

//===========================================================================
//產生tables
//==================== begin ================================================
for (j=0; j<menus.length; j++)
{
	var previousRowType = '';
	if (menus[j].parentMenu == null)
		document.write('<table id='+menus[j].name+' style="position:absolute;left:'+(leftMargin+tableWidth*menus[j].menuLayer)+';visibility:hidden;font-size:13px;width:200;cursor:pointer;border:1 solid #00CCFF" border=0 bgcolor=#FFFFFF cellspacing=1 cellpadding=2 onMouseOver=showMenu(null,null) onMouseOut=hideMenu()>');
	else
		document.write('<table id='+menus[j].name+' style="position:absolute;left:'+(leftMargin+tableWidth*menus[j].menuLayer)+';visibility:hidden;font-size:13px;width:200;cursor:pointer;border:1 solid #00CCFF" border=0 bgcolor=#FFFFFF cellspacing=1 cellpadding=2 onMouseOver=showMenu2(null,null) onMouseOut=hideMenu2()>');

	for (i=0; i<menus[j].rows.length; i++)
	{
		if (previousRowType!='' && menus[j].rows[i].type==null)
		{
			document.write('<tr bgcolor=#00CCFF height=2 style=cursor:default>');
			document.write('	<td></td>');
			document.write('</tr>');
		}

		if (menus[j].rows[i].type && menus[j].rows[i].type!=previousRowType)
		{
			document.write('<tr bgcolor=#00CCFF height='+rowHeight+' style="cursor:default">');
			document.write('	<td>《'+menus[j].rows[i].type+'》</td>');
			document.write('</tr>');
		}

		if (menus[j].rows[i].submenu)
		{
			document.write('<tr onMouseOver="incell(this);showMenu2(this,'+menus[j].rows[i].submenu+')" onMouseOut="outcell(this);hideMenu2()" bgcolor=#C2E5FF height='+rowHeight+'>');
			if (menus[j].rows[i].link)
				document.write('	<td onClick="location.href=\''+path+menus[j].rows[i].link+'\'">'+menus[j].rows[i].text+'</td>');
			else
				document.write('	<td>'+menus[j].rows[i].text+'</td>');
			document.write('</tr>');
		}
		else 
		{
			if (menus[j].rows[i].type == null)
			{
				document.write('<tr onMouseOver=incell(this) onMouseOut=outcell(this) bgcolor=#C2E5FF height='+rowHeight+'>');
				document.write('	<td onClick="location.href=\''+path+menus[j].rows[i].link+'\'">◎'+menus[j].rows[i].text+'</td>');
				document.write('</tr>');
			}
			else
			{
				document.write('<tr onMouseOver=incell(this) onMouseOut=outcell2(this) bgcolor=#41DAAA height='+rowHeight+'>');
				document.write('	<td onClick="location.href=\''+path+menus[j].rows[i].link+'\'">．'+menus[j].rows[i].text+'</td>');
				document.write('</tr>');
			}
		}

		previousRowType = menus[j].rows[i].type==null? '': menus[j].rows[i].type;
	}

	document.write('</table>');
}
//====================  end  ================================================

var activeRow,activeMenu1,activeRow1,activeMenu2;
var protrude1;
var timer,timer2;
var hide,hide2

function getMenu(name)
{
	index = -1;
	for (i=0; i<menus.length; i++)
		if (menus[i].name == name)
		{
			index = i;
			break;
		}
	if (index != -1) return menus[index];
	else return null;
}

function showMenu(row,menu)
{
	if (activeRow)
	{
		hide = true;
		hideAllMenu();
	}
	hide = false;
	if (row)	activeRow = row;
	activeRow.style.backgroundColor = '#FFCCFF';
	if (menu) activeMenu1 = menu;
	
	defaultTop = topMargin+layerHeight*getMenu(activeMenu1.id).layer;
	protrude1 = defaultTop-document.body.scrollTop+activeMenu1.offsetHeight-document.body.clientHeight;
	if (protrude1 > 0)	
		activeMenu1.style.top = defaultTop-protrude1;
	else
		activeMenu1.style.top = defaultTop;
		
	activeMenu1.style.visibility = 'visible';
}

function hideMenu()
{
	clearTimeout(timer);
	hide = true;
	timer = setTimeout(hideAllMenu,700);
}

function hideAllMenu()
{
	if (hide)
	{
		activeRow.style.backgroundColor = '#FAF9F5';
		activeMenu1.style.visibility = 'hidden';
	}
}

function showMenu2(row,menu)
{
	if (activeRow1)
	{
		hide2 = true;
		hideAllMenu2();
	}
	hide = false;
	hide2 = false;
	if (row)	activeRow1 = row;
	activeRow.style.backgroundColor = '#FFCCFF';
	activeRow1.style.backgroundColor = '#FFCCFF';
	if (menu) activeMenu2 = menu;
	
	defaultTop = topMargin+layerHeight*getMenu(activeMenu2.id).layer;
	protrude2 = defaultTop-document.body.scrollTop+activeMenu2.offsetHeight-document.body.clientHeight;
	if (protrude2 > 0)	
	{
		if (protrude1 > protrude2)
			activeMenu2.style.top = defaultTop-protrude1;
		else
			activeMenu2.style.top = defaultTop-protrude2;
	}
	else
	{
		if (protrude1 > 0)
			activeMenu2.style.top = defaultTop-protrude1;
		else
			activeMenu2.style.top = defaultTop;
	}
	
	activeMenu1.style.visibility = 'visible';
	activeMenu2.style.visibility = 'visible';
}

function hideMenu2()
{
	hideMenu();
	clearTimeout(timer2);
	hide2 = true;
	timer2 = setTimeout(hideAllMenu2,700);
}

function hideAllMenu2()
{
	if (hide2) {
		activeRow1.style.backgroundColor = '#C2E5FF';
		activeMenu2.style.visibility = 'hidden';
	}
}

function outcell(cell)
{
	cell.style.backgroundColor = '#C2E5FF';
	cell.style.color = 'black';
}

function outcell2(cell)
{
	cell.style.backgroundColor = '#41DAAA';
	cell.style.color = 'black';
}

function incell(cell)
{
	cell.style.backgroundColor = '#FFCCFF';
	cell.style.color = 'blue';
}