﻿function showMenuObj(){
	var menuObjID;

	if(Selected_ID==1)
		menuObjID=1;
	else if(Selected_ID==2)
		menuObjID=2;
	else if(Selected_ID==3)
		menuObjID=3;
	else if(Selected_ID==4)
		menuObjID=4;
	else if(Selected_ID==5)
		menuObjID=5;
	else if(Selected_ID==6)
		menuObjID=6;
	else if(Selected_ID==7)
		menuObjID=7;
	else if(Selected_ID==8)
		menuObjID=8;
	else if(Selected_ID==9)
		menuObjID=9;
	else if(Selected_ID==10)
		menuObjID=10;
	else if(Selected_ID==11)
		menuObjID=11;
	else if(Selected_ID==12)
		menuObjID=12;
	else if(Selected_ID==13)
		menuObjID=13;
	return menuObjID;
}



function addMenu(sectionID, caption, chi_caption,gb_caption,url,offPic,onPic,hasChild,sitemap,navigationMenu)
{
	menuObj[x] = new Object();
	menuObj[x].id = sectionID;
	menuObj[x].caption = caption;
	menuObj[x].chiCaption = chi_caption;
	menuObj[x].gbCaption = gb_caption;
	if(url.search('http://')!=-1){
		menuObj[x].url = url;
		menuObj[x].popup = ' target="_blank"'
	}else{
		menuObj[x].url = locationPath+langPath+url;
		menuObj[x].popup = ''
	}
	menuObj[x].onPic = imagePath + "images/menu/" + onPic;
	menuObj[x].offPic = imagePath + "images/menu/" + offPic;
	menuObj[x].hasChild = hasChild;
	menuObj[x].sitemap = sitemap;
	menuObj[x].navigationMenu = navigationMenu;
	x++;
}

function addSubMenu(menuID, subSectionID, caption, chi_caption,gb_caption,url,sitemap,navigationMenu)
{
	subMenuObj[y] = new Object();
	subMenuObj[y].id = subSectionID;
	subMenuObj[y].menuID = menuID;
	subMenuObj[y].caption = caption;
	subMenuObj[y].chiCaption = chi_caption;
	subMenuObj[y].gbCaption = gb_caption;	
	if(url.search('http://')!=-1){
		subMenuObj[y].url = url;
		subMenuObj[y].popup = ' target="_blank"'
	}else if(url.search('.pdf')!=-1){
		subMenuObj[y].url = url;
		subMenuObj[y].popup = ' target="_blank"'
	}else if(url.search('javascript:')!=-1){
		subMenuObj[y].url = url;
		subMenuObj[y].popup = ''
	}else{
		subMenuObj[y].url = locationPath+langPath+url;
		subMenuObj[y].popup = ''
	}
	subMenuObj[y].sitemap = sitemap;
	subMenuObj[y].navigationMenu = navigationMenu;
	y++;
}

function changeLanguage(switchLang){
	var currentPath=location.href.toString();
	var switchTc='/tc/';
	var switchSc='/sc/';
	var switchEn='/en/';
	var switchText='/text';
	
	if(location.href.toString().search('.pl')!=-1){
		if(langID==1){
			alert("Language switch function for search page is not available")
		}else{
			alert("本搜尋網頁並沒有提供轉換語言版本的功能")
		}
	}
	else
	{
		switch (switchLang){
			case '/graphics/':
				currentPath=currentPath.replace(switchText, "");
//			currentPath=currentPath.replace(switchTc, switchText+switchTc);
				break;
			case '/text/':
				currentPath=currentPath.replace(switchEn, switchText+switchEn);
				currentPath=currentPath.replace(switchTc, switchText+switchTc);
				currentPath=currentPath.replace(switchSc, switchText+switchSc);
				break;
			case '/sc/':
				currentPath=currentPath.replace(switchTc, switchSc);
				currentPath=currentPath.replace(switchEn, switchSc);
				break;
			case '/en/':
				currentPath=currentPath.replace(switchTc, switchEn);
				currentPath=currentPath.replace(switchSc, switchEn);
				break;
			case '/tc/':
				currentPath=currentPath.replace(switchEn, switchTc);
				currentPath=currentPath.replace(switchSc, switchTc);
				break;
			default:
		}

		document.location=currentPath;	
	}
}

function getCaption(menu, i){
	var showAlt;

	if(langID==1)
		eval('showAlt='+menu+'['+i+'].caption');
	if(langID==2)
		eval('showAlt='+menu+'['+i+'].chiCaption');
	if(langID==3)
		eval('showAlt='+menu+'['+i+'].gbCaption');
	return showAlt;
}
function getMenuPath(ID, sub_ID, showlink){
	menuObjID=showMenuObj();
	
	var strText;
	
	if(showlink)
		strText = "<li><a href='"+menuObj[menuObjID].url+"'>"+getCaption('menuObj', ID)+"</a></li>"
		//strText = "<a href='"+menuObj[menuObjID].url+"' class='path_link'>"+getCaption('menuObj', ID)+"</a>"
	else
		strText = "<li><span class='path2'>"+getCaption('menuObj', ID)+"</span></li>"
	
	return strText;
}

