﻿if (location.href.toString().search('winstate-hk.no-ip.org') != -1){
    var domain_url = 'ht'+'tp://winstate-hk.no-ip.org:32230';
}
else if (location.href.toString().search('www0.cms.elderacademy.org.hk') != -1)
{
    var domain_url = 'ht'+'tp://www0.cms.elderacademy.org.hk';
}
else if (location.href.toString().search('www0.elderacademy.org.hk') != -1)
{
    var domain_url = 'ht'+'tp://www0.elderacademy.org.hk';
}
else
{
    var domain_url = 'ht'+'tp://www.elderacademy.org.hk';
}

// ------------------------------------------------------------- Variables for Common Function for Left Menu -----------------------------------------

var vLink = '';  // for specifying the target of "Back" button
var LastReviewDate = '09/27/2008';   //Date Format: MM/DD/YYYY
var LastReviewText = '最近修訂日期';

var leftMenuSectionImageOut = ".gif";
var leftMenuSectionImageOver = "_over.gif";
var leftMenuName = "Menu";         // Image object name prefix of menu items
//var leftMenuImageName = "icon";  // Filename prefix of menu bitmaps
var layerCommonName = "Popup";     // Name prefix of layer objects which holds the menu items
var left_menu_img_path='/file_manager/tc/images/left_menu/';

var displayOrders = new Array();

function menuPad(level, parentMenuItem) {
  this.level = level;
  this.menuItems = new Array();  // array of menu items
  this.parentMenuItem = parentMenuItem;
}

function menuItem(inUse, idx, theLink, theTitle, containerMenuPad) {
  this.inUse = inUse;      // whether the item is displayed (0 or 1)
  this.idx = idx;          // index of the menu item within its parent menu pad, which constitutes the
                           //   (1) image object name for the item
                           //   (2) image filename    for the item
                           //   (3) layer object name of child menu pad (if any)
  this.theLink = theLink;    // URL or javascript action
  this.theTitle = theTitle;  // Title of menu item, used for ALT TEXT of image
  this.containerMenuPad = containerMenuPad;  // reference to container
  this.childMenuPad = null;  // reference to child menu pad
}

var rootMenu = new menuPad(0,null);  // top level menu pad
var errorAbort = false;  // when set to true, abort menu building

var menuPadLeftPos = Array();  // Specify Left position of all menu layers
//menuPadLeftPos[0] = 0;
menuPadLeftPos[1] = 136;
menuPadLeftPos[2] = 295;

var menuPadTopPos = Array();  // For specifying Top position of certain menu layers

function setMenuItem(inUse, mnuId, theLink, theTitle) {
  var i;
  var menuID = mnuId_2_menuID(mnuId);  // '0,1,10' becomes '00_01_10'

  // go to the appropriate container menu pad
  var tmpMenuPad = rootMenu;  // start form the root menu
  var level = 0;
  var mnuIdx, mnuIdxs = menuID; // we'll strip the indices one by one
                                // and follow that to the appropriate container
  var mnuItm;

  if (errorAbort) return;

  if (theLink.indexOf('\\')==0) theLink = domain_url + theLink;

  while ((i=mnuIdxs.indexOf('_')) != -1) {
    mnuIdx = mnuIdxs.substring(0,i);  // stripped index
    mnuIdxs = mnuIdxs.substring(i+1); // remaining indices
    // Check if outer menu item is defined
    if (typeof(tmpMenuPad.menuItems[mnuIdx]) == 'undefined') {
      alert('Cannot create menu item ' + menuID + 
            '\r\nbecause menu item ' + menuID.substring(0, menuID.length-mnuIdxs.length) + ' not yet created.');
      errorAbort = true;
      return;
    }
    mnuItm = tmpMenuPad.menuItems[mnuIdx];
    level++;
    // Check if outer menu pad is defined
    if (!mnuItm.childMenuPad) {
      if (mnuIdxs.indexOf('_') == -1) { // reached the inner most index
      	mnuItm.childMenuPad = new menuPad(level, mnuItm);
      } else {
        alert('Cannot create menu pad ' + menuID + 
              '\r\nbecause menu pad ' + menuID.substring(0, menuID.length-mnuIdxs.length) + ' not yet created.');
      	errorAbort = true;
      	return;
      }    
    }
    tmpMenuPad = mnuItm.childMenuPad; // go into next inner menu pad    
  }

  // Now should be at the appropriate menu pad
  // Check if the item to be created already exist
  if (typeof(tmpMenuPad.menuItems[mnuIdxs]) != 'undefined') {
    alert('Menu Item ' + mnuId + ' already exists !');
    errorAbort = true;
    return;
  }

  // Create the menu item
  tmpMenuPad.menuItems[mnuIdxs] = new menuItem(inUse, mnuIdxs, theLink, theTitle, tmpMenuPad);
}


