//switch language version

function langSwitch(lang) {

	var goPath;

	var pagePath=document.location.pathname;

	

	if(location.href.toString().search('arcotect') != -1)

		var translationServer='ht'+'tp://203.169.152.25/gb/';

	else

		var translationServer='ht'+'tp://sc.info.gov.hk/gb/';



	if (lang=='en') { //change to English version

		goPath='/en'+pagePath.substring(3,pagePath.length);

	}

	if (lang=='tc') { //change to traditional chinese version

		goPath='/tc'+pagePath.substring(3,pagePath.length);

	}

	if (lang=='sc') { //change to simplified chinese version

		goPath='/chs'+pagePath.substring(3,pagePath.length);

		//goPath=translationServer+location.host+goPath;

	}

	document.location=goPath;

}

/*

function getTitle() {

	var title=new Array();

	title[1]='政 策'; //Policy 

	title[2]='新 消 息'; //What's New

	title[3]='法 例'; //Legislation 

	title[4]='成 立 業 主 立 案 法 團'; //Formation of Owners' Corporations 

	title[5]='財 務 管 理 、 採 購 及 保 險'; //Financial Management, Procurement and Insurance

	title[6]='大 廈 管 理 日 常 運 作'; //Daily Operation of Building Management

	title[7]='地 區 大 廈 管 理 聯 絡 小 組'; //District Building Management Liaison Teams

	title[8]='宣 傳 及 教 育 活 動'; //Publicity and Educational Activities 

	title[9]='刊 物 及 相 關 網 址'; //Publications and Useful Links

	title[10]='參 考 資 料'; //Reference Materials

	title[11]='意 見 及 查 詢'; //Comments and Enquires
	
	title[12]='香 港 私 人 大 廈 電 腦 資 料 庫';

	title[13]='網 頁 指 南';

	title[14]='重 要 告 示';

	title[15]='「 設 立 物 業 管 理 行 業 的 規 管 架 構 」的 公 眾 諮 詢';

	title[16]='大 廈 管 理 專 業 顧 問 服 務 計 劃 邀 請 服 務 供 應 報 價';


	var scriptBuffer='';

	scriptBuffer+='<title>';

	scriptBuffer+='民 政 事 務 總 署 ─ 大 廈 管 理 ─ '+title[selectedSection];

	scriptBuffer+='</title>';

	return scriptBuffer;	

}

*/

function getTopic() {

	var title=new Array();

	title[1]='政 策'; //Policy 

	title[2]='新 消 息'; //What's New

	title[3]='法 例'; //Legislation 

	title[4]='成 立 業 主 立 案 法 團'; //Formation of Owners' Corporations 

	title[5]='財 務 管 理 、 採 購 及 保 險'; //Financial Management, Procurement and Insurance

	title[6]='大 廈 管 理 日 常 運 作'; //Daily Operation of Building Management

	title[7]='地 區 大 廈 管 理 聯 絡 小 組'; //District Building Management Liaison Teams

	title[8]='教 育 及 宣 傳 活 動'; //Publicity and Educational Activities 

	title[9]='刊 物 及 相 關 網 址'; //Publications and Useful Links

	title[10]='參 考 資 料'; //Reference Materials

	title[11]='意 見 及 查 詢'; //Comments and Enquires
	
	title[12]='香 港 私 人 大 廈 電 腦 資 料 庫';

	title[13]='網 頁 指 南';

	title[14]='重 要 告 示';
	
	title[15]='私 隱 政 策';

	title[16]='「 設 立 物 業 管 理 行 業 的 規 管 架 構 」的 公 眾 諮 詢';

	title[17]='大 廈 管 理 專 業 顧 問 服 務 計 劃 邀 請 服 務 供 應 報 價';

	if (arguments.length > 0) {
		return title[arguments[0]];
	}
	
	return title[selectedSection];

}



