﻿

	var existing_lang_url = "";
	var redirect_lang_url = "";
	var url_start_index = 0;
	var url_length = 0;

	// define the existing URL.
	existing_lang_url = document.location.pathname;

	// find the "english" wording in english page URL and replace is by "chinese";
	if (existing_lang_url.search("en_txt") != -1) {
		redirect_lang_url = existing_lang_url.replace(/en_txt/i, "cn_txt" );
	} 
	else {
	// find the "chinese" wording in english page URL and replace is by "english";
		redirect_lang_url = existing_lang_url.replace(/cn_txt/i, "en_txt" );
	}

	// define the absolute path of the redirect URL and ignore the HTTP:// and C:/;
	url_length = redirect_lang_url.length;
	url_start_index = redirect_lang_url.indexOf("www.fhb.gov.hk");
	//alert(redirect_lang_url);
	//redirect_lang_url = redirect_lang_url.substr(url_start_index, url_length);
	//gb_url_str = "//sc.info.gov.hk/gb/www.fhb.gov.hk"+redirect_lang_url;
	gb_url_str = redirect_lang_url;
	gb_url_str = gb_url_str.replace("cn_txt","chs_txt");
	// print out the redirect url;
	text_ver_url = existing_lang_url.replace(/en_txt/i, "en" );
	
function graphic_v() { 
	self.location.href = text_ver_url;
}

function gb_v() { 
	self.location.href = gb_url_str;
}

function cn_v() { 
	self.location.href = redirect_lang_url;
}

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;
}



document.write("  <table width=\"760\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">");
document.write("    <tr> ");
document.write("      <td colspan=\"2\" class=\"title\"><kanhanbypass><a href=\"/\">Food and Health Bureau ");
document.write("        <br>");
document.write("        The Government of the Hong Kong Special Administrative Region</a></kanhanbypass></td>");
document.write("    </tr>");
document.write("	    ");
document.write("    <tr> ");
document.write("      <td colspan=\"2\" class=\"title\">&nbsp;</td>");
document.write("    </tr>");
document.write("    <tr valign=\"bottom\"> ");
document.write("      <td height=\"25\" colspan=\"2\" class=\"content\"><a href=\"/en_txt/sitemap.html\">Index</a> ");
document.write("        | <a href=\"javascript:cn_v()\">繁體純文字</a> | <a href=\"javascript:gb_v()\">簡體純文字</a> ");
document.write("        | <a href=\"javascript:graphic_v()\">Graphic Version</a> | <a href=\"/en_txt/sitemap.html\">Site ");
document.write("        Map</a> | <a href=\"/en_txt/contact_us/enquiry/index.html\">Contact Us</a></td>");
document.write("    </tr>");
document.write("    <tr> ");
document.write("      <td class=\"content\"><a href=\"http://www.gov.hk/en/residents/\">GovHK </a>  ");
document.write("        | <a href=\"http://www.brandhk.gov.hk/brandhk/eindex.htm\">Brand Hong Kong - Asia's world city</a></td> ");
document.write("      <td class=\"content\"><div align=\"right\">");
document.write("    <form action=http://search.gov.hk/search.html method=get name=search id=search>");
document.write("	<input type=hidden name=ui_lang value=en>");
document.write("	<input name=gp0 type=hidden value=fhb_home>");
document.write("	<input name=gp1 type=hidden value=fhb_home>");
document.write("	<input type=hidden name=web value=this>");
document.write("	<input type=hidden name=ui_charset value=iso-8859-1");
document.write("	<input type=hidden name=tpl_id value=fhb>");
document.write("          <input name=\"query\" type=\"text\" id=\"query\" size=\"15\">");
document.write("          <a href=\"javascript:window.document.search.submit()\">Search</a> </div></td>");
document.write("</form>");
document.write("    </tr>");
document.write("    <tr> ");
document.write("      <td colspan=\"2\" class=\"content\"><hr>");
document.write("      </td>");
document.write("    </tr>");
document.write("  </table>");

