var table_template_front_array = new Array();
var table_template_end_array = new Array();
var row_template_front_array = new Array();
var parent_layer_array = new Array();
var child_layer_array = new Array();
var last_button_name = "";
var last_parent_layer = "";
var last_child_layer = "";
var last_image_name = "";
var image_pointer = "";
var TimerID = "";
var table_width = 100;

// reload code for Netscape browsers
if (document.layers) {
	initial_width = innerWidth;
	initial_height = innerHeight;
}

function reload_window() {
	if ((innerWidth != initial_width) || (innerHeight != initial_height)) location.reload();
}

if (document.layers) onresize = reload_window;
// end reload code

if (document.images) {
	var arrow = new Image();
	var blank = new Image();
	
	var home_on = new Image();
	var news_on = new Image();
	var sports_on = new Image();
	var entertainment_on = new Image();
	var finance_on = new Image();
	var life_style_on = new Image();
	var love_match_on = new Image();
	var classified_on = new Image();
	var education_on = new Image();
		
	var home_off = new Image();
	var news_off = new Image();
	var sports_off = new Image();
	var entertainment_off = new Image();
	var finance_off = new Image();
	var life_style_off = new Image();
	var love_match_off = new Image();
	var classified_off = new Image();
	var education_off = new Image();
	
	arrow.src = "support/pix/arrow.gif";
	blank.src = "support/pix/blank.gif";
		
		
// define mouseover-on images
// ***************************************************************** 
	home_on.src = "chinesetoday20010423_files/home-on.jpg";
	news_on.src = "chinesetoday20010423_files/news-on.jpg";
	sports_on.src = "chinesetoday20010423_files/sports-on.jpg";
	entertainment_on.src = "chinesetoday20010423_files/e-news-on.jpg";
	finance_on.src = "chinesetoday20010423_files/finance-on.jpg";
	life_style_on.src = "chinesetoday20010423_files/life_style-on.jpg";
	love_match_on.src = "chinesetoday20010423_files/love_match-on.jpg";
	classified_on.src = "chinesetoday20010423_files/classified-on.jpg";
	education_on.src = "chinesetoday20010423_files/education-on.jpg";


// define mouseover-off images
// ***************************************************************** 	
	home_off.src = "chinesetoday20010423_files/home.gif";
	news_off.src = "chinesetoday20010423_files/news.gif";
	sports_off.src = "chinesetoday20010423_files/sports.gif";
	entertainment_off.src = "chinesetoday20010423_files/e-news.gif";
	finance_off.src = "chinesetoday20010423_files/finance.gif";
	life_style_off.src = "chinesetoday20010423_files/life_style.gif";
	love_match_off.src = "chinesetoday20010423_files/love_match.gif";
	classified_off.src = "chinesetoday20010423_files/classified.gif";
	education_off.src = "chinesetoday20010423_files/education.gif";
}

function Layer(name, visibility, zindex, table_template, left, top) {
	this.name = name;
	this.left = left;
	this.top = top;
	this.width = table_width;
	this.visibility = visibility;
	this.zindex = zindex;
	this.table_template = table_template;
	
	this.ar = ar;
	this.fl = fl;

	if (this.table_template == 1) this.left = this.left + this.width - 7;
	
	if (document.all) {
		if (navigator.appVersion.indexOf("Macintosh") == -1) {
			this.top += 7;
			this.left += 2;
		}
		
		this.layer_content = '<div id="' + this.name + '" style="position: absolute; left: ' + this.left + '; top: ' + this.top + '; width: ' + this.width + '; visibility: ' + (this.visibility ? 'visible' : 'hidden') + '; z-index: ' + this.zindex + ';">';
	}
	else if (document.layers) {
	    this.layer_content = '<layer name="' + this.name + '" left=' + this.left + ' top=' + this.top + ' width=' + this.width + ' visibility=' + (this.visibility ? '"show"' : '"hide"') + ' z-index=' + this.zindex + '>';
	}
	
	this.layer_content += table_template_front_array[this.table_template];
	if (this.table_template == 0) parent_layer_array[parent_layer_array.length] = this.name;
	else child_layer_array[child_layer_array.length] = this.name;
}

function ar(row_template, row_content) {  // add row
	this.layer_content += row_template_front_array[row_template] + row_content + row_end;
}

function fl() {  // finish layer
	this.layer_content += table_template_end_array[this.table_template];
	if (document.all) this.layer_content += '</div>';
	else if (document.layers) this.layer_content += '</layer>';
	document.write(this.layer_content);
}

function cpv(layer_name, image_name) {  // change parent visibility
	if ((last_parent_layer) && (last_parent_layer != layer_name)) mi(last_parent_layer);
	if ((last_button_name) && (last_button_name != image_name)) mii(last_button_name);
	ha();
	last_parent_layer = layer_name;
	last_button_name = image_name;
	hc();
	tlv(layer_name);
	tiv(layer_name, image_name);
}

