/*************************** MouseOver & MouseOut Function **************************************/
function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; 
	if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
	
function over(imgname, filname){
	if (document.images)
		{imgname.src = filname;}
}

function out(imgname, filname){
	if (document.images)
		{imgname.src = filname;}
}

/*************************** MouseOver & MouseOut Function Finish **************************************/


/**************************** Variable Declaration Section *************************************************/
var selectedSection;
var selectedSubSection;
var selectedSecondSubSection;
var subPath;
var locationPath;
var graphicPath;
var langID;
var titleID;
var graphicLang;
var langNum;
var langPath;
var topButton;
var backButton;
var printPage;
var copyright_txt;
var printTxt;
var footerY = 600;
var menu;
var textOnly
var txtHome;
var txtSearch;
var txtGo;
var mode;
var searchLink;
var textBtn='/text/';
var graphicBtn = '/graphics/';
var enBtn='/en/';
var tcBtn='/tc/';
var scBtn='/gb/';
var searchDate;

var copyYear='2006';
var revisionDate;
var reviewDate;

var resizeFlag;
var footerY = 600;


/**************************** Variable Declaration Section Finish ******************************************/


/**************************** Language / Server Path declaration ******************************************/
if(window.name=='PrintPage'){
	printPage=1;
}

function genPrintButton(){
	if(printPage!=1){
		if(langID==1){ var altText='Printer-friendly Version'; }else{ var altText='友善列印'; }
		document.writeln('	<a href="javascript:PrintDocument();" onMouseOut="MM_swapImgRestore()"  onMouseOver="MM_swapImage(\'print\',\'\',\''+graphicPath+'btn_printer_vers_over.gif\',1)"><img src="'+graphicPath+'btn_printer_vers.gif" border=0 align=top alt="'+altText+'" name="print"></a>');
	}
}

//function for Print Function
function PrintDocument(){
	window.open(document.URL,'PrintPage','top=10,left=10,height=500,width=570,scrollbars=1');
}


if(document.URL.toString().search('/text/')!=-1 || location.search.toString().indexOf('lang=text')!=-1 || location.search.toString().indexOf('mode=394')!=-1 || location.search.toString().indexOf('mode=395')!=-1){
	isText=true;
	if(document.URL.toString().search('/text/en/')!=-1 || location.search.toString().indexOf('lang=text')!=-1 || location.search.toString().indexOf('mode=394')!=-1){
		langPath = 'text/en/';
		langID=4;
		titleID=1;
		textOnly = 'Graphical Version'
		txtHome = 'Home';
		txtSearch = 'Search';
		txtGo = 'Go';
		mode = 394;
		searchLink = "http://search.gov.hk/search.html";
	}else if ((document.URL.toString().search('/text/tc/')!=-1 || location.search.toString().indexOf('lang=text')!=-1 || location.search.toString().indexOf('mode=395')!=-1)&&!(document.URL.toString().search('/gb/')!=-1)){
		langPath = 'text/tc/';
		langID=5;
		titleID=2;
		textOnly = '圖像版本';
		txtHome = '主頁';
		txtSearch = '搜尋';
		txtGo = 'Go';
		mode = 395;
		searchLink = "http://search.gov.hk/search.html";
	}else{
		langPath = 'text/tc/';
		langID=6;
		titleID=2;
		textOnly = '圖像版本';
		txtHome = '主頁';
		txtSearch = '搜尋';
		txtGo = 'Go';
//		mode = 397;
		mode = 395;
		searchLink = "http://sc.info.gov.hk/TuniS/search.gov.hk/search.html";
	} 

}else{
	isText=false;
	if(document.URL.toString().search('/en/')!=-1 || location.search.toString().indexOf('lang=en')!=-1 || location.search.toString().indexOf('mode=257')!=-1){
		langPath = 'en/';
		langID=1;
		titleID=1;
		textOnly = 'Text Only Version';
		txtHome = 'Home';
		txtSearch = 'Search';
		txtGo = 'Go';
		mode = 257;
		searchLink = "http://search.gov.hk/search.html";
	}else if ((document.URL.toString().search('/tc/')!=-1 || location.search.toString().indexOf('lang=tc')!=-1 || location.search.toString().indexOf('mode=258')!=-1) &&!(document.URL.toString().search('/gb/')!=-1)){
		langPath = 'tc/';
		langID=2;
		titleID=2;
		textOnly = '純文字版本';
		txtHome = '主頁';
		txtSearch = '搜尋';
		txtGo = 'Go';
		mode = 258;
		searchLink = "http://search.gov.hk/search.html";
	}else{
		langPath = 'tc/';
		langID=3;
		titleID=2;
		textOnly = '純文字版本';
		txtHome = '主頁';
		txtSearch = '搜尋';
		txtGo = 'Go';
		mode = 258;
		searchLink = "http://sc.info.gov.hk/TuniS/search.gov.hk/search.html";
	}
}

var gicSearchForm;

var ui_langs = new Array("en", "zh-hk", "zh-cn");
var ui_charsets = new Array("big5", "big5", "utf-8");

gicSearchForm='<form name="frmSearch" action="'+searchLink+'" method="get">\n';
gicSearchForm+='<input type="hidden" name="tpl_id" value="hkreform">\n';
gicSearchForm+='<input type="hidden" name="ui_lang" value="'+ui_langs[(langID%3)-1]+'">\n';
gicSearchForm+='<input type="hidden" name="ui_charset" value="'+ui_charsets[(langID%3)-1]+'">\n';
gicSearchForm+='<input type="hidden" name="gp0" value="hkreform_home">\n';
gicSearchForm+='<input type="hidden" name="gp1" value="hkreform_home">\n';
gicSearchForm+='<input type="hidden" name="web" value="this">\n';
if (isText)
	gicSearchForm+='<input type="hidden" name="txtonly" value="1">\n';


if(location.href.toString().search('dev01.westcomzivo.com/lrc')!=-1){
	if(location.href.toString().search('/gb/')!=-1)
	{
		subPath="ht"+"tp://common.westcomzivo.com/gb/dev01.westcomzivo.com/lrc/"
	}
	else
	{
		subPath="ht"+"tp://dev01.westcomzivo.com/lrc/"
	}
}

if(location.href.toString().search('www0.hkreform.gov.hk')!=-1){
	if(location.href.toString().search('/gb/')!=-1)
	{
		subPath="ht"+"tp://sc.info.gov.hk/gb/www0.hkreform.gov.hk/"
	}
	else
	{
		subPath="ht"+"tp://www0.hkreform.gov.hk/"
	}
}

if(location.href.toString().search('www.hkreform.gov.hk')!=-1){
	if(location.href.toString().search('/gb/')!=-1)
	{
		subPath="ht"+"tp://sc.info.gov.hk/gb/www.hkreform.gov.hk/"
	}
	else
	{
		subPath="ht"+"tp://www.hkreform.gov.hk/"
	}
}

