var HUBRIS_gImages=new Array;  // Array to hold images so they don't show up on the page
var HUBRIS_gIndex=0;		// Index for current image	
var HUBRIS_DCS=new Object();   // The HUBRIS_DCS object holds parameters to override fields in the SDC weblog
var HUBRIS_WT=new Object();    // The HUBRIS_WT object holds parameters used in custom reporting
var HUBRIS_DCSext=new Object(); // The HUBRIS_DCSext object holds site specific parameters
var HUBRIS_gQP=new Array();     // Array of desired query parameters to pass to WebTrends


var HUBRIS_HSBC = new Object(); // THw HSBC parameter holds five subgroups of parameters defined on a per site basis


HUBRIS_HSBC.SITE = new Object(); // SITE specific variables go into this object.  They are translated to HUBRIS_DCSext vairables
HUBRIS_HSBC.PAGE = new Object(); // HUBRIS_WT Overrides --portal variables that need to overrride HUBRIS_WT variables go into this object
HUBRIS_HSBC.EXT = new Object(); //  This is a placeholder for non SITE oriented HUBRIS_DCSext variables
HUBRIS_HSBC.LOG = new Object(); //  DCS overrides -- Variables in here will override DCS.* variables matching the name
HUBRIS_HSBC.DCS = new Object(); // This object contains HUBRIS_HSBC.DCS.ID with the dcsid and HUBRIS_HSBC.DCS.Doms with the comma-separated
                         // list of domains to be considered on-site.  As it currently stands, these domains have 
                         // to be complete domain names.

// List all the live domains the group has (per GeB) to make sure they are not included as an off-site link
HUBRIS_HSBC.DCS.Doms="www.hsbc.co.jp,www.ebanking.hsbc.co.jp,www.banking.hsbc.co.jp,www.moneyport.co.jp";

// This is where the information collected by the HUBRIS_WT Tracklet be sent
var HUBRIS_gDomain="www1.member-hsbc-group.com";

// The HUBRIS_gDcsId will be assigned from the HUBRIS_HSBC.DCS.ID variable
var HUBRIS_gDcsId="dcs8a9pzfvievvfhkn6u3og9d_5u3o"; // GLOBAL DCS ID... 

// This is the code to handle the impressions for the onsite Ad campaigns
function HUBRIS_dcsAdSearch(){
	if (document.links){
		for (var i=0;i<document.links.length;i++){
			var myAnch=document.links[i]+"";
			var pos=myAnch.toUpperCase().indexOf("HSBC_AD=");
			if (pos!=-1){
				var start=pos+8;
				var end=myAnch.indexOf("&",start);
				if (end==-1){
				end=myAnch.length;
				}
				var adValue=myAnch.substring(start,end);
				//HUBRIS_WT.ad=HUBRIS_WT.ad?HUBRIS_WT.ad+";"+adValue:adValue;
				HUBRIS_DCSext.HSBC_ad=HUBRIS_DCSext.HSBC_ad?HUBRIS_DCSext.HSBC_ad+";"+adValue:adValue; 
				HUBRIS_DCSext.HSBC_au=HUBRIS_DCSext.HSBC_au?HUBRIS_DCSext.HSBC_au+";1":"1";
				HUBRIS_DCSext.HSBC_ae="v";
			}
		}
	}
}
// Code section for Enable Event Tracking

//  Replaces SmartView links when tracking offsite pages
//
function HUBRIS_dcsParseSvl(sv){
	sv=sv.replace(/\s/g,"");
	var pos=sv.toUpperCase().indexOf("HUBRIS_WT.SVL=");
	if (pos!=-1){
		var start=pos+8;
		var end=sv.indexOf('"',start);
		if (end==-1){
			end=sv.indexOf("'",start);
			if (end==-1){
				end=sv.length;
			}
		}
		return sv.substring(start,end);
	}
	return "";
}

