// JavaScript Document
function chLang(lang) {
	var link = parent.location.href;
	var endLink = link.length;
	var i;
	var n;
	var found = 0;
	
	for(i = 0; i <= endLink; i++) {
		n = i + 3;
		if (link.substring(i, n) == "/en") {
			chLink = link.substring(0, i) + lang + link.substring(n, endLink);
			break;
		}
				else if (link.substring(i, n) == "/tc") {
			chLink = link.substring(0, i) + lang + link.substring(n, endLink);
			break;
		}				else if (link.substring(i, n) == "/gb") {
			chLink = link.substring(0, i) + lang + link.substring(n, endLink);
			break;
		}
	}
	//alert(lang);

	var reg_exp = new RegExp("#+[0-9a-zA-Z]+", "g");
	chLink = chLink.replace(reg_exp, "");
	chLink = chLink.replace("#", "");

	parent.location.href = chLink;
}

function go(page) {
	if (page != 0)
		self.location.href = page;
}

function writeflash(hyperlink,width,height){
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,29,0\" width=\"" + width + "\" height=\"" + height + "\">");
    document.write("<param name=\"movie\" value=\"" + hyperlink + "\">");
    document.write("<param name=\"quality\" value=\"high\">");
    document.write("<param name=\"wmode\" value=\"transparent\">");
	document.write("<param name=\"allowNetworking\" value=\"all\">");
	document.write("<param name=\"allowScriptAccess\" value=\"samedomain\">");
    document.write("<embed src=\"" + hyperlink + "\" quality=\"high\" allowNetworking=\"all\" allowScriptAccess=\"samedomain\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\" wmode=\"transparent\" type=\"application\/x-shockwave-flash\"  width=\"" + width + "\" height=\"" + height + "\"></embed>");
    document.write("</object>");
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

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_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_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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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; }
}

function header1(){
	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
    document.write('<tr>');
	document.write('<td width="15%" align="center" height="25" style="padding: 5px 1px 5px 1px" class="headerText"><a href="#" class="headerText">Home</a></td>');
	document.write('<td width="2%" align="center" style="padding: 5px 1px 5px 1px" class="headerText"> | </td>');
    document.write('<td width="20%" align="center" style="padding: 5px 1px 5px 1px" class="headerText"><a href="engtxt/index.html" class="headerText">Text Only</a></td>');
	document.write('<td align="center" style="padding: 5px 1px 5px 1px" class="headerText" width="2%"> | </td>');
	document.write('<td align="center" style="padding: 5px 1px 5px 1px" class="headerText" width="30%">');
	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
	document.write('  <tr>');
	document.write('    <td width="63%" align="center" class="headerText">Font Size<\/td>');
	document.write('    <td width="37%" style="padding: 0px 1px 4px 1px"><a href="javascript:increaseFontSize();"><img src="images\/common\/img_plus_off.gif" name="increase" border="0" id="increase" onMouseOver="MM_swapImage(\'increase\',\'\',\'images\/common\/img_plus_on.gif\',1)" onMouseOut="MM_swapImgRestore()"><\/a><a href="javascript:decreaseFontSize();"><img src="images\/common\/img_minus_off.gif" name="decrease" border="0" id="decrease" onMouseOver="MM_swapImage(\'decrease\',\'\',\'images\/common\/img_minus_on.gif\',1)" onMouseOut="MM_swapImgRestore()"><\/a><\/td>');
	document.write('  <\/tr>');
	document.write('<\/table></td>');
	document.write('<td align="center" style="padding: 5px 0px 5px 0px" class="headerText" width="2%"> | </td>');
	document.write(' <td align="center" style="padding: 5px 0px 5px 0px" width="10%"><a href="javascript:chLang(\'\/tc\');"  class="footerText">中文</a> </td>');
    document.write('</tr>');
    document.write('</table>');
}