function getSubMenuPath(ID, sub_ID, showlink){
	var strText;
	var langText;
	
	if(langID==1)
		langText=".caption";
	if(langID==2)
		langText=".chiCaption";
	if(langID==3)
		langText=".gbCaption";
	for(var i=1;i<y;i++){
		if (subMenuObj[i])
		{
//		alert(subMenuObj[i].menuID+"/"+ID)
			if (subMenuObj[i].menuID==menuObj[ID].id){
				if (subMenuObj[i].id == sub_ID){
					if(showlink)
						strText = "<li><a href='"+subMenuObj[i].url+"'"+subMenuObj[i].popup+" >"+eval('subMenuObj[i]'+langText)+"</a></li>";
						//strText = "<a href='"+subMenuObj[i].url+"'"+subMenuObj[i].popup+" class='path_link'>"+eval('subMenuObj[i]'+langText)+"</a>";
					else
						strText = eval('subMenuObj[i]'+langText);
				}
			}
		}
	}

	return strText;
}

function getTopic(){
	menuObjID=showMenuObj();
	
	var showPath;
	if(exLink!=null)
		showPath = exLink;
	var checkList = new Array()
		checkList[0] = "Selected_Sub"
		checkList[1] = "Selected_ID"
	var functionList = new Array()
		functionList[0] ="getSubMenuPath" 
		functionList[1] ="getMenuPath" 
	
	for (var i in checkList){
		if(eval(checkList[i]) > 0){
			if(showPath==null){
				showPath = eval(eval("functionList["+i+"]")+"("+menuObjID+", "+Selected_Sub+", false)");
			}else{
				showPath = eval(eval("functionList["+i+"]")+"("+menuObjID+", "+Selected_Sub+", true)") + "<span class='path'>" + showPath + "</span>";
				//showPath = eval(eval("functionList["+i+"]")+"("+menuObjID+", "+Selected_Sub+", true)") + "<span class='path_arrow'> > </span>" + showPath;
			}
		}
	}
	//document.writeln(showPath);
	return showPath
}

//function for check current Path
function getLocationPath(){
	var locPath=location.href.toString();
	var subPath='';

	if(location.href.toString().search('test2.westcomzivo.com/hadla_new')!=-1){
		subPath="ht"+"tp://test2.westcomzivo.com/hadla_new"
		HomePath="test2.westcomzivo.com/hadla_new"
	}
	if(location.href.toString().search('ogcio.devprj.com')!=-1){
		subPath="ht"+"tp://test2.westcomzivo.com/hadla_new"
		HomePath="test2.westcomzivo.com/hadla_new"
	}
	if(location.href.toString().search('www0.hadla.gov.hk')!=-1){
		subPath="ht"+"tp://www0.hadla.gov.hk"
		HomePath="www0.hadla.gov.hk"
	}
	if(location.href.toString().search('www.hadla.gov.hk')!=-1){
		subPath="ht"+"tp://www.hadla.gov.hk"
		HomePath="www.hadla.gov.hk"
	}

	if(location.href.toString().search('/text/')!=-1 || location.href.toString().search('_t.pl')!=-1){
		if(location.href.toString().search('test2.westcomzivo.com/hadla_new')!=-1){
			subPath="ht"+"tp://test2.westcomzivo.com/hadla_new/text"
		}
		if(location.href.toString().search('ogcio.devprj.com')!=-1){
			subPath="ht"+"tp://test2.westcomzivo.com/hadla_new/text"
		}
		if(location.href.toString().search('www0.hadla.gov.hk')!=-1){
			subPath="ht"+"tp://www0.hadla.gov.hk/text"
		}
		if(location.href.toString().search('www.hadla.gov.hk')!=-1){
			subPath="ht"+"tp://www.hadla.gov.hk/text"
		}
	}
	if(subPath==''){
		var lastSlash=location.href.toString().lastIndexOf('/');
		subPath=location.href.toString().substring(0, lastSlash);
	}

	locationPath=subPath;

	//for Search Template
/*	if(location.href.toString().search('westcomzivo')!=-1){
		locationPath=prodURL;
	}*/
}