// menuID is '-', '01', '01_02' or '01_02_03', etc...
function getDisplayOrder(menuID) {
  var i, j, s='', ar=Array();
  var tmpMenuPad;

  mnuId = menuID_2_mnuId(menuID);

  if (typeof(displayOrders[mnuId]) != 'undefined') {
    s = displayOrders[mnuId];
    j = 0;
    while ((i=s.indexOf(',')) != -1) {
      ar[j++] = padStrL(s.substring(0,i), '0', 2);
      s = s.substring(i+1);
    }
    ar[j++] = padStrL(s,'0',2);

  } else {
    tmpMenuPad = rootMenu;
    tmpMenuID = menuID;
    if (tmpMenuID != '-') {

      // go to appropriate menu pad
      while (tmpMenuID) {
        s = tmpMenuID.substring(0,2);
        // go to inner menu pad
        if (typeof(tmpMenuPad.menuItems[s])!='undefined' && tmpMenuPad.menuItems[s].childMenuPad) {
          tmpMenuPad = tmpMenuPad.menuItems[s].childMenuPad;
        } else {
          alert('Cannot get display order for ' + menuID +
                '\nFail at ' + menuID.substring(0, menuID.length-tmpMenuID.length));
          return null;
        }

        if (tmpMenuID.length > 3) {
          tmpMenuID = tmpMenuID.substring(3);
        } else {
          tmpMenuID = '';
        }  
      }  
    }

    // now arrived at the target menu pad
    // sort and return the menu items indices
    j = 0;
    for (i in tmpMenuPad.menuItems) {
      ar[j++] = i;
    }
    ar.sort();
  }

  return ar;
}


// ------------------------------------------------------------- Utility Functions for Left Menu -----------------------------------------


function fetchMenuPad(menuID) {
  var tmpMenuPad, s;
  // top level menu
  if (menuID=='-') return rootMenu;
  // walk along levels of menu pad (according to indices in menuID)
  tmpMenuPad = rootMenu;
  while (menuID) {
    s = menuID.substring(0,2);
    if (typeof(tmpMenuPad.menuItems[s])!='undefined' && tmpMenuPad.menuItems[s].childMenuPad)
      tmpMenuPad = tmpMenuPad.menuItems[s].childMenuPad;
    else
      return null;
    // strip outer index from menuID
    if (menuID.length > 2)
      menuID = menuID.substring(3);
    else
      menuID = '';
  }
  return tmpMenuPad;
}


function fetchMenuItem(menuID) {
  var tmpMenuPad, s;
  tmpMenuPad = rootMenu;
  while (menuID.length > 2) {
    s = menuID.substring(0,2);
    if (typeof(tmpMenuPad.menuItems[s])!='undefined' && tmpMenuPad.menuItems[s].childMenuPad)
      tmpMenuPad = tmpMenuPad.menuItems[s].childMenuPad;
    else
      return null;
    // strip outer index from menuID
    if (menuID.length > 2)
      menuID = menuID.substring(3);
    else
      menuID = '';
  }
  // should arrive at appropriate menu pad
  if (typeof(tmpMenuPad.menuItems[menuID]) != 'undefined')
    return tmpMenuPad.menuItems[menuID];
  else
    return null;
}



// Pad string 'st' on the left with char 'ch' to length N
function padStrL(st,ch,N) {
  var i, cnt, v;
  st = ''+st;
  cnt = N - st.length;
  for (i=0; i<cnt; i++) {
    st = ch + st;
  }
  return st;
}

// '0,1,10' becomes '00_01_10'
function mnuId_2_menuID(mnuId) {
  var i=0, retval='';
  while ((i=mnuId.indexOf(',')) != -1) {
    retval += padStrL(mnuId.substring(0,i), '0', 2) + '_';
    mnuId = mnuId.substring(i+1);
  }
  retval += padStrL(mnuId, '0', 2);
  return retval;
}

