﻿<!--
/*
 File		: topnav.js

 Purpose    : This javascript file for generating the top navigation bar

 Functions  :

 Remarks    : The TD tag and the Javascript tag must be on the same line

	    The following is the sample codes for including this js file

	<TR>
	    <TD NOWRAP><SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="[js path]/mem_nav.js"></SCRIPT></TD>
	</TR>


 Modification History :
 Version    Date	    By		    Description
 -----------------------------------------------------------------------
 1st	    2002-05-31	   Vivian Au	    First Version
 -----------------------------------------------------------------------
*/

// the variable "thisPath" was initialized in langCommon.js
//the object for storing the url links for the flash files

    var WASApplicationUrls = new Object;
    WASApplicationUrls['ti_ct'] = "/webapp/hactlpbf/CargoTracking/CargoTracking.jsp";
    WASApplicationUrls['nav_contactus_contact'] = "https://" + location.host + "/webapp/hactlpbf/contactus/default.jsp";
    WASApplicationUrls['nav_contactus_visitST1'] = "https://" + location.host + "/webapp/hactlpbf/contactus/tourbooking.jsp";
    WASApplicationUrls['nav_medcentre_newsalert'] = "https://" + location.host + "/webapp/hactlpbf/mediactr/newsalert.jsp";
    WASApplicationUrls['nav_medcentre_cargostat'] = "/webapp/hactlpbf/CargoStatistics/CargoStatistics.jsp";
    WASApplicationUrls['ti_sce'] = "/webapp/hactlpbf/StorageChargeEnquiry/StorageChargeEnquiry.jsp";
    WASApplicationUrls['ti_id_search'] = "/webapp/hactlpbf/pbfcontroller/HDCFDPS1";
    WASApplicationUrls['ti_cal'] = "/webapp/hactlpbf/calculators/metriccon.jsp";

// the variable "thisPath" was initialized in langCommon.js
//the object for storing the url links for the flash files

    var urls = new Object;
    urls['nav_aboutus'] = thisPath + "about/default.htm";
    urls['nav_medcentre'] = thisPath + "mediactr/pressreleases.htm";
    urls['nav_home'] = thisPath + "default.htm";

    if (thisSection == 'ti_ct' || thisSection == 'nav_contactus' || thisSection == 'nav_medcentre' || thisSection == 'ti_id' || thisSection == 'ti_sce'  || thisSection == 'ti_cal' || thisSection == 'ti_search')
    {
	var thisSectionChg;
	var thisFileHref = location.href;

	if ((thisFileHref.indexOf("HDCCTS")) != -1)
	{
	   thisSectionChg = 'nav_contactus_contact';
	}
	else if ((thisFileHref.indexOf("HDCHTB")) != -1)
	{
	   thisSectionChg = 'nav_contactus_visitST1';
	}
	else if ((thisFileHref.indexOf("HDCNAL")) != -1)
	{
	   thisSectionChg = 'nav_medcentre_newsalert';
	}
	else if (((thisFileHref.indexOf("HDCLCT1")) != -1) || ((thisFileHref.indexOf("HDCLTC1")) != -1) || ((thisFileHref.indexOf("HDCLTT1")) != -1) || ((thisFileHref.indexOf("HDCDCT")) != -1))
	{
	   thisSectionChg = 'nav_medcentre_cargostat';
	}
	else if (((thisFileHref.indexOf("HDCFDPS1")) != -1) || ((thisFileHref.indexOf("HDCFDPS2")) != -1)  || ((thisFileHref.indexOf("HDCFDPS3")) != -1)  || ((thisFileHref.indexOf("HDCFDPD")) != -1))
	{
	   thisSectionChg = 'ti_id_search';
	}
	else if (((thisFileHref.indexOf("HDCHCT")) != -1) || ((thisFileHref.indexOf("HDCSCE")) != -1) || ((thisFileHref.indexOf("HDCMCC")) != -1) || ((thisFileHref.indexOf("HDCFDPS1")) != -1) || ((thisFileHref.indexOf("HDCFDPS2")) != -1) || ((thisFileHref.indexOf("HDCFDPS3")) != -1) || ((thisFileHref.indexOf("HDCFDPD")) != -1))
	{
	   thisSectionChg = thisSection;
	}

	if (thisFileHref.indexOf(".htm") != -1)
	{

	   urls['nav_tradchi'] = chgLang(curLang, 'b5');
	   urls['nav_simpchi'] = chgLang(curLang, 'gb');
	}
	else if ((thisFileHref.indexOf(".jsp") == -1) && (thisFileHref.indexOf(".pl") == -1))
	{

	   urls['nav_tradchi'] = WASApplicationUrls[thisSectionChg] + "?language=b5&country=CN";
	   urls['nav_simpchi'] = WASApplicationUrls[thisSectionChg] + "?language=gb&country=CN";
	}
	else
	{

	   urls['nav_tradchi'] = thisFileHref.replace('language=en','language=b5');
	   urls['nav_tradchi'] = urls['nav_tradchi'].replace('country=US','country=CN');
	   urls['nav_tradchi'] = urls['nav_tradchi'].replace('/en/','/b5/');

	   urls['nav_simpchi'] = thisFileHref.replace('language=en','language=gb');
	   urls['nav_simpchi'] = urls['nav_simpchi'].replace('country=US','country=CN');
	   urls['nav_simpchi'] = urls['nav_simpchi'].replace('/en/','/gb/');
	}

    }
    else
    {
	urls['nav_tradchi'] = chgLang(curLang, 'b5');
	urls['nav_simpchi'] = chgLang(curLang, 'gb');
    }

    urls['nav_supdesk'] = thisPath + "support/default.htm";
    urls['nav_contactus'] = "https://" + location.host + "/webapp/hactlpbf/contactus/default.jsp?language=en&country=US";
    urls['nav_sitemap'] = thisPath + "sitemap/default.htm";

