﻿
var domain_pref ="earf";
var domain="192.168.201.54/"+domain_pref;
var domain2="202.64.223.54/"+domain_pref;

if(location.href.search(domain2)!=-1){	//domain is http://202.64.223.54
	domain=domain2;
}else if(location.href.search(domain)==-1){	//domain not is http://192.168.201.54
	/*
	domain_pref="censtatd";
	domain="202.64.223.114/"+domain_pref	;
	*/
	domain="www.e-authentication.gov.hk";
	if (location.href.search('www.e-authentication')!=-1){
		domain="www.e-authentication.gov.hk";
	}else if (location.href.search('www0.e-authentication')!=-1){
		domain="www0.e-authentication.gov.hk";
	}else if (location.href.search('www0.cms.e-authentication')!=-1){
		domain="www0.cms.e-authentication.gov.hk";
	}else if (location.href.search('www.cms.e-authentication')!=-1){
		domain="www.cms.e-authentication.gov.hk";
	}else if (location.href.search('active.e-authentication')!=-1){
		domain="active.e-authentication.gov.hk";
	}else if (location.href.search('staging.e-authentication')!=-1){
		domain="staging.e-authentication.gov.hk";
	}else if (location.href.search('wip.e-authentication')!=-1){
		domain="wip.e-authentication.gov.hk";
	}
}


if (typeof(langID)=='undefined'){

	if(document.URL.toString().search('/sc/')!=-1){
		langID=3;
		langFolder='/sc/';
		//imgFolder=langFolder;
		docFolder='/doc/';
	}else if(document.URL.toString().search('/tc/')!=-1 || document.URL.toString().search('mode=0')!=-1){
		langID=2;
		langFolder='/tc/';
		//imgFolder=langFolder;
		docFolder='/doc/';
	}else{
		langID=1;
		langFolder='/en/';
		//imgFolder=langFolder;
		docFolder=langFolder+'pdf/';
	}

}else{

	if(langID==3){
		langFolder='/sc/';
		docFolder='/doc/';
	}else if(langID==2){
		langID=2;
		langFolder='/tc/';
		docFolder='/doc/';
	}else{
		langFolder='/en/';
		docFolder=langFolder+'pdf/';
	}

}

domain_url = "ht"+"tp://"+domain;

if(document.URL.toString().search('/linear/')!=-1){					//TEXTONLY VERSION
	langPath = domain_url + '/linear' + langFolder;
	imgPath = domain_url + '/images' + langFolder/*imgFolder*/;
}else{													//GRAPHIC VERSION
	langPath = domain_url + langFolder;
	imgPath = domain_url + '/images' + langFolder/*imgFolder*/;
}
docPath=domain_url + docFolder;

if(location.href.toString().search('search.gov.hk') != -1){
	selectedSection=13;
	selectedSubSection=0;
	revisionDate='MM/DD/YYYY'; //Date Format: MM/DD/YYYY
}

//Dreamweaver Code
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 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_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; }
}

//print style sheet
var css_file='css.css';
if(document.URL.toString().search('/text/')!=-1){
	document.writeln('<link href="../../../css/'+css_file+'" rel="stylesheet" type="text/css">');
}else{
	document.writeln('<link href="../../css/'+css_file+'" rel="stylesheet" type="text/css">');
} 


// ******************** Start Text Size function ********************


/* MM added 20070510 */
function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

/* 20070527 make global variable 'lang' and 'lang_prefix' */
var lang = 0; 
var lang_prefix = "";

/* 20070527 move out from function "langCurrentPage" */
/* 20070612 not only "homepage", check for other pages also */
/* sc - 2, tc - 1, en - 0 */
if (location.href.toString().search('/sc/') != -1) {
	lang = 2;
	lang_prefix = '/sc';
} else if (location.href.toString().search('/tc/') != -1) {
	lang = 1;
	lang_prefix = '/tc';
} else {
	lang = 0;
	lang_prefix = '/en';
} 


// for Search Keyword Box (2007.04.30)
var clear = 0;
function ClearText()
{
	if (clear == 0)
	{
		document.getElementById("topNavSearchInput").value = "";		
	}
	clear = 1;
}



/* 20070525: Functions for enlarge font size and 'linear' mode for accessibility */
/* remark: replace Font stylesheet can benefit firefox */
/* if just change body font size, firefox will not have style to select */

/* 20070525: cookie functions */
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

/* 20070525: FIVE(5) global static variable */
var fontarray = new Array();
fontarray[0] = "Medium";
fontarray[1] = "Large";
fontarray[2] = "Extra";
var modeFormat = 'Format';
var modeLinear = 'Linear';
/* 20070720: the Link "ID" and cookie should keep above words */

/* 2 global variables from 2 cookie variables */
var myfonttitle = readCookie("govhkfonttitle");
if (myfonttitle==null) {myfonttitle=fontarray[0]; }

var myscreenmode = readCookie("govhkscreenmode");
if (myscreenmode==null) {myscreenmode=modeFormat; } 

// for clear old R2 cookie
if (myfonttitle!=fontarray[0] && myfonttitle!=fontarray[1] && myfonttitle!=fontarray[2] ) 
{ myfonttitle = fontarray[0]; }
if (myscreenmode!=modeFormat && myscreenmode!=modeLinear) { myscreenmode = modeFormat; }

var ChangeTextMenu='';

// 20070716: use "linearFontSize" to handle the linear and 3A
function linearFontSize()
{
	var toggleMsg= [
		['Linear Version', '簡化格式', '简化格式'],
		['Normal Version', '標準格式', '标准格式']	
	];
  
	// display - swap on or off images
	var tempChangeTextMenu = new Array();
	var temppath='';
	for (i=0;i<fontarray.length;i++)
	{
	if (myfonttitle==fontarray[i] ) {
		// seperate to 2 part, avoid change 'gif' to 'htm' when grab the website
		fonttail = '_over.gif';
	} else {
		fonttail = '.gif';
	}

	// fontimg:         "MediumFontImg", "LargeFontImg", "ExtraFontImg"
	// fontpath:        "/images/fontsize/Medium_off.gif"

	temp=i+1;
	fontimg = 'btn_size_'+temp;	
	//fontimg = fontarray[i] + 'FontImg';	
	fontpath = domain_url+'/images/common/' + fontimg+ fonttail;
	tempChangeTextMenu[i]=fontpath;
	temppath=temppath+fontpath+'\n'+'MM_swapImage('+fontimg+',\'\','+fontpath+',1);'+'\n';
	MM_swapImage(fontimg,'',fontpath,1);
}
  
	if(document.URL.toString().search('/sc/')!=-1){
		var fontSizeTitleDefault='原设定';
		var fontSizeTitleLarger='较大';
		var fontSizeTitleLargest='最大';
	}else if(document.URL.toString().search('/tc/')!=-1 || document.URL.toString().search('mode=0')!=-1){
		var fontSizeTitleDefault='原設定';
		var fontSizeTitleLarger='較大';
		var fontSizeTitleLargest='最大';
	}else{
		var fontSizeTitleDefault='Default Size';
		var fontSizeTitleLarger='Larger';
		var fontSizeTitleLargest='Largest';
	}	
	
	ChangeTextMenu='';
	ChangeTextMenu+='<a href="#" onclick="changeFontTitle(\'Medium\'); return false;" onkeypress="changeFontTitle(\'Medium\'); return false;" onmouseout="" onmouseover=""><img src="'+tempChangeTextMenu[0]+'" border="0" alt="'+fontSizeTitleDefault+'" title="'+fontSizeTitleDefault+'" name="btn_size_1" id="btn_size_1"/></a>';
	ChangeTextMenu+='<a href="#" onclick="changeFontTitle(\'Large\'); return false;" onkeypress="changeFontTitle(\'Large\'); return false;" onmouseout="" onmouseover=""><img src="'+tempChangeTextMenu[1]+'" border="0" alt="'+fontSizeTitleLarger+'" title="'+fontSizeTitleLarger+'" name="btn_size_2" id="btn_size_2" /></a>';
	ChangeTextMenu+='<a href="#" onclick="changeFontTitle(\'Extra\'); return false;" onkeypress="changeFontTitle(\'Extra\'); return false;" onmouseout="" onmouseover=""><img src="'+tempChangeTextMenu[2]+'" border="0" alt="'+fontSizeTitleLargest+'" title="'+fontSizeTitleLargest+'" name="btn_size_3" id="btn_size_3" /></a>';
  	//alert ("fontpath=\n"+ChangeTextMenu+temppath);

  // consider "myscreenmode":
  if (myscreenmode==modeFormat) {
	
	// change A-title
	MM_changeProp('screenmodeLink','','title',toggleMsg[0][lang],'A');	
	
	// for change text: 
	MM_changeProp('screenmodeLink','','innerHTML',toggleMsg[0][lang],'A');	
	
  } else {
	// myscreenmode = modeLinear;
	 
	// change A-title	  
	MM_changeProp('screenmodeLink','','title',toggleMsg[1][lang],'A');	
	
	// for change text: 
	MM_changeProp('screenmodeLink','','innerHTML',toggleMsg[1][lang],'A');

  }

  // CAUTION: For Bug in IE7, no matter how, 
  //          assign "a.disabled=true" before change the value 
  // CAUTION: firefox2.04 canNOT use: a.getAttribute("title").indexOf("linear")
  //          use it will break the for-loop
  // but firefox can get: a.getAttribute("title")
  // WorkAround is var1=a.getAttribute("title") and do indexOf or compare


  // For all Link-tag, 20070720: change "link" to "style", 0723 change back
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) 
  {
	// for all "stylesheet" in Link
	if (a.getAttribute("rel").indexOf("stylesheet")!=-1) 
	{
	  // 20070726: especially for "extra" css
	  // if it is linear mode, set all css disable first
	  // if it is normal mode, set all css enable first 
	  if (myscreenmode==modeLinear) { a.disabled=true; } 
	  if (myscreenmode==modeFormat) { a.disabled=true; a.disabled=false; }	

	  // get the title text first
	  var id1 = new String(a.getAttribute("id"));

      // for FontSize and Format relate stylesheet, ( e.g: 'modeFormatMedium' )
	  if (id1.indexOf("mode")!=-1)  {
		a.disabled=true;     // for bug in IE7, no matter how, set to true first
		
		if (id1.indexOf(myfonttitle)!=-1 && id1.indexOf(myscreenmode)!=-1) {
			// for format version and user selected font size, enable it
	        a.disabled=false; 
		}
	  }
	  
	  // 20070719: disable "ie.css" when it is linear version
	  if (id1.indexOf("iecss")!=-1) {
	    a.disabled=true;     // for bug in IE7, no matter how, set to true first
		// enable ie.css when it is "Format" Version
		if (myscreenmode==modeFormat) {
		  a.disabled=false;
		}
	  }
	  
	}
  
  }

}

// 20070716: changeFontTitle just handle global variable change, then pass to "linearFontSize"
function changeFontTitle(ft) {

	// change global variable "myfonttitle"
	myfonttitle = ft;

	// just call linearFontSize and let it handle
	linearFontSize();
}

// 20070716: toggleLinearStyleSheet just handle global variable change, then pass to "linearFontSize"
function toggleLinearStyleSheet(linearflag) {

  // change 'toggle' to modeFormat or modeLinear
  if (linearflag=='toggle') 
  { 
	// change global variable 'myscreenmode'
    if (myscreenmode==modeFormat) {
	  myscreenmode = modeLinear;
	} else {
	  myscreenmode = modeFormat;
	}
  } else {
	  // what it pass from parameter
	  myscreenmode = linearflag;
  } 
  
  // just call linearFontSize and let it handle
  linearFontSize();
}


// 20070716: change to use "linearFontSize"
// (try avoid "flash" before "onload"), do Font Enlarge and select screenmode before page onload, 
//changeFontTitle(myfonttitle);
//toggleLinearStyleSheet(myscreenmode);
linearFontSize();

/* part  : onload.js 
   usage : put all function that need "body onload" in javascript.
      1) : FontEnlarge (20070525)
      2) : Linear or Normal Mode (20070525)
      3) : a ref="external" 
      4) : leftmenu handling (obsolete)

  CAUTION: one html page canNOT have 2 onload functions (will count last one only).
  WorkAround: use try-catch block below
	  
*/