if(location.href.toString().search('ogciohkreform.arcotect.com')!=-1){
	if(location.href.toString().search('/gb/')!=-1)
	{
		subPath="ht"+"tp://sc.info.gov.hk/gb/www.hkreform.gov.hk/"
	}
	else
	{
		subPath="ht"+"tp://ogciohkreform.arcotect.com/"
	}
}

if(location.href.toString().search('se.cgi')!=-1){
	subPath="ht"+"tp://www.hkreform.gov.hk/"
}

/*	
if(location.href.toString().search('TextOnly.pl')!=-1){
	subPath="TextOnly.pl?search=";
}
*/
if(subPath==''){
	var lastSlash=location.href.toString().lastIndexOf('/');
	subPath=location.href.toString().substring(0, lastSlash);
}

locationPath=subPath+langPath;

if (langID==3 || langID==6) {
	graphicPath = subPath+ 'sc/images/';
} else {
	graphicPath = locationPath + 'images/';
}

//alert (graphicPath);

if(location.href.toString().search('westcomzivo')!=-1){		//Setting kanhan Server
	gb_urlPath='common.westcomzivo.com/gb/';
}else{
	gb_urlPath='sc.info.gov.hk/gb/';
}


function langSwitch(lang) {
	var currentPath = location.href.toString();
	var tempPath = location.href.toString();
	var switchTc = '/tc/';
	var switchEn = '/en/';
	var switchText = '/text';
	var switchGraphics = '/text';
	var urlVars = document.location.search;
	if (location.href.toString().search('se.cgi')!=-1){
		switch (lang){
			case '/text/':
				if (langID==1){
					tempPath=tempPath.replace("mode=257", "mode=394");
				}
				if (langID==2){
					tempPath=tempPath.replace("mode=258", "mode=395");
				}
				if (langID==3){
					tempPath=tempPath.replace("mode=258", "mode=395");
					tempPath=tempPath.replace('http://', 'http://'+gb_urlPath);
				}
					goPath=tempPath;
				break;
			case '/graphics/':
				if (langID==4){
					tempPath=tempPath.replace("mode=394", "mode=257");
				}
				if (langID==5){
					tempPath=tempPath.replace("mode=395", "mode=258");
				}
				if (langID==6){
					tempPath=tempPath.replace("mode=395", "mode=258");
					tempPath = tempPath.replace(gb_urlPath, '');
				}
					goPath=tempPath;
				break;
			case '/gb/':
				if (langID==1){
					tempPath=tempPath.replace('http://', 'http://'+gb_urlPath);
					tempPath=tempPath.replace("mode=257", "mode=258");
					tempPath=tempPath.replace("search", "search2");
				}
				if (langID==2){
					tempPath=tempPath.replace('http://', 'http://'+gb_urlPath);
//					tempPath=tempPath.replace("mode=258", "mode=396");
				}
				if (langID==6){
					tempPath = tempPath.replace(gb_urlPath, '');
					tempPath=tempPath.replace("mode=258", "mode=395");
				}
				if (langID==4){
					tempPath=tempPath.replace('http://', 'http://'+gb_urlPath);
					tempPath=tempPath.replace("mode=394", "mode=395");
					tempPath=tempPath.replace("search", "search2");
				}
				if (langID==5){
					tempPath=tempPath.replace('http://', 'http://'+gb_urlPath);
//					tempPath=tempPath.replace("mode=395", "mode=397");
				}
					goPath=tempPath;
				break;
			case '/en/':
				if (langID==2){
					tempPath=tempPath.replace("mode=258", "mode=257");
					tempPath=tempPath.replace("search2", "search");
				}
				if (langID==3){
					tempPath=tempPath.replace("mode=258", "mode=257");
					tempPath=tempPath.replace("search2", "search");
					tempPath = tempPath.replace(gb_urlPath, '');
				}
				if (langID==4){
					tempPath=tempPath.replace("mode=394", "mode=257");
				}
				if (langID==5){
					tempPath=tempPath.replace("mode=395", "mode=394");
					tempPath=tempPath.replace("search2", "search");
				}
				if (langID==6){
					tempPath=tempPath.replace("mode=395", "mode=394");
					tempPath=tempPath.replace("search2", "search");
					tempPath = tempPath.replace(gb_urlPath, '');
				}
					goPath=tempPath;
				break;
			case '/tc/':
				if (langID==3){
					tempPath = tempPath.replace(gb_urlPath, '');
//					tempPath=tempPath.replace("mode=396", "mode=258");
				}
				if (langID==2){
//					tempPath=tempPath.replace("mode=257", "mode=258");
					tempPath = tempPath.replace(gb_urlPath, '');
				}
				if (langID==1){
					tempPath=tempPath.replace("mode=257", "mode=258");
					tempPath=tempPath.replace("search", "search2");
				}
				if (langID==5){
//					tempPath=tempPath.replace("mode=395", "mode=258");
					tempPath = tempPath.replace(gb_urlPath, '');
				}
				if (langID==4){
					tempPath=tempPath.replace("mode=394", "mode=395");
					tempPath=tempPath.replace("search", "search2");
				}
				if (langID==6){
					tempPath = tempPath.replace(gb_urlPath, '');
//					tempPath=tempPath.replace("mode=397", "mode=395");
				}
					goPath=tempPath;
				break;
			default:
		}
		document.location=goPath;
	}else{
		switch (lang){
			case '/graphics/':
				currentPath = currentPath.replace(switchGraphics, '');
				break;
			case '/text/':
				currentPath = currentPath.replace(switchEn, switchText+switchEn);
				currentPath = currentPath.replace(switchTc, switchText+switchTc);
//				alert (currentPath);
				break;
			case '/gb/':
				currentPath = currentPath.replace('http://', 'http://'+gb_urlPath);
				currentPath = currentPath.replace(switchEn, switchTc);
//				alert (currentPath);
				break;
			case '/en/':
				currentPath = currentPath.replace(switchTc, switchEn);
				currentPath = currentPath.replace(gb_urlPath, '');
//				alert (currentPath);
				break;
			case '/tc/':
				currentPath = currentPath.replace(switchEn, switchTc);
				currentPath = currentPath.replace(gb_urlPath, '');
//				alert (currentPath);
				break;
			default:
		}
		document.location = currentPath;
	}
}



/**************************** Language / Server Path declaration Finish ***********************************/

function init(){
	setTopLayerPosition(true);
	if(printPage==1){
		window.print();
	}
}

function getTitle(){
	if (titleID == 1){
		var title='<title>The Law Reform Commission of Hong Kong';
	} else{
		var title='<title>香港法律改革委員會';
	}
	if (selectedSection == 99){
		if (langID == 1 || langID == 4){
			title += ' - ' + MainTitle[1][selectedSection];
		} else {
			title += ' - ' + MainTitle[2][selectedSection];
		}
	}else{
		if (selectedSection !='' && selectedSection !='-'){
			title += ' - ' + MainTitle[titleID][selectedSection];
			if (selectedSubSection !='' && selectedSection !='-'){
				title += ' - ' + SubSectionTitle[titleID][selectedSection][selectedSubSection];
				if (selectedSecondSubSection != '' && selectedSection !='-'){
					title += ' - ' + SecondSubSectionTitle[titleID][selectedSection][selectedSubSection][selectedSecondSubSection];
				}
			}
		}
	}
	title += '</title>';
	document.writeln(title);
}



