﻿function std_link(in_mode) {
  var ret_url;
  var vlocation;
  var vlength;
  var vhost;

  vlength = location.href.length;

    if ( location.href.indexOf("www0.smartid.gov.hk") == -1 ) {
       vhost = "www.smartid.gov.hk";
    } else {
       vhost = "www0.smartid.gov.hk";
    }
 
    if ( location.href.indexOf("/tc/") != -1 ) 
    {
       vlocation = location.href.substring( location.href.indexOf("/tc/")+4,vlength);
    } 
    else 
    {
      if ( location.href.indexOf("/en/") != -1 ) 
      {
         vlocation = location.href.substring( location.href.indexOf("/en/")+4,vlength);
      } 
      else 
      {
        if ( location.href.indexOf("/t_tc/") != -1 ) 
        {
           vlocation = location.href.substring( location.href.indexOf("/t_tc/")+6,vlength);
        } 
        else 
        {
          if ( location.href.indexOf("/t_en/") != -1 ) 
          {
             vlocation = location.href.substring( location.href.indexOf("/t_en/")+6,vlength);
          }
        else 
        {
          if ( location.href.indexOf("/t_sc/") != -1 ) 
          {
             vlocation = location.href.substring( location.href.indexOf("/t_sc/")+6,vlength);
          }
        else 
        {
          if ( location.href.indexOf("/sc/") != -1 ) 
          {
             vlocation = location.href.substring( location.href.indexOf("/sc/")+4,vlength);
          }
        }
        }
      }
}
}
    switch(in_mode) 
    {
     case 1:     
         ret_url = vhost+"/en/"+vlocation;
         break;
     case 2:     
         ret_url = vhost+"/tc/"+vlocation;
         break;
     case 3:     
         ret_url = vhost+"/sc/"+vlocation;
         break;
     case 4:     
         ret_url = vhost+"/t_en/"+vlocation;
         break;
     case 5:     
         ret_url = vhost+"/t_tc/"+vlocation;
         break;
     case 6:     
         ret_url = vhost+"/t_sc/"+vlocation;
         break;
    }

  return ret_url;
}


function ilevel_str(level_no,in_mode) {
  var ret_str="";
  var y=0;
  var mode = (in_mode > 0) ? in_mode : -in_mode;
  var level = (level_no < 10) ? level_no : level_no - 10;
  var lochost = location.href;
  if (location.href.indexOf("smartid.gov.hk") == -1) {
    lochost = "www.smartid.gov.hk/";
  }
  if (level_no > 10 || location.href.indexOf("search.info.gov.hk") != -1 ||
    location.href.indexOf("sc.info.gov.hk/gb/search.info.gov.hk") != -1) {
    switch(mode) {
    case 1:
      ret_str = "http://" + lochost + "en/";
      break;
    case 2:
      ret_str = "http://" + lochost + "tc/";
      break;
    case 3:
      ret_str = "http://" + lochost + "sc/";
      break;
    default:
      ret_str = "http://" + lochost + "en/";
      break;
    }
  } else {
    for(y=0;y<level;y++) {
      ret_str = ret_str + "../";
    }
  }

  return ret_str;
}