function getHeader(){

	linkHome='../../index.html';

	linkSC='javascript:langSwitch(\'sc\')';

	linkEN='javascript:langSwitch(\'en\')';

	linkSiteMap='../sitemap/t_sitemap.htm';

	linkContactUs='mailto:bm_enq@had.gov.hk';

	linkSearch='javascript:document.search.submit()';

//	linkSearch='javascript:PopWin(\'/popup2.html\', 0, 0, 300, 115)';



	var scriptBuffer='';

	scriptBuffer+='<table width="760" border="0" cellspacing="0" cellpadding="0">';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td colspan="2"><font size="4"><b>民 政 事 務 總 署 ─ 大 廈 管 理</b></font><br><br>';

	scriptBuffer+='</td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='<tr valign="middle">';

	scriptBuffer+='<td><table border="0" cellspacing="0" cellpadding="0">';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td nowrap>[ <a href="'+linkHome+'">首 頁</a> ]</td>';

	scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+linkSC+'">簡 體 版</a> ]</td>';

	scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+linkEN+'">English</a> ]</td>';

	scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+linkSiteMap+'">網 頁 指 南</a> ]</td>';

	scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap> [ <a href="'+linkContactUs+'">聯 絡 我 們</a> ] </td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='</table>';

	scriptBuffer+='</td>';

	scriptBuffer+='<td align="right"><table border="0" cellspacing="0" cellpadding="0">';

	scriptBuffer+='<form name="search" action="http://search.gov.hk/search.html" method="get">';

//	scriptBuffer+='<form name="search" action="javascript:PopWin(\'/popup2.html\', 0, 0, 300, 115)">';

	scriptBuffer+='<input type=hidden name=ui_lang value="zh-hk">';
             scriptBuffer+='<input type=hidden name=ui_charset value="utf-8">';
            scriptBuffer+='<input type=hidden name=gp0 value="buildingmgt_home">';
            scriptBuffer+=' <input type=hidden name=gp1 value="buildingmgt_home">';
             scriptBuffer+='<input type=hidden name=tpl_id value="buildingmgt">';
            scriptBuffer+=' <input type=hidden name=web value="this">';
			scriptBuffer+=' <input type=hidden name=txtonly value="1">';

	//form hidden field add here	

	scriptBuffer+='<tr>';

	scriptBuffer+='<td valign="middle" nowrap>[&nbsp;</td>';

	scriptBuffer+='<td valign="middle" nowrap><input type="text" name="query" value=""  id="qu" size="9" class="search_box"/>';

	scriptBuffer+='</td>';

	scriptBuffer+='<td valign="middle" nowrap>&nbsp;<a href="'+linkSearch+'">搜 尋</a>&nbsp;]</td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='</form>';

	scriptBuffer+='</table>';

	scriptBuffer+='</td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td colspan="2"><hr></td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='</table>';

	

	return scriptBuffer;

}



function getAcrobatMsg(display) {

	//generate the topic image to the buffer variable

	var scriptBuffer='';

	if (display) {

		scriptBuffer+='<table width="760" border="0" cellspacing="0" cellpadding="0">';

		scriptBuffer+='<tr>';

		scriptBuffer+='<td><br>';

		scriptBuffer+='<hr></td>';

		scriptBuffer+='</tr>';

		scriptBuffer+='<tr>';

		scriptBuffer+='<td>以 上 PDF 格 式 文 件 需 用 Adobe Reader 閱 讀 。 Adobe Reader 可 在 <a href="http://www.acrobat.com" target="_blank">http://www.acrobat.com</a> 下 載 。</td>';

		scriptBuffer+='</tr>';

		scriptBuffer+='</table>';

	}

	return scriptBuffer;

}