//
function getLeftMenu(){
	//tempHtml = '';
	if(!isText){
	
	document.writeln('<table border="0" class="nav" cellspacing="0" cellpadding="0">');
	}else{
	document.writeln('<table border="0" cellspacing="0" cellpadding="0" width=100%>');
	}
	
	document.writeln('<tr>');
	document.writeln('<td class="nav_bg">');
	if(!isText){
	document.writeln('<ul>');
	}else{
	document.writeln('');
	}
	
	menuObjID=showMenuObj();
	
	if(!isText){
	
	for(var i=1;i<x;i++){
			if(menuObj[i]){
				if(menuObj[i].navigationMenu=="Y"){
					if (Selected_ID==menuObj[i].id){
						var pic = menuObj[i].onPic;
						var selectedClass =" class=\"selected\"";
					}else{
						var pic = menuObj[i].offPic;
						var selectedClass ="";
					}
					
					//document.writeln('<tr><td><a href="'+menuObj[i].url+'"'+ outAction + overAction + menuObj[i].popup+ '><img name="pic'+i+'" id="pic'+i+'" src="' + pic +  '" alt="'+getCaption("menuObj", i)+'" title="'+getCaption("menuObj", i)+'" border=0></a></td></tr>');
					
					if(i==1)
					var firstClass =" class=\"firstNav\"";
					else
					var firstClass ="";
					
					document.writeln('<li'+firstClass+'><a href="'+menuObj[i].url+'"'+ menuObj[i].popup+ '" '+selectedClass+'>'+getCaption("menuObj", i)+'</a>')
					if(menuObj[i].hasChild=="Y"){
					//alert(i)
					getSubMenu(i);
					}
					document.writeln('</li>');
					
				}
			}
		}
		
	}else{
		document.writeln('<table border=0 cellspacing=0 cellpadding=1 width=100%><tr valign=top><tr valign=top><td>');
		for(var i=1;i<x;i++){
			if(menuObj[i]){
				if(menuObj[i].navigationMenu=="Y"){
					if(menuObj[i].id!=Selected_ID){
						document.writeln('[ <a href="'+menuObj[i].url+'"'+ menuObj[i].popup+ '>'+getCaption("menuObj", i)+'</a> ]&nbsp;');
					}else{
						document.writeln('[ <b><a href="'+menuObj[i].url+'"'+ menuObj[i].popup+ '>'+getCaption("menuObj", i)+'</a></b> ]&nbsp;');
					}
				}
			}
		}
		document.writeln('</td></tr>');
		document.writeln('<tr valign=top>');
		document.writeln('	<td colspan=100><hr width=100%></td>');
		document.writeln('</tr>');
		document.writeln('<tr>');
		if(menuObj[menuObjID].hasChild=="Y"){
		//alert(menuObjID)
			getSubMenu(menuObjID);
		}
		document.writeln('</tr>');
		document.writeln('</table>');
	}
	
	if(!isText){
	
	document.writeln('<li class="lastNav">&nbsp;</li>');
	document.writeln('</ul>');
	
	}else{
	document.writeln('');
	}
	document.writeln('</td>');
	document.writeln('<th></th>');
	document.writeln('</tr>');

	if(!isText && Selected_ID==1){
		if(langID==1){
			var num_of_visitor = "No. of Visitors";
		}
		if(langID==2){
			var num_of_visitor = "瀏覽人次";
		}
		if(langID==3){
			var num_of_visitor = "浏览人次";
		}
		document.writeln('<tr><td><img src="'+locationPath+'/filemanager/template/common/images/spacer.gif" width="1" height="330"></td></tr>');
		document.writeln('<tr><td><table class="privacy_info font-size12" border="0" cellspacing="0" cellpadding="0" align="center" height=100%><tr><td><div align="center">'+num_of_visitor+'<br><img src="http://210.17.235.120/cgi-bin/counter.exe?link=HAD_LA&style=had_la" align="ABSMIDDLE"></div></td></tr></table></td></tr>');
	}
	document.writeln('</table>');
	//document.write(tempHtml);
}

function getSubMenu(inID){
	var nextLine=0;
	/*for(var i=1;i<y;i++){
		if (subMenuObj[i])
		{
			if (subMenuObj[i].menuID==Selected_ID){
				if(nextLine==0){
					document.writeln('<ul>');
					document.writeln('	<li>');
				}
				nextLine++;
	
				if (subMenuObj[i].id != Selected_Sub){
					document.writeln("[ <a href='"+subMenuObj[i].url+"'>"+getCaption('subMenuObj', i)+"</a> ]&nbsp;&nbsp;");
				}else{
					document.writeln("[ <b><a href='"+subMenuObj[i].url+"'>"+getCaption('subMenuObj', i)+"</a></b> ]&nbsp;&nbsp;");
				}
			}
		}
	}*/
	if(!isText){
	
	document.writeln('<ul>');
	for(var i=1;i<y;i++){
		if (subMenuObj[i])
		{
		//alert(subMenuObj[i])
			if (subMenuObj[i].menuID==inID){
				//if(nextLine==0){
					
				//	document.writeln('	<li>');
				//}
				//nextLine++;
	
				//if (subMenuObj[i].id != Selected_Sub){
				//alert(i)
				document.writeln("<li><a href='"+subMenuObj[i].url+"'"+ subMenuObj[i].popup+"'>"+getCaption('subMenuObj', i)+"</a> </li>");
				//}else{
				//var selectedClass ="";
				//document.writeln("<li><a href='"+subMenuObj[i].url+"'>"+getCaption('subMenuObj', i)+"</a> </li>");
				//}
			}
		}
	}

	document.writeln('</ul>');
	
	}else{
	
	for(var i=1;i<y;i++){
		if (subMenuObj[i])
		{
			if (subMenuObj[i].menuID==Selected_ID){
				if(nextLine==0){
					document.writeln('<tr>');
					document.writeln('	<td>');
				}
				nextLine++;
	
				if (subMenuObj[i].id != Selected_Sub){
					document.writeln("[ <a href='"+subMenuObj[i].url+"''"+ subMenuObj[i].popup+"'>"+getCaption('subMenuObj', i)+"</a> ]&nbsp;&nbsp;");
				}else{
					document.writeln("[ <b><a href='"+subMenuObj[i].url+"''"+ subMenuObj[i].popup+"'>"+getCaption('subMenuObj', i)+"</a></b> ]&nbsp;&nbsp;");
				}
			}
		}
	}
	
	document.writeln('<tr><td><hr></hr></td></tr>');
	
	}
}