//the variable "thisSection" was declared in common.js and the corresponding html page will set the value
    var chkSection = new Object;
    chkSection[thisSection] = true;

//define the images for rollover function for the top navigation bar
    var nav_aboutus_on = new Image();
    var nav_aboutus_off = new Image();
    var nav_medcentre_on = new Image();
    var nav_medcentre_off = new Image();
    var nav_home_on = new Image();
    var nav_home_off = new Image();
    var nav_tradchi_on = new Image();
    var nav_tradchi_off = new Image();
    var nav_simpchi_on = new Image();
    var nav_simpchi_off = new Image();
    var nav_supdesk_on = new Image();
    var nav_supdesk_off = new Image();
    var nav_contactus_on = new Image();
    var nav_contactus_off = new Image();
    var nav_sitemap_on = new Image();
    var nav_sitemap_off = new Image();

    nav_aboutus_on.src = thisPath + "images/topnav/nav_aboutus_on.gif";
    nav_aboutus_off.src = thisPath + "images/topnav/nav_aboutus_off.gif";
    nav_medcentre_on.src = thisPath + "images/topnav/nav_medcentre_on.gif";
    nav_medcentre_off.src = thisPath + "images/topnav/nav_medcentre_off.gif";
    nav_home_on.src = thisPath + "images/topnav/nav_home_on.gif";
    nav_home_off.src = thisPath + "images/topnav/nav_home_off.gif";
    nav_tradchi_on.src = thisPath + "images/topnav/nav_tradchi_on.gif";
    nav_tradchi_off.src = thisPath + "images/topnav/nav_tradchi_off.gif";
    nav_simpchi_on.src = thisPath + "images/topnav/nav_simpchi_on.gif";
    nav_simpchi_off.src = thisPath + "images/topnav/nav_simpchi_off.gif";
    nav_supdesk_on.src = thisPath + "images/topnav/nav_supdesk_on.gif";
    nav_supdesk_off.src = thisPath + "images/topnav/nav_supdesk_off.gif";
    nav_contactus_on.src = thisPath + "images/topnav/nav_contactus_on.gif";
    nav_contactus_off.src = thisPath + "images/topnav/nav_contactus_off.gif";
    nav_sitemap_on.src = thisPath + "images/topnav/nav_sitemap_on.gif";
    nav_sitemap_off.src = thisPath + "images/topnav/nav_sitemap_off.gif";

//genImageTag is in common.js
//object "chkSection" is declared in langCommon.js
//the variable "clickAble" was declared in common.js and the corresponding html page will set the value
    var topnavStr = "";

    topnavStr += "<IMG SRC=\"" + thisPath + "images/topnav/nav_tile.gif\" WIDTH=\"15\" HEIGHT=\"20\" BORDER=\"0\">";
    topnavStr += genImageTag('nav_aboutus', chkSection['nav_aboutus'], clickAble, '68', '20', 'About Hactl');
    topnavStr += genImageTag('nav_medcentre', chkSection['nav_medcentre'], clickAble, '75', '20', 'Media Centre');
    topnavStr += "<IMG SRC=\"" + thisPath + "images/topnav/nav_tile.gif\" WIDTH=\"185\" HEIGHT=\"20\" BORDER=\"0\">";
    topnavStr += genImageTag('nav_home', chkSection['nav_home'], clickAble, '42', '20', 'Home');
    topnavStr += genImageTag('nav_tradchi', chkSection['nav_tradchi'], clickAble, '53', '20', 'Traditional Chinese');
    topnavStr += genImageTag('nav_simpchi', chkSection['nav_simpchi'], clickAble, '53', '20', 'Simplified Chinese');
    topnavStr += genImageTag('nav_supdesk', chkSection['nav_supdesk'], clickAble, '75', '20', 'Support Desk');
    topnavStr += genImageTag('nav_contactus', chkSection['nav_contactus'], clickAble, '124', '20', 'Feedaback & Contact Us');
    topnavStr += genImageTag('nav_sitemap', chkSection['nav_sitemap'], clickAble, '55', '20', 'Site Map');
    topnavStr += "<IMG SRC=\"" + thisPath + "images/topnav/nav_tile.gif\" WIDTH=\"15\" HEIGHT=\"20\" BORDER=\"0\">";

document.write(topnavStr);

//-->