function getNavMenu(){

	link0='../../index.html';

	link1='../policy/t_1.htm';

	link2='../whats_new/t_2.htm';

	link3='../legislation/t_3.htm';

	link4='../formation_of_owners_corporation/t_4.htm';

	link5='../financial_management_procurement_and_insurance/t_5.htm';

	link6='../daily_operation_of_building_management/t_6.htm';
	
	link7='../district_building_management_liaison_teams/t_7.htm';

	link8='../publicity_and_educational_activities/t_8.htm';

	link9='../publications_and_useful_links/t_9.htm';

	link10='../reference_materials/t_10.htm';

	link11='../comments_and_enquiry/t_11.htm';

	link12='../database_of_private_buildings_in_hong_kong/t_12.htm';

	link13='../public_consultation/t_13.htm';

	//generate the topic image to the buffer variable

	var scriptBuffer='';

	scriptBuffer+='<table width="760" border="0" cellspacing="0" cellpadding="0">';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td><br>';

	scriptBuffer+='<br>';

	scriptBuffer+='<hr></td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td>[ <a href="#top">頁 首</a> ]</td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td><hr></td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td><table border="0" cellspacing="0" cellpadding="0">';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td nowrap>[ <a href="'+link1+'">首 頁</a> ]</td>';

	scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+link1+'">'+getTopic(1)+'</a> ]</td>';

	scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+link2+'">'+getTopic(2)+'</a> ]</td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td nowrap>[ <a href="'+link3+'">'+getTopic(3)+'</a> ]</td>';

	scriptBuffer+='<td nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+link4+'">'+getTopic(4)+'</a> ]</td>';

	scriptBuffer+='<td nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+link5+'">'+getTopic(5)+'</a> ] </td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td nowrap>[ <a href="'+link6+'">'+getTopic(6)+'</a> ]</td>';

	scriptBuffer+='<td nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+link7+'">'+getTopic(7)+'</a> ]</td>';

	scriptBuffer+='<td nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+link8+'">'+getTopic(8)+'</a> ]</td>';
	
	scriptBuffer+='</tr>';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td nowrap>[ <a href="'+link9+'">'+getTopic(9)+'</a> ]</td>';

	scriptBuffer+='<td nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+link10+'">'+getTopic(10)+'</a> ]</td>';
	
	scriptBuffer+='<td nowrap>&nbsp;</td>';
		
	scriptBuffer+='<td nowrap>[ <a href="'+link11+'">'+getTopic(11)+'</a> ] </td>';		

	scriptBuffer+='</tr>';
	
	scriptBuffer+='<tr>';

	scriptBuffer+='<td nowrap>[ <a href="'+link12+'">'+getTopic(12)+'</a> ]</td>';

	scriptBuffer+='<td nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+link13+'">'+getTopic(16)+'</a> ]</td>';

	scriptBuffer+='<td nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+link2+'">'+getTopic(17)+'</a> ]</td>';
	
	scriptBuffer+='<td nowrap>&nbsp;</td>';
		
	scriptBuffer+='<td nowrap>&nbsp;</td>';		

	scriptBuffer+='</tr>';

	scriptBuffer+='</table></td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td><hr></td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='</table>';

	

	return scriptBuffer;

}



function getFooter() {

	var copyYear='2007';

	var noticesLink='../notice/t_notice.htm';
	
	var privacyLink='../privacy/privacy.htm';

	if (revisionDate==''||revisionDate=='MM/DD/YYYY') revisionDate='07/28/2008';

	var monthArray=new Array();

	monthArray[0]='1';

	monthArray[1]='2';

	monthArray[2]='3';

	monthArray[3]='4';

	monthArray[4]='5';

	monthArray[5]='6';

	monthArray[6]='7';

	monthArray[7]='8';

	monthArray[8]='9';

	monthArray[9]='10';

	monthArray[10]='11';

	monthArray[11]='12';

	var reDate=new Date(Date.parse(revisionDate))

	var showDate=reDate.getFullYear()+'年 '+monthArray[reDate.getMonth()]+'月 '+reDate.getDate()+'日';

	//generate the topic image to the buffer variable

	var scriptBuffer='';

	scriptBuffer+='<table width="760" border="0" cellspacing="0" cellpadding="0">';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td>版 權 所 有 '+copyYear+' | <a href="'+noticesLink+'">重 要 告 示</a> | <a href="'+privacyLink+'">私 隱 政 策</a><br>';

	scriptBuffer+='</td>';

	scriptBuffer+='<td align="right">修 訂 日 期 : '+showDate+'</td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='</table>';

	

	return scriptBuffer;

}