function getSiteMap(){
	var bulletPath1;
	var bulletPath2;
	if(!isText){
		bulletPath1='<img src="'+locationPath+'/filemanager/template/common/images/bullet_green.gif" alt="*">';
		bulletPath2='<img src="'+locationPath+'/filemanager/template/common/images/bullet_orange.gif" alt="*">';
		//bulletPath1='<img src="'+locationPath+'/images/bullet_1.gif" border=0 alt="*">';
		//bulletPath2='<img src="'+locationPath+'/images/bullet_2.gif" border=0 alt="*">';
	}else{
		bulletPath1='*';
		bulletPath2='*';
	}
	
	document.writeln('<table class="sitemap_info font-size12" cellspacing="3" cellpadding="0">');
	for(var i=1;i<x;i++){
		if(menuObj[i]){
			if(menuObj[i].sitemap=="Y"){
				document.write('<tr><td>'+bulletPath1+'</td><td><a class="greenfront" href="'+menuObj[i].url+'"'+menuObj[i].popup+'><b>'+getCaption('menuObj', i)+'</b></a></td>');
//				document.write('	<li><a href="'+menuObj[i].url+'">'+getCaption('menuObj', i)+'</a>');
				if(menuObj[i].hasChild=="Y" || menuObj[i].hasChild=="L"){
					document.writeln('	<tr><td></td><td><table cellspacing="3" cellpaddding="0">');
					for(var j=1;j<y;j++){
						if (subMenuObj[j].menuID==menuObj[i].id)
							document.write('	<tr><td>'+bulletPath2+'</td><td><a href="'+subMenuObj[j].url+'"'+subMenuObj[j].popup+' class="Link">'+getCaption('subMenuObj', j)+'</a></td></tr>');
					}
					document.writeln('	</table></td></tr>');
				}else{
				document.writeln('</tr>');
				}
			}
		}
	}
	document.writeln('</table>');
}

//function for Print Function
function PrintDocument(){
	window.open(document.URL,'PrintPage','top=10,left=10,height=500,width=650,resizable=0,scrollbars=1');
}

function init(){
	//setTopLayerPosition(true);
	if(printPage==1){
		setTimeout("window.print()",1000);
		//window.print();
	}
}

//
//
function genHeaderHTML() {
	tempHtml = '';
	tempHtml += '<script language="javascript">getwrapper();</script>';
	tempHtml += '<script language="javascript">gengov();</script>';
	tempHtml += '<script language="javascript">genprint();</script>';
	tempHtml += '<tr>';
	tempHtml += '<td>';
	tempHtml += '<table border="0" class="content_bg" cellspacing="0" cellpadding="0" width="100%">';
	tempHtml += '<tr>';

				if(printPage!=1){
	tempHtml += '<td class="nav_line_bg">';
				}else{
	tempHtml += '<td style="background-color:#FCFCF7">';			
				}
	tempHtml += '<script language="javascript">if(printPage!=1){ getLeftMenu(); }</script>';
	
				if(printPage!=1){
	tempHtml += '<table border="0" class="content" cellspacing="0" cellpadding="0">';
				}else{
	tempHtml += '<table border="0" class="contentPrint" cellspacing="0" cellpadding="0">';			
				}
	tempHtml += '<tr>';
	tempHtml += '<td>';
				if(printPage!=1){
	tempHtml += '<table border="0" class="content_info" cellspacing="0" cellpadding="0">';			
				}else{
	tempHtml += '<table border="0" class="content_info content_info_Print" cellspacing="0" cellpadding="0">';			
				}
	tempHtml += '<script language="javascript">gencrumb();</script>';
	tempHtml += '<script language="javascript">gentitle();</script>';
	tempHtml += '<tr>';
	tempHtml += '<td>';
	document.write(tempHtml);
}					

function genfooterHTML() {
	tempHtml = '';
	tempHtml += '</td>';
	tempHtml += '	</tr>';
	tempHtml += '		</table>';
	tempHtml += '			</td>';			
	tempHtml += '		</tr>';
	tempHtml += '	</table>';
		
	tempHtml += '			</td>';			
	tempHtml += '		</tr>';
	tempHtml += '	</table>';
	
	tempHtml += '</td>';
	tempHtml += '</tr>';
	tempHtml += '<script language="javascript">genfooter();</script>';
	tempHtml += '</table>';
	document.write(tempHtml);
}

function genfooterHTML2() {
	tempHtml = '';
	tempHtml += '</td>';
	tempHtml += '	</tr>';
	tempHtml += '		</table>';
	tempHtml += '			</td>';			
	tempHtml += '		</tr>';
	tempHtml += '	</table>';
		
	tempHtml += '			</td>';			
	tempHtml += '		</tr>';
	tempHtml += '	</table>';
	
	tempHtml += '</td>';
	tempHtml += '</tr>';
	tempHtml += '<script language="javascript">genfooter2();</script>';
	tempHtml += '</table>';
	document.write(tempHtml);
}
//
//
function getwrapper() {
	if(printPage!=1){
		var WidthClass="class=\"wrapper wrapperNoPrint\""
		}else{
		var WidthClass="class=\"wrapper wrapperPrint\""
		}	
	tempHtml = '';
	if(!isText){
	tempHtml += '<table '+WidthClass+' cellspacing="0" cellpadding="0">';
	}else{
	tempHtml += '<table cellspacing="0" cellpadding="0" width="100%">';
	}
	document.write(tempHtml);
}

