function showGlobal(hostLink, postNum, filename) {
  findHost(hostLink, postNum);
  var txt_button = "global_txt_chi.gif";
   var locapath = document.location.href;
  locapath = locapath.toLowerCase();  	
  global = '<table border="0" cellpadding="0" cellspacing="0">'
         + '  <tr>';

  if (filename == "null.html") {
    global = global + '    <td><a href="#"><img src="' + siteLink + 'common/global_txt_chi.gif" height="15" vspace="2" border="0"></a></td>';
  }
  else {
	  if (locapath.toString().search('/bm/web/')!= -1){
		
			global = global + '    <td><a href="' + filename + '&Version=big5Chinese" class="global"><img src="' + siteLink + 'common/global_txt_cn.gif" border="0"></a></td>';
			global = global + '    <td><img src="' + siteLink + 'common/spacer.gif" width="14" height="1"></td>';
			global = global + '    <td><a href="' + filename + '&Version=gbChinese" class="global"><img src="' + siteLink + 'common/global_txt_gb.gif" border="0"></a></td>';
		
	  }else{
        locapath = document.location.href;
		if (locapath.toString().search('/newsletter/')!= -1){
			locapath = locapath.replace("top.htm","index_cn.html")
			global = global + '    <td><a href="' + locapath + '" class="global"><img src="' + siteLink + 'common/global_txt_cn.gif" border="0"></a></td>'; 
			global = global + '    <td><img src="' + siteLink + 'common/spacer.gif" width="14" height="1"></td>';
			locapath = document.location.href;
			locapath = locapath.replace("top.htm","index_gb.html")
			global = global + '    <td><a href="' + locapath + '" class="global"><img src="' + siteLink + 'common/global_txt_gb.gif" border="0"></a></td>';
		}else{
			if (locapath.toString().search('.html')!= -1){
				locapath = locapath.replace(".html","_cn.html")
				global = global + '    <td><a href="' + locapath + '" class="global"><img src="' + siteLink + 'common/global_txt_cn.gif" border="0"></a></td>'; 
				global = global + '    <td><img src="' + siteLink + 'common/spacer.gif" width="14" height="1"></td>';
				locapath = document.location.href;
				locapath = locapath.replace(".html","_gb.html")
				global = global + '    <td><a href="' + locapath + '" class="global"><img src="' + siteLink + 'common/global_txt_gb.gif" border="0"></a></td>';
			}else{
				//locapath = locapath.replace(".html","_cn.html")
				global = global + '    <td><a href="' + locapath + 'index_cn.html" class="global"><img src="' + siteLink + 'common/global_txt_cn.gif" border="0"></a></td>'; 
				global = global + '    <td><img src="' + siteLink + 'common/spacer.gif" width="14" height="1"></td>';
				//locapath = document.location.href;
				//locapath = locapath.replace(".html","_gb.html")
				global = global + '    <td><a href="' + locapath + 'index_gb.html" class="global"><img src="' + siteLink + 'common/global_txt_gb.gif" border="0"></a></td>';
			}
		}
	  }
  }
   global = global       + '    <td><img src="' + siteLink + 'common/spacer.gif" width="14" height="1"></td>'
         + '    <td><a href="' + siteLink + 'enquiry/index.html" class="global">ENQUIRY</a></td>'
         + '    <td><img src="' + siteLink + 'common/spacer.gif" width="14" height="1"></td>'
         + '    <td><a href="' + siteLink + 'sitemap/index.html" class="global">SITEMAP</a></td>'
         + '    <td><img src="' + siteLink + 'common/spacer.gif" width="14" height="1"></td>'
         + '    <td><a href="' + siteLink + 'search/index.html" class="global">SEARCH</a></td>'
         + '    <td><img src="' + siteLink + 'common/spacer.gif" width="14" height="1"></td>'
         + '    <td><a href="http://www.ust.hk" target="_blank" class="global">HKUST</a></td>'
         + '    <td><img src="' + siteLink + 'common/spacer.gif" width="18" height="19"></td>'
         + '  </tr>'
         + '</table>'
  document.write(global);
}

function showNav(hostLink, postNum, dir) {
  findHost(hostLink, postNum);
  nav = '<table border="0" cellpadding="0" cellspacing="0">'
      + '  <tr>' 
      + '    <td><a href="' + siteLink + 'school/index.html" onMouseOver="MM_swapImage(\'btn_nav01\',\'\',\'' + siteLink + dir +'/img/btn_nav01_f2.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="' + siteLink + dir +'/img/btn_nav01.gif" name="btn_nav01" height="23" border="0" id="btn_nav01"></a></td>'
      + '    <td><a href="' + siteLink + 'programs/index.html" onMouseOver="MM_swapImage(\'btn_nav02\',\'\',\'' + siteLink + dir +'/img/btn_nav02_f2.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="' + siteLink + dir +'/img/btn_nav02.gif" name="btn_nav02" height="23" border="0" id="btn_nav02"></a></td>'
      + '    <td><a href="' + siteLink + 'exec_prog/index.html" onMouseOver="MM_swapImage(\'btn_nav03\',\'\',\'' + siteLink + dir +'/img/btn_nav03_f2.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="' + siteLink + dir +'/img/btn_nav03.gif" name="btn_nav03" height="23" border="0" id="btn_nav03"></a></td>'
      + '    <td><a href="' + siteLink + 'depts/index.html" onMouseOver="MM_swapImage(\'btn_nav04\',\'\',\'' + siteLink + dir +'/img/btn_nav04_f2.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="' + siteLink + dir +'/img/btn_nav04.gif" name="btn_nav04" height="23" border="0" id="btn_nav04"></a></td>'
      + '    <td><a href="' + siteLink + 'research/index.html" onMouseOver="MM_swapImage(\'btn_nav05\',\'\',\'' + siteLink + dir +'/img/btn_nav05_f2.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="' + siteLink + dir +'/img/btn_nav05.gif" name="btn_nav05" height="23" border="0" id="btn_nav05"></a></td>'
      + '    <td><a href="' + siteLink + 'media/index.html" onMouseOver="MM_swapImage(\'btn_nav06\',\'\',\'' + siteLink + dir +'/img/btn_nav06_f2.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="' + siteLink + dir +'/img/btn_nav06.gif" name="btn_nav06" height="23" border="0" id="btn_nav06"></a></td>'
      + '    <td><a href="' + siteLink + 'index.html" onMouseOver="MM_swapImage(\'btn_nav07\',\'\',\'' + siteLink + dir +'/img/btn_nav07_f2.gif\',1)" onMouseOut="MM_swapImgRestore()"><img src="' + siteLink + dir +'/img/btn_nav07.gif" name="btn_nav07" height="23" border="0" id="btn_nav07"></a></td>'
      + '    <td><img src="' + siteLink + 'common/spacer.gif" width="8" height="23"></td>'
      + '  </tr>'
      + '</table>'
  document.write(nav);
}