// Tests if current domain is in a list of 'on-site' domains.  This test
// is much more restrictive than the default to capture phishing sites that spoof 
// the HSBC domains.  The default code simply checks if the hostname
// matches somewhere in the domain array as in:
//  if ((host.indexOf(aDoms[i])!= -1) {
//           return 1;
//  }
function HUBRIS_dcsIsOnsite(host){
    for (N in HUBRIS_HSBC.DCS) {
	if (N == "Doms") {
	    var aDoms=HUBRIS_HSBC.DCS.Doms.split(',');
    	    for (var i=0;i<aDoms.length;i++){
		if ((host.indexOf(aDoms[i])==0)&&
			(host.length==aDoms[i].length) ){
		       return 1;
		}
    	     }
	    return 0;
	}
    }
    return 1;
}
// Ensures that offsite links are only processed for http/s schemas

function HUBRIS_dcsIsHttp(e){
	return (e.href&&e.protocol&&(e.protocol.indexOf("http")!=-1))?true:false;
}
//
//  This function makes sure that an actual event is handed to the various trigger functions
// depending on the way events are supported in the JavaScript

function HUBRIS_dcsEvt(evt){
	var e=evt.target||evt.srcElement;
	if (e.tagName&&(e.tagName=="IMG")){
		e=e.parentElement||e.parentNode;
	}
	return e;
}
// This function adds a specific function to fire off when a desired event occurs
// New function supplied by HUBRIS_WT to resolve the HK JS error
function HUBRIS_dcsBind(event,func){
	if (typeof(window[func])=="function"){
		if ((document.links) && (document.links.length>0) ) {
			for (var i =0;i < document.links.length;i++) {
				if (document.links[i].addEventListener){
				document.links[i].addEventListener(event, window[func], true);
				}
				else if(document.links[i].attachEvent){
					document.links[i].attachEvent("on"+event, window[func]);
				}
			}
		}
	}
}

// This functions defines the events of intgerest and the functions associated with them.
// In this example, we're only interested in offsite links

function HUBRIS_dcsET(){
    HUBRIS_dcsBind("click","HUBRIS_dcsDownload");
    HUBRIS_dcsBind("click","HUBRIS_dcsOffsite");
    HUBRIS_dcsBind("mousedown","HUBRIS_dcsRightClick");

}
// Track clicks to download links.
function HUBRIS_dcsDownload(evt){
    evt=evt||(window.event||"");
    if (evt){
        var e=HUBRIS_dcsEvt(evt);
        if (HUBRIS_dcsIsHttp(e)&&HUBRIS_dcsIsOnsite(e.hostname)){
            var types="xls,doc,pdf,txt,csv,zip";   //customize download types
            if (types.indexOf(e.pathname.substring(e.pathname.lastIndexOf(".")+1,e.pathname.length))!=-1){
                var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):"";
                if (qry.toUpperCase().indexOf("HUBRIS_WT.SVL=")==-1){
                    HUBRIS_WT.svl=HUBRIS_dcsParseSvl(e.name?e.name.toString():(e.onclick?e.onclick.toString():""));
                }
                var path=(e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname;
                HUBRIS_dcsMultiTrack("HUBRIS_DCS.dcssip",e.hostname,"HUBRIS_DCS.dcsuri",path,"HUBRIS_WT.ti","Download:"+path,"HUBRIS_WT.dl","1");
                HUBRIS_DCS.dcssip=HUBRIS_DCS.dcsuri=HUBRIS_WT.ti=HUBRIS_WT.svl=HUBRIS_WT.dl="";
            }
        }
    }
}