function header2(){
	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
    document.write('<tr>');
	document.write('<td align="center" height="25" style="padding: 5px 1px 5px 1px" class="headerText" width="15%"><a href="../index.html" class="headerText">Home</a></td>');
	document.write('<td align="center" style="padding: 5px 1px 5px 1px" class="headerText" width="2%"> | </td>');
    document.write('<td align="center" style="padding: 5px 1px 5px 1px" class="headerText" width="20%"><a href="../engtxt/index.html" class="headerText">Text Only</a></td>');
	document.write('<td align="center" style="padding: 5px 1px 5px 1px" class="headerText" width="2%"> | </td>');
document.write('<td align="center" style="padding: 5px 1px 5px 1px" class="headerText" width="30%">');
	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
	document.write('  <tr>');
	document.write('    <td width="63%" align="center" class="headerText" >Font Size<\/td>');
	document.write('    <td width="37%" style="padding: 0px 1px 4px 1px"><a href="javascript:increaseFontSize();"><img src="..\/images\/common\/img_plus_off.gif" name="increase" border="0" id="increase" onMouseOver="MM_swapImage(\'increase\',\'\',\'..\/images\/common\/img_plus_on.gif\',1)" onMouseOut="MM_swapImgRestore()"><\/a><a href="javascript:decreaseFontSize();"><img src="..\/images\/common\/img_minus_off.gif" name="decrease" border="0" id="decrease" onMouseOver="MM_swapImage(\'decrease\',\'\',\'..\/images\/common\/img_minus_on.gif\',1)" onMouseOut="MM_swapImgRestore()"><\/a><\/td>');
	document.write('  <\/tr>');
	document.write('<\/table></td>');
	document.write('<td align="center" style="padding: 5px 0px 5px 0px" class="headerText" width="2%"> | </td>');
	document.write(' <td align="center" style="padding: 5px 0px 5px 0px" width="10%"><a href="javascript:chLang(\'\/tc\');" class="footerText">中文</a> </td>');
    document.write('</tr>');
    document.write('</table>');
}


function footer_main(){
	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
	document.write('<tr>');
	document.write('<td width="54%" class="footerText" style="padding: 10px 0px 10px 8px">Copyright©2009 Kowloon-Canton Railway Corporation. All rights reserved.</td>');
	document.write('<td align="center" style="padding: 10px 5px 10px 5px"><a href="#" class="footerText" onClick="MM_openBrWindow(\'footerpops/disclaimer.html\',\'\',\'width=600,height=450\')">Disclaimer</a></td>');
	document.write('<td width="1" align="center" class="footerText">|</td>');
	document.write('<td align="center" style="padding: 10px 5px 10px 5px"><a href="#" class="footerText" onClick="MM_openBrWindow(\'footerpops/kcrc_ordinance.html\',\'\',\'width=600,height=450\')">KCRC Ordinance</a></td>');
	document.write('<td width="1" align="center" class="footerText">|</td>');
	document.write('<td align="center" style="padding: 10px 5px 10px 5px"><a href="#" class="footerText" onClick="MM_openBrWindow(\'footerpops/useful_links.html\',\'\',\'width=600,height=450\')">Useful Links</a></td>');
	document.write('<td width="1" align="center" class="footerText">|</td>');
	document.write('<td align="center" style="padding: 10px 5px 10px 5px"><a href="#" class="footerText" onClick="MM_openBrWindow(\'footerpops/contactus.html\',\'\',\'width=600,height=450\')">Contact Us</a></td>');
	document.write('<td width="1" align="center" class="footerText">|</td>');
	document.write('<td align="center" style="padding: 10px 5px 10px 5px"><a href="#" class="footerText" onClick="MM_openBrWindow(\'footerpops/sitemap.html\',\'\',\'width=600,height=450\')">Sitemap</a></td>');
	document.write(' </tr>');
	document.write('</table>');
}

function footer(){
	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
	document.write('<tr>');
	document.write('<td width="54%" class="footerText" style="padding: 10px 0px 10px 8px">Copyright©2009 Kowloon-Canton Railway Corporation. All rights reserved.</td>');
	document.write('<td align="center" style="padding: 10px 5px 10px 5px"><a href="#" class="footerText" onClick="MM_openBrWindow(\'../footerpops/disclaimer.html\',\'\',\'width=600,height=450\')">Disclaimer</a></td>');
	document.write('<td width="1" align="center" class="footerText">|</td>');
	document.write('<td align="center" style="padding: 10px 5px 10px 5px"><a href="#" class="footerText" onClick="MM_openBrWindow(\'../footerpops/kcrc_ordinance.html\',\'\',\'width=600,height=450\')">KCRC Ordinance</a></td>');
	document.write('<td width="1" align="center" class="footerText">|</td>');
	document.write('<td align="center" style="padding: 10px 5px 10px 5px"><a href="#" class="footerText" onClick="MM_openBrWindow(\'../footerpops/useful_links.html\',\'\',\'width=600,height=450\')">Useful Links</a></td>');
	document.write('<td width="1" align="center" class="footerText">|</td>');
	document.write('<td align="center" style="padding: 10px 5px 10px 5px"><a href="#" class="footerText" onClick="MM_openBrWindow(\'../footerpops/contactus.html\',\'\',\'width=600,height=450\')">Contact Us</a></td>');
	document.write('<td width="1" align="center" class="footerText">|</td>');
	document.write('<td align="center" style="padding: 10px 5px 10px 5px"><a href="#" class="footerText" onClick="MM_openBrWindow(\'../footerpops/sitemap.html\',\'\',\'width=600,height=450\')">Sitemap</a></td>');
	document.write(' </tr>');
	document.write('</table>');
}