//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'; //Policy 

	title[2]='What\'s New'; //What's New

	title[3]='Legislation'; //Legislation 

	title[4]='Formation of Owners\' Corporations'; //Formation of Owners' Corporations 

	title[5]='Financial Management, Procurement and Insurance'; //Financial Management, Procurement and Insurance

	title[6]='Daily Operation of Building Management'; //Daily Operation of Building Management

	title[7]='District Building Management Liaison Teams'; //District Building Management Liaison Teams

	title[8]='Publicity and Educational Activities '; //Publicity and Educational Activities 

	title[9]='Publications and Useful Links'; //Publications and Useful Links

	title[10]='Reference Materials'; //Reference Materials

	title[11]='Comments and Enquires'; //Comments and Enquires
	
	title[12]='Database of Private Building in Hong Kong';

	title[13]='Site Map';

	title[14]='Important Notice';

	title[15]='Public Consultation on "Putting in Place a Regulatory Framework for Property Management Industry"';

	title[16]='Building Management Professional Advisory Service Scheme<br />Invitation for Quotations for the Supply of Service';

	var scriptBuffer='';

	scriptBuffer+='<title>';

	scriptBuffer+='Home Affairs Department - Building Management - '+title[selectedSection];

	scriptBuffer+='</title>';

	return scriptBuffer;	

}
*/


function getTopic() {

	var title=new Array();

	title[1]='Policy'; //Policy 

	title[2]='What\'s New'; //What's New

	title[3]='Legislation'; //Legislation 

	title[4]='Formation of Owners\' Corporations'; //Formation of Owners' Corporations 

	title[5]='Financial Management, Procurement and Insurance'; //Financial Management, Procurement and Insurance

	title[6]='Daily Operation of Building Management'; //Daily Operation of Building Management

	title[7]='District Building Management Liaison Teams'; //District Building Management Liaison Teams

	title[8]='Educational and Publicity Activities'; //Publicity and Educational Activities 

	title[9]='Publications and Useful Links'; //Publications and Useful Links

	title[10]='Reference Materials'; //Reference Materials

	title[11]='Comments and Enquires'; //Comments and Enquires
	
	title[12]='Database of Private Building in Hong Kong';

	title[13]='Site Map';

	title[14]='Important Notice';
	
	title[15]='Privacy Policy';

	title[16]='Public Consultation on "Putting in Place a Regulatory Framework for Property Management Industry"';

	title[17]='Building Management Professional Advisory Service Scheme<br />Invitation for Quotations for the Supply of Service';

	if (arguments.length > 0) {
		return title[arguments[0]];
	}
	return title[selectedSection];

}



function getHeader(){

	linkHome='../../index.html';

	linkTC='javascript:langSwitch(\'tc\')';

	linkSC='javascript:langSwitch(\'sc\')';

	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>Home Affairs Department - Building Management</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+'">BM Home</a> ]</td>';

	scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap>[ <a href="'+linkTC+'">繁 體 版</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="'+linkSiteMap+'">Site Map</a> ]</td>';

	scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';

	scriptBuffer+='<td nowrap> [ <a href="'+linkContactUs+'">Contact Us</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="en">';
    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=""  type="text" id="qu" size="9" class="search_box"/>';

	scriptBuffer+='</td>';

	scriptBuffer+='<td valign="middle" nowrap>&nbsp;<a href="'+linkSearch+'">Search</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>You need to use Adobe Reader to read the above PDF format document files.<br>';

		scriptBuffer+='Adobe Reader can be downloaded at <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">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="'+link0+'">Home</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/t_privacy.htm';

	if (revisionDate==''||revisionDate=='MM/DD/YYYY') revisionDate='07/28/2008';

	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();



	//generate the topic image to the buffer variable

	var scriptBuffer='';

	scriptBuffer+='<table width="760" border="0" cellspacing="0" cellpadding="0">';

	scriptBuffer+='<tr>';

	scriptBuffer+='<td>Copyright '+copyYear+' | <a href="'+noticesLink+'">Important notices</a> | <a href="'+privacyLink+'">Privacy Policy</a><br>';

	scriptBuffer+='</td>';

	scriptBuffer+='<td align="right">Last revision date: '+showDate+'</td>';

	scriptBuffer+='</tr>';

	scriptBuffer+='</table>';

	

	return scriptBuffer;

}

function PopWin(url, x, y, w, h){

    eval("popup0 = window.open(url,'popup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,pageXOffset=300,pageYOffset=500,top=" + y + ",left=" + x +",width=" + w + ",height=" + h + "')");

        if ( popup0.focus != null){

        popup0.focus();

    }

   // return true;

}