// '00_01_10' becomes '0,1,10'
function menuID_2_mnuId(menuID) {
  var i=0, retval='';
  while (menuID) {
    if (menuID.indexOf('0') == 0) {
      retval += menuID.substring(1,2);
    } else {
      retval += menuID.substring(0,2);
    }
    if (menuID.length > 2) {
      retval += ',';
      menuID = menuID.substring(3);
    } else {
      menuID = '';
    }
  }
  return retval;
}



// ------------------------------------------------------------- Define Left Menu Items Here -------------------------------------------------------------

// setMenuItem(inUse, mnuId, theLink, theTitle)
// mnuId is "menu id" which is the concatination of all index 

// Top Level Left Menu
setMenuItem(1, '0', '/tc/welcome/t_index.html', '歡迎辭');
setMenuItem(1, '1', '/tc/aboutea/t_index.html', '關於長者學苑');
setMenuItem(1, '2', '/tc/school/t_index.html', '長者學苑在中小學');
setMenuItem(1, '3', '/tc/institution/t_index.html', '長者學苑在大專院校');
setMenuItem(1, '4', '/tc/howtoapply/t_index.html', '申請辦法');
setMenuItem(1, '5', '/tc/pr/t_index.html', '新聞公報及刊物');
setMenuItem(1, '6', '/tc/activities/t_index.html', '活動');
setMenuItem(1, '7', '/tc/doc/t_index.html', '重要文件、表格');
setMenuItem(1, '8', '/tc/links/t_index.html', '相關網址');
setMenuItem(1, '9', '/tc/contact/t_index.html', '聯絡我們');

//displayOrders['-'] = '1,0,3,2';

//welcome Message
setMenuItem(1, '0,0', '/tc/welcome/t_chairman.html', '安老事務委員會主席');
setMenuItem(1, '0,1', '/tc/welcome/t_secretary.html', '勞工及福利局局長');

displayOrders['0'] = '1,0';

//Elder Academies at Primary and Secondary Schools
setMenuItem(1, '2,0', '/tc/school/t_hongkong.html', '香港');
setMenuItem(1, '2,1', '/tc/school/t_kowloon.html', '九龍');
setMenuItem(1, '2,2', '/tc/school/t_nt.html', '新界');

//displayOrders['2'] = '1,2,0';

//How to Apply
setMenuItem(1, '4,0', '/tc/howtoapply/t_elders.html', '長者');
setMenuItem(1, '4,1', '/tc/howtoapply/t_schools.html', '學校');
setMenuItem(1, '4,2', '/tc/howtoapply/t_institutions.html', '大專院校');

//Press Releases and Publications
setMenuItem(1, '5,0', '/tc/pr/t_pressreleases.html', '新聞公報');
setMenuItem(1, '5,1', '/tc/pr/t_publications.html', '刊物');

//How to Apply
setMenuItem(1, '6,0', '/tc/activities/t_new.html', '新活動');
//setMenuItem(1, '6,1', '/tc/activities/t_ongoing.html', '進行中的活動');
setMenuItem(1, '6,2', '/tc/activities/t_past.html', '曾舉辦的活動');

displayOrders['6'] = '0,2';


//About Us - Organization
//setMenuItem(1, '2,1,0', '/tc/about_us/organization/orgainzation_chart/t_chart.html', '組 織 結 構 圖');
//setMenuItem(1, '2,1,1', '/tc/about_us/organization/responsibilities/t_major.html', '職 責');


//About Us - Statement of Privacy
//setMenuItem(1, '2,4,0', '/tc/about_us/statement_of_privacy_policy_and_practices/t_gpd.html', '一 般 個 人 資 料');
//setMenuItem(1, '2,4,1', '/tc/about_us/statement_of_privacy_policy_and_practices/t_privacy.html', '與 僱 傭 有 關 的 個 人 資 料');

//displayOrders['2,4'] = '1,0';
//menuPadTopPos['2,4'] = 290;


// ****** Pseudo Menu Items
// ****** This menu items are not display in the left menu (notice the inUse flag is '0')
// ****** but facilitate finding title images and alt text, etc...

setMenuItem(0, '99', '', '');
setMenuItem(0, '99,0', '/tc/t_notice.html', '重要告示');
setMenuItem(0, '99,1', '/tc/t_privacy.html', '私隱政策');
setMenuItem(0, '99,2', '/tc/t_sitemap.html', '網頁指南');




// ============================================================= Scripts for text only version =======================================================