function gengov() {
	var EnLanguage='en';
	var TcLanguage='tc';
	var ScLanguage='sc';
	if (langID==2){
		EnLanguage='tc';
		TcLanguage='sc';
		ScLanguage='en';
	}
	if (langID==3){
		EnLanguage='sc';
		TcLanguage='tc';
		ScLanguage='en';
	}

	tempHtml = '';
	
	if(!isText){
		if(printPage!=1){
	tempHtml += '<tr>';

	tempHtml += '	<td class="govh_bg">';
					
	tempHtml += '		<table cellspacing="0" cellpadding="0" style="width:990px;">';
	tempHtml += '			<tr>';
	tempHtml += '				<td>';			

	tempHtml += '					<table class="gov_nav" cellspacing="0" cellpadding="0">';
	tempHtml += '						<tr>';
	tempHtml += '							<td><a href="'+locationPath+'/index.html"><img src="'+locationPath+'/filemanager/template/'+EnLanguage+'/images/branding.gif"/ alt="'+arClfTopMenu[langID][3]+'"></a></td>';
	tempHtml += '							<th><a href="'+arClfTopMenu[langID][5]+'" target="_blank"><img src="'+locationPath+'/filemanager/template/'+EnLanguage+'/images/brandhk.gif" alt="'+arClfTopMenu[langID][6]+'"/></a></th>';
	tempHtml += '						</tr>';
	tempHtml += '						<tr>';
	tempHtml += '							<td><a href="'+arClfTopMenu[langID][23]+'" target="_blank"><img class="btn_over" src="'+locationPath+'/filemanager/template/common/images/btn_govhk.gif" alt="'+arClfTopMenu[langID][7]+'"/></a><a href="javascript:changeLanguage(\''+arClfTopMenu[langID][9]+'\')"><img class="btn_over" src="'+locationPath+'/filemanager/template/common/images/btn_textonly_'+EnLanguage+'.gif" alt="'+arClfTopMenu[langID][10]+'"/></a><a href="javascript:changeLanguage(\''+arClfTopMenu[langID][12]+'\')"><img class="btn_over" src="'+locationPath+'/filemanager/template/common/images/btn_'+TcLanguage+'.gif" alt="'+arClfTopMenu[langID][13]+'"/></a><a href="javascript:changeLanguage(\''+arClfTopMenu[langID][15]+'\')"><img class="btn_over" src="'+locationPath+'/filemanager/template/common/images/btn_'+ScLanguage+'.gif" alt="'+arClfTopMenu[langID][16]+'"/></a><img src="'+locationPath+'/filemanager/template/common/images/mainbar.gif"/></td>';
	tempHtml += '							<th class="govh"><a href="'+locationPath+langPath+'sitemap/index.html"><img class="btn_over" src="'+locationPath+'/filemanager/template/'+EnLanguage+'/images/btn_sitemap.gif" alt="'+arClfTopMenu[langID][18]+'"/></a><a href="'+locationPath+langPath+'contactus/index.html"><img class="btn_over" src="'+locationPath+'/filemanager/template/common/images/btn_mail.gif" alt="'+arClfTopMenu[langID][19]+'"/></a></th>';
	tempHtml += '						</tr>';
	tempHtml += '					</table>';
	tempHtml += '				</td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
					
	tempHtml += '</tr>';
		}else{}
	
	}else{
	tempHtml += '<tr>';
	tempHtml += '	<td>';
	tempHtml += '		<table cellspacing="0" cellpadding="0">';
	tempHtml += '			<tr>';
	tempHtml += '				<td><b>'+arClfTopMenu[langID][3]+'</b></td>';
	tempHtml += '			</tr>';
	tempHtml += '			<tr>';
	tempHtml += '				<td>&nbsp;</td>';
	tempHtml += '			</tr>';
	tempHtml += '			<tr>';
	tempHtml += '				<td>[ <a href="'+arClfTopMenu[langID][23]+'" target="_blank">'+arClfTopMenu[langID][7]+'</a> ] [ <a href="javascript:changeLanguage(\''+arClfTopMenu[langID][22]+'\')">'+arClfTopMenu[langID][21]+'</a> ] [ <a href="javascript:changeLanguage(\''+arClfTopMenu[langID][12]+'\')">'+arClfTopMenu[langID][13]+'</a> ] [ <a href="javascript:changeLanguage(\''+arClfTopMenu[langID][15]+'\')">'+arClfTopMenu[langID][16]+'</a> ] [ <a href="'+locationPath+'/text'+langPath+'sitemap/index.html">'+arClfTopMenu[langID][18]+'</a> ] [ <a href="'+locationPath+'/text'+langPath+'contactus/index.html">'+arClfTopMenu[langID][19]+'</a> ]</td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
	tempHtml += '<tr>';
	tempHtml += '	<td><hr></hr></td>';
	tempHtml += '</tr>';
	tempHtml += '<tr>';
	tempHtml += '	<td>&nbsp;</td>';
	tempHtml += '</tr>';
	}
	
	document.write(tempHtml);
}