function build_header(in_mode, alt_lang, level_no) {
var vhost = location.href;

  //1: English Graphic, 2: TC Graphic, 3: SC Graphic, 4: English Text, 5: TC Text, 6:SC Text
  //alt_lang: 0 = No, 1 = Yes

  if (location.href.indexOf("sc.info.gov.hk") != -1 && in_mode==2 ) {
    in_mode = 3;
  }
  else {
     if (location.href.indexOf("sc.info.gov.hk") != -1  && in_mode==5 ) {
        in_mode = 6;
     }
  }

  vlength = location.href.length;

if (location.host == "sc.info.gov.hk") {
    if ( location.href.indexOf("www0.smartid.gov.hk") == -1 ) {
       vhost = "www.smartid.gov.hk";
    } else {
       vhost = "www0.smartid.gov.hk";
    }
	}

  if (in_mode==1 || in_mode==2 || in_mode==3 || in_mode==4 || in_mode==5 || in_mode==6) {

//New 

    switch (in_mode) {
      case 1: //English
	  document.writeln('</form>');
            document.writeln('<form action="http://search.gov.hk/search.html" method="get" name="search" id="search">');
            document.writeln('<input type="hidden" name="ui_lang" value="en" />');
            document.writeln('<input type="hidden" name="ui_charset" value="iso-8859-1" />');
            document.writeln('<input type="hidden" name="gp0" value="smartid_home" />');
            document.writeln('<input type="hidden" name="gp1" value="smartid_home" />');
            document.writeln('<input type="hidden" name="tpl_id" value="smartid" />');
            document.writeln('<input type="hidden" name="web" value="this" />');

            document.writeln('<TR>');
            document.writeln('<TD ROWSPAN=2 COLSPAN=10 BGCOLOR=#FFFF8B> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_01.jpg" WIDTH=485 HEIGHT=65 ALT=""></TD>');
            document.write('<TD bgColor=#FFFF8B colSpan=5 align=right><KANHANBYPASS><A href="http://www.brandhk.gov.hk/brandhk/eindex.htm" target=_blank><IMG alt="Brand Hong Kong - Asia');
			document.write("'");
			document.write('s world city" border=0 src="'+ilevel_str(level_no,in_mode)+'images/topbar_15.gif" WIDTH=190 HEIGHT=60 ></A></KANHANBYPASS></TD></TR>');
            document.writeln('<TR>'); 
            document.writeln('<TD ROWSPAN=2 bgColor=#FFFF8B rowSpan=4 vAlign=bottom><INPUT class=search name=query size=12> </TD>');
            document.writeln('<TD  ROWSPAN=2 BGCOLOR=#FFFF8B> <A href="javascript:document.forms[1].submit()"');
	    document.writeln('ONMOUSEOVER="changeImages('+"'topbar_28', '"+ilevel_str(level_no,in_mode)+"images/topbar_28-over.jpg');"+' return true;"');
	    document.writeln('ONMOUSEOUT="changeImages('+"'topbar_28', '"+ilevel_str(level_no,in_mode)+"images/topbar_28.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_28" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_28.jpg" WIDTH=20 HEIGHT=20 BORDER=0 ALT="SEARCH"></A></TD>');
            document.writeln('<TD ROWSPAN=2 BGCOLOR=#FFFF8B> <a href="/en/sitemap/index.html"');
	    document.writeln('ONMOUSEOVER="changeImages('+"'topbar_29', '"+ilevel_str(level_no,in_mode)+"images/topbar_29-over.jpg');"+' return true;"');
	    document.writeln('ONMOUSEOUT="changeImages('+"'topbar_29', '"+ilevel_str(level_no,in_mode)+"images/topbar_29.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_29" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_29.jpg" WIDTH=65 HEIGHT=20 BORDER=0 ALT="SITE MAP"></A></TD>');
            document.writeln('<TD ROWSPAN=2 COLSPAN=2 BGCOLOR=#FFFF8B> <a href="/en/contact/index.html"');
	    document.writeln('ONMOUSEOVER="changeImages('+"'topbar_30', '"+ilevel_str(level_no,in_mode)+"images/topbar_30-over.jpg');"+' return true;"');
	    document.writeln('ONMOUSEOUT="changeImages('+"'topbar_30', '"+ilevel_str(level_no,in_mode)+"images/topbar_30.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_30" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_30.jpg" WIDTH=35 HEIGHT=20 BORDER=0 ALT="CONTACT US"></A></TD>');
            document.writeln('</TR>'); 


            document.writeln('<TR>'); 
            document.writeln('<TD BGCOLOR=#CC3333> <A HREF="http://www.gov.hk/en/residents/" target=_blank');
	    document.writeln('ONMOUSEOVER="changeImages('+"'topbar_17', '"+ilevel_str(level_no,in_mode)+"images/topbar_17-over.gif');"+' return true;"');
	    document.writeln('ONMOUSEOUT="changeImages('+"'topbar_17', '"+ilevel_str(level_no,in_mode)+"images/topbar_17.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_17" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_17.gif" WIDTH=179 HEIGHT=23 BORDER=0 ALT="GovHK"></A></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <a href="'+location.protocol+'//'+std_link(4)+'"');
	    document.writeln('ONMOUSEOVER="changeImages('+"'topbar_19', '"+ilevel_str(level_no,in_mode)+"images/topbar_19-over.gif');"+' return true;"');
	    document.writeln('ONMOUSEOUT="changeImages('+"'topbar_19', '"+ilevel_str(level_no,in_mode)+"images/topbar_19.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_19" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_19.gif" WIDTH=60 HEIGHT=23 BORDER=0 ALT="Text Only"></A></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_20.gif" WIDTH=20 HEIGHT=23 ALT=""></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <a href="'+location.protocol+'//'+std_link(2)+'"');
	    document.writeln('ONMOUSEOVER="changeImages('+"'topbar_21', '"+ilevel_str(level_no,in_mode)+"images/topbar_21-over.gif');"+' return true;"');
	    document.writeln('ONMOUSEOUT="changeImages('+"'topbar_21', '"+ilevel_str(level_no,in_mode)+"images/topbar_21.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_21" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_21.gif" WIDTH=40 HEIGHT=23 BORDER=0 ALT="Traditional Chinese"></A></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_22.gif" WIDTH=20 HEIGHT=23 ALT=""></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <A HREF="'+location.protocol+'//'+std_link(3)+'"');
	    document.writeln('ONMOUSEOVER="changeImages('+"'topbar_23', '"+ilevel_str(level_no,in_mode)+"images/topbar_23-over.gif');"+' return true;"');
	    document.writeln('ONMOUSEOUT="changeImages('+"'topbar_23', '"+ilevel_str(level_no,in_mode)+"images/topbar_23.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_23" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_23.gif" WIDTH=40 HEIGHT=23 BORDER=0 ALT="Simplified Chinese"></A></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_22.gif" WIDTH=20 HEIGHT=23 ALT=""></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_24.gif" WIDTH=20 HEIGHT=23 ALT=""></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_25.jpg" WIDTH=79 HEIGHT=23 ALT=""></TD>');
            document.writeln('<TD BGCOLOR=#FFFF8B> <a href="/en/search/index.html"');
	    document.writeln('ONMOUSEOVER="changeImages('+"'topbar_26', '"+ilevel_str(level_no,in_mode)+"images/topbar_26-over.jpg');"+' return true;"');
	    document.writeln('ONMOUSEOUT="changeImages('+"'topbar_26', '"+ilevel_str(level_no,in_mode)+"images/topbar_26.jpg');"+' return true;"> ');
             document.writeln('<IMG NAME="topbar_26" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_26.jpg" WIDTH=55 HEIGHT=20 BORDER=0 ALT="SEARCH"></A></TD>');
	    document.writeln('</TR>');

            document.writeln('<TR>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=179></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=60></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=20></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=40></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=20></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=40></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=20></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=20></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=79></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=55></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=100></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=20></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=65></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=15></TD>');
            document.writeln('<TD bgColor="#BB3333"><IMG alt="" height=2 src="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" width=20></TD>');
            document.writeln('</TR>');

	    break;
      case 2:  //Traditional Chinese
	  document.writeln('</form>');
            document.writeln('<form action="http://search.gov.hk/search.html" method="get" name="search" id="search">');
            document.writeln('<input type="hidden" name="ui_lang" value="zh-hk" />');
            document.writeln('<input type="hidden" name="ui_charset" value="big5" />');
            document.writeln('<input type="hidden" name="gp0" value="smartid_home" />');
            document.writeln('<input type="hidden" name="gp1" value="smartid_home" />');
            document.writeln('<input type="hidden" name="tpl_id" value="smartid" />');
            document.writeln('<input type="hidden" name="web" value="this" />');

            document.writeln('<TR> ');
            document.writeln('<TD  ROWSPAN=2 COLSPAN=8 BGCOLOR=#FFFF8B> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_01.jpg" WIDTH=485 HEIGHT=65 ALT=""></TD>');
            document.writeln('<TD COLSPAN=5  align="center" BGCOLOR=#FFFF8B> <kanhanbypass><A HREF="http://www.brandhk.gov.hk/brandhk/index.htm" target="_blank"> ');
            document.writeln('<IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_15.gif" WIDTH=190 HEIGHT=60 BORDER=0 ALT="香港品牌形象 - 亞洲國際都會"></A></kanhanbypass></TD>');
            document.writeln('</TR>');

            document.writeln('<TR>');
            document.writeln('<TD  height=19 ROWSPAN=2 valign="bottom" BGCOLOR=#FFFF8B> <input class="search" type="text" name="query" size="12"> ');
            document.writeln('</TD>');
            document.writeln('<TD ROWSPAN=2 BGCOLOR=#FFFF8B> <A HREF="javascript:document.forms[1].submit()"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_28', '"+ilevel_str(level_no,in_mode)+"images/topbar_28-over.jpg');"+' return true;"');
	    document.writeln('    ONMOUSEOUT="changeImages('+"'topbar_28', '"+ilevel_str(level_no,in_mode)+"images/topbar_28.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_28" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_28.jpg" WIDTH=20 HEIGHT=20 BORDER=0 ALT="搜尋"></A></TD>');
            document.writeln('<TD ROWSPAN=2 BGCOLOR=#FFFF8B> <a href="/tc/sitemap/index.html"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_29', '"+ilevel_str(level_no,in_mode)+"images/topbar_29-over.jpg');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_29', '"+ilevel_str(level_no,in_mode)+"images/topbar_29.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_29" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_29.jpg" WIDTH=65 HEIGHT=20 BORDER=0 ALT="網頁指南"></A></TD>');
            document.writeln('<TD ROWSPAN=2 COLSPAN=2 BGCOLOR=#FFFF8B> <a href="/tc/contact/index.html"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_30', '"+ilevel_str(level_no,in_mode)+"images/topbar_30-over.jpg');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_30', '"+ilevel_str(level_no,in_mode)+"images/topbar_30.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_30" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_30.jpg" WIDTH=35 HEIGHT=20 BORDER=0 ALT="聯絡我們"></A></TD>');
            document.writeln('</TR>');


            document.writeln('<TR> ');
            document.writeln('<TD BGCOLOR=#CC3333> <kanhanbypass><A HREF="http://www.gov.hk/tc/residents/" target="_blank"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_17', '"+ilevel_str(level_no,in_mode)+"images/topbar_17-over.gif');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_17', '"+ilevel_str(level_no,in_mode)+"images/topbar_17.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_17" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_17.gif" WIDTH=179 HEIGHT=23 BORDER=0 ALT="GovHK 香港政府一站通"></A></kanhanbypass></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <a href="'+location.protocol+'//'+std_link(5)+'"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_19', '"+ilevel_str(level_no,in_mode)+"images/topbar_19-over.gif');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_19', '"+ilevel_str(level_no,in_mode)+"images/topbar_19.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_19" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_19.gif" WIDTH=75 HEIGHT=23 BORDER=0 ALT="繁體純文字"></A></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_20.gif" WIDTH=25 HEIGHT=23 ALT=""></TD>');

            document.writeln('<TD BGCOLOR=#FF9900><kanhanbypass> <a href="'+location.protocol+'//'+std_link(3)+'"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_21', '"+ilevel_str(level_no,in_mode)+"images/topbar_21-over.gif');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_21', '"+ilevel_str(level_no,in_mode)+"images/topbar_21.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_21" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_21.gif" WIDTH=45 HEIGHT=23 BORDER=0 ALT="簡體版"></A></kanhanbypass></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_22.gif" WIDTH=25 HEIGHT=23 ALT=""></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <A HREF="'+location.protocol+'//'+std_link(1)+'"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_23', '"+ilevel_str(level_no,in_mode)+"images/topbar_23-over.gif');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_23', '"+ilevel_str(level_no,in_mode)+"images/topbar_23.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_23" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_23.gif" WIDTH=70 HEIGHT=23 BORDER=0 ALT="English"></A></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_24.gif" WIDTH=66 HEIGHT=23 ALT=""></TD>');
            document.writeln('<TD BGCOLOR=#FFFF8B> <a href="/tc/search/index.html"');
	    document.writeln('    ONMOUSEOVER="changeImages('+"'topbar_26', '"+ilevel_str(level_no,in_mode)+"images/topbar_26-over.jpg');"+' return true;"');
	    document.writeln('    ONMOUSEOUT="changeImages('+"'topbar_26', '"+ilevel_str(level_no,in_mode)+"images/topbar_26.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_26" SRC="'+ilevel_str(level_no,in_mode)+'images/topbar_26.jpg" WIDTH=55 HEIGHT=20 BORDER=0 ALT="搜尋"></A></TD>');
          document.writeln('</TR>');

            document.writeln('<TR> ');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=179 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=75 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=25 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=45 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=25 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=70 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=66 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=55 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=100 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=20 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=65 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=15 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'images/spacer.gif" WIDTH=20 HEIGHT=2 ALT=""></TD>');
            document.writeln('</TR>');

	    break;
       case 3:  //Simplified Chinese
	  document.writeln('</form>');

            document.writeln('<form action="http://sc.info.gov.hk/TuniS/search.gov.hk/search.html" method="get" name="search" id="search">');
            document.writeln('<input type="hidden" name="ui_lang" value="zh-cn" />');
            document.writeln('<input type="hidden" name="ui_charset" value="utr-8" />');
            document.writeln('<input type="hidden" name="gp0" value="smartid_home" />');
            document.writeln('<input type="hidden" name="gp1" value="smartid_home" />');
            document.writeln('<input type="hidden" name="tpl_id" value="smartid" />');
            document.writeln('<input type="hidden" name="web" value="this" />');
			

            document.writeln('<TR> ');
            document.writeln('<TD ROWSPAN=2 COLSPAN=8 BGCOLOR=#FFFF8B> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_01.jpg" WIDTH=485 HEIGHT=65 ALT=""></TD>');
            document.writeln('<TD COLSPAN=5 align="right" BGCOLOR=#FFFF8B> <kanhanbypass><A HREF="http://www.brandhk.gov.hk/brandhk/index.htm" target="_blank"> ');
            document.writeln('<IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_15.gif" WIDTH=190 HEIGHT=60 BORDER=0 ALT="香港品牌形象 - 亚洲国际都会"></A></kanhanbypass></TD>');
            document.writeln('</TR>');
            document.writeln('<TR> ');

            document.writeln('<TD ROWSPAN=2 valign="bottom" BGCOLOR=#FFFF8B> <input class="search" type="text" name="query" size="12"> ');
            document.writeln('<TD ROWSPAN=2 BGCOLOR=#FFFF8B> ');
			
			document.writeln('<A HREF="javascript:document.forms[1].submit()"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_28', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_28-over.jpg');"+' return true;"');
	    document.writeln('    ONMOUSEOUT="changeImages('+"'topbar_28', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_28.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_28" SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_28.jpg" WIDTH=20 HEIGHT=20 BORDER=0 ALT="搜寻"></A></TD>');
            document.writeln('<TD ROWSPAN=2 BGCOLOR=#FFFF8B> <a href="/sc/sitemap/index.html"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_29', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_29-over.jpg');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_29', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_29.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_29" SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_29.jpg" WIDTH=65 HEIGHT=20 BORDER=0 ALT="网页指南"></A></TD>');
            document.writeln('<TD ROWSPAN=2 COLSPAN=2 BGCOLOR=#FFFF8B> <a href="http://'+vhost+'/tc/contact/index.html"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_30', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_30-over.jpg');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_30', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_30.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_30" SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_30.jpg" WIDTH=35 HEIGHT=20 BORDER=0 ALT="联络我们"></A></TD>');
            document.writeln('</TR>');


            document.writeln('<TR> ');
            document.writeln('<TD BGCOLOR=#FF9900> <kanhanbypass><A HREF="http://www.gov.hk/sc/residents/" target="_blank"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_17', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_17-over.gif');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_17', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_17.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_17" SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_17.gif" WIDTH=179 HEIGHT=23 BORDER=0 ALT="香港政府一站通"></A></kanhanbypass></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <a href="'+location.protocol+'//'+std_link(6)+'"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_19', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_19-over.gif');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_19', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_19.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_19" SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_19.gif" WIDTH=75 HEIGHT=23 BORDER=0 ALT="简体纯文字"></A></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_20.gif" WIDTH=25 HEIGHT=23 ALT=""></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <A HREF="'+location.protocol+'//'+std_link(2)+'"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_21', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_21-over.gif');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_21', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_21.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_21" SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_21.gif" WIDTH=45 HEIGHT=23 BORDER=0 ALT="繁体版"></A></kanhanbypass></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_22.gif" WIDTH=25 HEIGHT=23 ALT=""></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <A HREF="'+location.protocol+'//'+std_link(1)+'"');
	    document.writeln('	  ONMOUSEOVER="changeImages('+"'topbar_23', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_23-over.gif');"+' return true;"');
	    document.writeln('	  ONMOUSEOUT="changeImages('+"'topbar_23', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_23.gif');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_23" SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_23.gif" WIDTH=70 HEIGHT=23 BORDER=0 ALT="English"></A></TD>');
            document.writeln('<TD BGCOLOR=#FF9900> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_24.gif" WIDTH=66 HEIGHT=23 ALT=""></TD>');
            document.writeln('<TD BGCOLOR=#FFFF8B Width=55 Align=Center> <a href="/sc/search/index.html"');
	    document.writeln('    ONMOUSEOVER="changeImages('+"'topbar_26', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_26-over.jpg');"+' return true;"');
	    document.writeln('    ONMOUSEOUT="changeImages('+"'topbar_26', '"+ilevel_str(level_no,in_mode)+"../sc/images/topbar_26.jpg');"+' return true;"> ');
            document.writeln('<IMG NAME="topbar_26" SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/topbar_26.jpg" WIDTH=36 HEIGHT=19 BORDER=0 ALT="搜寻"></A></TD>');
            document.writeln('</TR>');


            document.writeln('<TR> ');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=179 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=75 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=25 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=45 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=25 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=70 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=66 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=55 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=100 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=20 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=65 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=15 HEIGHT=2 ALT=""></TD>');
            document.writeln('<TD bgcolor="#BB3333"> <IMG SRC="'+ilevel_str(level_no,in_mode)+'../sc/images/spacer.gif" WIDTH=20 HEIGHT=2 ALT=""></TD>');
            document.writeln('</TR>');
	    break;

       case 4:
            document.writeln('<p>');
            document.writeln('<font size="2" face="Geneva, Arial, Helvetica, sans-serif">');
            document.writeln('<a href="'+location.protocol+'//'+std_link(1)+'">Graphical Mode</a> | ');
            document.writeln('<a href="'+location.protocol+'//'+std_link(5)+'">Traditional Chinese</a> | ');
            document.writeln('<a href="'+location.protocol+'//'+std_link(6)+'">Simplified Chinese</a> | ');
            document.writeln('<a href="/t_en/search/index.html">Search</a> | ');
            document.writeln('<a href="/t_en/sitemap/index.html">Site Map</a> | ');
            document.writeln('<a href="/t_en/contact/index.html">Contact Us</a> | ');
            document.writeln('<a href="/t_en/index.html">Home</a> | ');
            document.writeln('</font></p>');
            break;
       case 5:
            document.writeln('<P>');
            document.writeln('<FONT face="Geneva, Arial, Helvetica, sans-serif" size=2>');
            document.writeln('<A href="'+location.protocol+'//'+std_link(2)+'">圖文版</A>| <KANHANBYPASS> ');
            document.writeln('<A href="'+location.protocol+'//'+std_link(4)+'">英文</A></KANHANBYPASS> | ');
            document.writeln('<A href="'+location.protocol+'//'+std_link(6)+'">簡體版 </A>| ');
            document.writeln('<A href="/t_tc/search/index.html">搜尋</A>|  ');
            document.writeln('<A href="/t_tc/sitemap/index.html">網頁指南</A> | ');
            document.writeln('<A href="/t_tc/contact/index.html">聯絡我們</A> | ');
            document.writeln('<A href="/t_tc/index.html">主頁</A> | ');
            document.writeln('</FONT></P>');
            break;
       case 6:
            document.writeln('<P>');
            document.writeln('<FONT face="Geneva, Arial, Helvetica, sans-serif" size=2>');
            document.writeln('<A href="'+location.protocol+'//'+std_link(3)+'">图文版</A> | <KANHANBYPASS> ');
            document.writeln('<A href="'+location.protocol+'//'+std_link(4)+'">英文</A></KANHANBYPASS> | ');
            document.writeln('<A href="'+location.protocol+'//'+std_link(5)+'">繁体版</A> | ');
            document.writeln('<A href="http://www.smartid.gov.hk/t_sc/search/index.html">搜寻</A> | ');
            document.writeln('<A href="/t_tc/sitemap/index.html">网页指南</A> | ');
            document.writeln('<A href="/t_tc/contact/index.html">联络我们</A> | ');
            document.writeln('<A href="/t_tc/index.html">主页</A> | ');
            document.writeln('</FONT></P>');
            break;

    }    

  }
}