// switch language version
function langSwitch(lang) {
  var goPath, s;
  var pagePath = document.location.pathname;

  if (pagePath.search("photoscorner") != -1) {
    s = document.location.toString();
    pagePath = s.substring(s.search(document.location.pathname),s.length);
  }

  if (lang=='en') { //change to English version
    goPath = '/en'+pagePath.substring(3,pagePath.length);
  }
  if (lang=='tc') { //change to traditional chinese version
    goPath = '/tc'+pagePath.substring(3,pagePath.length);
  }
  if (lang=='sc') { //change to simplified chinese version
    goPath='/sc'+pagePath.substring(3,pagePath.length);
  }
  document.location=goPath;
}


//change to graphic only version
function graphicSwitch() {
  var arrayEle = new Array();
  //arrayEle = document.location.toString().split('/t_');
  arrayEle = document.location.pathname.split('/t_');
  document.location = ''+arrayEle[arrayEle.length-1];
}


function getTitle() {
  var mnuItm;
  var scriptBuffer='', altTitle='';

  scriptBuffer += '<title>';
  scriptBuffer += '長者學苑';

  // fetch menu item object correcponding to current page
  // and concat all titles up to the root menu
  if (mnuItm = fetchMenuItem(selectedSection)) {
    while (mnuItm) {
      if (mnuItm.theTitle)
        altTitle = ' - ' + mnuItm.theTitle + altTitle;
      mnuItm = mnuItm.containerMenuPad.parentMenuItem;
    }
  }
  scriptBuffer += altTitle;
  scriptBuffer += '</title>';
  return scriptBuffer;
}


function getTopic() {
  var mnuItm;
  var retStr='';
  
  if (mnuItm = fetchMenuItem(selectedSection)) {
    retStr = mnuItm.theTitle;
    if ((mnuItm = mnuItm.containerMenuPad.parentMenuItem) &&
        (mnuItm.theTitle))
      retStr = mnuItm.theTitle +' - '+ retStr;
  }

  return retStr;
}


function getHeader(){
	linkHome='/index.htm';
	linkGIC='javascript:externalLink(\'http://www.gov.hk/tc/residents/\')';
	linkSC='javascript:langSwitch(\'sc\')';
	linkEN='javascript:langSwitch(\'en\')';
	textLink='javascript:graphicSwitch()'; //Change to graphic only version
	linkSiteMap='/tc/t_sitemap.html';
	linkContactUs='/tc/contact_us/t_index.html';
	linkSearch='javascript:document.search.submit()';
//	linkSearch='javascript:PopWin(\'/popup2.html\', 0, 0, 300, 110)';

	var scriptBuffer='';
	scriptBuffer+='<table width="760" border="0" cellspacing="0" cellpadding="0">';
	scriptBuffer+='<tr>';
	scriptBuffer+='<td colspan="3"><font size="4"><b>長者學苑</b></font><br><br>';
	scriptBuffer+='</td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='<tr valign="middle">';
	scriptBuffer+='<td><table border="0" cellspacing="0" cellpadding="0">';
	scriptBuffer+='<tr>';
	//scriptBuffer+='<td nowrap>[ <a href="'+linkGIC+'">GovHK香港政府一站通</a> ]</td>';
	//scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';
	scriptBuffer+='<td nowrap>[ <a href="'+textLink+'">圖像版本</a> ]</td>';
	scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';
	scriptBuffer+='<td nowrap>[ <a href="'+linkSC+'">简体版</a> ]</td>';
	scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';
	scriptBuffer+='<td nowrap>[ <a href="'+linkEN+'">English</a> ]</td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='</table>';
	scriptBuffer+='</td>';
	scriptBuffer+='<td align="right" width="100%"><table border="0" cellspacing="0" cellpadding="0">';
	scriptBuffer+='<form name="search" action="http://search.gov.hk/search.html" method="get">';
	scriptBuffer+='<input name=ui_lang type=hidden value=zh-hk>';
	scriptBuffer+='<input name=ui_charset type=hidden value=utf-8>';
	scriptBuffer+='<input name=tpl_id type=hidden value=stdsearch>';
	scriptBuffer+='<input name=gp0 type=hidden value=elderacademy_home>';
  scriptBuffer+='<input name=gp1 type=hidden value=elderacademy_home>';
	scriptBuffer+='<input name=web type=hidden value=this>';
	//form hidden field add here
	scriptBuffer+='<tr>';
	scriptBuffer+='<td valign="middle" nowrap>&nbsp;</td>';
	scriptBuffer+='<td valign="middle" nowrap><input type="text" name="query">';
	scriptBuffer+='</td>';
	scriptBuffer+='<td valign="middle" nowrap>&nbsp;[&nbsp;<a href="'+linkSearch+'">搜尋</a>&nbsp;]</td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='</form>';
	scriptBuffer+='</table>';
	scriptBuffer+='</td>';
	scriptBuffer+='<td align="right">';
	scriptBuffer+='<table border="0" cellspacing="0" cellpadding="0"><tr>';
	//scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';
	scriptBuffer+='<td nowrap>[ <a href="'+linkSiteMap+'">網頁指南</a> ]</td>';
	//scriptBuffer+='<td width="10" nowrap>&nbsp;</td>';
	//scriptBuffer+='<td nowrap> [ <a href="'+linkContactUs+'">聯絡我們</a> ] </td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='</table>';
	scriptBuffer+='</td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='<tr>';
	scriptBuffer+='<td colspan="3"><hr></td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='</table>';

	return scriptBuffer;
}