function getHTMLHeader(){
	if(isText){			//Top Menu of Text Only version
		if(printPage!=1){
			document.writeln('<table cellpadding="0" cellspacing="0" width="100%" border="0">');
			document.writeln('	<tr valign="top" align="left"><td width="100%">');
			document.writeln('		<table cellpadding="10" cellspacing="0" width="750" border="0">');
			document.writeln('			<tr valign="top" align="left"><td>');
			document.writeln('				<table cellpadding="0" cellspacing="0" width="100%" border="0">');
			document.writeln('					<tr><td>');
			document.writeln('						<table cellpadding="0" cellspacing="0" width="100%" border="0">');
			document.writeln('							<tr valign="bottom">');
			document.writeln('								<td class="header">香港法律改革委員會<br>The Law Reform Commission of Hong Kong</td>');
			document.writeln('								<td nowrap align="right">');
			if (langID == 4){
				document.writeln('						<a href="javascript:langSwitch(\''+graphicBtn+'\')">'+textOnly+'</a>&nbsp;|&nbsp;English&nbsp;|&nbsp;<a href="javascript:langSwitch(\''+tcBtn+'\')">&#32321;&#39636;</a>&nbsp;|&nbsp;<a href="/text/chs/index/">&#31616;&#20307;</a>');
			} else if (langID == 5 && location.href.toString().search('sc.info.gov.hk/gb')==-1){
				document.writeln('						<a href="javascript:langSwitch(\''+graphicBtn+'\')">'+textOnly+'</a>&nbsp;|&nbsp;<a href="javascript:langSwitch(\''+enBtn+'\')">English</a>&nbsp;|&nbsp;&#32321;&#39636;&nbsp;|&nbsp;<a href="/text/chs/index/">&#31616;&#20307;</a>');
			} else if (langID == 6 || location.href.toString().search('sc.info.gov.hk/gb')!=-1){
				document.writeln('						<a href="javascript:langSwitch(\''+graphicBtn+'\')">'+textOnly+'</a>&nbsp;|&nbsp;<a href="javascript:langSwitch(\''+enBtn+'\')">English</a>&nbsp;|&nbsp;<a href="javascript:langSwitch(\''+tcBtn+'\')">&#32321;&#39636;</a>&nbsp;|&nbsp;&#31616;&#20307;');
			}
			document.writeln('								</td>');
			document.writeln('							</tr>');
			document.writeln('						</table>');
			document.writeln('					</td></tr>');
			document.writeln('					<tr><td>');
			document.writeln('						<table cellpadding="0" cellspacing="0" width="100%" border="0">');
			document.writeln(							gicSearchForm);
			if (selectedSection == 5){
				document.writeln('							<tr>');
				document.writeln('								<td align="left" nowrap>[<a href="javascript:mainWinLink(\''+locationPath+'index/index.htm\');">'+txtHome+'</a>]</td>');
				document.writeln('								<td class="Header" width="100%">&nbsp;&nbsp;&nbsp;'+MainTitle[titleID][selectedSection]+'</td>');
				document.writeln('								<td align="right" nowrap>[<a href="javascript:mainWinLink(\''+MainSection[1][6]+'\');">'+MainTitle[titleID][6]+'</a>]&nbsp;&nbsp;[<a href="javascript:mainWinLink(\''+MainSection[1][7]+'\');">'+MainTitle[titleID][7]+'</a>]&nbsp;&nbsp;['+txtSearch+'&nbsp;<input type="text" name="query" size="9" class="input_search">&nbsp;<a href="javascript:document.frmSearch.submit();">'+txtGo+'</a>]</td>');
				document.writeln('							</tr>');
			} else {
				document.writeln('							<tr>');
				document.writeln('								<td align="left" nowrap>[<a href="'+locationPath+'index/index.htm">'+txtHome+'</a>]</td>');
				document.writeln('								<td align="right" nowrap>[<a href="'+MainSection[1][6]+'">'+MainTitle[titleID][6]+'</a>]&nbsp;&nbsp;[<a href="'+MainSection[1][7]+'">'+MainTitle[titleID][7]+'</a>]&nbsp;&nbsp;['+txtSearch+'&nbsp;<input type="text" name="query" size="9" class="input_search">&nbsp;<a href="javascript:document.frmSearch.submit();">'+txtGo+'</a>]</td>');
				document.writeln('							</tr>');
			}
			document.writeln('						</table>');
			document.writeln('					</td></tr>');
			if (selectedSection != 5){
				document.writeln('					<tr><td><hr color="440039"></td></tr>');
				document.writeln('					<tr><td>');
							for (var i=0; i < 6; i++){
								(selectedSection==i)?isOver='_over':isOver='';
								document.writeln('								[<a href="'+MainSection[1][i]+'">'+MainTitle[titleID][i]+'</a>]&nbsp;&nbsp;');
							}
				document.writeln('					</td></tr>');
			}
			document.writeln('					<tr><td><hr color="440039"></td></tr>');
			document.writeln('					<tr><td width="100%">');
		}
	}else{				//Top and Left Menu of graphical version
		if(printPage!=1){
			document.writeln('<table cellpadding="0" cellspacing="0" width="100%" border="0">');
			document.writeln('	<tr valign="top" align="left"><td width="100%">');
			document.writeln('		<table cellpadding="0" cellspacing="0" width="770" border="0">');
			document.writeln('			<tr valign="top" align="left"><td bgcolor="440039"><img src="'+graphicPath+'spacer.gif" height="1" width="1" border="0" alt="" title=""></td></tr>');
			document.writeln('			<tr valign="top" align="left"><td>');
			document.writeln('				<table cellpadding="0" cellspacing="0" width="100%" border="0">');
			document.writeln('					<tr valign="top" align="left">');
			document.writeln('						<td><img src="'+graphicPath+'spacer.gif" width="10" height="67" border="0" alt="" title=""></td>');
			document.writeln('						<td valign="bottom"><a href="'+locationPath+'index/index.htm"><img src="'+graphicPath+'logo.gif" alt="The Law Reform Commission of Hong Kong" title="The Law Reform Commission of Hong Kong" border="0"></a></td>');
			document.writeln('						<td align="right" valign="bottom">');
			document.writeln('      						<table border="0" cellspacing="0" cellpadding="0">');
			document.writeln('								<tr valign="bottom">');
			document.writeln('									<td><a href="javascript:langSwitch(\''+textBtn+'\')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'text\',\'\',\''+graphicPath+'lang_text_o.gif\',1)"><img src="'+graphicPath+'lang_text.gif" name="text" alt="'+textOnly+'" border="0"></a></td>');
			document.writeln('									<td><img src="'+graphicPath+'divider.gif" width="5" height="19"></td>');
			if (langID == 1){
				document.writeln('									<td><img src="'+graphicPath+'lang_eng_o.gif" name="eng" alt="English" title="English" border="0"></td>');
			} else {
				document.writeln('									<td><a href="javascript:langSwitch(\''+enBtn+'\')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'eng\',\'\',\''+graphicPath+'lang_eng_o.gif\',1)"><img src="'+graphicPath+'lang_eng.gif" name="eng" alt="English" title="English" border="0"></a></td>');
			}
			document.writeln('									<td><img src="'+graphicPath+'divider.gif" width="5" height="19"></td>');
			if (langID == 2 && location.href.toString().search('sc.info.gov.hk/gb')==-1){
				document.writeln('									<td><img src="'+graphicPath+'lang_tc_o.gif" name="tc" alt="&#32321;&#39636;" title="&#32321;&#39636;" border="0"></td>');
			} else {
				document.writeln('									<td><a href="javascript:langSwitch(\''+tcBtn+'\')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'tc\',\'\',\''+graphicPath+'lang_tc_o.gif\',1)"><img src="'+graphicPath+'lang_tc.gif" name="tc" alt="&#32321;&#39636;" title="&#32321;&#39636;" border="0"></a></td>');
			}
			document.writeln('									<td><img src="'+graphicPath+'divider.gif" width="5" height="19"></td>');
			if (langID == 3 || location.href.toString().search('sc.info.gov.hk/gb')!=-1){
				document.writeln('									<td><img src="'+graphicPath+'lang_sc_o.gif" name="sc" alt="&#31616;&#20307;" title="&#31616;&#20307;" border="0"></td>');
			} else {
				document.writeln('									<td><a href="/chs/index/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'sc\',\'\',\''+graphicPath+'lang_sc_o.gif\',1)"><img src="'+graphicPath+'lang_sc.gif" name="sc" alt="&#31616;&#20307;" title="&#31616;&#20307;" border="0"></a></td>');
			}
			document.writeln('								</tr>');
			document.writeln('							</table>');
			document.writeln('						</td>');
			document.writeln('						<td><img src="'+graphicPath+'spacer.gif" width="10" height="67" border="0" alt="" title=""></td>');
			document.writeln('					</tr>');
			document.writeln('				</table>');
			document.writeln('			</td></tr>');
			document.writeln('			<tr valign="top" align="left"><td height="19"><img src="'+graphicPath+'spacer.gif" height="19" width="19" border="0" alt="" title=""></td></tr>');
			if (selectedSection == 5){
				document.writeln('			<tr valign="middle" align="left"><td>');
				document.writeln('				<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="440039">');
				document.writeln(					gicSearchForm);
				document.writeln('					<tr valign="middle" align="left">');
				document.writeln('						<td width="20"><img src="'+graphicPath+'spacer.gif" height="30" width="20" alt="" title=""></td>');
				document.writeln('						<td nowrap><a href="javascript:mainWinLink(\''+locationPath+'index/index.htm\');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'home\',\'\',\''+graphicPath+'tm_home_o.gif\',1)"><img src="'+graphicPath+'tm_home.gif" name="home" border="0" alt="'+txtHome+'" title="'+txtHome+'"></a></td>');
				document.writeln('						<td align="center" class="Header" width="100%"><font color="#ffffff">'+MainTitle[titleID][selectedSection]+'</font></td>');
				document.writeln('						<td nowrap><a href="javascript:mainWinLink(\''+MainSection[1][6]+'\');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'contact\',\'\',\''+graphicPath+'tm_contact_o.gif\',1)"><img src="'+graphicPath+'tm_contact.gif" name="contact" border="0" alt="'+MainTitle[titleID][6]+'" title="'+MainTitle[titleID][6]+'"></a></td>');
				document.writeln('						<td nowrap><img src="'+graphicPath+'spacer.gif" width="15" height="15" alt="" title="" border="0"></td>');
				document.writeln('						<td nowrap><a href="javascript:mainWinLink(\''+MainSection[1][7]+'\');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'sitemap\',\'\',\''+graphicPath+'tm_sitemap_o.gif\',1)"><img src="'+graphicPath+'tm_sitemap.gif" name="sitemap" border="0" alt="'+MainTitle[titleID][7]+'" title="'+MainTitle[titleID][7]+'"></a></td>');
				document.writeln('						<td nowrap><img src="'+graphicPath+'spacer.gif" width="15" height="15"></td>');
				document.writeln('						<td nowrap><img src="'+graphicPath+'tm_search.gif" border="0" alt="'+txtSearch+'" title="'+txtSearch+'"><img src="'+graphicPath+'spacer.gif" width="5" height="1" border="0" alt="" title=""></td>');
				document.writeln('						<td nowrap><input type="text" name="query" size="9" class="input_search"></td>');
				document.writeln('						<td nowrap><img src="'+graphicPath+'spacer.gif" width="5" height="1" border="0" alt="" title="0"><a href="javascript:document.frmSearch.submit();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'go\',\'\',\''+graphicPath+'tm_go_o.gif\',1)"><img src="'+graphicPath+'tm_go.gif" name="go" border="0" alt="'+txtGo+'" title="'+txtGo+'"></a></td>');
				document.writeln('						<td width="10"><img src="'+graphicPath+'spacer.gif" height="30" width="10" alt="" title="" border="0"></td>');
				document.writeln('					</tr>');
				document.writeln('				</table>');
				document.writeln('			</td></tr>');
			} else {
				document.writeln('			<tr valign="middle" align="left"><td>');
				document.writeln('				<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="440039">');
				document.writeln(					gicSearchForm);
				document.writeln('					<tr valign="middle" align="left">');
				document.writeln('						<td width="20"><img src="'+graphicPath+'spacer.gif" height="30" width="20" alt="" title=""></td>');
				document.writeln('						<td width="100%"><a href="'+locationPath+'index/index.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'home\',\'\',\''+graphicPath+'tm_home_o.gif\',1)"><img src="'+graphicPath+'tm_home.gif" name="home" border="0" alt="'+txtHome+'" title="'+txtHome+'"></a></td>');
				document.writeln('						<td nowrap><a href="'+MainSection[1][6]+'" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'contact\',\'\',\''+graphicPath+'tm_contact_o.gif\',1)"><img src="'+graphicPath+'tm_contact.gif" name="contact" border="0" alt="'+MainTitle[titleID][6]+'" title="'+MainTitle[titleID][6]+'"></a></td>');
				document.writeln('						<td nowrap><img src="'+graphicPath+'spacer.gif" width="15" height="15" alt="" title="" border="0"></td>');
				document.writeln('						<td nowrap><a href="'+MainSection[1][7]+'" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'sitemap\',\'\',\''+graphicPath+'tm_sitemap_o.gif\',1)"><img src="'+graphicPath+'tm_sitemap.gif" name="sitemap" border="0" alt="'+MainTitle[titleID][7]+'" title="'+MainTitle[titleID][7]+'"></a></td>');
				document.writeln('						<td nowrap><img src="'+graphicPath+'spacer.gif" width="15" height="15"></td>');
				document.writeln('						<td nowrap><img src="'+graphicPath+'tm_search.gif" border="0" alt="'+txtSearch+'" title="'+txtSearch+'"><img src="'+graphicPath+'spacer.gif" width="5" height="1" border="0" alt="" title=""></td>');
				document.writeln('						<td nowrap><input type="text" name="query" size="9" class="input_search"></td>');
				document.writeln('						<td nowrap><img src="'+graphicPath+'spacer.gif" width="5" height="1" border="0" alt="" title="0"><a href="javascript:document.frmSearch.submit();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'go\',\'\',\''+graphicPath+'tm_go_o.gif\',1)"><img src="'+graphicPath+'tm_go.gif" name="go" border="0" alt="'+txtGo+'" title="'+txtGo+'"></a></td>');
				document.writeln('						<td width="10"><img src="'+graphicPath+'spacer.gif" height="30" width="10" alt="" title="" border="0"></td>');
				document.writeln('					</tr>');
				document.writeln('				</table>');
				document.writeln('			</td></tr>');
			}
			document.writeln('			<tr valign="top" align="left"><td height="1"><img src="'+graphicPath+'spacer.gif" height="1" border="0" width="1"></td></tr>');
			if (selectedSection != 5){
				document.writeln('			<tr valign="top" align="left"><td><img src="'+graphicPath+'title_image.jpg" border="0" alt="graphic" title="graphic"></td></tr>');
			}
			document.writeln('			<tr valign="top" align="left"><td>');
			document.writeln('				<table cellpadding="0" cellspacing="0" width="100%" border="0">');
			document.writeln('					<tr valign="top">');
			if (menu != 'N'){
				document.writeln('						<td><img src="'+graphicPath+'spacer.gif" width="15" height="1" border="0" alt="" title=""></td>');
				document.writeln('<!-- Left Menu Here -->');
				document.writeln('						<td width="180" valign="top"><img src="'+graphicPath+'spacer.gif" height="24" width="180" border="0" alt="" title="">');
				getLeftMenu();
				document.writeln('						</td>');
				document.writeln('<!-- Left Menu Finish -->');
			}
			document.writeln('						<td width="100%">');
		}
	}
}