// Track right clicks to download links.
function HUBRIS_dcsRightClick(evt){
    evt=evt||(window.event||"");
    if (evt){
        var btn=evt.which||evt.button;
        if (btn!=1){
            var e=evt.target||evt.srcElement;
            if (HUBRIS_dcsIsHttp(e)){
                var types="xls,doc,pdf,txt,csv,zip";    //customize download types
                if (types.indexOf(e.pathname.substring(e.pathname.lastIndexOf(".")+1,e.pathname.length))!=-1){
                    var path=(e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname;
                    HUBRIS_dcsMultiTrack("HUBRIS_DCS.dcssip",e.hostname,"HUBRIS_DCS.dcsuri",path,"HUBRIS_DCS.dcsqry","","HUBRIS_WT.ti","Download:"+path,"HUBRIS_WT.dl","1","HUBRIS_WT.rc","1");
                    HUBRIS_DCS.dcssip=HUBRIS_DCS.dcsuri=HUBRIS_WT.ti=HUBRIS_WT.dl=HUBRIS_WT.rc="";
                }
            }
        }
    }
}

// Code section for Track clicks to links leading offsite.
function HUBRIS_dcsOffsite(evt){
	evt=evt||(window.event||"");
	if (evt){
		var e=HUBRIS_dcsEvt(evt);
		if (HUBRIS_dcsIsHttp(e)&&!HUBRIS_dcsIsOnsite(e.hostname)){
			var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):"";
			if (qry.toUpperCase().indexOf("HUBRIS_WT.SVL=")==-1){
				HUBRIS_WT.svl=HUBRIS_dcsParseSvl(e.name?e.name.toString():(e.onclick?e.onclick.toString():""));
			}
			var path=(e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname;
			var trim=true;
			HUBRIS_dcsMultiTrack("HUBRIS_DCS.dcssip",e.hostname,"HUBRIS_DCS.dcsuri",path,"HUBRIS_DCS.dcsqry",trim?"":qry,"HUBRIS_WT.ti","Offsite:"+e.hostname+path+qry,"HUBRIS_WT.os","1","HUBRIS_DCS.dcsref",window.location.hostname);
			HUBRIS_DCS.dcssip=HUBRIS_DCS.dcsuri=HUBRIS_DCS.dcsqry=HUBRIS_WT.ti=HUBRIS_WT.svl=HUBRIS_WT.os=HUBRIS_DCS.dcsref="";
		}
	}
}
// Assign your query parameters to WebTrends query parameters. 
function HUBRIS_dcsQP(N){
    if (!N){
        return;
    }
    var qry=location.search.substring(1);
    var pairs=qry.split("&");
    for (var i=0;i<pairs.length;i++){
        var pos=pairs[i].indexOf("=");
        if (pos==-1){
            continue;
        }
        var name=pairs[i].substring(0,pos);
        var value=pairs[i].substring(pos+1);
        if (name==N){
            HUBRIS_gQP.push((i==0?"":"&")+pairs[i]);
            return value;
        }
    }
    return "";
}
//<!-- START OF SDC Advanced Tracking Code -->
//<!-- Copyright (c) 1996-2005 WebTrends Inc.  All rights reserved. -->
//<!-- V7.5 -->
//<!-- $DateTime: 2005/08/25 15:58:46 $ -->

var HUBRIS_gService = true;
var HUBRIS_gTimeZone = 0;
// Code section for Enable First-Party Cookie Tracking
function HUBRIS_dcsCookie(){
if (typeof(HUBRIS_dcsOther)=="function"){
HUBRIS_dcsOther();
}
else if (typeof(HUBRIS_dcsPlugin)=="function"){
HUBRIS_dcsPlugin();
}
else if (typeof(HUBRIS_dcsFPC)=="function"){
HUBRIS_dcsFPC(HUBRIS_gTimeZone);
}
}
function HUBRIS_dcsGetCookie(name){
var pos=document.cookie.indexOf(name+"=");
if (pos!=-1){
var start=pos+name.length+1;
var end=document.cookie.indexOf(";",start);
if (end==-1){
end=document.cookie.length;
}
return unescape(document.cookie.substring(start,end));
}
return null;
}
function HUBRIS_dcsGetCrumb(name,crumb){
var aCookie=HUBRIS_dcsGetCookie(name).split(":");
for (var i=0;i<aCookie.length;i++){
var aCrumb=aCookie[i].split("=");
if (crumb==aCrumb[0]){
return aCrumb[1];
}
}
return null;
}
function HUBRIS_dcsGetIdCrumb(name,crumb){
var cookie=HUBRIS_dcsGetCookie(name);
var id=cookie.substring(0,cookie.indexOf(":lv="));
var aCrumb=id.split("=");
for (var i=0;i<aCrumb.length;i++){
if (crumb==aCrumb[0]){
return aCrumb[1];
}
}
return null;
}
function HUBRIS_dcsFPC(offset){
if (typeof(offset)=="undefined"){
return;
}
var name=HUBRIS_gFpc;
var dCur=new Date();
dCur.setTime(dCur.getTime()+(dCur.getTimezoneOffset()*60000)+(offset*3600000));
var dExp=new Date(dCur.getTime()+315360000000);
var dSes=new Date(dCur.getTime());
if (document.cookie.indexOf(name+"=")!=-1){
var id=HUBRIS_dcsGetIdCrumb(name,"id");
var lv=parseInt(HUBRIS_dcsGetCrumb(name,"lv"));
var ss=parseInt(HUBRIS_dcsGetCrumb(name,"ss"));
if ((id==null)||(id=="null")||isNaN(lv)||isNaN(ss)){
return;
}
HUBRIS_WT.co_f=id;
var dLst=new Date(lv);
dSes.setTime(ss);
if ((dCur.getTime()>(dLst.getTime()+1800000))||(dCur.getTime()>(dSes.getTime()+28800000))){
dSes.setTime(dCur.getTime());
HUBRIS_WT.vt_f_s="1";
}
if ((dCur.getDay()!=dLst.getDay())||(dCur.getMonth()!=dLst.getMonth())||(dCur.getYear()!=dLst.getYear())){
HUBRIS_WT.vt_f_d="1";
}
}
else{
var tmpname=name+"_TMP=";
document.cookie=tmpname+"1";
if (document.cookie.indexOf(tmpname)!=-1){
document.cookie=tmpname+"; expires=Thu, 01-Jan-1970 00:00:01 GMT";
if ((typeof(HUBRIS_gWtId)!="undefined")&&(HUBRIS_gWtId!="")){
HUBRIS_WT.co_f=HUBRIS_gWtId;
}
else if ((typeof(HUBRIS_gTempWtId)!="undefined")&&(HUBRIS_gTempWtId!="")){
HUBRIS_WT.co_f=HUBRIS_gTempWtId;
HUBRIS_WT.vt_f="1";
}
else{
HUBRIS_WT.co_f="2";
var cur=dCur.getTime().toString();
for (var i=2;i<=(32-cur.length);i++){
HUBRIS_WT.co_f+=Math.floor(Math.random()*16.0).toString(16);
}
HUBRIS_WT.co_f+=cur;
HUBRIS_WT.vt_f="1";
}
if (typeof(gWtAccountRollup)=="undefined"){
HUBRIS_WT.vt_f_a="1";
}
HUBRIS_WT.vt_f_s="1";
HUBRIS_WT.vt_f_d="1";
}
else{
HUBRIS_WT.vt_f="2";
HUBRIS_WT.vt_f_a="2";
return;
}
}
HUBRIS_WT.co_f=escape(HUBRIS_WT.co_f);
HUBRIS_WT.vt_sid=HUBRIS_WT.co_f+"."+dSes.getTime();
var expiry="; expires="+dExp.toGMTString();
document.cookie=name+"="+"id="+HUBRIS_WT.co_f+":lv="+dCur.getTime().toString()+":ss="+dSes.getTime().toString()+expiry+"; path=/"+(((typeof(HUBRIS_gFpcDom)!="undefined")&&(HUBRIS_gFpcDom!=""))?("; domain="+HUBRIS_gFpcDom):(""));
}

// Code section for Use the new first-party cookie generated with this tag.
var HUBRIS_gFpc="WT_FPC";
var HUBRIS_gWtId="";
var HUBRIS_gTempWtId="";
var HUBRIS_gConvert=true;


// Code section for Set the First-Party Cookie domain
var HUBRIS_gFpcDom="";
//
// If we need to convert an old SDC cookie, this code will pull the old cookie from the sdc server
//
if ((typeof(HUBRIS_gConvert)!="undefined")&&HUBRIS_gConvert&&(document.cookie.indexOf(HUBRIS_gFpc+"=")==-1)){
document.write("<SCR"+"IPT Language='JavaScript' SRC='"+"http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+HUBRIS_gDomain+"/"+HUBRIS_gDcsId+"/wtid.js"+"'></SCR"+"IPT>");
}

function HUBRIS_dcsAdv(){
	HUBRIS_dcsFunc("HUBRIS_dcsAdSearch");
	HUBRIS_dcsFunc("HUBRIS_dcsCookie");
	HUBRIS_dcsFunc("HUBRIS_dcsET");
}

function HUBRIS_dcsFunc(func){
	if (typeof(window[func])=="function"){
		window[func]();
	}
}

// HUBRIS_dcsMultiTrack is called with pairs of parameters as
// text strings that use the JavaScript variable to be
// overridded and the value to override.  For example,
// in an onClick function downloading a PDF:
// onClick="HUBRIS_dcsMultiTrack('DCS.dcsuri','this.pdf')"

function HUBRIS_dcsMultiTrack(){
	for (var i=0;i<arguments.length;i++){
		if (arguments[i].indexOf('HUBRIS_WT.')==0){
				HUBRIS_WT[arguments[i].substring(3)]=arguments[i+1];
				i++;
		}
		if (arguments[i].indexOf('HUBRIS_DCS.')==0){
				HUBRIS_DCS[arguments[i].substring(4)]=arguments[i+1];
				i++;
		}
		if (arguments[i].indexOf('HUBRIS_DCSext.')==0){
				HUBRIS_DCSext[arguments[i].substring(7)]=arguments[i+1];
				i++;
		}
	}
	var dCurrent=new Date();
	HUBRIS_DCS.dcsdat=dCurrent.getTime();
	HUBRIS_dcsTag();
}


// HUBRIS_dcsVar sets default values for the following variables:
// URI Stem 		(HUBRIS_DCS.dcsuri)
// URI Query String 	(HUBRIS_DCS.dcsqry)
// Server 		(HUBRIS_DCS.dcssip)
// Referring document 	(HUBRIS_DCS.dcsref)
// Document Title 	(HUBRIS_WT.ti)
// User Time Zone 	(HUBRIS_WT.tz)
// User browsing hour 	(HUBRIS_WT.bh)
// User language  	(HUBRIS_WT.ul)
// Screen widthxheight 	(HUBRIS_WT.sr)
// Screen color depth 	(HUBRIS_WT.cd)
// Java capability 	(HUBRIS_WT.jo)
// JavaScript capability (HUBRIS_WT.js)
// JavaScript Version 	(HUBRIS_WT.jv
//
function HUBRIS_dcsVar(){
	var dCurrent=new Date();
	HUBRIS_WT.tz=dCurrent.getTimezoneOffset()/60*-1;
	if (HUBRIS_WT.tz==0){
		HUBRIS_WT.tz="0";
	}
	HUBRIS_WT.bh=dCurrent.getHours();
	HUBRIS_WT.ul=navigator.appName=="Netscape"?navigator.language:navigator.userLanguage;
	if (typeof(screen)=="object"){
		HUBRIS_WT.cd=navigator.appName=="Netscape"?screen.pixelDepth:screen.colorDepth;
		HUBRIS_WT.sr=screen.width+"x"+screen.height;
	}
	if (typeof(navigator.javaEnabled())=="boolean"){
		HUBRIS_WT.jo=navigator.javaEnabled()?"Yes":"No";
	}
	if (document.title){
		HUBRIS_WT.ti=document.title;
	}
	HUBRIS_WT.js="Yes";
	if (typeof(gVersion)!="undefined"){
		HUBRIS_WT.jv=gVersion;
	}
	if (document.body&&document.body.addBehavior){
	    document.body.addBehavior("#default#clientCaps");
	    if (document.body.connectionType){
		HUBRIS_WT.ct=document.body.connectionType;
	    }
	    document.body.addBehavior("#default#homePage");
	    HUBRIS_WT.hp=document.body.isHomePage(location.href)?"1":"0";
	}
	if (parseInt(navigator.appVersion)>3){
	    if ((navigator.appName=="Microsoft Internet Explorer")&&document.body){
		HUBRIS_WT.bs=document.body.offsetWidth+"x"+document.body.offsetHeight;
	    }
	    else if (navigator.appName=="Netscape"){
		HUBRIS_WT.bs=window.innerWidth+"x"+window.innerHeight;
	    }
	}
	HUBRIS_WT.fi="No";
	if (window.ActiveXObject){
	    var maxVer=10;
	    var minVer=2;
	    for (var ver=minVer;ver<=maxVer;ver++){
		try{
		    var oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ver+"');");
		    if (oFlash){
			HUBRIS_WT.fi="Yes";
			HUBRIS_WT.fv=ver+".0";
			break;
		    }
		}
		catch(e){
		}
	    }
	}
	else if (navigator.plugins&&navigator.plugins.length){
	    for (var i=0;i<navigator.plugins.length;i++){
		if (navigator.plugins[i].name.indexOf('Shockwave Flash')!=-1){
		    HUBRIS_WT.fi="Yes";
		    HUBRIS_WT.fv=navigator.plugins[i].description.split(" ")[2];
		    break;
		}
	    }
	}
	HUBRIS_DCS.dcsdat=dCurrent.getTime();
	HUBRIS_DCS.dcssip=window.location.hostname;
	HUBRIS_DCS.dcsuri=window.location.pathname;
	if (window.location.search){
		HUBRIS_DCS.dcsqry=window.location.search;
		if (HUBRIS_gQP.length>0){
		    for (var i=0;i<HUBRIS_gQP.length;i++){
			var pos=HUBRIS_DCS.dcsqry.indexOf(HUBRIS_gQP[i]);
			if (pos!=-1){
			    var front=HUBRIS_DCS.dcsqry.substring(0,pos);
			    var end=HUBRIS_DCS.dcsqry.substring(pos+HUBRIS_gQP[i].length,HUBRIS_DCS.dcsqry.length);
			    HUBRIS_DCS.dcsqry=front+end;
			}
		    }
		}
	}
	if ((window.document.referrer!="")&&(window.document.referrer!="-")){
		if (!(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)<4)){
			HUBRIS_DCS.dcsref=window.document.referrer;
		}
	}
}