startList = function() {
  
  /* --- prevent loading GovHK in frames */
  breakOutOfFrame();

  /* --- For FontSize - start --- */
  // 20070716: change to use "linearFontSize"  
  //changeFontTitle(myfonttitle);
  //toggleLinearStyleSheet(myscreenmode);
  linearFontSize();
  //fontinit=1;	// 20070713: set user can action on FontSize
  /* --- For FontSize - end --- */

  /* --- For Expand (online service and sitemap) : start --- */
  try { toggleAllExpand('collapse'); } catch (e) {}
  /* --- For Expand : end --- */

  /* --- For New Window - start --- */
  if (document.getElementsByTagName) {
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
      var anchor = anchors[i];
      if (anchor.getAttribute("href") )
      {
        anchor.onkeypress=function() {
          verifykey(this,event);
        }
	// check for different "rel"
	if ( anchor.getAttribute("rel") == "external" )	{
	  anchor.onclick=function() {
	    return openwindow(this.href);
	  }
	}

	if ( anchor.getAttribute("rel") == "application" ) {
	  anchor.onclick=function() {
	    return openwindowapplication(this.href);
	  }
	}

	if ( anchor.getAttribute("rel") == "window800x650" ) {
	  anchor.onclick=function() {
	    return openwindow800x650(this.href);
	  }
	}

	if ( anchor.getAttribute("rel") == "onlinedemo" ) {
	  anchor.onclick=function() {
	    return openwindowdemo(this.href);
	  }
	}

      }
    } 
  }
  /* --- For New Window - end --- */

}

window.onload=startList;

/* 20070525: function when page unload */
window.onunload = function(e) {
  /* assign fontsize and screenmode to cookie, cookie set to 3 months */
  createCookie("govhkfonttitle", myfonttitle, 90);
  createCookie("govhkscreenmode", myscreenmode, 90);
}

/* 20070605: prevent loading of GovHK content in frames */
function breakOutOfFrame()
{
  if (self != top)
  {
    if (document.images)
      top.location.replace(window.location.href);
    else
      top.location.href = window.location.href;
  }
}


// ******************** END Text Size function ********************

// -------------------------------------------------------------    Variable for Common Function for Left Menu -----------------------------------------

//Browser Type var:
var isNS4 = (document.layers) ? true : false;
var isIE4 = (document.all && !document.getElementById) ? true : false;
var isIE5 = (document.all && document.getElementById) ? true : false;
var isNS6 = (!document.all && document.getElementById) ? true : false;
//If not NS4. It should be IE or NS6+
isIE5 =!isNS4;


var leftMenuSectionImageOut = ".jpg";
var leftMenuSectionImageOver = "_over.jpg";
var leftMenuName = "Menu";
var leftMenuImageName = "icon";
var layerCommonName = "Popup";
var leftMenuFlag = false;
var firstLayerFlag = false;
var firstLayerTimerID;
var activeLeftMenuID = "";
var mainTopic = "";

var arLayer = new Array()
var arLayer2 = new Array()

// -------------------------------------------------------------    End of Variable for Common Function for Left Menu -----------------------------------------

// -------------------------------------------------------------    Variable for Common Function for First Level Layers-----------------------------------------

var firstLayerImagesFlag = false;
var secondLayerFlag = false;
var activeFirstLayerImageID = "";
var activeSecondLayerID = "";
var secondLayerTimerID;
var subTopic = "";

var arSecondLayer = new Array()
var arSecondLayer2 = new Array()

// -------------------------------------------------------------    End of Variable for Common Function for First Level Layers -----------------------------------------

// -------------------------------------------------------------    Variable for Common Function for Second Level Layers-----------------------------------------

var secondLayerImagesFlag = false;
var thirdLayerFlag = false;
var activeSecondLayerImageID = "";
var activeThirdLayerID = "";
var thirdLayerTimerID;
var subSubTopic = "";

var arThirdLayer = new Array()
var arThirdLayer2 = new Array()

// -------------------------------------------------------------    End of Variable for Common Function for Second Level Layers -----------------------------------------

// -------------------------------------------------------------    Common Function for Left Menu -----------------------------------------
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 moveDivs(layerObj, inObjTop){
	layerObj.top  = inObjTop - 1 + 'px';
}

var arLayerPos = new Array()
//arLayerPos[5] = 180;

function setLayerPosition()
{
	//alert ('arLayer.length'+arLayer.length);
	for (var i in arLayer)
	{
			 if(arLayerPos[arLayer2[i]]!=null)
			 {
				 if (document.all){moveDivs(document.all[arLayer[i]].style, arLayerPos[arLayer2[i]]);}
				 if (document.layers){moveDivs(document.layers[arLayer[i]], arLayerPos[arLayer2[i]]);}
				 if (!document.all && document.getElementById) {
					 moveDivs(document.getElementById(arLayer[i]).style, arLayerPos[arLayer2[i]]);
					 //alert(arLayer[i] +'-'+ leftMenuName+arLayer2[i]);
				 }
			}
			else
			{
				 if (document.all){moveDivs(document.all[arLayer[i]].style, getDim(document.images[leftMenuName+arLayer2[i]]).y);}
				 if (document.layers){moveDivs(document.layers[arLayer[i]], document.images[leftMenuName+arLayer2[i]].y);}
				 if (!document.all && document.getElementById) {
					 moveDivs(document.getElementById(arLayer[i]).style, document.images[leftMenuName+arLayer2[i]].y);
					 //alert(arLayer[i] +'-'+ leftMenuName+arLayer2[i]);
				 }
			}
	}
} 