function getLeftMenu(){
	document.writeln('							<table width="180"  border="0" cellpadding="8" cellspacing="0">');
	for (var i=0; i < 6; i++){
		(selectedSection==i)?isOver='_over':isOver='';
		document.writeln('								<tr><td class="leftMenu'+isOver+'"><a href="'+MainSection[1][i]+'">'+MainTitle[titleID][i]+'</a></td></tr>');
	}
	document.writeln('							</table>');
}

function moveTopDivs(layerObj, inObjTop, inObjLeft){
	layerObj.top  = inObjTop;
	layerObj.left  = inObjLeft;
} 

function getDim(el){
	for (var lx=0,ly=0;el!=null;
		lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
	return {x:lx,y:ly}
}

//function for setting the top button
function setTopLayerPosition(resizeFlag){
	if(topButton=='Y'){
		if (document.all && document.all["footer_layer"]!=null)
		{
			moveTopDivs(document.all["footer_layer"].style, getDim(document.images.backtotopspacer).y, getDim(document.images.backtotopspacer).x)
			if (getDim(document.images.backtotopspacer).y > footerY)
			{
				if (resizeFlag)
				{document.all["footer_layer"].style.visibility = "visible"}
			}
		}
		if (document.layers && document.layers["footer_layer"])
		{
			moveTopDivs(document.layers["footer_layer"], document.images["backtotopspacer"].y, document.images["backtotopspacer"].x);
			if (document.images["backtotopspacer"].y > footerY)
			{
				if (resizeFlag)
				{document.layers["footer_layer"].visibility = "show"}
			}
		}
		if (!document.all && document.getElementById && document.getElementById("footer_layer")!=null)
		{
			moveTopDivs(document.getElementById("footer_layer").style, document.images["backtotopspacer"].y, document.images["backtotopspacer"].x);
			if (document.images["backtotopspacer"].y > footerY)
			{
				if (resizeFlag)
				{document.getElementById("footer_layer").style.visibility = "visible"}
			}
		}
	}
}

onresize=setTopLayerPosition;

function getfooterHTML(){
	var noticeText='Important notices';
	var revisionText='Last revision date:';	
	var reviewText='Last review date:';	
	if (revisionDate==''||revisionDate=='MM/DD/YYYY') revisionDate='03/12/2010';
	if (reviewDate==''||reviewDate=='MM/DD/YYYY') reviewDate='03/12/2010';
	if (titleID==2){
		noticeText='重要告示';
		revisionText='修訂日期： ';	
		reviewText='覆檢日期： ';	
	}
	var monthArray=new Array();
	monthArray[0]='January';
	monthArray[1]='February';
	monthArray[2]='March';
	monthArray[3]='April';
	monthArray[4]='May';
	monthArray[5]='June';
	monthArray[6]='July';
	monthArray[7]='August';
	monthArray[8]='September';
	monthArray[9]='October';
	monthArray[10]='November';
	monthArray[11]='December';
	var reDate=new Date(Date.parse(revisionDate))
	var showDate=reDate.getDate()+' '+monthArray[reDate.getMonth()]+' '+reDate.getFullYear();
	if (titleID==2) showDate=reDate.getFullYear()+'年'+(reDate.getMonth()+1)+'月'+reDate.getDate()+'日';
	
	var reDate2=new Date(Date.parse(reviewDate))
	var showDate2=reDate2.getDate()+' '+monthArray[reDate2.getMonth()]+' '+reDate2.getFullYear();
	if (titleID==2) showDate2=reDate2.getFullYear()+'年'+(reDate2.getMonth()+1)+'月'+reDate2.getDate()+'日';

	if(isText){			//Top Menu of Text Only version
		if(printPage!=1){
			document.writeln('					</td></tr>');
			document.writeln('					<tr><td height="40"><img src="'+graphicPath+'spacer.gif" width="1" height="40" border="0"></td></tr>');
			document.writeln('					<tr><td>');
			getFooter();
			document.writeln('					</td></tr>');
			document.writeln('					<tr><td><hr color="440039"></td></tr>');
			document.writeln('					<tr><td>');
			document.writeln('						<table cellpadding="0" cellspacing="0" width="100%" border="0">');
			if (selectedSection == 5){
				document.writeln('							<tr valign="bottom">');
				document.writeln('								<td width="100%" valign="bottom" class="footer"><a href="javascript:mainWinLink(\''+MainSection[1][8]+'\');">'+MainTitle[titleID][8]+'</a><!--  | <a href="javascript:mainWinLink(\''+MainSection[1][9]+'\');">'+MainTitle[titleID][9]+'</a> | <a href="javascript:mainWinLink(\''+MainSection[1][10]+'\');">'+MainTitle[titleID][10]+'</a> --></td>');
				document.writeln('								<td nowrap class="footertext"><strong>'+revisionText+' </strong>'+showDate+'</td>');
				document.writeln('							</tr>');
			} else if (selectedSection == 99) {
				if (titleID == 1) {
					searchDate = '12 March 2010';
				} else {
					searchDate = '2010年3月12日'
				}
				document.writeln('							<tr valign="bottom">');
				document.writeln('								<td width="100%" valign="bottom" class="footer"><a href="'+MainSection[1][8]+'">'+MainTitle[titleID][8]+'</a><!--  | <a href="'+MainSection[1][9]+'">'+MainTitle[titleID][9]+'</a> | <a href="'+MainSection[1][10]+'">'+MainTitle[titleID][10]+'</a> --></td>');
				document.writeln('								<td nowrap class="footertext"><strong>'+revisionText+' </strong>'+searchDate+'</td>');
				document.writeln('							</tr>');
			} else {
				document.writeln('							<tr valign="bottom">');
				document.writeln('								<td width="100%" valign="bottom" class="footer"><a href="'+MainSection[1][8]+'">'+MainTitle[titleID][8]+'</a><!--  | <a href="'+MainSection[1][9]+'">'+MainTitle[titleID][9]+'</a> | <a href="'+MainSection[1][10]+'">'+MainTitle[titleID][10]+'</a> --></td>');
				document.writeln('								<td nowrap class="footertext"><strong>'+revisionText+' </strong>'+showDate+'</td>');
				document.writeln('							</tr>');
			}
			document.writeln('						</table>');
			document.writeln('					</td></tr>');
			document.writeln('				</table>');
			document.writeln('			</td></tr>');
			document.writeln('		</table>');
			document.writeln('	</td></tr>');
			document.writeln('</table>');
		}		
	}else{				//Top and Left Menu of graphical version
		if(printPage!=1){
			document.writeln('						</td>');
			if (menu != 'N'){
				document.writeln('						<td width="15" valign="top"><img src="'+graphicPath+'spacer.gif" width="15" height="20" border="0" alt="" title=""></td>');
			}
			document.writeln('					</tr>');
			document.writeln('				</table>');
			document.writeln('			</td></tr>');
			document.writeln('			<tr><td height="40"><img src="'+graphicPath+'spacer.gif" width="1" height="40" border="0"></td></tr>');
			document.writeln('			<tr valign="top" align="left"><td width="100%">');
			document.writeln('				<table cellpadding="0" cellspacing="0" width="100%" border="0">');
			document.writeln('					<tr valign="top" align="left">');
			if (menu != 'N'){
				document.writeln('						<td width="180"><img src="'+graphicPath+'spacer.gif" height="1" width="180" border="0" alt="" title=""></td>');
			} else {
				document.writeln('						<td width="180"><img src="'+graphicPath+'spacer.gif" height="1" width="40" border="0" alt="" title=""></td>');
			}
			document.writeln('						<td width="100%">');
			getFooter();
			document.writeln('						</td>');
			document.writeln('						<td width="15" valign="top"><img src="'+graphicPath+'spacer.gif" width="15" height="20" border="0" alt="" title=""></td>');
			document.writeln('					</tr>');
			document.writeln('				</table>');
			document.writeln('			</td></tr>');
			document.writeln('			<tr valign="top" align="left"><td width="100%">');
			document.writeln('				<table cellpadding="0" cellspacing="0" width="100%" border="0">');
			document.writeln('					<tr valign="top" align="left">');
			if (menu != 'N'){
				document.writeln('						<td width="180"><img src="'+graphicPath+'spacer.gif" height="1" width="180" border="0" alt="" title=""></td>');
			} else {
				document.writeln('						<td width="180"><img src="'+graphicPath+'spacer.gif" height="1" width="40" border="0" alt="" title=""></td>');
			}
			if (selectedSection == 5){
				document.writeln('						<td width="100%" valign="bottom" class="footer"><a href="javascript:mainWinLink(\''+MainSection[1][8]+'\');">'+MainTitle[titleID][8]+'</a><!--  | <a href="javascript:mainWinLink(\''+MainSection[1][9]+'\');">'+MainTitle[titleID][9]+'</a> | <a href="javascript:mainWinLink(\''+MainSection[1][10]+'\');">'+MainTitle[titleID][10]+'</a> --></td>');
			} else {
				document.writeln('						<td width="100%" valign="bottom" class="footer"><a href="'+MainSection[1][8]+'">'+MainTitle[titleID][8]+'</a><!--  | <a href="'+MainSection[1][9]+'">'+MainTitle[titleID][9]+'</a> | <a href="'+MainSection[1][10]+'">'+MainTitle[titleID][10]+'</a> --></td>');
			}
			if (selectedSection == 99){
				if (titleID == 1) {
					searchDate = '12 March 2010';
				} else {
					searchDate = '2010年3月12日'
				}
				document.writeln('						<td nowrap class="footertext"><strong>'+revisionText+' </strong>'+searchDate+'</td>');
			}else{
				document.writeln('						<td nowrap class="footertext"><strong>'+revisionText+' </strong>'+showDate+'</td>');
			}
			document.writeln('						<td width="15" valign="top"><img src="'+graphicPath+'spacer.gif" width="15" height="20" border="0" alt="" title=""></td>');
			document.writeln('					</tr>');
			document.writeln('				</table>');
			document.writeln('			</td></tr>');
			document.writeln('			<tr><td height="20"><img src="'+graphicPath+'spacer.gif" width="1" height="20" border="0"></td></tr>');
			document.writeln('		</table>');
			document.writeln('	</td></tr>');
			document.writeln('</table>');
		}
	}
}

function getFooter(){
	var altText='Go to Top';
	if(titleID!=1) altText='頁首';
	
	var altBack='Back';
	if(titleID!=1) altBack='回上頁';

	document.writeln('<table cellpadding="0" cellspacing="0" width="100%" border="0"><tr valign=top>');
	if (backButton=='Y'){
		document.writeln('<td align="left" width="50%" class="footerlinksmall"><a href="javascript:window.history.back()">'+altBack+'</a></td>');
	} else{
		document.writeln('<td align="left" width="50%"><img src="'+graphicPath+'spacer.gif" border="0" width="1" height="21"></td>');
	}
//	if(topButton=='Y')
	document.writeln('<td align="right" width="50%" class="footerlinksmall"><img src="'+graphicPath+'spacer.gif" name="backtotopspacer" border="0" width="287" height="21"></td>');
	document.writeln('</tr></table>');
}

function genfooterLayer(){
	var altText='Go to Top';
	
	if(titleID!=1) altText='頁首';

	if (document.layers)
		{document.writeln('<layer name=footer_layer top=0 left=0 width=287 height=21 visibility="hide">');}
	else
		{document.writeln('<div id="footer_layer" style="position:absolute; left:0; top:0; width:287; height:21; z-index:1; visibility: hidden"> ');}
	document.writeln('										<table width="287" border="0" cellspacing="0" cellpadding="0">');
	document.writeln('											<tr align="right"><td class="footerlinksmall"><a href="#top">'+altText+'</a></td></tr>');
	document.writeln('										</table>');
	if (document.layers)
		{document.writeln('</layer>');}
	else
		{document.writeln('</div>');}		
		
}

function PopWin(url,x,y) {
  eval("nw = window.open(url,'content1','toolbar=yes,location=yes,directories=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,pageXOffset=100,pageYOffset=100,top=0,left=0,width=" + x + ",height=" + y + "')");
  if ( nw.focus != null){
    nw.focus();
  }
}

function getNavLink(){
	var navLink;
	navLink = '<a href="../index/index.htm" class="topsubmenulinksmall">'+txtHome+'</a>';
	if (selectedSection == 99){
		navLink = '<a href="../index/index.htm" class="topsubmenulinksmall">'+txtHome+'</a>';
	} else {
	if (selectedSection !=''){
		if (selectedSubSection == ''){
			navLink += '&nbsp;&gt;&nbsp;<span class="topsubmenutextsmall">'+MainTitle[titleID][selectedSection]+'</span>';
		} else {
			navLink += '&nbsp;&gt;&nbsp;<a href="'+MainSection[1][selectedSection]+'" class="topsubmenulinksmall">'+MainTitle[titleID][selectedSection]+'</a>';
		}
		if (selectedSubSection !=''){
			if (selectedSecondSubSection == ''){
				navLink += '&nbsp;&gt;&nbsp;<span class="topsubmenutextsmall">'+SubSectionTitle[titleID][selectedSection][selectedSubSection]+'</span>';
			} else{
				navLink += '&nbsp;&gt;&nbsp;<a href="'+SubSection[1][selectedSection][selectedSubSection]+'" class="topsubmenulinksmall">'+SubSectionTitle[titleID][selectedSection][selectedSubSection]+'</a>';
			}
			if (selectedSecondSubSection != ''){
				navLink += '&nbsp;&gt;&nbsp;<span class="topsubmenutextsmall">'+SecondSubSectionTitle[titleID][selectedSection][selectedSubSection][selectedSecondSubSection]+'</span>';
			}
		}
	}
	}
	document.writeln(navLink);
}
		
function getSecondLevel(){
	if (SubSection[1][selectedSection].length>0){
		var secondLevel;
		secondLevel = '<tr><td height="30">'
		if (selectedSection == 4){
			// In News section, the most updated one needed to be on top, so it need to use reverse function
			for (var i=SubSection[1][selectedSection].length-1; i>0; i--){
				if (selectedSubSection == i){
					secondLevel += '<span class="topsubmenutext">'+SubSectionTitle[titleID][selectedSection][i]+'</span>';
				}else{
					secondLevel += '<span class="topsubmenulink"><a href="'+SubSection[1][selectedSection][i]+'">'+SubSectionTitle[titleID][selectedSection][i]+'</a></span>';
				}
				if ((i-1)>0){
					secondLevel += ' | ';
				}
			}
		} else {
			for (var i=1; i<SubSection[1][selectedSection].length; i++){
				if (selectedSubSection == i){
					secondLevel += '<span class="topsubmenutext">'+SubSectionTitle[titleID][selectedSection][i]+'</span>';
				}else{
					secondLevel += '<span class="topsubmenulink"><a href="'+SubSection[1][selectedSection][i]+'">'+SubSectionTitle[titleID][selectedSection][i]+'</a></span>';
				}
				if ((i+1)<SubSection[1][selectedSection].length){
					secondLevel += ' | ';
				}
			}
		}
	}
	secondLevel += '</td></tr>'
	document.writeln(secondLevel);
}

function getThirdLevel(){
	if (SecondSubSection[1][selectedSection][selectedSubSection].length>0){
		var thirdLevel;
		thirdLevel = '<tr><td height="30">'
		for (var i=1; i<SecondSubSection[1][selectedSection][selectedSubSection].length; i++){
			if (selectedSecondSubSection == i){
				thirdLevel += '<span class="topsubmenutext">'+SecondSubSectionTitle[titleID][selectedSection][selectedSubSection][i]+'</span>';
			}else{
				thirdLevel += '<span class="topsubmenulink"><a href="'+SecondSubSection[1][selectedSection][selectedSubSection][i]+'">'+SecondSubSectionTitle[titleID][selectedSection][selectedSubSection][i]+'</a></span>';
			}
			if ((i+1)<SecondSubSection[1][selectedSection][selectedSubSection].length){
				thirdLevel += ' | ';
			}
		}
	}
	thirdLevel += '</td></tr>'
	document.writeln(thirdLevel);
}

function getHeader(){
/*	if (selectedSecondSubSection != ''){
		document.writeln (SecondSubSectionTitle[titleID][selectedSection][selectedSubSection][selectedSecondSubSection]);
	} else*/ if (selectedSubSection !=''){
		document.writeln(SubSectionTitle[titleID][selectedSection][selectedSubSection])
	} else if (selectedSection !=''){
		document.writeln(MainTitle[titleID][selectedSection]);
	}
}

function genHeader(){
	if (selectedSection !=99){
		document.writeln('<table width="94%"  border="0" cellspacing="0" cellpadding="0">');
		if (selectedSection != 5){
			document.writeln('<tr><td>&nbsp;</td></tr>');
			document.writeln('<tr><td height="26" class="topsubmenulinksmall">');
			getNavLink();
			document.writeln('</td></tr>');
			document.writeln('<tr><td>&nbsp;</td></tr>');
			document.writeln('<tr><td class="Header">'+MainTitle[titleID][selectedSection]+'</td></tr>');
			document.writeln('<tr><td>&nbsp;</td></tr>');
		}
		if (selectedSubSection != ''){
			if (selectedSection != 4){
				getSecondLevel();
			} else {
				document.writeln('<tr><td>');
				getSectionList(4, '')
				document.writeln('</td></tr>');
			}
			document.writeln('<tr><td>&nbsp;</td></tr>');
			document.writeln('<tr><td>&nbsp;</td></tr>');
			document.writeln('<tr><td>');
			document.writeln('<p class="Header2">');
			getHeader()
			document.writeln('</p>');
			document.writeln('</td></tr>');
		}
		if (selectedSecondSubSection != ''){
			getThirdLevel();
			document.writeln('<tr><td>&nbsp;</td></tr>');
			document.writeln('<tr><td>&nbsp;</td></tr>');
			document.writeln('<tr><td>');
			document.writeln('<p class="Header3">'+SecondSubSectionTitle[titleID][selectedSection][selectedSubSection][selectedSecondSubSection]+'</p>');
			document.writeln('</td></tr>');
		}
		document.writeln('</table>');
	}else{
		document.writeln('<table width="94%"  border="0" cellspacing="0" cellpadding="0">');
			document.writeln('<tr><td>&nbsp;</td></tr>');
			document.writeln('<tr><td>&nbsp;</td></tr>');
		document.writeln('</table>');
	}
}

function getSectionList(section, subSection){
	if (subSection == ''){
		document.writeln('<ul style="margin-left:20px;margin-bottom:0px;">');
		if (section == 4){
			// In News section, the most updated one needed to be on top, so it need to use reverse function
			for (var i=SubSection[1][section].length-1; i>0; i--){
				document.writeln('<li><a href="'+SubSection[1][section][i]+'">'+SubSectionTitle[titleID][section][i]+'</a></li>');
				if (SecondSubSection[1][section][i].length>0){
					document.writeln('<ul style="margin-left:20px;margin-bottom:0px;">');
					for (var j=1; j<SecondSubSection[1][section][i].length; j++){
						document.writeln('<li><a href="'+SecondSubSection[1][section][i][j]+'">'+SecondSubSectionTitle[titleID][section][i][j]+'</a></li>');
					}
					document.writeln('</ul>');
				}
			}
		} else {
			for (var i=1; i<SubSection[1][section].length; i++){
				document.writeln('<li><a href="'+SubSection[1][section][i]+'">'+SubSectionTitle[titleID][section][i]+'</a></li>');
				if (SecondSubSection[1][section][i].length>0){
					document.writeln('<ul style="margin-left:20px;margin-bottom:0px;">');
					for (var j=1; j<SecondSubSection[1][section][i].length; j++){
						document.writeln('<li><a href="'+SecondSubSection[1][section][i][j]+'">'+SecondSubSectionTitle[titleID][section][i][j]+'</a></li>');
					}
					document.writeln('</ul>');
				}
			}
		}
		document.writeln('</ul>');
	} else {
		if (SecondSubSection[1][section][subSection].length>0){
			document.writeln('<ul style="margin-left:20px;margin-bottom:0px;">');
			for (var j=1; j<SecondSubSection[1][section][subSection].length; j++){
				document.writeln('<li><a href="'+SecondSubSection[1][section][subSection][j]+'">'+SecondSubSectionTitle[titleID][section][subSection][j]+'</a></li>');
			}
			document.writeln('</ul>');
		}
	}
}

function getSitemap(){
	if (MainSection[1].length >0){
		document.writeln('<ul style="margin-left:20px;margin-bottom:0px;">');
		for (var k=0; k<MainSection[1].length; k++){
			document.writeln('<li><a href="'+MainSection[1][k]+'">'+MainTitle[titleID][k]+'</a><br><br></li>');
			if (SubSection[1][k].length>0){
				document.writeln('<ul style="margin-left:20px;margin-bottom:0px;">');
				if (k==4){
				// In News section, the most updated one needed to be on top, so it need to use reverse function
					for (var i=SubSection[1][k].length-1; i>0; i--){
						document.writeln('<li><a href="'+SubSection[1][k][i]+'">'+SubSectionTitle[titleID][k][i]+'</a><br><br></li>');
						if (SecondSubSection[1][k][i].length>0){
							document.writeln('<ul style="margin-left:20px;margin-bottom:0px;">');
							for (var j=1; j<SecondSubSection[1][k][i].length; j++){
								document.writeln('<li><a href="'+SecondSubSection[1][k][i][j]+'">'+SecondSubSectionTitle[titleID][k][i][j]+'</a><br><br></li>');
							}
							document.writeln('</ul>');
						}
					}
				} else {
					for (var i=1; i<SubSection[1][k].length; i++){
						document.writeln('<li><a href="'+SubSection[1][k][i]+'">'+SubSectionTitle[titleID][k][i]+'</a><br><br></li>');
						if (SecondSubSection[1][k][i].length>0){
							document.writeln('<ul style="margin-left:20px;margin-bottom:0px;">');
							for (var j=1; j<SecondSubSection[1][k][i].length; j++){
								document.writeln('<li><a href="'+SecondSubSection[1][k][i][j]+'">'+SecondSubSectionTitle[titleID][k][i][j]+'</a><br><br></li>');
							}
							document.writeln('</ul>');
						}
					}
				}
				document.writeln('</ul>');
			}
		}
		document.writeln('</ul>');
	}
}

function getAcrobat(){
	if(isText){
		if (titleID == 1){
			document.writeln('<p><span class="content_bold">Note: </span>Some of the files are in PDF format. Please download <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank">Adobe Reader</a> for viewing and printing.</p>');
		} else {
			document.writeln('<p><span class="content_bold">注意︰</span>部份檔案為PDF格式，請下載 <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank">Adobe Reader</a> 以便瀏覽。</p>');
		}
	} else {
		if (titleID == 1){
			document.writeln('<p><span class="content_bold">Note: </span>Some of the files are in PDF format. Please download <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank">Adobe Reader <img src="../images/adobe.gif" border="0" alt="Get Adobe Reader" title="Get Adobe Reader"></a> for viewing and printing.</p>');
		} else {
			document.writeln('<p><span class="content_bold">注意︰</span>部份檔案為PDF格式，請下載 <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank">Adobe Reader<img src="../images/adobe.gif" border="0" alt="Get Adobe Reader" title="Get Adobe Reader"></a>以便瀏覽。</p>');
		}
	}
}

function mainWinLink(url){
	window.opener.location = url;
	window.opener.focus();
	document.focus();
}

function getNewsIndex(num){
	if (num == 'all'){
		document.writeln('			<table width="100%" border="0" cellspacing="0" cellpadding="10">');
		if (SubSection[1][4].length > 0){
			for (var news=SubSection[1][4].length-1; news>0; news--){
				document.writeln('				<tr>');
				document.writeln('					<td class="news_title"><a href="'+SubSection[1][4][news]+'">'+NewsTitle[titleID][news]+'</a><br>');
				document.writeln('					<span class="news_date">'+NewsDate[titleID][news]+'</span> </td>');
				document.writeln('				</tr>');
			}
		}
		document.writeln('			</table>');
	} else {
		document.writeln('			<table width="100%" border="0" cellspacing="0" cellpadding="10">');
		if (SubSection[1][4].length > 0){
			for (var news=SubSection[1][4].length-1; news>num-1; news--){
				document.writeln('				<tr>');
				document.writeln('					<td class="news_title"><a href="'+SubSection[1][4][news]+'">'+NewsTitle[titleID][news]+'</a><br>');
				document.writeln('					<span class="news_date">'+NewsDate[titleID][news]+'</span> </td>');
				document.writeln('				</tr>');
			}
		}
		document.writeln('			</table>');
	}
}