// This is an internal function to append tags to a query 
// string (including escaping invalid characters)

function HUBRIS_A(N,V){
	return "&"+N+"="+HUBRIS_dcsEscape(V);
}

// This function allows characters that would be invalid 
//in a query string to pass through and be reported on 
//at the destination.

function HUBRIS_dcsEscape(S){
	if (typeof(RE)!="undefined"){
		var retStr = new String(S);
		for (R in RE){
			retStr = retStr.replace(RE[R],R);
		}
		return retStr;
	}
	else{
		return escape(S);
	}
}

// This function creates an image array and places the 
// parameter as the source value for the image.  Setting 
// the source value has the effect of loading the 
// image from the server, but it does not hold up 
// display of the page.
function HUBRIS_dcsCreateImage(dcsSrc){
	if (document.images){
		HUBRIS_gImages[HUBRIS_gIndex]=new Image;
		HUBRIS_gImages[HUBRIS_gIndex].src=dcsSrc;
		HUBRIS_gIndex++;
	}
	else{
                document.write('<img border="0" name="dcsimg" width="1" height="1" alt="" src="'+dcsSrc+'">');
      	}
}

// This function goes through all META tags on a page 
// and replaces HUBRIS_WT, DCS and HUBRIS_DCSext JavaScript variables 
// with the content of the META tags that match their names.
// With this function you do not have to include or 
// modify JavaScript to change parameters used by 
// WebTrends reporting.
function HUBRIS_dcsMeta(){
	var myDocumentElements;
	if (document.all){
		myDocumentElements=document.all.tags("meta");
	}
	else if (document.documentElement){
	 myDocumentElements=document.getElementsByTagName("meta");
	}
	if (typeof(myDocumentElements)!="undefined"){
	   for (var i=1;i<=myDocumentElements.length;i++){
		myMeta=myDocumentElements.item(i-1);
		if (myMeta.name){
			if (myMeta.name.indexOf('HUBRIS_WT.')==0){
			  HUBRIS_WT[myMeta.name.substring(3)]=myMeta.content;
			} else if (myMeta.name.indexOf('HUBRIS_DCSext.')==0){
				HUBRIS_DCSext[myMeta.name.substring(7)	]
					=myMeta.content;
			}else if (myMeta.name.indexOf('HUBRIS_DCS.')==0){
				HUBRIS_DCS[myMeta.name.substring(4)]
					=myMeta.content;
			}
		}
	   }
	}
}