function ccv(name) {  // change child visibility
	if ((last_child_layer) && (last_child_layer != name)) mi(last_child_layer);
	last_child_layer = name;
	tav(name);
	tlv(name);
}

function hc() {  // hide child
	if (last_child_layer) mi(last_child_layer);
}

function ha() {  // hide arrow
	image_pointer.src = blank.src;
}

function sa(name) { // show arrow
	last_image_name = name + "link";

	if (document.layers) {
		if (last_image_name) document.layers[last_parent_layer].document.images[last_image_name].src = arrow.src;
		image_pointer = document.layers[last_parent_layer].document.images[last_image_name];
	}
	else if (document.all) {
		document.images[last_image_name].src = arrow.src;
		image_pointer = document.images[last_image_name];
	}
}

function tav(name) {  // toggle arrow visibility
	ha();
	
	if (document.layers) {
		if (document.layers[name].visibility == "show") ha();
		else sa(name);
	}
	else if (document.all) {
		if (document.all[name].style.visibility == "visible") ha();
		else sa(name);
	}
}

function tlv(name) {  // toggle layer visibility
	if (document.layers) {
		if (document.layers[name].visibility == "show") mi(name);
		else mv(name);
	}
	else if (document.all) {
		if (document.all[name].style.visibility == "visible") mi(name);
		else mv(name);
	}
}

function mv(name) {  // make visible
	if (document.layers) document.layers[name].visibility = "show";
	else if (document.all) document.all[name].style.visibility = "visible";
}

function mi(name) {  // make invisible
	if (document.layers) document.layers[name].visibility = "hide";
	else if (document.all) document.all[name].style.visibility = "hidden";
}

function tiv(layer_name, image_name) {  // toggle image visibility
	if (document.layers) {
		if (document.layers[layer_name].visibility == "show") miv(image_name);
		else mii(image_name);
	}
	else if (document.all) {
		if (document.all[layer_name].style.visibility == "visible") miv(image_name);
		else mii(image_name);
	}
}

function mii(name) {  // make image invisible
	document.images[name].src = eval(last_button_name + "_off.src");
}

function miv(name) {  // make image visible
document.images[last_button_name].src = eval(last_button_name + "_off.src");
document.images[name].src = eval(name + "_on.src");
}

function ci(image_tag_name, new_image_name) {  // change image
document.images[image_tag_name].src = eval(new_image_name + ".src");
}

function close_sec()
{
    clearTimeout(TimerID);
    TimerID = setTimeout('close_all()', 2000);
}

function close_all() {
	mi(last_parent_layer);
	mii(last_button_name);
	ha();
	hc();
}