function genprint() {
	var topTitletAlt='OFFICE OF THE LICENSING AUTHORITY';
	var language='en';
	if (langID==2){
		topTitletAlt='重要告示';
		language='tc';
	}
	if (langID==3){
		topTitletAlt='重要告示';
		language='sc';
	}
	if(printPage!=1){
		var WidthClass="class=\"top topNoPrint\""
		}else{
		var WidthClass="class=\"top topPrint\""
	}
	
	tempHtml = '';
	if(!isText){
	tempHtml += '<tr>';
	tempHtml += '	<td class="top_bg">';
	tempHtml += '		<table '+WidthClass+' cellspacing="0" cellpadding="0">';
	tempHtml += '			<tr>';
	if(printPage!=1){
		tempHtml += '				<th><img src="'+locationPath+'/filemanager/template/'+language+'/images/top_title.gif" alt="'+topTitletAlt+'"/></th>';
	}else{
		tempHtml += '				<th><img src="'+locationPath+'/filemanager/template/'+language+'/images/top_title_print.gif" alt="'+topTitletAlt+'"/></th>';
	}
	tempHtml += '				<td><a href="javascript:PrintDocument();"><img class="btn_over" src="'+locationPath+'/filemanager/template/'+language+'/images/btn_print.gif" alt="'+arClfTopMenu[langID][27]+'"/></a></td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
	}else{
	tempHtml += '';
	/*
	tempHtml += '<tr>';
	tempHtml += '	<td>';
	tempHtml += '		<table cellspacing="0" cellpadding="0">';
	tempHtml += '			<tr>';
	tempHtml += '				<td>'+topTitletAlt+'</td>';
	tempHtml += '				<td><a href="javascript:PrintDocument();">'+arClfTopMenu[langID][27]+'</a></td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';*/
	}
	document.write(tempHtml);
}

function gencrumb() {
	tempHtml = '';
	if(!isText){
	tempHtml += '<tr>';
	tempHtml += '	<th>';
	tempHtml += '<p class="btn_main"><a href="'+locationPath+'/index.html"><img src="'+locationPath+'/filemanager/template/common/images/main_icon.gif" /></a></p>';
	tempHtml += '		<ul>';
	tempHtml += '			'+getTopic()+'';			
	tempHtml += '		</ul>';
	tempHtml += '	</th>';
	tempHtml += '</tr>';
	}else{
	tempHtml += '';
	}
	document.write(tempHtml);
}
function gentitle() {
	menuObjID=showMenuObj();
	var checkList = new Array()
		checkList[0] = "Selected_Sub"
		checkList[1] = "Selected_ID"
	var functionList = new Array()
		functionList[0] ="getSubMenuPath" 
		functionList[1] ="getMenuPath"
	var functionNum;
	functionNum = 1;

	if(Selected_ID<10)
		var titleNum="0"+Selected_ID;
	else
		var titleNum=Selected_ID;
	
	if(Selected_Sub>0){
		functionNum = 0;
		if(Selected_Sub<10){
			subTitleNum=titleNum+"0"+Selected_Sub;
		}else{
			subTitleNum=titleNum+Selected_Sub;
		}
	}
	tempHtml = '';
	tempHtml += '<tr>'
	tempHtml += '	<td>';
	//if (subMenuObj[Selected_Sub])
	//	{
			//if (subMenuObj[Selected_Sub].menuID==Selected_ID)
			//	{
				//alert(Selected_Sub)
				//	if (subMenuObj[Selected_Sub].id != Selected_Sub){
				//		tempHtml += '<h1>'+getCaption("menuObj", Selected_Sub)+'</h1>';
				//	}else{
				//	tempHtml += '<h1>'+getCaption("menuObj", Selected_Sub)+'</h1>';
				//	}
				//}
	//	}
	
					//if (subMenuObj[subSectionID].menuID==inID){
						//if(menuObj[Selected_ID].hasChild=="Y"){
	//tempHtml += '		<h1>'+getCaption("menuObj", Selected_Sub)+'</h1>';
							//if (subMenuObj[Selected_Sub].menuID==Selected_ID){
							//if (subMenuObj[Selected_Sub].id = Selected_Sub){
	//tempHtml += '		<h1>'+getCaption("menuObj", Selected_ID)+'</h1>';
							//}else{
	//tempHtml += '		<h1>'+getCaption("menuObj", Selected_ID)+'</h1>';
							//}
					//		}
					//	alert(Selected_Sub)
					//	}else{
	if(Selected_Sub==0)
	{
		tempHtml += '		<h1>'+getCaption("menuObj", Selected_ID)+'</h1>';
	}
	else
	{
		tempHtml += '		<h1>'+eval(eval("functionList["+functionNum+"]")+"("+menuObjID+", "+Selected_Sub+", false)")+'</h1>';	
	}
					//	}
	tempHtml += '	</td>';
	tempHtml += '</tr>';
	document.write(tempHtml);
}