function getNavMenu() {
  var scriptBuffer='';
  var thisLink = '';
  var mnuItm, mnuPad, itmsPerRow, arOrder;
  var i, idx, lvlOneIdx, itmCnt;

  // "Top" and "Back" buttons

  scriptBuffer+='<table width="760" border="0" cellspacing="0" cellpadding="0">';
  scriptBuffer+='<tr>';
  scriptBuffer+='<td><br>';
  scriptBuffer+='<br>';
  scriptBuffer+='<hr></td>';
  scriptBuffer+='</tr>';
  scriptBuffer+='<tr>';
  scriptBuffer+='<td><table width="100%"><tr><td>[ <a href="#">頁首</a> ]</td>';

  if (vLink) {
    thisLink = vLink;

  } else if ((i=selectedSection.length) > 3 &&
             ((mnuItm=fetchMenuItem(selectedSection.substring(0,i-3))))) {
    thisLink = mnuItm.theLink;
  }

  if (thisLink)
    scriptBuffer += '<td align="right">[ <a href="'+thisLink+'">回上頁</a> ]</td>';

  scriptBuffer += '</tr></table></td></tr>';

  //
  scriptBuffer+='<tr>';
  scriptBuffer+='<td><hr></td>';
  scriptBuffer+='</tr>';
  //

  // Display level 1 menu items (if any)
  lvlOneIdx = selectedSection.substring(0,2);
  if (selectedSection.length > 3  &&  
      (mnuPad = fetchMenuPad(lvlOneIdx)) &&  // menu pad object of "opened" level 1 menu
      (mnuItm = fetchMenuItem(lvlOneIdx)) && mnuItm.inUse  // the menu is in use ?      
      ) {

    scriptBuffer+='<tr>';
    scriptBuffer+='<td><table border="0" cellspacing="0" cellpadding="0">';

    // determine menu items per row
    switch (lvlOneIdx) {
      case '02': itmsPerRow = 3;
      default: itmsPerRow = 4;
    }

    // iterate over the menu items and display them
    itmCnt = 0;
    scriptBuffer += '<tr>';
    //
    arOrder = getDisplayOrder(lvlOneIdx);
    for (i=0; i<arOrder.length; i++) {
      idx = arOrder[i];
      mnuItm = mnuPad.menuItems[idx];
      if (mnuItm.inUse) {
      	itmCnt++;
        if (itmCnt > itmsPerRow) {
          scriptBuffer += '</tr><tr>';
          itmCnt = 1;
        } else if (itmCnt > 1) {
          scriptBuffer += '<td width="10" nowrap>&nbsp;</td>';
        }
        scriptBuffer += '<td nowrap>[ <a href="'+mnuItm.theLink+'">'+mnuItm.theTitle+'</a> ]</td>';
      }
    }
    while (itmCnt < itmsPerRow) {
      scriptBuffer += '<td width="10" nowrap>&nbsp;</td>';
      scriptBuffer += '<td nowrap>&nbsp;</td>';
      itmCnt++;
    }
    //
    scriptBuffer += '</tr>';

    scriptBuffer+='</table></td>';
    scriptBuffer+='</tr>';
    //
    scriptBuffer+='<tr>';
    scriptBuffer+='<td><hr></td>';
    scriptBuffer+='</tr>';
  }


  // Display top level menu
  itmsPerRow = 4;
  itmCnt = 0;
  scriptBuffer += '<tr>';
  scriptBuffer += '<td><table border="0" cellspacing="0" cellpadding="0">';
  scriptBuffer += '<tr>';

  arOrder = getDisplayOrder('-');
  for (i=0; i<arOrder.length; i++) {
    idx = arOrder[i];
    mnuItm = rootMenu.menuItems[idx];
    if (mnuItm.inUse) {
      itmCnt++;
      if (itmCnt > itmsPerRow) {
        scriptBuffer += '</tr><tr>';
        itmCnt = 1;
      } else if (itmCnt > 1) {
    	scriptBuffer += '<td width="10" nowrap>&nbsp;</td>';
      }
      scriptBuffer += '<td nowrap>[ <a href="'+mnuItm.theLink+'">'+mnuItm.theTitle+'</a> ]</td>';
    }
  }
  while (itmCnt < itmsPerRow) {
    scriptBuffer += '<td width="10" nowrap>&nbsp;</td>';
    scriptBuffer += '<td nowrap>&nbsp;</td>';
    itmCnt++;
  }

  scriptBuffer+='</tr>';
  scriptBuffer+='</table></td>';
  scriptBuffer+='</tr>';

  scriptBuffer+='<tr>';
  scriptBuffer+='<td><hr></td>';
  scriptBuffer+='</tr>';
  scriptBuffer+='</table>';


  return scriptBuffer;
}