function define_table(tw) {
	table_template_front_array[0] = '<TABLE WIDTH="' + tw + '" CELLSPACING="0" CELLPADDING="0" BORDER="0" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()"><TR><TD COLSPAN="2" WIDTH="' + (tw-7) + '" BGCOLOR="FFFFCC" BACKGROUND="support/pix/bg_top.gif"><IMG SRC="support/pix/spffffcc.gif" WIDTH=' + (tw-7) + ' HEIGHT=1 BORDER="0"></TD><TD COLSPAN="2" WIDTH="7"><IMG SRC="support/pix/yllw_ur.gif" WIDTH=7 HEIGHT=8 BORDER="0"></TD></TR><TR><TD WIDTH="7" BGCOLOR="FFFFCC"><IMG SRC="support/pix/spffffcc.gif" WIDTH=7 HEIGHT=1 BORDER="0"></TD><TD WIDTH="' + (tw-7) + '" VALIGN="top" BGCOLOR="FFFFCC"><TABLE WIDTH="' + (tw-14) + '" CELLSPACING="0" CELLPADDING="1" BORDER="0">';
	table_template_end_array[0] = '</TABLE></TD><TD WIDTH="6" BGCOLOR="FFFFCC"><IMG SRC="support/pix/spffffcc.gif" WIDTH=6 HEIGHT=1 BORDER="0"></TD><TD WIDTH="1" BACKGROUND="support/pix/spff9900.gif"><IMG SRC="support/pix/spff9900.gif" WIDTH=1 HEIGHT=1 BORDER="0"></TD></TR><TR><TD COLSPAN="2" WIDTH="' + (tw-7) + '" BGCOLOR="FFFFCC" BACKGROUND="support/pix/bg_bot.gif"><IMG SRC="support/pix/spffffcc.gif" WIDTH=' + (tw-7) + ' HEIGHT=1 BORDER="0"></TD><TD COLSPAN="2" WIDTH="7"><IMG SRC="support/pix/yllw_lr.gif" WIDTH=7 HEIGHT=8 BORDER="0"></TD></TR></TABLE>';
	
	table_template_front_array[1] = '<TABLE WIDTH="' + tw + '" CELLSPACING="0" CELLPADDING="0" BORDER="0" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()"><TR><TD COLSPAN="2" WIDTH="7"><IMG SRC="support/pix/crnr_ul.gif" WIDTH=7 HEIGHT=8 BORDER="0"></TD><TD WIDTH="' + (tw-14) + '" BACKGROUND="support/pix/bg_top.gif"><IMG SRC="support/pix/spffffcc.gif" WIDTH=' + (tw-14) + ' HEIGHT=1 BORDER="0"></TD><TD COLSPAN="2" WIDTH="7"><IMG SRC="support/pix/yllw_ur.gif" WIDTH=7 HEIGHT=8 BORDER="0"></TD></TR><TR><TD WIDTH="1" BACKGROUND="support/pix/spff9900.gif"><IMG SRC="support/pix/spff9900.gif" WIDTH=1 HEIGHT=1 BORDER="0"></TD><TD WIDTH="6" BGCOLOR="FFFFCC"><IMG SRC="support/pix/spffffcc.gif" WIDTH=6 HEIGHT=1 BORDER="0"></TD><TD WIDTH="' + (tw-14) + '" VALIGN="top" BGCOLOR="FFFFCC"><TABLE WIDTH="' + (tw-14) + '" CELLSPACING="0" CELLPADDING="1" BORDER="0">';
	table_template_end_array[1] = '</TABLE></TD><TD WIDTH="6" BGCOLOR="FFFFCC"><IMG SRC="support/pix/spffffcc.gif" WIDTH=6 HEIGHT=1 BORDER="0"></TD><TD WIDTH="1" BACKGROUND="support/pix/spff9900.gif"><IMG SRC="support/pix/spff9900.gif" WIDTH=1 HEIGHT=1 BORDER="0"></TD></TR><TR><TD COLSPAN="2" WIDTH="7"><IMG SRC="support/pix/crnr_ll.gif" WIDTH=7 HEIGHT=8 BORDER="0"></TD><TD WIDTH="' + (tw-14) + '" BACKGROUND="support/pix/bg_bot.gif"><IMG SRC="support/pix/spffffcc.gif" WIDTH=' + (tw-14) + ' HEIGHT=1 BORDER="0"></TD><TD COLSPAN="2" WIDTH="7"><IMG SRC="support/pix/yllw_lr.gif" WIDTH=7 HEIGHT=8 BORDER="0"></TD></TR></TABLE>';
	
	row_template_front_array[0] = '<TR><TD WIDTH=11 VALIGN="top"><IMG SRC="chinesetoday20010423_files/bullet.gif" WIDTH=11 HEIGHT=13 BORDER="0"></TD><TD WIDTH=' + (tw-25) + '><FONT FACE="細明體" SIZE=2>';
	row_template_front_array[1] = '<TR><TD WIDTH=' + (tw-14) + ' COLSPAN="2"><FONT FACE="細明體" SIZE=2>';
	row_template_front_array[2] = '<TR><TD WIDTH=' + (tw-14) + ' ALIGN="right" COLSPAN="2"><FONT FACE="細明體" SIZE=1>';

	row_end = '</TR>';
}

define_table(table_width);

var l = new Layer("L1", 0, 4, 0, -500, 78);
l.ar(0, '<a href="home.cfm" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">Home</a></FONT></TD>');
l.ar(2, '<a href="javascript:close_all();" onmouseover="window.status=\'Close\'; return true;" onmouseout="window.status=\'\';"><!--<img src="/support/pix/close.gif" width=36 height=14 alt="Close" border=0 hspace="5">--></A></FONT></TD>');
l.fl();


var l = new Layer("L2", 0, 4, 0, 128, 124);
l.ar(0, '<a href="GetNews.cfm?C=news&S=International" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">國際新聞</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=news&S=n_america" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">北美社區</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=news&S=China" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">中國大陸</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=news&S=Taiwan" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">今日台灣</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=news&S=HongKong" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">香港澳門</a></FONT></TD>');
l.ar(2, '<a href="javascript:close_all();" onmouseover="window.status=\'Close\'; return true;" onmouseout="window.status=\'\';"><!--<img src="/support/pix/close.gif" width=36 height=14 alt="Close" border=0 hspace="5">--></A></FONT></TD>');
l.fl();
		

var l = new Layer("L3", 0, 4, 0, 128, 158);
l.ar(0, '<a href="GetNews.cfm?C=sports&S=International" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">國際新聞</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=sports&S=China" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">中國大陸</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=sports&S=Taiwan" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">今日台灣</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=sports&S=HongKong" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">香港澳門</a></FONT></TD>');
l.ar(2, '<a href="javascript:close_all();" onmouseover="window.status=\'Close\'; return true;" onmouseout="window.status=\'\';"><!--<img src="/support/pix/close.gif" width=36 height=14 alt="Close" border=0 hspace="5">--></A></FONT></TD>');
l.fl();