//This function calls the appending function to create the 
// tag and HUBRIS_dcsCreateImage to send it to the server. 
function HUBRIS_dcsTag(){
	var P="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+HUBRIS_gDomain+(HUBRIS_gDcsId==""?'':'/'+HUBRIS_gDcsId)+"/dcs.gif?";
	for (N in HUBRIS_DCS){
		if (HUBRIS_DCS[N]) {
			P+=HUBRIS_A(N,HUBRIS_DCS[N]);
		}
	}
	for (N in HUBRIS_WT){
		if (HUBRIS_WT[N]) {
			P+=HUBRIS_A("HUBRIS_WT."+N,HUBRIS_WT[N]);
		}
	}
	for (N in HUBRIS_DCSext){
		if (HUBRIS_DCSext[N]) {
			P+=HUBRIS_A(N,HUBRIS_DCSext[N]);
		}
	}
	if (P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){
		P=P.substring(0,2040)+"&HUBRIS_WT.tu=1";
	}
	HUBRIS_dcsCreateImage(P);
}

// This function collects an HUBRIS_HSBC cookie that otherwise would
// not be available for tracking  The desired cookie is 
// passed as a parameter and the cookie value returned.
function HUBRIS_dcsGetHSBCCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

// This function collects all the HSBC variables and translates
// them into the appropriate WebTrends variabls (HUBRIS_WT variables
// from HUBRIS_HSBC.PAGE, HUBRIS_DCSext variables from SITE and EXT, and 
// DCS variables from HUBRIS_HSBC.LOG variables.  It also overrides
// the value of HUBRIS_gDcsId from the HUBRIS_HSBC.DCS.ID variable.