function getFooter() {
	var copyYear='2008';
	var noticesLink='/tc/t_notice.html';
	var privacyLink='/tc/t_privacy.html';
	if (revisionDate=='' || revisionDate=='MM/DD/YYYY') revisionDate='05/18/2008';
	var monthArray=new Array();
	monthArray[0]='1';
	monthArray[1]='2';
	monthArray[2]='3';
	monthArray[3]='4';
	monthArray[4]='5';
	monthArray[5]='6';
	monthArray[6]='7';
	monthArray[7]='8';
	monthArray[8]='9';
	monthArray[9]='10';
	monthArray[10]='11';
	monthArray[11]='12';
	var reDate=new Date(Date.parse(revisionDate))
	var showDate=reDate.getFullYear()+'年'+monthArray[reDate.getMonth()]+'月'+reDate.getDate()+'日';
	
	var ReviewDate = new Date (Date.parse(LastReviewDate));
	var showReviewDate = ReviewDate.getFullYear() + '年' + monthArray[ReviewDate.getMonth()] + '月' + ReviewDate.getDate() + '日';
	
	//generate the topic image to the buffer variable
	var scriptBuffer='';
	scriptBuffer+='<table width="760" border="0" cellspacing="0" cellpadding="0">';
	scriptBuffer+='<tr>';
	scriptBuffer+='<td>版權所有 2008 | <a href="'+noticesLink+'">重要告示</a> | <a href="'+privacyLink+'">私隱政策</a><br>';
	scriptBuffer+='</td>';
	if(ReviewDate >= reDate)
		scriptBuffer+='<td align="right">'+ LastReviewText +': '+showReviewDate+'</td>';
	else
		scriptBuffer+='<td align="right">最近修訂日期: '+showDate+'</td>';
	scriptBuffer+='</tr>';
	scriptBuffer+='</table>';
	
	return scriptBuffer;
}


function getSubSectionList() {
  var scriptBuffer;

  var mnuPad, mnuItm, arOrder, idx;

  mnuPad = fetchMenuPad(selectedSection);
  if (!mnuPad) return;

  scriptBuffer = '';
  scriptBuffer += '<ul>';

  arOrder = getDisplayOrder(selectedSection);

  for (i=0; i<arOrder.length; i++) {
    idx = arOrder[i];
    mnuItm = mnuPad.menuItems[idx];
    if (mnuItm.inUse) {    	
      scriptBuffer+='<li><a href="'+mnuItm.theLink+'">'+mnuItm.theTitle+'</a></li>';    	    	
    }
  }

  scriptBuffer+='</ul>';
  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=800,height=300')");
  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 documentPopUp2(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 PopWin(url, x, y, w, h) {
  eval("popup0 = window.open(url,'popup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,pageXOffset=300,pageYOffset=500,top=" + y + ",left=" + x +",width=" + w + ",height=" + h + "')");
  if ( popup0.focus != null) {
    popup0.focus();
  }
  // return true;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}