var l = new Layer("L4", 0, 4, 0, 128, 192);
l.ar(0, '<a href="GetNews.cfm?C=e-news&S=n_america" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">北美社區</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=e-news&S=China" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">中國大陸</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=e-news&S=Taiwan" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">今日台灣</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=e-news&S=HongKong" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">香港澳門</a></FONT></TD>');
l.ar(2, '<a href="javascript:close_all();" onmouseover="window.status=\'Close\'; return true;" onmouseout="window.status=\'\';"><!--<img src="/support/pix/close.gif" width=36 height=14 alt="Close" border=0 hspace="5">--></A></FONT></TD>');
l.fl();


var l = new Layer("L5", 0, 4, 0, 128, 226);
l.ar(0, '<a href="GetNews.cfm?C=finance&S=International" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">國際新聞</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=finance&S=China" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">中國大陸</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=finance&S=Taiwan" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">今日台灣</a></FONT></TD>');
l.ar(0, '<a href="GetNews.cfm?C=finance&S=HongKong" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">香港澳門</a></FONT></TD>');
l.ar(2, '<a href="javascript:close_all();" onmouseover="window.status=\'Close\'; return true;" onmouseout="window.status=\'\';"><!--<img src="/support/pix/close.gif" width=36 height=14 alt="Close" border=0 hspace="5">--></A></FONT></TD>');
l.fl();


var l = new Layer("L6", 0, 4, 0, -500, 78);
l.ar(0, '<a href="Life-Style.cfm" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">生活</a></FONT></TD>');
l.ar(2, '<a href="javascript:close_all();" onmouseover="window.status=\'Close\'; return true;" onmouseout="window.status=\'\';"><!--<img src="/support/pix/close.gif" width=36 height=14 alt="Close" border=0 hspace="5">--></A></FONT></TD>');
l.fl();


var l = new Layer("L7", 0, 4, 0, -500, 78);
l.ar(0, '<a href="love-match0.cfm" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">交友</a></FONT></TD>');
l.ar(2, '<a href="javascript:close_all();" onmouseover="window.status=\'Close\'; return true;" onmouseout="window.status=\'\';"><!--<img src="/support/pix/close.gif" width=36 height=14 alt="Close" border=0 hspace="5">--></A></FONT></TD>');
l.fl();


var l = new Layer("L8", 0, 4, 0, 128, 328);
l.ar(0, '<a href="classified-car.cfm" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">汽車</a></FONT></TD>');
l.ar(0, '<a href="#" onmouseover="clearTimeout(TimerID); ccv(\'L8A\')" onmouseout="close_sec()" class="c1">房屋</a>&nbsp;</FONT><img src="support/pix/blank.gif" name="L8Alink"></TD>');
l.ar(0, '<a href="classified-helpwanted.cfm" onmouseover="clearTimeout(TimerID); hc(); ha()" onmouseout="close_sec()">徵人</a></FONT></TD>');
l.ar(0, '<a href="classified-service.cfm" onmouseover="clearTimeout(TimerID); hc(); ha()" onmouseout="close_sec()">服務</a></FONT></TD>');
l.ar(0, '<a href="classified-other.cfm" onmouseover="clearTimeout(TimerID); hc(); ha()" onmouseout="close_sec()">其他</a></FONT></TD>');
l.ar(2, '<a href="javascript:close_all();" onmouseover="window.status=\'Close\'; return true;" onmouseout="window.status=\'\';"><!--<img src="/support/pix/close.gif" width=36 height=14 alt="Close" border=0 hspace="5">--></A></FONT></TD>');
l.fl();


var l = new Layer("L8A", 0, 5, 1, 128, 328);
l.ar(0, '<a href="#" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">出售</a></FONT></TD>');
l.ar(0, '<a href="classified-house_rent.cfm" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">出租</a></FONT></TD>');
l.ar(2, '<a href="javascript:close_all();" onmouseover="window.status=\'Close\'; return true;" onmouseout="window.status=\'\';"><!--<img src="/support/pix/close.gif" width=36 height=14 alt="Close" border=0 hspace="5">--></A></FONT></TD>');
l.fl();

var l = new Layer("L9", 0, 4, 0, -500, 78);
l.ar(0, '<a href="education.cfm" onmouseover="clearTimeout(TimerID)" onmouseout="close_sec()">教育</a></FONT></TD>');
l.ar(2, '<a href="javascript:close_all();" onmouseover="window.status=\'Close\'; return true;" onmouseout="window.status=\'\';"><!--<img src="/support/pix/close.gif" width=36 height=14 alt="Close" border=0 hspace="5">--></A></FONT></TD>');
l.fl();