function doShowMenu(imgName)
{
	var iconNo = parseInt(imgName)+1;
	(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
	if(mainTopic != imgName && !leftMenuFlag)

	{
		document.images[leftMenuName+imgName].src=document.images[leftMenuName+imgName].src.replace(leftMenuSectionImageOut, leftMenuSectionImageOver)
		leftMenuFlag = true;
	}
	if (!firstLayerFlag)
	{
		MM_showHideLayers(layerCommonName+iconNo,'','show');
		firstLayerFlag=true;
	}
	activeLeftMenuID = imgName
}

function leftMenuMouseOver(imgName) 
{
	if (activeLeftMenuID == imgName)
	{
		if (firstLayerTimerID) clearTimeout(firstLayerTimerID);
		firstLayerTimerID = null;
	}
	else
	{
		if (firstLayerTimerID) clearTimeout(firstLayerTimerID);
		firstLayerTimerID = null;
		if (activeLeftMenuID!=""){doHideMenu(activeLeftMenuID);}
		doShowMenu(imgName)	
	}
}

function doHideMenu(imgName)
{
	var iconNo = parseInt(imgName)+1;
	(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;

	if(mainTopic != imgName)
	{
		document.images[leftMenuName+imgName].src=document.images[leftMenuName+imgName].src.replace(leftMenuSectionImageOver, leftMenuSectionImageOut)
		leftMenuFlag = false;
	}
	if (firstLayerFlag)
	{
		MM_showHideLayers(layerCommonName+iconNo,'','hide')
		firstLayerFlag=false;
	}
	activeLeftMenuID = "";
}

function leftMenuMouseOut(imgName) {
	
	if (activeLeftMenuID == imgName)
	{
		firstLayerTimerID = setTimeout("doHideMenu('"+imgName+"')", 500);
	}
	else
	{
		doHideMenu(imgName);
	}
}

// -------------------------------------------------------------   End of Common Function for Left Menu -----------------------------------------

// -------------------------------------------------------------    Common Function for First Level Layers -----------------------------------------
function findHeightForLayer(layerObj, obj)
{
	var height = 0;
	var flag = true;
	for (i=0;i<layerObj.images.length;i++)
	{
		if (obj==layerObj.images[i].name)
		{flag = false;}
		if (flag)
		{height+=parseInt(layerObj.images[i].height);}
	}
	return height;
}

var arSecondLayerPos = new Array();
arSecondLayerPos[6] = new Array();
arSecondLayerPos[6][11] = 300;

function setSecondLayerPosition()
{
	for (var i in arSecondLayer)
	{
			 var tempLayer = arSecondLayer[i].substring(0, arSecondLayer[i].length-2)
			 var tempImage = leftMenuName+arSecondLayer2[i];
			 var tempImagePos = tempImage.indexOf("_")

			 tempImage = tempImage.substring(0, tempImagePos)
		 
			 var tempFirstNo = parseFloat(arSecondLayer[i].substring(arSecondLayer[i].length-4, arSecondLayer[i].length-2));
			 var tempSecondNo = parseFloat(arSecondLayer[i].substring(arSecondLayer[i].length-2, arSecondLayer[i].length));
			 
			 if (arLayerPos[parseInt(tempFirstNo-1)] != null)
			 {
				if (arSecondLayerPos[parseInt(tempFirstNo)][parseInt(tempSecondNo)] != null)
				{
					if (document.all){moveDivs(document.all[arSecondLayer[i]].style, arSecondLayerPos[parseInt(tempFirstNo)][parseInt(tempSecondNo)]);}
				 	if (document.layers){moveDivs(document.layers[arSecondLayer[i]], arSecondLayerPos[parseInt(tempFirstNo)][parseInt(tempSecondNo)]);}
				 	if (!document.all && document.getElementById) {moveDivs(document.getElementById(arSecondLayer[i]).style, arSecondLayerPos[parseInt(tempFirstNo)][parseInt(tempSecondNo)]);}	
				}
				else
				{
					if (document.all){moveDivs(document.all[arSecondLayer[i]].style, getDim(document.images[leftMenuName+arSecondLayer2[i]]).y);}
				 	if (document.layers){moveDivs(document.layers[arSecondLayer[i]], arLayerPos[parseInt(tempFirstNo-1)] + findHeightForLayer(document.layers[tempLayer].document, leftMenuName+arSecondLayer2[i]) - 1);}
				 	if (!document.all && document.getElementById) {moveDivs(document.getElementById(arSecondLayer[i]).style, document.images[leftMenuName+arSecondLayer2[i]].y);}	
				}
			 }
			 else
			 {
			 	if (document.all){moveDivs(document.all[arSecondLayer[i]].style, getDim(document.images[leftMenuName+arSecondLayer2[i]]).y);}
			 	if (document.layers){moveDivs(document.layers[arSecondLayer[i]], document.images[tempImage].y + findHeightForLayer(document.layers[tempLayer].document, leftMenuName+arSecondLayer2[i]) - 1);}
			 	if (!document.all && document.getElementById) {moveDivs(document.getElementById(arSecondLayer[i]).style, document.images[leftMenuName+arSecondLayer2[i]].y);}	
			 }
	}
} 

function doShowLayer(imgName, layerName)
{
	var tempLayerName = layerName.substring(0, (layerName.length-2))
	var tempLayer = "";
	var tempImage = "";
	var tempPath = "";
	if(subTopic != imgName && !firstLayerImagesFlag)
	{
		if(document.layers) //netscape 4.x version
		{
			tempLayer = document.layers[tempLayerName].document;
			tempImage = tempLayer.images[imgName];
//			tempImage.src=tempImage.src.replace(leftMenuSectionImageOut, leftMenuSectionImageOver)
		}
		else
		{
//			document.images[imgName].src=document.images[imgName].src.replace(leftMenuSectionImageOut, leftMenuSectionImageOver)
		}
		
		firstLayerImagesFlag = true;
	}
	if (!secondLayerFlag )
	{
		MM_showHideLayers(layerName,'','show');
		secondLayerFlag =true;
	}
	activeFirstLayerImageID = imgName
	activeSecondLayerID = layerName
}

function firstLayerMouseOver(imgName, layerName) 
{
	if (activeFirstLayerImageID == imgName && activeSecondLayerID == layerName)
	{
		if (secondLayerTimerID) clearTimeout(secondLayerTimerID);
		secondLayerTimerID = null;
	}
	else
	{
		if (secondLayerTimerID) clearTimeout(secondLayerTimerID);
		secondLayerTimerID = null;
		if (activeFirstLayerImageID!=""){doHideLayer(activeFirstLayerImageID, activeSecondLayerID);}
		doShowLayer(imgName, layerName)	
	}
}

function doHideLayer(imgName, layerName)
{
	var tempLayerName = layerName.substring(0, layerName.length-2)
	var tempLayer = "";
	var tempImage = "";

	if(subTopic != imgName)
	{
		if(document.layers) //netscape 4.x version
		{
			tempLayer = document.layers[tempLayerName].document;
			tempImage = tempLayer.images[imgName];
//			tempImage.src=tempImage.src.replace(leftMenuSectionImageOver, leftMenuSectionImageOut)
		}
		else
		{
//			document.images[imgName].src=document.images[imgName].src.replace(leftMenuSectionImageOver, leftMenuSectionImageOut)
		}
		
		firstLayerImagesFlag = false;
	}
	if (secondLayerFlag )
	{
		MM_showHideLayers(layerName,'','hide')
		secondLayerFlag =false;
	}
	activeFirstLayerImageID = "";
	activeSecondLayerID = "";
}

function firstLayerMouseOut(imgName, layerName) {
	
	if (activeFirstLayerImageID == imgName && activeSecondLayerID == layerName)
	{
		secondLayerTimerID = setTimeout("doHideLayer('"+imgName+"', '"+layerName+"')", 500);
	}
	else
	{
		doHideLayer(imgName, layerName);
	}
}

// -------------------------------------------------------------   End of Common Function for First Level Layers -----------------------------------------

// -------------------------------------------------------------    Common Function for Second Level Layers -----------------------------------------
function doShowSecondLayer(imgName, layerName)
{
	var tempLayerName = layerName.substring(0, (layerName.length-2))
	var tempLayer = "";
	var tempImage = "";
	var tempPath = "";
	if(subSubTopic != imgName && !secondLayerImagesFlag)
	{
		if(document.layers) //netscape 4.x version
		{
			tempLayer = document.layers[tempLayerName].document;
			tempImage = tempLayer.images[imgName];
//			tempImage.src=tempImage.src.replace(leftMenuSectionImageOut, leftMenuSectionImageOver)
		}
		else
		{
//			document.images[imgName].src=document.images[imgName].src.replace(leftMenuSectionImageOut, leftMenuSectionImageOver)
		}
		
		secondLayerImagesFlag = true;
	}
	if (!thirdLayerFlag )
	{
		MM_showHideLayers(layerName,'','show');
		thirdLayerFlag =true;
	}
	activeSecondLayerImageID = imgName
	activeThirdLayerID = layerName
}

function secondLayerMouseOver(imgName, layerName) 
{
	if (activeSecondLayerImageID == imgName && activeThirdLayerID == layerName)
	{
		if (thirdLayerTimerID) clearTimeout(thirdLayerTimerID);
		thirdLayerTimerID = null;
	}
	else
	{
		if (thirdLayerTimerID) clearTimeout(thirdLayerTimerID);
		thirdLayerTimerID = null;
		if (activeSecondLayerImageID!=""){doHideSecondLayer(activeSecondLayerImageID, activeThirdLayerID);}
		doShowSecondLayer(imgName, layerName)	
	}
}

function doHideSecondLayer(imgName, layerName)
{
	var tempLayerName = layerName.substring(0, layerName.length-2)
	var tempLayer = "";
	var tempImage = "";

	if(subSubTopic != imgName)
	{
		if(document.layers) //netscape 4.x version
		{
			tempLayer = document.layers[tempLayerName].document;
			tempImage = tempLayer.images[imgName];
//			tempImage.src=tempImage.src.replace(leftMenuSectionImageOver, leftMenuSectionImageOut)
		}
		else
		{
//			document.images[imgName].src=document.images[imgName].src.replace(leftMenuSectionImageOver, leftMenuSectionImageOut)
		}
		
		secondLayerImagesFlag = false;
	}
	if (thirdLayerFlag )
	{
		MM_showHideLayers(layerName,'','hide')
		thirdLayerFlag =false;
	}
	activeSecondLayerImageID = "";
	activeThirdLayerID = "";
}

function secondLayerMouseOut(imgName, layerName) {
	
	if (activeSecondLayerImageID == imgName && activeThirdLayerID == layerName)
	{
		thirdLayerTimerID = setTimeout("doHideSecondLayer('"+imgName+"', '"+layerName+"')", 500);
	}
	else
	{
		doHideSecondLayer(imgName, layerName);
	}
}

// -------------------------------------------------------------   End of Common Function for Second Level Layers -----------------------------------------


//print this page
function printPage(){
	if(location.href.toString().search('search.gov.hk')!=-1){
		window.open(document.URL+'?p=1','PrintPage','top=10,left=10,height=500,width=650,scrollbars=1');
	}else{
		window.open(document.location.pathname+'?p=1','PrintPage','top=10,left=10,height=500,width=650,scrollbars=1');
	}
}

function getTitle() {
	var scriptBuffer='';
	var scriptBuffer2='';
	
	scriptBuffer2+=sitetitle+' - '+title[selectedID];
	if(selectedSection!=0&&selectedSection!='') {
		scriptBuffer2+= ' - ' + subTitle[selectedID][selectedSection]
		if(selectedSubSection>0&&selectedSubSection!='') {
			scriptBuffer2+= ' - ' + subSubTitle[selectedID][selectedSection][selectedSubSection]
		}
	}
	
	scriptBuffer+='<title>'+scriptBuffer2+'</title>\n';
	scriptBuffer+='<meta name="Keywords" content="'+scriptBuffer2+'">\n';
	scriptBuffer+='<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n';
	
	//alert(scriptBuffer);
	return scriptBuffer;	
}


//change to text only version
function textSwitch() {
	document.location = domain_url+ "/index.htm";
	if(location.href.toString().search('search.gov.hk') != -1){
		if (location.href.toString().search('mode=0') != -1) { //change to English version
			goPath=location.href.replace("mode=0", "mode=1");
		}
		if (location.href.toString().search('mode=0') != -1) { //change to traditional chinese version
			goPath=location.href.replace("mode=0", "mode=1");
		}
		document.location=goPath;
	}else{
	var arrayEle = new Array()
	arrayEle = document.location.pathname.split('/')
	document.location = 't_'+arrayEle[arrayEle.length-1]
	}
}

//switch language version

function langSwitch(lang) {
	var currentPath=location.href.toString();
	var switchTc='/tc/';
	var switchEn='/en/';
	var switchSc='/sc/';
	
	if(lang=="graphic"){
		currentPath=currentPath.replace('/linear', "");
	}else if(lang=="textonly"){
		currentPath=currentPath.replace(switchEn, '/linear'+switchEn);
		currentPath=currentPath.replace(switchTc, '/linear'+switchTc);
		currentPath=currentPath.replace(switchSc, '/linear'+switchSc);
	}else if(lang=="tc"){
		currentPath=currentPath.replace(switchEn, switchTc);
		currentPath=currentPath.replace(switchSc, switchTc);
		//currentPath=currentPath.replace(gb_urlPath, "");
	}else if(lang=="sc"){
		currentPath=currentPath.replace(switchTc, switchSc);
		currentPath=currentPath.replace(switchEn, switchSc);
	}else if(lang=="en"){
		currentPath=currentPath.replace(switchTc, switchEn);
		currentPath=currentPath.replace(switchSc, switchEn);
		//currentPath=currentPath.replace(gb_urlPath, "");
	}
	location.href=currentPath;
}

function langheader(){
	var scriptBuffer='';
	if(document.URL.toString().search('/sc/')!=-1){
		var lang1Link='javascript:langSwitch(\'tc\')'; //Traditional Chinese
		var lang2Link='javascript:langSwitch(\'en\')'; //English
		var lang1Alt='繁體版';
		var lang2Alt='English';
		var lang1Img='btn_lang_tc';
		var lang2Img='btn_lang_en';
	}else if(document.URL.toString().search('/tc/')!=-1 || document.URL.toString().search('mode=0')!=-1){
		var lang1Link='javascript:langSwitch(\'sc\')'; //Simplified Chinese
		var lang2Link='javascript:langSwitch(\'en\')'; //English
		var lang1Alt='簡體版';
		var lang2Alt='English';
		var lang1Img='btn_lang_sc';
		var lang2Img='btn_lang_en';
	}else{
		var lang1Link='javascript:langSwitch(\'tc\')'; //Traditional Chinese
		var lang2Link='javascript:langSwitch(\'sc\')'; //Simplified Chinese
		var lang1Alt='繁體版';
		var lang2Alt='簡體版';
		var lang1Img='btn_lang_tc';
		var lang2Img='btn_lang_sc';
	}	
	scriptBuffer+='<table border="0" cellspacing="0" cellpadding="0"><tr><td align="left"><img src="'+domain_url+'/images/common/btn_lang_left.gif" width="6" height="18" /><a href="'+lang1Link+'" onclick="" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Image28\',\'\',\''+domain_url+'/images/common/'+lang1Img+'_over.gif\',1)"><img src="'+domain_url+'/images/common/'+lang1Img+'.gif" name="Image28" width="44" height="18" border="0" id="Image28" title="'+lang1Alt+'" alt="'+lang1Alt+'"/></a><a href="'+lang2Link+'" onclick="" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Image30\',\'\',\''+domain_url+'/images/common/'+lang2Img+'_over.gif\',1)"><img src="'+domain_url+'/images/common/'+lang2Img+'.gif" name="Image30" width="45" height="18" border="0" id="Image30" title="'+lang2Alt+'" alt="'+lang2Alt+'"/></a><img src="'+domain_url+'/images/common/btn_lang_right.gif" width="6" height="18" /></td></tr></table>';
	return scriptBuffer;
}
function getheaderHTML()
{
	if(document.URL.toString().search('/en/')!=-1){
		var searchAlt='Search';
		var fontsizeAlt='Text Size :&nbsp;&nbsp;';
		var formlang='en';
		var linearver='Linear Version';
		var brandhk='Brand Hong Kong';
//		var brandhklink='http://www.brandhk.gov.hk/brandhk/eindex.htm';
		var brandhklink='http://www.brandhk.gov.hk/en';
	}else if(document.URL.toString().search('/sc/')!=-1){
		var searchAlt='搜寻';
		var fontsizeAlt='字型大小 :&nbsp;&nbsp;';
		var formlang='zh-cn';
		var linearver='简化格式';
		var brandhk='香港品牌形象';
//		var brandhklink='http://sc.info.gov.hk/gb/www.brandhk.gov.hk/brandhk/index.htm';
		var brandhklink='http://www.brandhk.gov.hk/tc';
	}else{
		var searchAlt='搜尋';
		var fontsizeAlt='字型大小 :&nbsp;&nbsp;';
		var formlang='zh-hk';
		var linearver='簡化格式';
		var brandhk='香港品牌形象';
//		var brandhklink='http://www.brandhk.gov.hk/brandhk/index.htm';
		var brandhklink='http://www.brandhk.gov.hk/tc';
	}
	var searchLink='javascript:document.frmSearch.submit()';
	
	//form hidden field add here
	var scriptFormBuffer='';
	scriptFormBuffer+='<form name="frmSearch" action="http://search.gov.hk/search.html" method="get">\n';
	scriptFormBuffer+='<INPUT name="exact_q" type="hidden" value="">\n';
	scriptFormBuffer+='<INPUT name="any_q" type="hidden" value="">\n';
	scriptFormBuffer+='<INPUT name="none_q" type="hidden" value="">\n';
	scriptFormBuffer+='<INPUT name="gp0" type="hidden" value="e-auth_home">\n';
	scriptFormBuffer+='<INPUT name="gp1" type="hidden" value="e-auth_home">\n';
	scriptFormBuffer+='<INPUT name="p_size" type="hidden" value="10">\n';
	scriptFormBuffer+='<INPUT name="doc_type" type="hidden" value="all">\n';
	scriptFormBuffer+='<INPUT name="last_mod" type="hidden" value="#-1">\n';
	scriptFormBuffer+='<INPUT name="r_lang" type="hidden" value="all">\n';
	scriptFormBuffer+='<INPUT name="tpl_id" type="hidden" value="e-auth">\n';
	scriptFormBuffer+='<INPUT name="a_submit" type="hidden" value="false">\n';
	scriptFormBuffer+='<INPUT name="web" type="hidden" value="this">\n';
	scriptFormBuffer+='<INPUT name="txtonly" type="hidden" value="0">\n';
	scriptFormBuffer+='<INPUT name="ui_lang" type="hidden" value="'+formlang+'">\n';	//<!--English: en; Traditional Chinese: zh-hk; Simplified Chinese: zh-cn-->
	scriptFormBuffer+='<INPUT name="ui_charset" type="hidden" value="utf-8">\n';

	//scriptFormBuffer+='<input type="text" name="query" size="12" class="search" style="height:17px">';
	//scriptFormBuffer+='</form>';

	//check not textonly version
	if(document.URL.toString().search('/linear/')==-1){
//		document.writeln (imgPath);
		document.writeln('<body background="../../images/common/btn_bg.gif" onload="MM_preloadImages(\''+imgPath+'btn_05_over.jpg\',\''+imgPath+'btn_01_over.jpg\',\''+imgPath+'btn_02_over.jpg\',\''+imgPath+'btn_03_over.jpg\',\''+imgPath+'btn_04_over.jpg\',\''+imgPath+'btn_06_over.jpg\',\''+imgPath+'btn_07_over.jpg\',\''+imgPath+'btn_08_over.jpg\',\''+imgPath+'btn_top_over.jpg\',\'../../images/common/btn_search_over.gif\',\'../../images/common/btn_lang_tc_over.gif\',\'../../images/common/btn_lang_sc_over.gif\',\'../../images/common/btn_size_2_over.gif\',\''+imgPath+'btn_05.jpg\',\''+imgPath+'btn_01.jpg\',\''+imgPath+'btn_02.jpg\',\''+imgPath+'btn_03.jpg\',\''+imgPath+'btn_04.jpg\',\''+imgPath+'btn_06.jpg\',\''+imgPath+'btn_07.jpg\',\''+imgPath+'btn_08.jpg\',\''+imgPath+'btn_top.jpg\',\'../../images/common/btn_search.gif\',\'../../images/common/btn_lang_tc.gif\',\'../../images/common/btn_lang_sc.gif\',\'../../images/common/btn_size_2.gif\'); setLayerPosition();">');
		document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
		document.writeln('  <tr>');
		document.writeln('    <td height="80" colspan="2" background="../../images/common/top_2.jpg"><table width="101%" height="80" border="0" cellpadding="0" cellspacing="0">');
		document.writeln('      <tr>');
		document.writeln('        <td height="80" valign="top"><a href="'+domain_url+'/index.htm"><img src="'+imgPath+'top_1.jpg" width="356" height="80"  border="0" title="'+sitetitle+'" alt="'+sitetitle+'"/></a></td>');
		document.writeln('        <td height="80" align="right" valign="top"><table width="400" height="80" border="0" cellpadding="0" cellspacing="0">');
		document.writeln('          <tr>');
		document.writeln('            <td background="../../images/common/top_3.jpg"><table width="400" height="80" border="0" cellpadding="0" cellspacing="0">');
		document.writeln('              <tr>');
		document.writeln('                <td height="23"><img src="../../images/common/spacer.gif" width="23" height="23" /></td>');
		document.writeln('              </tr>');
		document.writeln('              <tr>');
		document.writeln('                <td height="38" class="top_nav"><table width="400" border="0" cellspacing="0" cellpadding="0">');
		document.writeln(scriptFormBuffer+'<tr>');
		document.writeln('                    <td width="172" style="font-size:14px" nowrap>'+searchAlt+' <input name="query" type="text" id="query" size="10" class="box"><a href="'+searchLink+'" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Image25\',\'\',\'../../images/common/btn_search_over.gif\',1)"><img src="../../images/common/btn_search.gif" name="Image25" width="17" height="12" border="0" id="Image25" /></a></td>');
		document.writeln('                    <td width="6" style="font-size:14px">|</td>');
		document.writeln('                    <td width="68" align="center" style="font-size:14px" nowrap><a href="../sitemap/index.htm" class="top_nav">'+title[0]+'</a></td>');
		document.writeln('                    <td width="6" align="center"><span style="font-size:14px">|</span></td>');
		document.writeln('                    <td width="24" align="center" valign="middle"><a href="../contact/index.htm"><img src="../../images/common/btn_mail.gif" name="Image26" width="17" height="12" border="0" id="Image26" title="'+title[7]+'" alt="'+title[7]+'"/></a></td>');
		document.writeln('                    <td width="6" align="center"><span style="font-size:14px">|</span></td>');
		document.writeln('                    <td width="124" align="left">');
		document.writeln(langheader());
		document.writeln('                    </td>');
		document.writeln('                    </form></tr>');
		document.writeln('                </table></td>');
		document.writeln('              </tr>');
		document.writeln('              <tr>');
		document.writeln('                <td height="15" align="right" valign="bottom"><table width="280" height="15" border="0" cellpadding="0" cellspacing="0">');
		document.writeln('                    <tr>');
		document.writeln('                      <td height="15" align="right" valign="bottom"><span style="font-size: 12px; font-weight: bold; color: White;line-height: 100%"><a href="javascript:langSwitch(\'textonly\')" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Imagelv\',\'\',\''+imgPath+'/btn_LV_over.gif\',1)"><img src="'+imgPath+'/btn_LV.gif" name="Imagelv" id="Imagelv" align="absmiddle" border="0" height="15" alt="'+linearver+'" title="'+linearver+'"></a> <img src="../../images/spacer.gif" height="5" width="10">| <img src="../../images/spacer.gif" height="5" width="10">'+fontsizeAlt+'</span></td>');
		document.write('                      <td align="left" valign="bottom"> ');
		document.writeln(ChangeTextMenu+'<img src="../../images/common/spacer.gif" width="5" height="5" /></td>');
		document.writeln('                    </tr>');
		document.writeln('                  </table></td>');
		document.writeln('              </tr>');
		document.writeln('            </table></td>');
		document.writeln('          </tr>');
		document.writeln('          ');
		document.writeln('        </table></td>');
		document.writeln('      </tr>');
		document.writeln('    </table></td>');
		document.writeln('  </tr>');
		document.writeln('  <tr>');
		document.writeln('    <td colspan="2" align="left" background="../../images/common/top_5.jpg"><img src="../../images/common/top_4.jpg" width="139" height="16" /></td>');
		document.writeln('  </tr>');
		document.writeln('  <tr>');
		document.writeln('    <td width="153" align="right" valign="top" background="../../images/common/btn_bg.gif">');
		document.writeln(getLeftMenu());
		document.writeln('    </td>');
		document.writeln('    <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">');
		document.writeln('      <tr>');
		document.writeln('        <td width="23" rowspan="4"><img height="20" alt="" src="../../images/common/spacer.gif" width="16" /></td>');
		document.writeln('        <td height="15" colspan="3" valign="bottom">');

		if(selectedSection!=0&&selectedSection!='') {
			document.write('<span class="path"><a href="'+MainLink[selectedID]+'" class="path">'+title[selectedID]+'</a></span>');
			if(selectedSubSection>0&&selectedSubSection!='') {
				document.write('<span class="path"> &gt; <a href="'+SubLink[selectedID][selectedSection]+'" class="path">'+subTitle[selectedID][selectedSection]+'</a></span>');
				document.write('<span class="path"> &gt; </span><span class="path_bold"><a href="'+SubLink2[selectedID][selectedSection][selectedSubSection]+'" class="path_bold">'+subSubTitle[selectedID][selectedSection][selectedSubSection]+'</a></span>');
			}else{
				document.write('<span class="path_bold"> &gt; <a href="'+SubLink[selectedID][selectedSection]+'" class="path">'+subTitle[selectedID][selectedSection]+'</a></span>');
			}
		}else{
			document.write('<span class="path_bold"><!-- <a href="'+MainLink[selectedID]+'" class="path"> -->'+title[selectedID]+'<!-- </a> --></span>');
		}
		iconNo = parseInt(selectedID);
		(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
		
		document.writeln('        </td>');
		document.writeln('      </tr>');
		document.writeln('      <tr>');
		document.writeln('        <td colspan="3">');
		document.writeln('        <table width="100%" border="0" cellpadding="0" cellspacing="0">');
		document.writeln('        <tr><td width="100%" ><img src="'+imgPath+'header'+iconNo+'.jpg" height="46" alt="'+title[selectedID]+'" title="'+title[selectedID]+'"/></td>');
		document.writeln('        <td align="right"><a href="'+brandhklink+'" target="_blank"><img src="'+domain_url+'/images/common/hk_logo2010.jpg" alt="'+brandhk+'" title="'+brandhk+'" border="0"/></a></td></tr>');
		document.writeln('        </table>');
		document.writeln('        </td>');
		document.writeln('      </tr>');
		document.writeln('      <tr>');
		document.writeln('        <td width="25" valign="bottom"><p align="justify" class="content"><img height="20" alt="" src="../../images/common/spacer.gif" width="16" /></p><p align="justify" class="content"><br /></p></td>');
		document.writeln('        <td width="982" valign="top">');
		if(selectedSection!=0&&selectedSection!='') {
			document.writeln('		<p align="justify" class="heading13"><br />'+subTitle[selectedID][selectedSection]+'</p>');
			if(selectedSubSection>0&&selectedSubSection!='') {
				document.writeln('		<p align="justify" class="headingb12">'+subSubTitle[selectedID][selectedSection][selectedSubSection]+'</p>');
			}
//		}else{
			//document.writeln('		<p align="justify" class="heading13">&nbsp;</p>');
		}
	}else{//istextonly version
		if(document.URL.toString().search('/en/')!=-1){
			var sVer='Standard Version';
		}else if(document.URL.toString().search('/sc/')!=-1){
			var sVer='标准格式';
		}else{
			var sVer='標準格式';
		}
		document.writeln('<p><table border="0" cellspacing="0" cellpadding="0" width="100%">');
		document.writeln('<tr valign="top"><td>');
		document.writeln('<a href="'+domain_url+'/index.htm"><img src="'+imgPath+'top_1.jpg" width="356" height="80"  border="0" title="'+sitetitle+'" alt="'+sitetitle+'"/></a></p>');
		document.writeln('	<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr valign="middle">');
		document.writeln('                <td>');
		document.writeln('                <table border="0" cellspacing="0" cellpadding="0">');
		document.writeln(scriptFormBuffer+'<tr>');
		document.writeln('                    <td nowrap>'+searchAlt+' <input name="query" type="text" id="query" size="13" class=""><a href="'+searchLink+'" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'Image25\',\'\',\''+domain_url+'/images/common/btn_search_over.gif\',1)"><img src="'+domain_url+'/images/common/btn_search.gif" name="Image25" width="17" height="12" border="0" id="Image25" /></a></td>');
		document.writeln('                    <td width="6" style="font-size:14px">|</td>');
		document.writeln('                    <td width="68" align="center" style="font-size:14px" nowrap><a href="../sitemap/index.htm" class="top_nav">'+title[0]+'</a></td>');
		document.writeln('                    <td width="6" align="center"><span style="font-size:14px">|</span></td>');
		document.writeln('                    <td width="24" align="center" valign="middle"><a href="../contact/index.htm"><img src="'+domain_url+'/images/common/btn_mail.gif" name="Image26" width="17" height="12" border="0" id="Image26" title="'+title[7]+'" alt="'+title[7]+'"/></a></td>');
		document.writeln('                    <td width="6" align="center"><span style="font-size:14px">|</span></td>');
		document.writeln('                    <td>');
		document.write(langheader());
		document.writeln('                    </td>');
		document.writeln('                    <td>');
		document.write('<span style="font-size:14px">&nbsp;| </span>'+ChangeTextMenu+'<span style="font-size:14px"> | </span><a href="javascript:langSwitch(\'graphic\')">'+sVer+'</a>');
		document.writeln('                    </td>');
		document.writeln('                    </form></tr>');
		document.writeln('                </table>');
		document.writeln('                </td>');
		document.writeln('                <td align="right"><!--img src="'+domain_url+'/images/spacer.gif" alt="" title="" border="0" height="46" width="80"/--><a href="'+brandhklink+'" target="_blank"><img src="'+domain_url+'/images/common/hk_logo2010.jpg" alt="'+brandhk+'" title="'+brandhk+'" border="0"/></a></td>');
		document.writeln('	</tr></table>');
		document.writeln('<hr>');
		document.writeln(getLeftMenu());
		document.write('<p>');
		if(selectedSection!=0&&selectedSection!='') {
			document.write('<span class="path"><a href="'+MainLink[selectedID]+'" class="path">'+title[selectedID]+'</a></span>');
			if(selectedSubSection>0&&selectedSubSection!='') {
				document.write('<span class="path"> &gt; <a href="'+SubLink[selectedID][selectedSection]+'" class="path">'+subTitle[selectedID][selectedSection]+'</a></span>');
				document.write('<span class="path"> &gt; </span><span class="path_bold"><a href="'+SubLink2[selectedID][selectedSection][selectedSubSection]+'" class="path_bold">'+subSubTitle[selectedID][selectedSection][selectedSubSection]+'</a></span>');
			}else{
				document.write('<span class="path_bold"> &gt; <a href="'+SubLink[selectedID][selectedSection]+'" class="path">'+subTitle[selectedID][selectedSection]+'</a></span>');
			}
		}else{
			document.write('<span class="path_bold"><!-- <a href="'+MainLink[selectedID]+'" class="path"> -->'+title[selectedID]+'<!-- </a> --></span>');
		}
		
		if(selectedSection!=0&&selectedSection!='') {
			document.writeln('		<p align="justify" class="heading13"><br />'+subTitle[selectedID][selectedSection]+'</p>');
			if(selectedSubSection>0&&selectedSubSection!='') {
				document.writeln('		<p align="justify" class="headingb12">'+subSubTitle[selectedID][selectedSection][selectedSubSection]+'</p>');
			}
//		}else{
			//document.writeln('		<p align="justify" class="heading13">&nbsp;</p>');
		}
		document.write('</p>');
		/*
		document.write('<table border="0">');
		document.write('<tr valign="top">');
		document.write('<td>');
		*/
		
	}//check not textonly version
	SiteMap();
}


function getfooterHTML()
{
	//check not textonly version
	if(document.URL.toString().search('/linear/')==-1){

		if(selectedSubSection>0&&selectedSubSection!='') {
			document.write('          <p class="path" style="font-weight : bold;">');
			for (var i in SubLink2[selectedID][selectedSection]){
				if(i==selectedSubSection){
					document.write('<span class="path_orange">&lt;'+subSubTitle[selectedID][selectedSection][i]+'&gt;</span>');
				}else{
					document.write('<a href="'+SubLink2[selectedID][selectedSection][i]+'" class="path">'+subSubTitle[selectedID][selectedSection][i]+'</a>');
				}
				if (i!=SubLink2[selectedID][selectedSection].length-1){
					document.write(' | ');
				}
			}
			document.writeln('</p>');
		}

		document.writeln('		</td><td><img height="20" alt="" src="../../images/common/spacer.gif" width="5" /></td>');
		document.writeln('      </tr>');
		document.writeln('      <tr>');
		document.writeln('        <td colspan="3">');
		document.writeln(getFooter());
		document.writeln('        </td>');
		document.writeln('      </tr>');
		document.writeln('    </table></td>');
		document.writeln('  </tr>');
		document.writeln('</table>');
	}else{//istextonly version
		/*
		document.writeln(PdfReader());
		Back_gotoTop(2);
		*/
		document.writeln('</td></tr>');
		document.writeln('<tr><td>');
		document.writeln('<hr>');
		document.writeln(getFooter());
		document.writeln('</td></tr>');
		document.writeln('</table>');

	}//check not textonly version
}


function indexpage(){//print a bulletin sub section link

	if (selectedSection==0){
		document.writeln('<p><table width="100%" border="0" cellspacing="0" cellpadding="0">\n');
		for (var i in SubLink[selectedID])		
			document.writeln('<tr valign="top"><td nowrap><img src="../../images/common/bullet1.gif" width="19" height="13" alt="*" title="*" /><img src="../../images/common/spacer.gif" width="5" height="10" border="0" alt=""></td><td width="100%"><a href="'+SubLink[selectedID][i]+'">'+subTitle[selectedID][i]+'</a></td></tr>\n');
		document.writeln('</table></p>\n');
		
	}
}

function indexpage2nd(){//print a bulletin 2nd sub section link

	if (selectedSubSection==0){
		document.writeln('<p><table width="100%" border="0" cellspacing="0" cellpadding="0">\n');
		for (var i in SubLink2[selectedID][selectedSection])		
			document.writeln('<tr valign="top"><td nowrap><img src="'+domain_url+'/images/common/bullet1.gif" width="19" height="13" alt="*" title="*" vspace="5" hspace="2"></td><td width="100%"><a href="'+SubLink2[selectedID][selectedSection][i]+'">'+subSubTitle[selectedID][selectedSection][i]+'</a></td></tr>\n');
		document.writeln('</table></p>\n');
		
	}
}

function SiteMap(){
	if(document.URL.toString().search('/sitemap/')!=-1){
		document.writeln('<p><table border="0" cellpadding="2" cellspacing="0">');
		document.writeln('<tr><td>&nbsp;</td></tr>');
		document.writeln('<tr><td>');
		document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
		for (var i in MainLink){
			if ((i!=10)&&(i!=11)&&(i!=12)){
				document.writeln('<tr valign="top"><td nowrap><img src="'+domain_url+'/images/common/bullet1.gif" width="19" height="13" alt="*" title="*" vspace="5" hspace="2"></td><td width="100%" class="sitemap"><a href="'+MainLink[i]+'">'+title[i]+'</a>');
				if (SubLink[i]!=null){
					document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
					for (var k in SubLink[i]){
						document.writeln('<tr><td valign="top"><img src="'+domain_url+'/images/common/bullet2.gif" width="13" height="13" vspace="5" hspace="2"/></td><td valign="top" width="100%" class="sitemap"><a href="'+SubLink[i][k]+'">'+subTitle[parseInt(i)][k]+'</a>');
						if (SubLink2[i][k]!=null){
							document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
							for (var m in SubLink2[i][k]){
								document.writeln('<tr><td valign="top"><img src="'+domain_url+'/images/common/bullet2.gif" width="13" height="13" vspace="5" hspace="2"/></td><td valign="top" width="100%" class="sitemap"><a href="'+SubLink2[i][k][m]+'">'+subSubTitle[parseInt(i)][k][m]+'</a></td></tr>');
							}
							document.writeln('</table>');
						}
						document.writeln('</td></tr>');
					}
					document.writeln('</table>');
				}
				document.writeln('</td></tr>');
				document.writeln('<tr><td colspan=2>&nbsp;</td></tr>');
				if ((i==1)||(i==5)){
					if (i==1){
						tempctr=10;
						temptime=1;
					}else{
						tempctr=11;
						temptime=2;
					}
					for (var x = 0; x < temptime; x++){
						iconNo = parseInt(tempctr+x);
						(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
						(selectedID==eval(tempctr+x))?isOver='_over':isOver='';
						//alert('selectedID'+selectedID+', tempctr'+eval(tempctr+x));
						//scriptBuffer+='      <tr><td align="right"><a href="'+MainLink[eval(tempctr+x)]+'" onmouseout="leftMenuMouseOut(\''+eval(tempctr+x)+'\');" onmouseover="leftMenuMouseOver(\''+eval(tempctr+x)+'\');"><img src="'+imgPath+'btn_'+iconNo+isOver+'.jpg" border="0" name="'+leftMenuName+eval(tempctr+x)+'" alt="'+title[eval(tempctr+x)]+'" title="'+title[eval(tempctr+x)]+'"/></a></td></tr>\n';
						document.writeln('<tr valign="top"><td nowrap><img src="'+domain_url+'/images/common/bullet1.gif" width="19" height="13" alt="*" title="*" vspace="5" hspace="2"></td><td width="100%" class="sitemap"><a href="'+MainLink[eval(tempctr+x)]+'">'+title[eval(tempctr+x)]+'</a>');
						document.writeln('<tr><td colspan=2>&nbsp;</td></tr>');
					}
				}
			}
		}
		document.writeln('</table>');
		document.writeln('</td></tr></table></p>');
			
	}
}
//generate the left side menu
function getLeftMenu(){
	var scriptBuffer='';
	var isOver='';
	var iconNo = '';
	
	//check not textonly version
	if(document.URL.toString().search('/linear/')==-1){
		scriptBuffer+='<table width="153" border="0" cellspacing="0" cellpadding="0">\n';
		scriptBuffer+='      <tr>\n';
		scriptBuffer+='        <td align="right"><img src="../../images/common/btn_bg_op.jpg" /></td>\n';
		scriptBuffer+='      </tr>\n';
		for (var i in MainLink)
		{
			iconNo = parseInt(i);
			(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
			(selectedID==i)?isOver='_over':isOver='';
			if (selectedID==i){mainTopic=i;}
			if ((i!=10)&&(i!=11)&&(i!=12)){
				scriptBuffer+='      <tr><td align="right"><a href="'+MainLink[i]+'" onmouseout="leftMenuMouseOut(\''+i+'\');" onmouseover="leftMenuMouseOver(\''+i+'\');"><img src="'+imgPath+'btn_'+iconNo+isOver+'.jpg" border="0" name="'+leftMenuName+i+'" alt="'+title[i]+'" title="'+title[i]+'"/></a></td></tr>\n';
				if ((i==1)||(i==5)){
					if (i==1){
						tempctr=10;
						temptime=1;
					}else{
						tempctr=11;
						temptime=2;
					}
					for (var x = 0; x < temptime; x++){
						iconNo = parseInt(tempctr+x);
						(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
						(selectedID==eval(tempctr+x))?isOver='_over':isOver='';
						//alert('selectedID'+selectedID+', tempctr'+eval(tempctr+x));
						scriptBuffer+='      <tr><td align="right"><a href="'+MainLink[eval(tempctr+x)]+'" onmouseout="leftMenuMouseOut(\''+eval(tempctr+x)+'\');" onmouseover="leftMenuMouseOver(\''+eval(tempctr+x)+'\');"><img src="'+imgPath+'btn_'+iconNo+isOver+'.jpg" border="0" name="'+leftMenuName+eval(tempctr+x)+'" alt="'+title[eval(tempctr+x)]+'" title="'+title[eval(tempctr+x)]+'"/></a></td></tr>\n';
					}
				}
			}
		}
		scriptBuffer+='    </table>\n';
	}else{//istextonly version
	
		//mainmenu
		scriptBuffer+='<table border="0" cellspacing="0" cellpadding="2">\n';
		scriptBuffer+='<tr><td>';
		for (var i in MainLink){
			iconNo = parseInt(i) + 1;
			(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
			(selectedSection==i)?isOver='_o':isOver='';
			if ((i!=10)&&(i!=11)&&(i!=12)){
				if(i!=selectedID){
					scriptBuffer+='[<a href="'+MainLink[i]+'">'+title[i]+'</a>]\n';
				}else{
					scriptBuffer+='['+title[i]+']\n';
				}
				if ((i==1)||(i==5)){
					if (i==1){
						tempctr=10;
						temptime=1;
					}else{
						tempctr=11;
						temptime=2;
					}
					for (var x = 0; x < temptime; x++){
						iconNo = parseInt(tempctr+x);
						(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
						(selectedID==eval(tempctr+x))?isOver='_over':isOver='';
						//alert('selectedID'+selectedID+', tempctr'+eval(tempctr+x));
						//scriptBuffer+='      <tr><td align="right"><a href="'+MainLink[eval(tempctr+x)]+'" onmouseout="leftMenuMouseOut(\''+eval(tempctr+x)+'\');" onmouseover="leftMenuMouseOver(\''+eval(tempctr+x)+'\');"><img src="'+imgPath+'btn_'+iconNo+isOver+'.jpg" border="0" name="'+leftMenuName+eval(tempctr+x)+'" alt="'+title[eval(tempctr+x)]+'" title="'+title[eval(tempctr+x)]+'"/></a></td></tr>\n';
						if(tempctr+x!=selectedID){
							scriptBuffer+='[<a href="'+MainLink[eval(tempctr+x)]+'">'+title[eval(tempctr+x)]+'</a>]\n';
						}else{
							scriptBuffer+='['+title[eval(tempctr+x)]+']\n';
						}
					}
				}
			}
			/*
			if(i!=selectedID){
				scriptBuffer+='[<a href="'+MainLink[i]+'">'+title[i]+'</a>]\n';
			}else{
				scriptBuffer+='['+title[i]+']\n';
			}
			*/
		}
		scriptBuffer+='</td></tr>';
		scriptBuffer+='</table>\n';
		scriptBuffer+='<hr>\n';
		//mainmenu

		//submenu
		var TempSelectedID=selectedID;
		if (SubLink[selectedID]!=null){
			
			scriptBuffer+='<table border="0" cellspacing="0" cellpadding="2">\n';
			scriptBuffer+='<tr><td>';
		
		  	for (var k in SubLink[selectedID]){
		  		if(k!=selectedSection){
					scriptBuffer+='[<a href="'+SubLink[selectedID][k]+'">'+subTitle[TempSelectedID][k]+'</a>] ';
				}else{
					scriptBuffer+='['+subTitle[TempSelectedID][k]+'] ';
				}//end if
		  	}//end for
			
			scriptBuffer+='</td></tr>';
			scriptBuffer+='</table>\n';
			if (typeof(k) !='undefined'){
				scriptBuffer+='<hr>\n';
			}
		}
		//submenu
		
		//Sub Submenu
		if (SubLink[selectedID]!=null){
		
			scriptBuffer+='<table border="0" cellspacing="0" cellpadding="2">\n';
			scriptBuffer+='<tr><td>';
			if (SubLink2[selectedID]!=null){
				for (var l in SubLink2[selectedID][selectedSection]){
					if(l!=selectedSubSection){
						scriptBuffer+='[<a href="'+SubLink2[selectedID][selectedSection][l]+'">'+subSubTitle[selectedID][selectedSection][l]+'</a>] ';
					}else{
						scriptBuffer+='['+subSubTitle[selectedID][selectedSection][l]+'] ';
					}
				}
			}
			scriptBuffer+='</td></tr>';
			scriptBuffer+='</table>\n';
			if (typeof(l) !='undefined'){
				scriptBuffer+='<hr>\n';
			}
		
		}//Sub Submenu

		
	}//check not textonly version

	return scriptBuffer;
}

function getLayer()
{
	var scriptBuffer='';
	var isOver='';
	var iconNo = '';
	var subIconNo = '';
	
	//check not textonly version
	if(document.URL.toString().search('/linear/')==-1){
	
	for (var j in MainLink)
	{
		if (SubLink[j]!=null)
		{
			
			//Start Layer
			iconNo = parseInt(j) + 1;
			(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
			arLayer[arLayer.length] = layerCommonName+iconNo;
			arLayer2[arLayer2.length] = j;
			//alert('arLayer2.length='+arLayer2.length);
			
			if (document.layers)
			{document.writeln('<layer name="'+layerCommonName+iconNo+'" top=100 left='+(leftOffSet+147)+' width=180 height=58 visibility="hide" onMouseOver="leftMenuMouseOver(\''+j+'\')" onMouseOut="leftMenuMouseOut(\''+j+'\')">');}
			else
			{document.writeln('<div id="'+layerCommonName+iconNo+'" style="position:absolute; left:'+(leftOffSet+147)+'px; top:100px; width:180px; height:58px; z-index:2; visibility: hidden"> ');}
			
			//content for Layers
			document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0" onMouseOver="leftMenuMouseOver(\''+j+'\')" onMouseOut="leftMenuMouseOut(\''+j+'\')">');
			for (var k in SubLink[j])
			{
				(selectedSection==j && selectedSubSection==k)?isOver='_over':isOver='';
				subIconNo = parseInt(k);
				(subIconNo<10)?subIconNo='0'+subIconNo:subIconNo=subIconNo;
				if (selectedSection==j && selectedSubSection==k){subTopic=leftMenuName+j+'_'+k;}

				document.writeln('<tr valign=top>');
				document.writeln('	<td><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td align="left" width="100%" class="menu"><a href="'+SubLink[j][k]+'" onMouseOver="MM_swapImage(\''+leftMenuName+j+'_'+k+'\',\'\',\''+imgPath+'btn_0'+j+'_'+subIconNo+'_over.jpg\',1); firstLayerMouseOver(\''+leftMenuName+j+'_'+k+'\', \''+layerCommonName+iconNo+subIconNo+'\');" onMouseOut="MM_swapImgRestore(); firstLayerMouseOut(\''+leftMenuName+j+'_'+k+'\', \''+layerCommonName+iconNo+subIconNo+'\');"><img name="'+leftMenuName+j+'_'+k+'" src="'+imgPath+'btn_0'+j+'_'+subIconNo+'.jpg" alt="'+subTitle[parseInt(j)][k]+'" title="'+subTitle[parseInt(j)][k]+'" border="0"></a></td></tr></table></td>');
				document.writeln('</tr>');
			}
			document.writeln('</table>');
			
			//Close Layer
			if (document.layers)
			{document.writeln('</layer>');}
			else
			{document.writeln('</div>');}
		}
	}
	
	}//check not textonly version
	
	return scriptBuffer;
}

function getSecondLayer()
{
	var scriptBuffer='';
	var isOver='';
	var iconNo = '';
	var subIconNo = '';
	var subSubIconNo = '';
	
	//check not textonly version
	if(document.URL.toString().search('/linear/')==-1){
	
	for (var j in MainLink)
	{
		if (SubLink[j]!=null)
		{
			
			//Start Layer
			iconNo = parseInt(j) + 1;
			(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
			
			for (var k in SubLink[j])
			{
				if (SubLink2[j][k]!=null)
				{
					subIconNo = parseInt(k);
					(subIconNo<10)?subIconNo='0'+subIconNo:subIconNo=subIconNo;
					arSecondLayer[arSecondLayer.length] = layerCommonName+iconNo+subIconNo;
					arSecondLayer2[arSecondLayer2.length] = j+'_'+k;
					
					if (document.layers)
					{document.writeln('<layer name='+layerCommonName+iconNo+subIconNo+' top=0 left='+(leftOffSet+350)+' width=120 height=58 visibility="hide" onMouseOver="leftMenuMouseOver(\''+j+'\');firstLayerMouseOver(\''+leftMenuName+j+'_'+k+'\', \''+layerCommonName+iconNo+subIconNo+'\');" onMouseOut="leftMenuMouseOut(\''+j+'\');firstLayerMouseOut(\''+leftMenuName+j+'_'+k+'\', \''+layerCommonName+iconNo+subIconNo+'\');">');}
					else
					{document.writeln('<div id="'+layerCommonName+iconNo+subIconNo+'" style="position:absolute; left:'+(leftOffSet+350)+'; top:0; width:120; height:58; z-index:2; visibility: hidden"> ');}
					
					//content for Layers
					document.writeln('<table width="100%" border="0" cellspacing="0" cellpadding="0" onMouseOver="leftMenuMouseOver(\''+j+'\');firstLayerMouseOver(\''+leftMenuName+j+'_'+k+'\', \''+layerCommonName+iconNo+subIconNo+'\');" onMouseOut="leftMenuMouseOut(\''+j+'\');firstLayerMouseOut(\''+leftMenuName+j+'_'+k+'\', \''+layerCommonName+iconNo+subIconNo+'\');">');
					document.writeln('<tr valign=top>');
					document.writeln('	<td><img src="'+imgPath+'btn_lv2_top.jpg" border="0"></td>');
					document.writeln('</tr>');
					
					for (var l in SubLink2[j][k])
					{
						subSubIconNo = parseInt(l);
						(subSubIconNo<10)?subSubIconNo='0'+subSubIconNo:subSubIconNo=subSubIconNo;
						
						document.writeln('<tr valign=top>');
						document.writeln('	<td><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td width="100%" class="menu"><a href="'+SubLink2[j][k][l]+'" onMouseOver="MM_swapImage(\''+leftMenuName+j+'_'+k+'_'+l+'\',\'\',\''+imgPath+'btn_lv2_'+iconNo+subIconNo+subSubIconNo+'_o.jpg\',1); secondLayerMouseOver(\''+leftMenuName+j+'_'+k+'_'+l+'\', \''+layerCommonName+iconNo+subIconNo+subSubIconNo+'\');" onMouseOut="MM_swapImgRestore(); secondLayerMouseOut(\''+leftMenuName+j+'_'+k+'_'+l+'\', \''+layerCommonName+iconNo+subIconNo+subSubIconNo+'\');"><img name="'+leftMenuName+j+'_'+k+'_'+l+'" src="'+imgPath+'btn_lv2_'+iconNo+subIconNo+subSubIconNo+'.jpg" alt="'+subSubTitle[parseInt(j)+1][k][l]+'" border="0"></a></td></tr></table></td>');
						document.writeln('</tr>');
					}
					document.writeln('<tr valign=top>');
					document.writeln('	<td><img src="'+imgPath+'btn_lv2_bottom.jpg" border="0"></td>');
					document.writeln('</tr>');
					document.writeln('</table>');		
			
					//Close Layer
					if (document.layers)
					{document.writeln('</layer>');}
					else
					{document.writeln('</div>');}
				}
			}
		}
	}
	
	
	}//check not textonly version
	
	return scriptBuffer;
}

function getTopic()
{
	//check not textonly version
	if(document.URL.toString().search('/text/')==-1){
	
	document.writeln('<table width="607" border="0" cellspacing="0" cellpadding="0">');
	document.writeln('<tr>');
	document.writeln('	<td width="21" height="31" rowspan="3" align="left" valign="top"><img src="'+imgPath+'spacer.gif" width="21" height="31" border="0"></td>');
	document.writeln('	<td height="14" align="left" valign="top" colspan="2">');
	document.writeln('	<IMG src="'+imgPath+'heading'+selectedID+'.jpg" alt="'+title[selectedID]+'" title="'+title[selectedID]+'" border="0">');
	document.writeln('</td>');
	document.writeln('</tr>');
	document.writeln('<tr>');
	document.writeln('	<td height="3" align="left" valign="top" colspan="2"><IMG src="'+imgPath+'title_line.jpg" ALT="" border="0"></td>');
	document.writeln('</tr>');
	document.writeln('<tr>');
	document.writeln('	<td align="left" valign="top" colspan="2"><IMG src="'+imgPath+'title_line_left.jpg" ALT="" border="0">');
	
	if (typeof(subTitle[parseInt(selectedID)+1]) !='undefined'){
		if (typeof(subTitle[parseInt(selectedID)+1][selectedSection]) !='undefined'){
			if (subSubTitle[parseInt(selectedID)+1].length>1){
				if (subSubTitle[parseInt(selectedID)+1][selectedSection].length>1){
					//alert(subTitle[parseInt(selectedID)+1][selectedSection].length);
					if (typeof(subSubTitle[parseInt(selectedID)+1][selectedSection][selectedSubSection]) !='undefined'){
						document.write('<a href="'+SubLink[selectedID][selectedSection]+'"><IMG src="'+imgPath+'sub_title_0'+(parseInt(selectedID)+1)+'_0'+selectedSection+'.jpg" title="'+subTitle[parseInt(selectedID)+1][selectedSection]+'" ALT="'+subTitle[parseInt(selectedID)+1][selectedSection]+'" border="0"></a>');
						document.write('<img src="'+imgPath+'sub_title_arr.jpg" border="0" title="&gt;" alt="&gt;"><img src="'+imgPath+'sub_title_0'+(parseInt(selectedID)+1)+'_0'+selectedSection+'_0'+selectedSubSection+'.jpg" border="0" title="'+subSubTitle[parseInt(selectedID)+1][selectedSection][selectedSubSection]+'" alt="'+subSubTitle[parseInt(selectedID)+1][selectedSection][selectedSubSection]+'">');
					}else{
						document.write('<IMG src="'+imgPath+'sub_title_0'+(parseInt(selectedID)+1)+'_0'+selectedSection+'.jpg" title="'+subTitle[parseInt(selectedID)+1][selectedSection]+'" ALT="'+subTitle[parseInt(selectedID)+1][selectedSection]+'" border="0">');
					}
				}else{
					document.write('<IMG src="'+imgPath+'sub_title_0'+(parseInt(selectedID)+1)+'_0'+selectedSection+'.jpg" title="'+subTitle[parseInt(selectedID)+1][selectedSection]+'" ALT="'+subTitle[parseInt(selectedID)+1][selectedSection]+'" border="0">');
				}
			}else{
				document.write('<IMG src="'+imgPath+'sub_title_0'+(parseInt(selectedID)+1)+'_0'+selectedSection+'.jpg" title="'+subTitle[parseInt(selectedID)+1][selectedSection]+'" ALT="'+subTitle[parseInt(selectedID)+1][selectedSection]+'" border="0">');
			}
		}else{
			document.write('&nbsp;');
		}
	}else{
		document.write('&nbsp;');
	}
	document.write('</td>');
	document.writeln('</tr>');
	document.writeln('</table>');
	
	}else{//istextonly version
		var TempSelectedID=selectedID + 1;
		if(document.URL.toString().search('/sitemap/')!=-1){//check sitemap
			document.writeln('<b>'+title[selectedID]+'</b>');
		}else{
			if (SubLink[selectedID]!=null && selectedSection!=0) {//check main
				document.writeln('<p><a href="'+MainLink[selectedID]+'">'+title[selectedID]+'</a>');

				if (SubLink2[selectedID].length > 1){//check SubLink2
					if (SubLink2[selectedID][selectedSection]!=null && selectedSubSection!=0){
				
						document.writeln(' > <a href="'+SubLink[selectedID][selectedSection]+'">'+subTitle[TempSelectedID][selectedSection]+'</a>');
						if (SubLink2[selectedID][selectedSection][selectedSubSection]!=null) {
							document.writeln(' > '+subSubTitle[TempSelectedID][selectedSection][selectedSubSection]+'</p>');
						}else{
							document.writeln('</p>');
						}
				
					}else{
						document.writeln(' > <b>'+subTitle[TempSelectedID][selectedSection]+'</b></p>');
					}
			
				}else{
					document.writeln(' > <b>'+subTitle[TempSelectedID][selectedSection]+'</b></p>');
				}//end check SubLink2
			}else{
				document.writeln('<p><b>'+title[selectedID]+'</b></p>');
			}//end check main
		

		}//end check sitemap
		
	}//check not textonly version
}

function getPrintButton() {
	var scriptBuffer='';
	if(p==0)
	scriptBuffer+='<a href="javascript:printPage();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'btnprint\',\'\',\'images/btn_print_over.gif\',1)"><img src="images/btn_print.gif" name="btnprint" alt="Print This Page" border="0"></a>';
	return scriptBuffer;
}


//generate the page footer to show the notices and revision date
function getFooter() {
	var copyYear='2007';
	var noticesLink=langPath+'notice/index.htm';
	//alert(noticesLink);
	if (revisionDate==''||revisionDate=='MM/DD/YYYY') revisionDate='07/26/2010';
	var reDate=new Date(Date.parse(revisionDate))
	
	//set language format
	if(document.URL.toString().search('/en/')!=-1){
		var txtLastRevisionDate='Last revision date: ';
		var txtImportantNotices='Important Notices';
		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 showDate=reDate.getDate()+' '+monthArray[reDate.getMonth()]+' '+reDate.getFullYear();
	}else if(document.URL.toString().search('/sc/')!=-1){
		var txtLastRevisionDate='修订日期:';
		var txtImportantNotices='重要告示';
		var showMonth=reDate.getMonth()+1;
		var showDate=reDate.getFullYear()+'年'+showMonth+'月'+reDate.getDate()+'日';
	}else{
		var txtLastRevisionDate='修訂日期:';
		var txtImportantNotices='重要告示';
		var showMonth=reDate.getMonth()+1;
		var showDate=reDate.getFullYear()+'年'+showMonth+'月'+reDate.getDate()+'日';
	}
	//generate the topic image to the buffer variable
	var scriptBuffer='';
	
	//check not textonly version
	if(document.URL.toString().search('/linear/')==-1){
	
	scriptBuffer+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	
	if(!p) {
		scriptBuffer+='<tr>';
		scriptBuffer+='<td colspan="2" align="right" class="footer">'; 

		if (selectedSubSection != 0) {
			var thisLink;
			thisLink = '';
			if (selectedSubSubSection > 0 ) {
				thisLink = 'javascript: history.go(-1);';
			}else if (isArrayContain(document.location.pathname)){
				thisLink = MainLink[selectedID];
			}else {
				thisLink = SubLink[selectedID][selectedSection];
			}
			
			if((selectedSection==2)&&(selectedSubSection==2)&&(subLevelSection==2))
				thisLink = '/about_us/organization/responsibilities/major.htm';
			
			if((selectedSection==2)&&(selectedSubSection==2)&&(subLevelSection==1)&&(selectedSubSubSection==1))
				thisLink = '/about_us/organization/orgainzation_chart/chart.htm';
				
			if((selectedSection==5)&&(selectedSubSection==2)&&(subLevelSection==2)&&(selectedSubSubSection==1))
				thisLink = '/public_services/community_halls_centres/ccch.htm';
	
			if (vLink != '') {
				thisLink = vLink;
			}
		}
		if((selectedSection==1)&&(selectedSubSection==0)){
			thisLink = MainLink[selectedSection];
		}
		scriptBuffer+='</tr>';
	}
	scriptBuffer+='<tr>';
	scriptBuffer+='<td colspan="2"><img src="../../images/common/spacer.gif" width="16" height="16"></td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='<tr>';
	scriptBuffer+='<td colspan="2" background="../../images/common/botdot2.jpg"><img src="../../images/common/botdot2.jpg" alt="" width="596" height="3" border="0" /></td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='<tr>';
	scriptBuffer+='<td colspan="2"><img src="../../images/common/spacer.gif" width="1" height="4"></td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='<tr>';
	scriptBuffer+='<td class="footer" align="left">&nbsp;'+copyYear+'<img src="../../images/common/copy.gif" align="absmiddle"> | <a href="'+noticesLink+'" class="notices">'+txtImportantNotices+'</a></td>';
	scriptBuffer+='<td align="right" class="footer"><div align=right>'+txtLastRevisionDate+showDate+'&nbsp;</div></td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='<tr>';
	scriptBuffer+='<td colspan="2"><img src="../../images/common/spacer.gif" width="1" height="16"></td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='</table>';
	
	}else{// istextonly version
	
		scriptBuffer+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
		scriptBuffer+='<tr>';
		scriptBuffer+='<td>'+copyYear+' &copy; | <a href="'+noticesLink+'" class="notices">'+txtImportantNotices+'</a></td><td align="right"><div align=right>'+txtLastRevisionDate+showDate+'</div></td>';
		scriptBuffer+='</tr>';
		scriptBuffer+='</table>';
	
	}//check not textonly version
	
	return scriptBuffer;
}

function PdfReader(){
	
	var scriptBuffer='';
	var PdfText='';
	var PdfLogoAlt='';
	var PdfLogo='';
	var checker=false;
	var CheckPdfSection = new Array();
	CheckPdfSection[3]  = new Array();
	CheckPdfSection[3][1]  = true;
	CheckPdfSection[3][5]  = new Array();
	CheckPdfSection[3][5][0] = false;
	CheckPdfSection[3][5][1] = true;
	CheckPdfSection[3][5][2] = true;
	CheckPdfSection[3][5][3] = true;
	CheckPdfSection[3][5][4] = true;
	
	CheckPdfSection[6]  = true;
	
	
	if (typeof(CheckPdfSection[selectedID]) !='undefined'){
		if (CheckPdfSection[selectedID].length>1){
			if (typeof(CheckPdfSection[selectedID][selectedSection]) !='undefined'){
				if (CheckPdfSection[selectedID][selectedSection]){
					checker=true;
				}
				if (CheckPdfSection[selectedID][selectedSection].length>1){
					if (typeof(CheckPdfSection[selectedID][selectedSection][selectedSubSection]) !='undefined'){
						
						//check isTrue add content here
						if (CheckPdfSection[selectedID][selectedSection][selectedSubSection]){
							checker=true;
						}else{
							checker=false;
						}
						//check isTrue add content
						
					}//check defind 3-lv
				}//check length 2-lv
			} //check defind 2-lv
		}else{
			if(CheckPdfSection[selectedID]){
				checker=true;
			}
		}//check length 1-lv
	}//check defind 1-lv
		
	
	if (checker){
	if(document.URL.toString().search('/en/')!=-1){
		PdfText='To view the above document, you need to use an Adobe Acrobat Reader. Please click <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank">here</a> to download the latest version and install the <a href="http://www.adobe.com/products/acrobat/acrrasianfontpack.html" target="_blank">Asian Font Pack</a> if necessary.';
		PdfLogoAlt='Get Adobe Acrobat Reader';
	}else if(document.URL.toString().search('/sc/')!=-1){
		PdfText='以上文件以PDF 格式储存，你需要使用Adobe Acrobat Reader 来阅览。如需安装，可按<a href="http://www.chinese-t.adobe.com/products/acrobat/readstep2.html?c=hk" target="_blank">此处</a> 下载该软件及其<a href="http://www.chinese-t.adobe.com/products/acrobat/acrrasianfontpack.html?c=hk">亚洲字型套件</a> 。';
		PdfLogoAlt='安装 Acrobat Reader';
	}else{
		PdfText='以上文件以PDF 格式儲存，你需要使用Adobe Acrobat Reader 來閱覽。如需安裝，可按<a href="http://www.chinese-t.adobe.com/products/acrobat/readstep2.html?c=hk" target="_blank">此處</a> 下載該軟件及其<a href="http://www.chinese-t.adobe.com/products/acrobat/acrrasianfontpack.html?c=hk">亞洲字型套件</a> 。';
		PdfLogoAlt='安裝 Acrobat Reader';
	}
	//check not textonly version
	if(document.URL.toString().search('/text/')==-1){
		PdfLogo='<img src="'+domain_url+'/images/pdficon.gif" width="88" height="31" border="0" title="'+PdfLogoAlt+'" alt="'+PdfLogoAlt+'">';
	}else{//istextonly version
		PdfLogo=PdfLogoAlt;
	}
	scriptBuffer+='<table border="0" cellpadding="2" cellspacing="0" width="100%">';
	scriptBuffer+='<tr><td><a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank">'+PdfLogo+'</a></td><td>';
	scriptBuffer+=PdfText;
	scriptBuffer+='</td></tr>';
	scriptBuffer+='</table>';
	}
	
	return scriptBuffer;
}
function PdfReader2(){
	
	var scriptBuffer='';
	var PdfText='';
	var PdfLogoAlt='';
	var PdfLogo='';

	if(document.URL.toString().search('/en/')!=-1){
		PdfText='To view the above document, you need to use an Adobe Acrobat Reader. Please click <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank">here</a> to download the latest version and install the <a href="http://www.adobe.com/products/acrobat/acrrasianfontpack.html" target="_blank">Asian Font Pack</a> if necessary.';
		PdfLogoAlt='Get Adobe Acrobat Reader';
	}else if(document.URL.toString().search('/sc/')!=-1){
		PdfText='以上文件以PDF 格式储存，你需要使用Adobe Acrobat Reader 来阅览。如需安装，可按<a href="http://www.chinese-t.adobe.com/products/acrobat/readstep2.html?c=hk" target="_blank">此处</a> 下载该软件及其<a href="http://www.chinese-t.adobe.com/products/acrobat/acrrasianfontpack.html?c=hk">亚洲字型套件</a> 。';
		PdfLogoAlt='安装 Acrobat Reader';
	}else{
		PdfText='以上文件以PDF 格式儲存，你需要使用Adobe Acrobat Reader 來閱覽。如需安裝，可按<a href="http://www.chinese-t.adobe.com/products/acrobat/readstep2.html?c=hk" target="_blank">此處</a> 下載該軟件及其<a href="http://www.chinese-t.adobe.com/products/acrobat/acrrasianfontpack.html?c=hk">亞洲字型套件</a> 。';
		PdfLogoAlt='安裝 Acrobat Reader';
	}
	//check not textonly version
	if(document.URL.toString().search('/text/')==-1){
		PdfLogo='<img src="'+domain_url+'/images/pdficon.gif" width="88" height="31" border="0" title="'+PdfLogoAlt+'" alt="'+PdfLogoAlt+'">';
	}else{//istextonly version
		PdfLogo=PdfLogoAlt;
	}
	scriptBuffer+='<table border="0" cellpadding="2" cellspacing="0" width="100%">';
	scriptBuffer+='<tr><td><a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank">'+PdfLogo+'</a></td><td>';
	scriptBuffer+=PdfText;
	scriptBuffer+='</td></tr>';
	scriptBuffer+='</table>';
	
	//alert(scriptBuffer);
	document.writeln(scriptBuffer);
}
function GenTopid(){
	for (i=1; i<100; i++){
		if (document.getElementById('Image'+i)==null){
			//alert(i);
			return 'Image'+i
		}
	}
}
function Back_gotoTop(type)
{
	//type 2 = back + gotoTop, type 1 = gotoTop
	if(document.URL.toString().search('/sc/')!=-1){
		var backalt='上一頁';
		var topalt='回頁首';
	}else if(document.URL.toString().search('/tc/')!=-1){
		var backalt='上一頁';
		var topalt='回頁首';
	}else{
		var backalt='Back';
		var topalt='Top^';
	}
	
	GenTopidtxt=GenTopid();
	
	//check not textonly version
	if(document.URL.toString().search('/text/')==-1){
		document.writeln('	        <table border="0" cellpadding="0" cellspacing="0" width="100%">');
		document.writeln('	        	<tr valign="middle">');
		if (type == 2){
			document.writeln('	        		<td align="left"><!-- <div align="right"> --><a href="javascript:history.go(-1);" onMouseOver="MM_swapImage(\'back\',\'\',\''+imgPath+'btn_back_o.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="'+imgPath+'btn_back.jpg" id="back" alt="'+backalt+'" title="'+backalt+'" border="0"></a><!-- </div> --></td>');
		}
		document.writeln('	        		<td align="right"><div align="right"><a href="#top" onMouseOver="MM_swapImage(\''+GenTopidtxt+'\',\'\',\''+imgPath+'btn_top_o.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="'+imgPath+'btn_top.jpg" id="'+GenTopidtxt+'" alt="'+topalt+'" title="'+topalt+'" border="0"></a></div></td>');
		document.writeln('	        	</tr>');
		document.writeln('	        </table>');
	}else{//is textonly version
		document.writeln('	<table border="0" cellpadding="2" cellspacing="2" width="100%">');
		document.writeln('		<tr valign="middle">');
		if (type == 2){
			document.writeln('		<td><a href="javascript:history.go(-1);">'+backalt+'</a></td>');
		}
		document.writeln('		<td align="right"><div align="right"><a href="#top">'+topalt+'</a></td></div></tr>');
		document.writeln('	</table>');
	}
}

function isArrayContain(sLink) {
	for (var i in SubLink[selectedSection]){
		if (SubLink[selectedSection][i].indexOf(sLink)!=-1) {
			return true;
		}
	}
	return false;
}


function getSubSectionList() {
	var scriptBuffer;
	var bulletPath;
	bulletPath = 'images/bullet_1.gif';
	
	scriptBuffer = '';
	scriptBuffer+='<table cellspacing="0" cellpadding="0" border="0" width="100%">';
	if (selectedSubSection==0){
		for (i=1; i<SubLink[selectedSection].length;i++ ) {
			scriptBuffer+='<tr>';
			scriptBuffer+='<td width="10%" align="right" valign="top"><img src="'+bulletPath+'" border=0 align=middle alt="*">&nbsp;&nbsp;&nbsp;</td>';
			scriptBuffer+='<td width="90%" align="left" valign="top"><a href="'+SubLink[selectedSection][i]+'">'+subTitle[selectedSection+1][i]+'</a><br><br></td>';
			scriptBuffer+='</tr>';
		}
	} else {
		for (i=1; i<SubLink2[selectedSection][selectedSubSection].length;i++ ) {
			scriptBuffer+='<tr>';
			scriptBuffer+='<td width="10%" align="right" valign="top"><img src="'+bulletPath+'" border=0 align=middle alt="*">&nbsp;&nbsp;&nbsp;</td>';
			scriptBuffer+='<td width="90%" align="left" valign="top"><a href="'+SubLink2[selectedSection][selectedSubSection][i]+'">'+subSubTitle[selectedSection+1][selectedSubSection][i]+'</a><br><Br></td>';
			scriptBuffer+='</tr>';
		}
	}
	scriptBuffer+='</table>';
	return scriptBuffer;
}


function externalLink(url)
{eval("nw = window.open(url, 'external','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,pageXOffset=0,pageYOffset=0,top=0,left=0,width=760,height=580')");
	if ( nw.focus != null)
	{nw.focus();}
}

function documentPopUp(url)
{eval("nw = window.open(url, 'document','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,pageXOffset=0,pageYOffset=0,top=0,left=0,width=800,height=300')");
	if ( nw.focus != null)
	{nw.focus();}
}

function setVistorTopPos(){
	if(!isNS4){
		document.getElementById('rightMenuTop').style.visibility = "visible";
		document.getElementById('rightMenuTop').style.left=getDim(document.images.ptest).x;
	}
}

function PopWin(url, x, y, w, h){
	url = domain_url + url;
    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();
    }
}

function customPreload(pageType){
	if(pageType==0)
		MM_preloadImages('images/spacer.gif','images/spacer_over.gif','images/nav_sub_Line.gif','images/nav_sub_Line_over.gif','images/top_view.jpg','images/btn_01.gif' ,'images/btn_01_over.gif' ,'images/btn_02.gif' ,'images/btn_02_over.gif' ,'images/btn_03.gif' ,'images/btn_03_over.gif' ,'images/btn_04.gif' ,'images/btn_04_over.gif' ,'images/btn_05.gif' ,'images/btn_05_over.gif' ,'images/btn_06.gif' ,'images/btn_06_over.gif' ,'images/btn_07.gif' ,'images/btn_07_over.gif' ,'images/btn_08.gif' ,'images/btn_08_over.gif' ,'images/btn_09.gif' ,'images/btn_09_over.gif' ,'images/btn_10.gif' ,'images/btn_10_over.gif' ,'images/btn_11.gif' ,'images/btn_11_over.gif' ,'images/btn_12.gif' ,'images/btn_12_over.gif',"btn_gotoTop.gif","btn_gotoTop_over.gif","btn_logIn.gif","btn_logIn_over.gif","btn_next.gif","btn_next_over.gif","btn_previous.gif","btn_previous_over.gif","btn_signUp.gif","btn_signUp_over.gif","btn_visit.gif","btn_visit_over.gif","btn_visit_top.gif","key_pix_01.gif","key_pix_01.jpg","key_pix_01_over.gif","key_pix_01_over.jpg","title_pop_R_On.gif","title_pop_R.gif","title_key_R.gif","title_key_R_On.gif","title_highlight_bg.gif","sub_title_R.gif","subHead_bg_01.gif","subHead_bg_02.gif","subHead_pix_top.gif","sub_title_bg.gif","stat_low.gif","sub_R.gif","stat_bgR.gif","stat_bgL.gif","smal_low_L.gif","smal_low_R.gif","RSS.gif","reg_right.jpg","regist_bgL.gif","reg_left.jpg","regist_bgR.gif","new.gif")
	else	
		MM_preloadImages('images/spacer.gif','images/spacer_over.gif','images/nav_sub_Line.gif','images/nav_sub_Line_over.gif','images/top_view.jpg','images/btn_01.gif' ,'images/btn_01_over.gif' ,'images/btn_02.gif' ,'images/btn_02_over.gif' ,'images/btn_03.gif' ,'images/btn_03_over.gif' ,'images/btn_04.gif' ,'images/btn_04_over.gif' ,'images/btn_05.gif' ,'images/btn_05_over.gif' ,'images/btn_06.gif' ,'images/btn_06_over.gif' ,'images/btn_07.gif' ,'images/btn_07_over.gif' ,'images/btn_08.gif' ,'images/btn_08_over.gif' ,'images/btn_09.gif' ,'images/btn_09_over.gif' ,'images/btn_10.gif' ,'images/btn_10_over.gif' ,'images/btn_11.gif' ,'images/btn_11_over.gif' ,'images/btn_12.gif' ,'images/btn_12_over.gif');
}


function newlink(abc){
	
	tlink=abc.replace("javascript:externalLink('", "")
	externalLink(tlink.replace("')", ""));
}

function month_reg2(getMonth, thisForm, dayoption, getYear){
	var dayMonth='';
	if (getMonth ==2){
		if ((getYear%4)==0)
			dayMonth=29;
		else
			dayMonth=28;
	}else if((getMonth ==4)||(getMonth ==6)||(getMonth ==9)||(getMonth ==11)){
		dayMonth=30;
	}else{
		dayMonth=31;
	}
		txtselect='---Select---';
		txtDay='';
	dayoption.options.length = 0;	//completely clear a select box
	dayoption.options[0] = new Option(txtselect,'');
	
	for (i=1; i<=dayMonth; i++){
		dayoption.options[i] = new Option(i+txtDay,i);
	}
}

function clearAssuranceForm() {
	document.form01.assimage.src = domain_url+"/images/spacer.gif";
	document.form01.assimage.alt = '';
	document.form01.reset();
}

function ClearAssurance(){
	document.form01.assimage.src = '../../images/spacer.gif';
	document.form01.assimage.alt = '';
}

function CalculateAssurance()
{
	var msgLeft, msgRight;
	switch(langID){
		case 1 : msgLeft = 'Image: Assurance Level ';msgRight = ''; break;
		case 2 : msgLeft = '圖像： 第 ';msgRight = ' 保證等級'; break;
		case 3 : msgLeft = '图像： 第 ';msgRight = ' 保证等级'; break;
	}
	
	if ((document.form01.C01[3].checked) || (document.form01.C02[3].checked) || (document.form01.C03[3].checked) || (document.form01.C04[2].checked) || (document.form01.C05[3].checked))
	{
	      document.form01.assimage.src = imgPath+"alevel4.gif";
		  document.form01.assimage.alt = msgLeft + '4' + msgRight;
	      return;
	}
	else if ((document.form01.C03[2].checked) || (document.form01.C04[1].checked) || (document.form01.C05[2].checked))
	{
	      document.form01.assimage.src = imgPath+"alevel3.gif";
		  document.form01.assimage.alt = msgLeft + '3' + msgRight;
	      return;
	}
	else if ((document.form01.C01[2].checked) || (document.form01.C02[2].checked) || (document.form01.C03[1].checked) || (document.form01.C05[1].checked))
	{
	      document.form01.assimage.src = imgPath+"alevel2.gif";
		  document.form01.assimage.alt = msgLeft + '2' + msgRight;
	      return;
	} 
	else
	{
	      document.form01.assimage.src = imgPath+"alevel1.gif";
		  document.form01.assimage.alt = msgLeft + '1' + msgRight;
	      return;
	}
}

function clearAssuranceFormText() {
	document.getElementById('assimage').innerHTML = '';
	document.form01.reset();
}

function ClearAssuranceText(){
	document.getElementById('assimage').innerHTML = '';
}

function CalculateAssuranceText()
{
	var msgLeft, msgRight;
	switch(langID){
		case 1 : msgLeft = 'Assurance Level ';msgRight = ''; break;
		case 2 : msgLeft = '第 ';msgRight = ' 保證等級'; break;
		case 3 : msgLeft = '第 ';msgRight = ' 保证等级'; break;
	}
		
	if ((document.form01.C01[3].checked) || (document.form01.C02[3].checked) || (document.form01.C03[3].checked) || (document.form01.C04[2].checked) || (document.form01.C05[3].checked))
	{
	      document.getElementById('assimage').innerHTML = msgLeft + '4' + msgRight;
	      return;
	}
	else if ((document.form01.C03[2].checked) || (document.form01.C04[1].checked) || (document.form01.C05[2].checked))
	{
	      document.getElementById('assimage').innerHTML = msgLeft + '3' + msgRight;
	      return;
	}
	else if ((document.form01.C01[2].checked) || (document.form01.C02[2].checked) || (document.form01.C03[1].checked) || (document.form01.C05[1].checked))
	{
	      document.getElementById('assimage').innerHTML = msgLeft + '2' + msgRight;
	      return;
	} 
	else
	{
	      document.getElementById('assimage').innerHTML = msgLeft + '1' + msgRight;
	      return;
	}
}