function genfooter() {
	var altText='Top';
	if(langID==2) altText='頁首';
	if(langID==3) altText='页首';
	
	var altBack='Back';
	if(langID==2) altBack='回上頁';
	if(langID==3) altBack='回上页';
	
	var copyYear='2009';
	var noticesLink=locationPath+langPath+'notices/index.html';
	var privacyLink=locationPath+langPath+'privacy/index.html';
	var noticeText='Important Notices';
	var	privacyText='Privacy Policy';
	var revisionText='Last revision date: ';
//	var reviewText='Last review date: ';
	if (revisionDate==''||revisionDate=='MM/DD/YYYY') revisionDate='10/1/2009';
//	if (reviewDate==''||reviewDate=='MM/DD/YYYY') reviewDate='10/1/2009';
	if (langID==2){
		noticeText='重要告示';
		privacyText='私隱政策';
		revisionText='修訂日期： ';	
//		reviewText='覆檢日期： ';	
	}
	if (langID==3){
		noticeText='重要告示';
		privacyText='私隐政策';
		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 (langID==2) showDate=reDate.getFullYear()+'年'+(reDate.getMonth()+1)+'月'+reDate.getDate()+'日';
	if (langID==3) showDate=reDate.getFullYear()+'年'+(reDate.getMonth()+1)+'月'+reDate.getDate()+'日';

	tempHtml = '';

	if(!isText){
	
		if(printPage!=1){
		
	if(topButton=='Y'){
	tempHtml += '<tr>';
	tempHtml += '	<td class="btn_top_bg">';
	tempHtml += '		<table cellspacing="0" cellpadding="0" style="width:990px;">';
	tempHtml += '			<tr>';
	tempHtml += '				<td class="btn_top"><a href="#top">'+altText+'</a></td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
	}
	tempHtml += '<tr>';
	tempHtml += '	<td class="bottom_bg">';
	tempHtml += '		<table cellspacing="0" cellpadding="0" style="width:990px;">';
	tempHtml += '			<tr>';
	tempHtml += '				<td class="bottom">';
	tempHtml += '					<table class="bottom_info" cellspacing="0" cellpadding="0">';
	tempHtml += '						<tr>';
	tempHtml += '							<td colspan="2"><img src="'+locationPath+'/filemanager/template/common/images/dotline_2.gif"/></td>';
	tempHtml += '						</tr>';
	tempHtml += '						<tr>';
	tempHtml += '							<td class="info_left">'+copyYear+' &copy; | <a href="'+noticesLink+'">'+noticeText+'</a> | <a href="'+privacyLink+'">'+privacyText+'</a></td>';
	tempHtml += '							<td class="info_right">'+revisionText+showDate+'</td>';
	tempHtml += '						</tr>';
	tempHtml += '					</table>';
	tempHtml += '				</td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
	
		}else{
		var WidthClass="bottomPrint"
	
	if(topButton=='Y'){
	//if(printPage!=1){
	//tempHtml += '<tr><td class="btn_top"><a href="#top">'+altText+'</a></td></tr>';
	//}else{
	tempHtml += '<tr><td class="btn_top btn_top_print"><a href="#top">'+altText+'</a></td></tr>';
	//}
	}
	tempHtml += '<tr>';
	tempHtml += '	<td class="bottom '+WidthClass+'">';
	tempHtml += '		<table class="bottom_info" cellspacing="0" cellpadding="0">';
	tempHtml += '			<tr>';
	tempHtml += '				<td colspan="2" class="bottom_info_line">&nbsp;</td>';
	tempHtml += '			</tr>';
	tempHtml += '			<tr>';
	tempHtml += '				<td class="info_left">'+copyYear+' &copy; | <a href="'+noticesLink+'">'+noticeText+'</a> | <a href="'+privacyLink+'">'+privacyText+'</a></td>';
	tempHtml += '				<td class="info_right">'+revisionText+showDate+'</td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
		}	
		
	}else{
	tempHtml += '<tr><td>&nbsp;</td></tr>';
	if(topButton=='Y'){
	tempHtml += '<tr><td><hr></hr></td></tr>';
	tempHtml += '<tr><td class="btn_top"><a href="#top">[ '+altText+' ]</a></td></tr>';
	}
	tempHtml += '<tr>';
	tempHtml += '	<td><hr></hr></td>';
	tempHtml += '</tr>';
	tempHtml += '<tr>';
	tempHtml += '	<td>';
	tempHtml += '		<table cellspacing="0" cellpadding="0" width="100%">';
	tempHtml += '			<tr>';
	tempHtml += '				<td>'+copyYear+' &copy; | <a href="'+noticesLink+'">'+noticeText+'</a> | <a href="'+privacyLink+'">'+privacyText+'</a></td>';
	tempHtml += '				<td style="text-align:right;">'+revisionText+showDate+'</td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
	}
	
	document.write(tempHtml);
}

function genfooter2() {
	var altText='Top';
	if(langID==2) altText='頁首';
	if(langID==3) altText='页首';
	
	var altBack='Back';
	if(langID==2) altBack='回上頁';
	if(langID==3) altBack='回上页';
	
	var copyYear='2009';
	var noticesLink=locationPath+langPath+'notices/index.html';
	var privacyLink=locationPath+langPath+'privacy/index.html';
	var noticeText='Important Notices';
	var	privacyText='Privacy Policy';
	var revisionText='Last revision date: ';
//	var reviewText='Last review date: ';
	if (revisionDate2==''||revisionDate2=='MM/DD/YYYY') revisionDate2='6/30/2010';
//	if (reviewDate2==''||reviewDate2=='MM/DD/YYYY') reviewDate2='10/1/2009';
	if (langID==2){
		noticeText='重要告示';
		privacyText='私隱政策';
		revisionText='修訂日期： ';	
//		reviewText='覆檢日期： ';	
	}
	if (langID==3){
		noticeText='重要告示';
		privacyText='私隐政策';
		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(revisionDate2))
	var showDate=reDate.getDate()+' '+monthArray[reDate.getMonth()]+' '+reDate.getFullYear();
	if (langID==2) showDate=reDate.getFullYear()+'年'+(reDate.getMonth()+1)+'月'+reDate.getDate()+'日';
	if (langID==3) showDate=reDate.getFullYear()+'年'+(reDate.getMonth()+1)+'月'+reDate.getDate()+'日';

	tempHtml = '';

	if(!isText){
	
		if(printPage!=1){
		
	if(topButton=='Y'){
	tempHtml += '<tr>';
	tempHtml += '	<td class="btn_top_bg">';
	tempHtml += '		<table cellspacing="0" cellpadding="0" style="width:990px;">';
	tempHtml += '			<tr>';
	tempHtml += '				<td class="btn_top"><a href="#top">'+altText+'</a></td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
	}
	tempHtml += '<tr>';
	tempHtml += '	<td class="bottom_bg">';
	tempHtml += '		<table cellspacing="0" cellpadding="0" style="width:990px;">';
	tempHtml += '			<tr>';
	tempHtml += '				<td class="bottom">';
	tempHtml += '					<table class="bottom_info" cellspacing="0" cellpadding="0">';
	tempHtml += '						<tr>';
	tempHtml += '							<td colspan="2"><img src="'+locationPath+'/filemanager/template/common/images/dotline_2.gif"/></td>';
	tempHtml += '						</tr>';
	tempHtml += '						<tr>';
	tempHtml += '							<td class="info_left">'+copyYear+' &copy; | <a href="'+noticesLink+'">'+noticeText+'</a> | <a href="'+privacyLink+'">'+privacyText+'</a></td>';
	tempHtml += '							<td class="info_right">'+revisionText+showDate+'</td>';
	tempHtml += '						</tr>';
	tempHtml += '					</table>';
	tempHtml += '				</td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
	
		}else{
		var WidthClass="bottomPrint"
	
	if(topButton=='Y'){
	//if(printPage!=1){
	//tempHtml += '<tr><td class="btn_top"><a href="#top">'+altText+'</a></td></tr>';
	//}else{
	tempHtml += '<tr><td class="btn_top btn_top_print"><a href="#top">'+altText+'</a></td></tr>';
	//}
	}
	tempHtml += '<tr>';
	tempHtml += '	<td class="bottom '+WidthClass+'">';
	tempHtml += '		<table class="bottom_info" cellspacing="0" cellpadding="0">';
	tempHtml += '			<tr>';
	tempHtml += '				<td colspan="2" class="bottom_info_line">&nbsp;</td>';
	tempHtml += '			</tr>';
	tempHtml += '			<tr>';
	tempHtml += '				<td class="info_left">'+copyYear+' &copy; | <a href="'+noticesLink+'">'+noticeText+'</a> | <a href="'+privacyLink+'">'+privacyText+'</a></td>';
	tempHtml += '				<td class="info_right">'+revisionText+showDate+'</td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
		}	
		
	}else{
	tempHtml += '<tr><td>&nbsp;</td></tr>';
	if(topButton=='Y'){
	tempHtml += '<tr><td><hr></hr></td></tr>';
	tempHtml += '<tr><td class="btn_top"><a href="#top">[ '+altText+' ]</a></td></tr>';
	}
	tempHtml += '<tr>';
	tempHtml += '	<td><hr></hr></td>';
	tempHtml += '</tr>';
	tempHtml += '<tr>';
	tempHtml += '	<td>';
	tempHtml += '		<table cellspacing="0" cellpadding="0" width="100%">';
	tempHtml += '			<tr>';
	tempHtml += '				<td>'+copyYear+' &copy; | <a href="'+noticesLink+'">'+noticeText+'</a> | <a href="'+privacyLink+'">'+privacyText+'</a></td>';
	tempHtml += '				<td style="text-align:right;">'+revisionText+showDate+'</td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table>';
	tempHtml += '	</td>';
	tempHtml += '</tr>';
	}
	
	document.write(tempHtml);
}

function getLastVerDate()
{
var dataVersionDate='6/30/2010'
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(dataVersionDate))
	var showDate=reDate.getDate()+' '+monthArray[reDate.getMonth()]+' '+reDate.getFullYear();
	if (langID==2) showDate=reDate.getFullYear()+'年'+(reDate.getMonth()+1)+'月'+reDate.getDate()+'日';
	if (langID==3) showDate=reDate.getFullYear()+'年'+(reDate.getMonth()+1)+'月'+reDate.getDate()+'日';

	document.write (showDate)
}

//
function NewWindow(mypage, myname, w, h, scroll,resizable) {
	var winl = (screen.width - w) / 4;
	var wint = (screen.height - h) / 4;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resizable+','
	win = window.open(mypage, myname, winprops)
	win.self.focus()
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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_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_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];}
}