function HUBRIS_dcsMapHSBC() {
	for (N in HUBRIS_HSBC) {
		if (N == "SITE")  {
			for (S in HUBRIS_HSBC.SITE) {
				HUBRIS_DCSext[S] = HUBRIS_HSBC.SITE[S];
			}
		}
		if (N == "PAGE") {
			for (S in HUBRIS_HSBC.PAGE) {
				HUBRIS_WT[S] = HUBRIS_HSBC.PAGE[S];
			}
		}
		if (N == "EXT") {
			for (S in HUBRIS_HSBC.EXT) {
				HUBRIS_DCSext[S] = HUBRIS_HSBC.EXT[S];
			}
		}
		if (N == "LOG") {
			for (S in HUBRIS_HSBC.LOG) {
				HUBRIS_DCS[S] = HUBRIS_HSBC.LOG[S];
			}
		}
		if (N == "HUBRIS_DCS") {
			HUBRIS_gDcsId = HUBRIS_HSBC.DCS.ID;
		}
	}
}

// This values are constant for the site
HUBRIS_HSBC.SITE.rgn="Asia Pacific";            //HUBRIS_DCSext.geb_rgn (Europe,Americas,..)
HUBRIS_HSBC.SITE.subrgn="Rest of Asia Pacific";            //HUBRIS_DCSext.geb_subrgn (North America, South America,..)
HUBRIS_HSBC.SITE.cnty="Japan";              //HUBRIS_DCSext.geb_cnty (Mexico,USA,Great Britain...)
HUBRIS_HSBC.SITE.ent="The Hongkong & Shanghai Banking Corporation Ltd";    //HUBRIS_DCSext.geb_ent (HSBC UK, HSBC US,Household,...)
HUBRIS_HSBC.SITE.brand="HSBC";
HUBRIS_HSBC.DCS.ID = "dcsgswl9y00000kv1mpp5xcie_3w6n";
