//***************************************************
//*
//* Program Name       : util.js
//*
//* Copyright Notice   : COPYRIGHT (C) 2000 BY HSBC
//*
//* Creation Date      : 22 Jun 2000
//*
//* Programmer         : IFS Phase 2 Team
//*
//* Abstract           : JavaScript functions for PIB2
//*
//* Amendment History:
//*
//* Date       By            Description
//* ---------  ------------- ------------------------------------------------
//   3 Jan 05  Eddy Chang   Change popupDualLifeSaveInstr() to popupDualLifeSaveInstr(link)
//   3 Jan 05  Eddy Chang   Change popupDualLifeInsuranceCert() to popupDualLifeInsuranceCert(link)
//   3 Jan 05  Eddy Chang   Change popupBranchInfo() to popupBranchInfo(link)
//   3 Jan 05  Eddy Chang   Change popSaveInstrNote() to popSaveInstrNote(link)
//   3 Jan 05  Eddy Chang   Change popupStopLimitSellTC() to popupStopLimitSellTC(link)
//   3 Jan 05  Eddy Chang   Change popupInvHPAcctTC() to popupInvHPAcctTC(link)
//   3 Jan 05  Eddy Chang   Change popupInvPVAcctTC() to popupInvPVAcctTC(link)
//   3 Jan 05  Eddy Chang   Change popupSecAcctTC() to popupSecAcctTC(link)
//   3 Jan 05  Eddy Chang   Change popupHPCreditCardTC() to popupHPCreditCardTC(link)
//   3 Jan 05  Eddy Chang   Change popupDAcctLimit(x) to popupDAcctLimit(action,link,x)
//   3 Jan 05  Eddy Chang   Change startTimer() to startTimer(link)
//   3 Jan 05  Eddy Chang   Change popUpTimer() to popUpTimer(link)
//   3 Jan 05  Eddy Chang   Change popUpDisclaimer() to popUpDisclaimer(link)
//   3 Jan 05  Eddy Chang   Change popUpTermsAndConditions() to popUpTermsAndConditions(link)
//   3 Jan 05  Eddy Chang   Change popUpFAQ() to popUpFAQ(link)
//   3 Jan 05  Eddy Chang   Change popUpFAQServiceFees() to  popUpFAQServiceFees(link)
//   3 Jan 05  Eddy Chang   Change popUpSecFaq() to popUpSecFaq(link)
//   3 Jan 05  Eddy Chang   Change popUpSecAdPwd() to popUpSecAdPwd(link)
//   3 Jan 05  Eddy Chang   Change popUpSecurity(x, y) to popUpSecurity(link,x, y)
//   3 Jan 05  Eddy Chang   Change popupBalance(x) to popupBalance(link,action,x)
//   3 Jan 05  Eddy Chang   Change popupCalFutureVal(DepCur, LnkCur, Amount, DbAcct, DpAcct, DpTerm) to popupCalFutureVal(link, action,DepCur, LnkCur, Amount, DbAcct, DpAcct, DpTerm)
//   3 Jan 05  Eddy Chang   Change popupForCurrGetRate(BA, RC, RA, DA, TAC, WhichAccount, OA) to popupForCurrGetRate(link,action, BA, RC, RA, DA, TAC, WhichAccount, OA)
//   3 Jan 05  Eddy Chang   Change popupBuySellGoldGetRate(RA, DA, OA) to popupBuySellGoldGetRate(link,action,RA, DA, OA)
//   3 Jan 05  Eddy Chang   Change popupRemGetRate(CA, RC, RA, DA) to popupRemGetRate(link,action,CA, RC, RA, DA)
//   3 Jan 05  Eddy Chang   Change popupBuyingPower(SecAcct, SetAcct) to popupBuyingPower(link,action,SecAcct, SetAcct)
//   3 Jan 05  Eddy Chang   Change openTimetable() to openTimetable(link)
//   3 Jan 05  Eddy Chang   Change popUpUTRestriction() to popUpUTRestriction(link)
//   3 Jan 05  Eddy Chang   Change popUpMpfHotline() to popUpMpfHotline(link)
//   3 Jan 05  Eddy Chang   Change popISMoreInfo(info) to popISMoreInfo(link)
//   3 Jan 05  Eddy Chang   Change redemption() to redemption(link)
//  26 Feb 05  Alex Cheng   P2G Migration - Syn PIB16
//  19 Apr 05  Kelly Mai    Add function redemption(logoffURL, redirectPageID)
//  02 Jun 05  Basel Zhang  Change startTimer() and popUpTimer().
//  16 Jun 05  Jerry Zheng  P2G Migration - syn PIB17B
//			    Changed function list:
//		     	    delelte popupWinWinTC() & popupAllInOneTC()
//			    add popupCalFutureValSid(link, action, DepCur, LnkCur, Amount, DbAcct, DpAcct, DpTerm)
//			    add popupFundsOfTheQuarter()
//			    add mgmRegisterTrackGif(referURL) & mgmReferTrackGif(referURL) & mgmRegisterLogOff(link) & mgmReferLogOff(link)
//			    modify redirectIPO()
//			    add popUpRpqFaq()
//  08 Jul 05  Jonathan Xue remove functions:mgmRegisterTrackGif(referURL) & mgmReferTrackGif(referURL) & mgmRegisterLogOff(link) & mgmReferLogOff(link)
//  12 Jul 05  Jonathan Xue Add function:lnWaitAtConfirmation
//  03 Aug 05  Rokcall Gu   Fix the font style problem in function lnWaitAtConfirmation
//  05 Sep 05  Vincent Chen Change popUpSecMain(link) to popUpSecMain()
//  18 Jan 06  Vincent chen Change the inactivity time-out alert from 15 minutes to 12 minutes
//  04 Apr 06  Ryan         Change the function:popInsuranceProductHighlight(), adding the argument:IFI, IFIH
//  05 Apr 06  Ryan 	    Change the function:popInsuranceSummaryOfCover(), adding the argument:IFI
//  13 Apr 06  Gary         combine the IFI,IHR,IOP in popInsuranceProductHighlight(),popInsuranceSummaryOfCover()
//  08 Sep 06 Eddy	    add pws_hbap_popupPdf(helpUrl ,windowName, winProperties)	 
//  22 Sep 06  Ken   	    Update some PWS links for Loans Interest Rates
//  26 Sep 06  Cherry       Added anchor  for popupInsuranceCmcProductHighlight
//  27 Sep 06  Wesley ZHU   Change the link to redraw-rate in popUpRpiRate()
//  28 Sep 06  Raymond Cai  Fix PWS link in the function:popInsuranceMakeClaim()
//  05 Oct 06  Raymond Cai  Change PWS link in the function: popInsuranceProductHighlights()
//  05 Oct 06  Wesley ZHU   Change PWS link in the function: popupAutosweepFXLearnMore()
//  16 Nov 06  Ken          Fix the url linkage on TT & SITT pages
//  23 Nov 06  Ken          Change the popup link of Health Check for Helper Insurance
//  11 Dec 06  Kevin Ding   Add functions popupSVServiceCharge(),popupSVDefaultPage(),popupInvSVAcctTC.
//  02 Jan 07  Ken          Add method blurOrderPrice() for All-Or-Nothing Changed
//  01 Mar 07  Arthur       Amend popupInvSVAcctTC().
//  13 Jun 07  Cherry       Change Meta Values in Themes.
//  14 Jun 07  Cherry       Amend URL in popUpAuctionTrade().
//  20 Jun 07  Gary         Amend popMerchantList() and popAutopayRecipientList()
//  20 Jun 07  Gary         Add popUpPilLongPromo() and popUpRcfLongPromo()
//***********************************************************
	var HUBRIS_classHeader1 = "font-family:arial;font-size:10pt; font-weight: bold;";
	var HUBRIS_classFont = "font-family:arial;font-size:9pt";
	var HUBRIS_urlPrefix = 'https://www.ebanking.hsbc.com.hk/1/2/'; 
	var HUBRIS_transgif_url = '/favicon.ico';


function HUBRIS_pws_hbap_popupPdf(pdfUrl ,windowName, winProperties) {

var targetUrl=content_root.substring(0,content_root.length-1) + pdfUrl;
var hsbcheader='\n'
+ '    <HTML>\n'
+ '	    <SCRIPT language="JavaScript" src="' + wt_header_url +'"><\/SCRIPT>\n'
+ '	    <SCRIPT LANGUAGE="JavaScript">\n'
+'		function redirectToPDF(link) {\n'
+'			window.location=link;\n'
+'		}\n'
+ '    	    <\/SCRIPT>\n'
+ '	    <SCRIPT LANGUAGE="JavaScript">\n'
+ '		if (typeof(HUBRIS_HSBC) !=  "undefined"){\n'
+ '			HUBRIS_HSBC.SITE.rgn="Asia Pacific";\n'
+ '			HUBRIS_HSBC.SITE.subrgn="Hong Kong";\n'
+ '			HUBRIS_HSBC.SITE.cnty="Hong Kong SAR";\n'
+ '		        HUBRIS_HSBC.SITE.ent="The Hongkong & Shanghai Banking Corporation Ltd";\n'
+ '     	        HUBRIS_HSBC.LOG.dcsuri="' + pdfUrl + '";\n'
+ '			HUBRIS_HSBC.SITE.brand="HSBC";\n'
+ '  		  	HUBRIS_HSBC.DCS.ID="dcsur62uf00000s5nnzq4hvrl_6i5x";\n'
+ '		}\n'
+ '    	    <\/SCRIPT>\n'
+ '         <SCRIPT language="JavaScript" src="' + wt_footer_url + '"><\/SCRIPT>'
+ '         <BODY onload="redirectToPDF(\''+targetUrl + '\');"><\/BODY>'
+ '    </HTML>\n'
+ '    \n';

   var popWin;
   if(winProperties != null && winProperties.length>0){   
   	popWin = window.open(HUBRIS_transgif_url,'_blank',winProperties);   	
   } else {   
   	popWin = window.open(HUBRIS_transgif_url);   	
   }
  	popWin.document.write(hsbcheader);
   	popWin.document.close(); 
	
	if(navigator.userAgent.indexOf("Safari") <= 0)
		popWin.history.go(0); 
	popWin.focus();		 
	
}

	function HUBRIS_getlink(location) {
		if(location==null || location=="")
			return HUBRIS_transgif_url;	
		else
			return location;
	}

 

	function HUBRIS_popupWindow(urlName, windowName) {
		var newWindow = window.open(urlName, windowName,'width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		newWindow.focus();
	}

	function HUBRIS_popupWindowWithDimension(urlName, windowName, width, height) {
		var winProperties = "width=" + width + ",height=" + height + ",menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes";
		var newWindow = window.open(urlName, windowName, winProperties);
		newWindow.focus();
	}

	function HUBRIS_popupAccountGeneralTnC(filename){
		var accountGeneralTnC = window.open(filename,'AccountGeneralTnC','width=700,height=480,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		accountGeneralTnC.focus();
	}

	function HUBRIS_popupGeneralBankTariffTable(){
		
		HUBRIS_pws_hbap_popupPdf('/content/hongkong/pws_pdf/hk/personal/forms/pdf/personal/p018_eng.pdf' ,'GeneralBankTariffTable', 'width=700,height=480,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');		
	}

	function HUBRIS_popupTariffTable(){
		var tariffTable = window.open('http://www.hsbc.com.hk/1/2/hk/investments/stocks/detail','SecTariffTable','width=700,height=480,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		tariffTable.focus();
	}

	function HUBRIS_popupDualLifeSummaryCover(){
				
		HUBRIS_pws_hbap_popupPdf('/content/hongkong/pws_pdf/hk/personal/pdf/insur_dual_life.pdf' ,'dualLifeSummaryCover', 'width=700,height=480,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');		
	}

	function HUBRIS_popupHPServiceCharge(){
		
		HUBRIS_pws_hbap_popupPdf('/content/hongkong/pws_pdf/hk/personal/bank/premier/pdf/hpchargese.pdf' ,'SecTariffTable', 'width=700,height=480,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');		

	}

	function HUBRIS_popupHPDefaultPage(){
		var HPDefault = window.open('http://www.hsbc.com.hk/1/2/hk/banking/premier','HPDefault','width=700,height=480,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		HPDefault.focus();
	}

	function HUBRIS_popupPVServiceCharge(){
		
		HUBRIS_pws_hbap_popupPdf('/content/hongkong/pws_pdf/hk/personal/bank/power/pdf/pvacharges.pdf' ,'SecTariffTable', 'width=700,height=480,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
	}

	function HUBRIS_popupPVDefaultPage(){
		var PVDefault = window.open('http://www.hsbc.com.hk/1/2/hk/banking/pva','PVDefault','width=700,height=480,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		PVDefault.focus();
	}

	function HUBRIS_popupSVServiceCharge(){
	   
	   HUBRIS_pws_hbap_popupPdf('/content/hongkong/pws_pdf/hk/personal/bank/smart/pdf/svacharges.pdf' ,'SecTariffTable', 'width=700,height=480,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');	
	
	}

	function HUBRIS_popupSVDefaultPage(){
		var SVDefault = window.open('http://www.hsbc.com.hk/1/2/hk/banking/sva','SVDefault','width=700,height=480,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		SVDefault.focus();
	}

	function HUBRIS_popupDualLifeSaveInstr(){
		var SavePrintInsuranceCert = window.open(HUBRIS_urlPrefix + 'DualLifeSaveInstrPopup','SavePrintInsuranceCert','width=400,height=250,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		SavePrintInsuranceCert.focus();
	}

	function HUBRIS_popupDualLifeInsuranceCert() {
		var win_link=HUBRIS_transgif_url;
		var printCert = window.open(win_link,'PrintCert','top=0,left=0,width=630,height=580,scrollbars=yes,status=no,resizable=yes,toolbar=no,directories=no,menubar=yes,location=no');
		document.PrintCertForm.target = 'PrintCert';
		document.PrintCertForm.action = HUBRIS_urlPrefix + 'AcAcctOpenPVPrintCert?cmd-AcctOpenPVPrintCertPortlet_in=';
		document.PrintCertForm.submit();
	}

	function HUBRIS_popupBranchInfo() {
		var win_link=HUBRIS_transgif_url;
		var branchInfo = window.open(win_link,'BranchInfo','top=0,left=0,width=560,height=220,scrollbars=yes,status=no,resizable=no,toolbar=no,directories=no,menubar=no,location=no');
		document.BranchForm.target = 'BranchInfo';
		document.BranchForm.action = HUBRIS_urlPrefix + 'AcAcctOpenBranchInfo?cmd-AcctOpenBranchInfoPortlet_in=';
		document.BranchForm.submit();
	}

	function HUBRIS_popUpAuctionTrade(){
		var auctWin = window.open('http://www.hsbc.com.hk/1/2/hk/misc/pib-info','AuctionTrade','width=785,height=443,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		auctWin.focus();
	}

	function HUBRIS_popUpPilNonDARate(){
		var rateWin = window.open("http://www.hsbc.com.hk/1/2/hk/loans/pil/rates",'Rate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		rateWin.focus();
	}

	function HUBRIS_popUpPilDARate(mktPgm){
		var daRateWin = window.open("http://www.banking.hsbc.com.hk/script/hk/personal/loan/ploan/showint.asp?int_type=PIL&int_gp="+mktPgm,'Rate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		daRateWin.focus();
	}

	function HUBRIS_popUpPtlDARate(mktPgm){
		var daRateWin = window.open("http://www.banking.hsbc.com.hk/script/hk/personal/loan/ploan/showint.asp?int_type=PTL&int_gp="+mktPgm,'Rate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		daRateWin.focus();
	}

	function HUBRIS_popUpRcfNonDARate(){
		var rateWin = window.open("http://www.hsbc.com.hk/1/2/hk/loans/pil/rates",'Rate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		rateWin.focus();
	}

	function HUBRIS_popUpRcfDARate(pdtGpPgm){
		var daRateWin = window.open("http://www.banking.hsbc.com.hk/script/hk/personal/loan/ploan/showint.asp?int_type=RCF&int_gp="+pdtGpPgm,'Rate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		daRateWin.focus();
	}

	function HUBRIS_popUpLoanSpecialOffer(){
		var lnSpecOfferWin = window.open("http://www.banking.hsbc.com.hk/hk/personal/loan/ploan/offer.htm",'SpecialOffer','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		lnSpecOfferWin.focus();
	}

	function HUBRIS_popUpPersonalLoanPlanTC(){
		
		HUBRIS_pws_hbap_popupPdf('/content/hongkong/pws_pdf/hk/personal/pdf/tc_ploan.pdf' ,'TC', 'width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
	}

	function HUBRIS_popupInsurance(location){		
        	var insuranceWin = window.open(location,'Insurance','width=390,height=400,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		insuranceWin.focus();
	}

	function HUBRIS_popSaveInstrNote(link) {
		var saveInstrNoteWin = window.open(link,'SvPrnNt','top=0,left=0,width=400,height=250,scrollbars=yes,status=no,resizable=no,toolbar=no,directories=no,menubar=no,location=no');
		saveInstrNoteWin.focus();
	}

	function HUBRIS_popupAutosweepFXLearnMore(){
		var argArray = HUBRIS_popupAutosweepFXLearnMore.arguments;
		var learnMoreURL = '';
		if(argArray!=null && argArray[0]!=null && argArray[0]=="YB")
			learnMoreURL = 'http://www.hsbc.com.hk/1/2/hk/investments/fcy';
		else
			learnMoreURL = 'http://www.hsbc.com.hk/1/2/hk/investments/fcy';

		var asFXWin = window.open(learnMoreURL,'asFX','top=0,left=0,width=400,height=250,scrollbars=yes,status=no,resizable=yes,toolbar=no,directories=no,menubar=no,location=no');
		asFXWin.focus();
	}

	function HUBRIS_popupAutosweepUTLearnMore(){
		var asUTWin = window.open('http://www.banking.hsbc.com.hk/hk/personal/special/02Oct02a.htm','asUT','top=0,left=0,width=400,height=250,scrollbars=yes,status=no,resizable=yes,toolbar=no,directories=no,menubar=no,location=no');
		asUTWin.focus();
	}

	function HUBRIS_popUpPilPromoPlusRate(){
		var pilRateWin = window.open("http://www.hsbc.com.hk/1/2/hk/loans/pil/rates",'pilPrompRate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		pilRateWin.focus();
	}

	function HUBRIS_popUpRcfPromoPlusRate(){
		var rcfRateWin = window.open("http://www.hsbc.com.hk/1/2/hk/loans/rcf/rates",'rcfPrompRate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		rcfRateWin.focus();
	}

	function HUBRIS_popUpPtlPromoPlusRate(){
		var ptlRateWin = window.open("http://www.banking.hsbc.com.hk/hk/personal/loan/promo/ptl.htm",'ptlPrompRate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		ptlRateWin.focus();
	}

	function HUBRIS_popUpRpiRate(){
		var pilRateWin = window.open("http://www.hsbc.com.hk/1/2/hk/loans/pil/redraw-rate",'pilPrompRate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		pilRateWin.focus();
	}

	function HUBRIS_popUpPilPromo(){
		var pilRateWin = window.open("http://www.banking.hsbc.com.hk/hk/personal/loan/promo/pil.htm",'pilRate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		pilRateWin.focus();
	}

	function HUBRIS_popUpRcfPromo(){
		var rcfRateWin = window.open("http://www.banking.hsbc.com.hk/hk/personal/loan/promo/rcf.htm",'rcfRate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		rcfRateWin.focus();
	}
	
	function HUBRIS_popUpPilLongPromo(){
		var pilRateWin = window.open("http://www.hsbc.com.hk/1/2/special/loans/pil",'pilRate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		pilRateWin.focus();
	}

	function HUBRIS_popUpRcfLongPromo(){
		var rcfRateWin = window.open("http://www.hsbc.com.hk/1/2/special/loans/rcf",'rcfRate','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		rcfRateWin.focus();
	}

	function HUBRIS_popUpLoanRepaymentProtectionPolicy() {
		
		HUBRIS_pws_hbap_popupPdf('/content/hongkong/pws_pdf/hk/personal/insur/loan_repymt_policy.pdf' ,'lnProtectPolicy', 'width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
	}

	function HUBRIS_popUpLoanRepaymentProtectionFeature() {
		var lnProtectFeature = window.open("http://www.hsbc.com.hk/1/2/hk/insurance/more/loan-repay", 'lnProtectFeature','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		lnProtectFeature.focus();
	}

	function HUBRIS_popUpLoanRepaymentProtectionCoverTerm() {
		var lnProtectCT = window.open("http://www.hsbc.com.hk/1/2/hk/insurance/more/loan-repay/highlighs", 'lnProtectCT','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		lnProtectCT.focus();
	}
	function HUBRIS_popupStopLimitSellTC(link) {
		HUBRIS_popupWindow(link, 'TCStopLimitSell');
	}
	function HUBRIS_popupInvHPAcctTC() {
		var InvAcctTC = window.open(HUBRIS_urlPrefix + 'InvHPAcctTCPopup', 'InvAcctTC','width=530,height=600,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		InvAcctTC.focus();
	}
	function HUBRIS_popupInvPVAcctTC() {
		var InvAcctTC = window.open(HUBRIS_urlPrefix + 'InvPVAcctTCPopup', 'InvAcctTC','width=530,height=600,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		InvAcctTC.focus();
	}
	function HUBRIS_popupInvSVAcctTC() {
		var InvAcctTC = window.open(HUBRIS_urlPrefix + 'faq/ivacctopeninvsvaccttc', 'InvAcctTC','width=530,height=600,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		InvAcctTC.focus();
	}		
	function HUBRIS_popupSecAcctTC() {
		var SecAcctTC = window.open(HUBRIS_urlPrefix + 'SecAcctTCPopup', 'SecAcctTC','width=530,height=600,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		SecAcctTC.focus();
	}
	function HUBRIS_popupUTAcctTC() {
		
		HUBRIS_pws_hbap_popupPdf('/content/hongkong/pws_pdf/hk/personal/invest/unit/pdf/ut_tc.pdf' ,'UTAcctTC', 'width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
	}
	function HUBRIS_popupStopLossTC() {
		
		HUBRIS_pws_hbap_popupPdf('/content/hongkong/pws_pdf/hk/personal/invest/pdf/stoploss_tc.pdf','StopLossTC', 'width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
	}
	function HUBRIS_popupInvestAcctRelevantCharge() {
		var InvRelChrg = window.open("http://www.hsbc.com.hk/1/2/hk/investments/stocks/detail", 'InvRelevantCharge','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		InvRelChrg.focus();
	}
	function HUBRIS_popupHPCreditCardTC(link){
		var HPCreditCardMajorTC = window.open(link,'HPCreditCardMajorTC','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		HPCreditCardMajorTC.focus();
	}
	function HUBRIS_popupPremierCreditCard(){
		var premierCreditCard = window.open("http://www.hsbc.com.hk/1/2/hk/cards/premier",'PremierCreditCard','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		premierCreditCard.focus();
	}
	function HUBRIS_popupHPAppointment() {
		var pwsHPAppointmentWin = window.open("https://www.tools.asiapacific.hsbc.com/webform/apply?id=hk+personal+bank+hp&lang=en&init=true",'HPAppointment','width=680,height=440,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		pwsHPAppointmentWin.focus();
	}
	function HUBRIS_popupPbTaxDemo(){
		var pbTaxDemoWin = window.open('http://www.banking.hsbc.com.hk/hk/personal/loan/tax/demo/default01.htm','PbTaxDemo','width=620,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		pbTaxDemoWin.focus();
	}
	function HUBRIS_popupPbLimitDemo(){
		var pbTaxDemoWin = window.open('http://www.banking.hsbc.com.hk/hk/personal/loan/tax/demo/default02.htm','PbTaxDemo','width=620,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		pbTaxDemoWin.focus();
	}
	function HUBRIS_popUpRenminbiFaq() {
		var renminbiFaqWin = window.open('http://www.hsbc.com.hk/hk/misc/rmb-info','RenminbiFaq','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		renminbiFaqWin.focus();
	}

	function HUBRIS_popORTTServiceCharge(anchor) {
		var link = "http://www.hsbc.com.hk/1/2/hk/misc/oversea-fee";
		var anchorStr = "";
		if(anchor == "LOCAL")
			anchorStr = "#local";
		else if(anchor == "OVERSEAS")
			anchorStr = "#oversea";
		link = link + anchorStr;
		
		var orttServChargeWin = window.open(link,'ORTTServCharge','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		orttServChargeWin.focus();
	}
	function HUBRIS_popSITTServiceCharge(anchor) {
		var link = "http://www.hsbc.com.hk/1/2/hk/misc/sitt-info";
		var anchorStr = "";
		if(anchor == "LOCAL")
			anchorStr = "#local";
		else if(anchor == "OVERSEAS")
			anchorStr = "#oversea";
		link = link + anchorStr;
		
		var sittServChargeWin = window.open(link,'SITTServCharge','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		sittServChargeWin.focus();
	}

	function HUBRIS_popUpRenminbiLocalCharge() {
		var rmbLocalChargeWin = window.open('http://www.hsbc.com.hk/hk/misc/rmb-charges','RenminbiLocalCharge','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		rmbLocalChargeWin.focus();
	}
	function getPopUpCoordStr(top_x, top_y, startOfStr) {
		var popUpStr = "";
		if (top_x != "-1" && top_y != "-1") {
			if (!startOfStr) popUpStr = ',';
			if (navigator.appName.indexOf("Microsoft")>=0)
				popUpStr+='left='+top_x+',top='+top_y;
			else
				popUpStr+='screenX='+top_x+',screenY='+top_y;
		}
		return popUpStr;
	}

	//Michelle
	function HUBRIS_matchCountryDistrict(Dlist, Clist)
	{
		if (Clist.options[Clist.selectedIndex].value.substring(0, 2) != "HK")
			Dlist.options[0].selected = true;
	}

	function HUBRIS_matchDistrictCountry(Dlist, Clist)
	{
		if(Dlist.selectedIndex != 0){
			for (var i = 0; i<Clist.length; i++){
				if (Clist.options[i].value.substring(0, 2) == "HK"){
					Clist.options[i].selected = true;
					break;
				}
			}
		}
	}

	//Michelle
	function HUBRIS_popUpBannerLink(link){
		var newWin = window.open(link,'banner','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		newWin.focus();
	}

	// Malcolm
	function HUBRIS_popupDAcctLimit(action,x)
	{
		var win_link=HUBRIS_transgif_url;
		var str1 = '<html><title>online@hsbc</title><body bgcolor="#FFFFFF">';
		var str2 = '<form autocomplete=off name=Form1 action="' + action + '" method="POST"><input type=hidden name=Acc value="'+x+'"></form></body></html>';
		var balancewin = window.open(win_link,'balance','width=308,height=165,menubar=no,toolbar=no,directories=no,location=no,scrollbars=auto,status=yes,resizable=yes');
		balancewin.document.open();
		balancewin.document.write(str1);
		balancewin.document.writeln(str2);
		balancewin.document.close();
		balancewin.document.Form1.submit();
		balancewin.focus();
	}

	function HUBRIS_popupDAcctLimitWithType(action, x, type)
	{
		var win_link=HUBRIS_transgif_url;
		var str1 = '<html><title>online@hsbc</title><body bgcolor="#FFFFFF">';
		var str2 = '<form autocomplete=off name=Form1 action="' + action + '" method="POST"><input type=hidden name=Acc value="'+x+'"><input type=hidden name=Type value="'+type+'"></form></body></html>';
		var balancewin = window.open(win_link,'balance','width=308,height=165,menubar=no,toolbar=no,directories=no,location=no,scrollbars=auto,status=yes,resizable=yes');
		balancewin.document.open();
		balancewin.document.write(str1);
		balancewin.document.writeln(str2);
		balancewin.document.close();
		balancewin.document.Form1.submit();
		balancewin.focus();
	}
	
	function HUBRIS_lnWaitAtConfirmation(timeOut,displayTitle,displayContent,imagePath_1ptrans) {
	       var win_link=HUBRIS_transgif_url;
	       var str1 = '<html><head><title>online@hsbc</title></head><BODY onload="setTimeout(\'window.close()\',' + timeOut + ')"  bgcolor="#ffffff" leftmargin="0" marginwidth="0"> ';	
	       str1 = str1 + '<table cellpadding="0" cellspacing="0" border="0" width="300"><tr valign="top"><td valign="top" align="left"><table border="0" cellpadding="4" cellspacing="0" width="100%">';
	       str1 = str1 + '<tr><td height="5"></td></tr><tr><td><img src="' + imagePath_1ptrans + '" height="5"></td></tr>';
	       str1 = str1 + '<tr><td width="5%">&nbsp;</td><td bgcolor="#8DD1B6"><font Style="' + HUBRIS_classHeader1 + '"><b>' + displayTitle + '</b></font></td><td width="5%">&nbsp;</td></tr><tr><td width="5%">&nbsp;</td><td>';
	       str1 = str1 + '<table border="0" cellpadding="3" cellspacing="2"><tr><td>&nbsp;</td></tr><tr><td><font Style="' + HUBRIS_classFont + '">' + displayContent + '</font></td></tr><tr><td><img src="' + imagePath_1ptrans + '" height="5"></td></tr></table>';
	       str1 = str1 + '</td></tr></table><form autocomplete=off></form>';
	       str1 = str1 + '</body></html>';

	        var waitProcess = window.open(win_link,'WaitProcess','left=250,top=150,width=300,height=230,scrollbars=no,status=no,resizable=no,toolbar=no,directories=no,menubar=no,location=no');
   	        waitProcess.document.open();
		waitProcess.document.write(str1);
		waitProcess.document.close();
		waitProcess.focus();
	
	}	
	
	//Michelle
	function HUBRIS_startTimer(formName, action){
		setTimeout("popUpTimer('" + formName + "', '" + action + "');", 720*1000);
	}
	function popUpTimer(formName, action){
		alert(Error_402);
		eval("document." + formName + ".action = '" + action + "';");
		eval("document." + formName + ".submit();");
	}

	// Malcolm
	function HUBRIS_setSessionCookie (name, value, expires, path, domain, secure) {
		document.cookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	}

	// Malcolm
	 function HUBRIS_getSessionCookie(name) {
		var prefix = name + "=";
		var cookieStartIndex = document.cookie.indexOf(prefix);
		if (cookieStartIndex == -1)
			return null;
		var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
		if (cookieEndIndex == -1)
			cookieEndIndex = document.cookie.length;
		return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
	}


	//Sherman
 	function HUBRIS_openWinAtLeftCorner(link,winWidth,winHeight){
	winStats='toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,status=no,resizable=yes';
	if (navigator.appName.indexOf("Microsoft")>=0)
	winStats+=',left=0,top=0,width='+winWidth+',height='+winHeight;
	else
	winStats+=',screenX=0,screenY=0,width='+winWidth+',height='+winHeight;
	pop=window.open(link,"pop",winStats)
	pop.focus();
	}

	function HUBRIS_popBounsInterestRate(){
        var newWin = HUBRIS_openWinAtLeftCorner('http://www.hsbc.com.hk/hk/misc/tcb-rate','500','400');
	}

	function HUBRIS_popTrbFaq(){
        var newWin = HUBRIS_openWinAtLeftCorner('http://www.hsbc.com.hk/hk/misc/tcr-rate','500','400');
	}



	//Sherman
	function HUBRIS_popUpInvest(){
		var newWin = window.open('http://www.banking.hsbc.com.hk/hk/personal/special/newinv.htm','investAck','width=785,height=443,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		newWin.focus();
	}


	// Malcolm
	function HUBRIS_mpfSpecialOfferPopup(){
        var mpfSpecialOffersWin = window.open('http://www.banking.hsbc.com.hk/hk/mpf/default.htm','HSBC','');
		mpfSpecialOffersWin.focus();
	}

	//Joanne
	function HUBRIS_popUpSoleProp(filename){
		var newWin = window.open(filename,'solePropWin','width=480,height=230,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		newWin.focus();
	}

	//Norman
	function HUBRIS_popUpEmToHSBC(filename)
	{   var EmToHSBCwin = window.open(filename, 'termsandcondition','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
			EmToHSBCwin.focus();
	}

	//Malcolm
	function HUBRIS_popUpMoreService(){
        var moreServiceWin = window.open('http://www.hsbc.com.hk/1/2/home','HSBC','');
		moreServiceWin.focus();
	}

	function HUBRIS_popUpPILoanTermsAndConditions(fileName){
		var PILoanTermsAndConditions = window.open(fileName, 'termsandcondition','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		PILoanTermsAndConditions.focus();
	}

	function HUBRIS_popUpDisclaimer(link){
        var disclaimerwin = window.open(link,'disclaimer','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		disclaimerwin.focus();
	}//End of function HUBRIS_popUpDisclaimer()

	function HUBRIS_popUpTermsAndConditions(link){
        var termsandconditionwin = window.open(link,'termsandcondition','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		termsandconditionwin.focus();
	}//End of function HUBRIS_popUpTermsAndConditions()

	function HUBRIS_popTermsConditions(termsName){
        var termswin = window.open(termsName,'TermsAndConditions','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		termswin.focus()
	}//End of function HUBRIS_popTermsConditions() for Insurance

	// Malcolm
	function HUBRIS_printScreen(){
		printWarning = HUBRIS_getSessionCookie("printWarning");
		if (printWarning != "false"){
			alert(HUBRIS_Msg_001);
		}

      if (navigator.userAgent.toLowerCase().indexOf("mac")!=-1) {
			alert("To print this screen, please press 'Command-P' and use Landscape printing option");
			HUBRIS_setSessionCookie("printWarning", "false","","/",".hsbc.com.hk","true");
	   }
	   else{
			window.print();
			HUBRIS_setSessionCookie("printWarning", "false","","/",".hsbc.com.hk","true");
		}
	}//End of function HUBRIS_printScreen()

	function HUBRIS_printAck(){
      if (navigator.userAgent.toLowerCase().indexOf("mac")!=-1) {
			alert("To print this screen, please press 'Command-P' and use Landscape printing option");
	   }
	   else{
			window.print();
		}
	}

	function HUBRIS_backToPrevious(){
		window.history.back(-1);
	}//End of function HUBRIS_backToPrevious()


    function HUBRIS_download(fileName){
	win=window.open(fileName,'Form','menubar=no,resizable=yes,toolbar=no,location=no,directories=no,scrollbars=no,center=yes,status=yes,width=400,height=400,screenX=150,screenY=200,top=200,left=150');
	if (!win.opener)win.opener=self;
	if (win.focus)win.focus();
    }

    function HUBRIS_popUpFAQ(link)
    {
        var faqwin = window.open(link,'faq','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		faqwin.focus();
	}

    function HUBRIS_popUpFAQServiceFees(link)
    {
	var faqServiceFeesWin = window.open(link,'faq','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
	faqServiceFeesWin.focus();
    }

	function HUBRIS_popUpSecFaq(link) {
		var secWin = window.open(link,'faq','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		secWin.focus();
	}
	function HUBRIS_popUpSecMain() {
		var link = "http://www.banking.hsbc.com.hk/hk/personal/security/default_hk.htm";
		var secWin = window.open(link,'securityWin','top=75,left=60,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=680,height=440');
		secWin.focus();
	}
	function HUBRIS_popUpSecAdPwd(link) {
		var secWin = window.open(link,'securityWin','top=75,left=60,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=400');
		secWin.focus();
	}
	function HUBRIS_popUpPreLogonFAQ(link) {
		if (link.length == 0) link = "http://www.hsbc.com.hk/hk/misc/faq";
		var faqwin = window.open(link,'faq','width=738,height=560,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		faqwin.focus();
	}
	function HUBRIS_popUpKeyFeatures(link) {
		if (link.length == 0) link = "http://www.hsbc.com.hk/hk/personal/internet-banking";
		var keyWin = window.open(link,'keyfeature','width=800,height=440,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		keyWin.focus();
	}

	function HUBRIS_popUpSecurity(link,x, y)
	{
		var winStatus = 'width=445,height=450,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no';
		winStatus+=getPopUpCoordStr(x, y, false);
		var securityWin = window.open(link, 'Security', winStatus);
		securityWin.focus();
	}


    function HUBRIS_popUpDemo(link)
    {
    	if (link.length == 0) link = "http://www.banking.hsbc.com.hk/hk/personal/pibdemo/demo.htm";
        var demowin = window.open(link,'demo','width=680,height=440,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		demowin.focus();
    }

    function HUBRIS_popFundInfo(link)
    {
    	if (link.length == 0) link = "http://www.hsbc.com.hk/1/2/hk/investments/ut/disclaimer";
        var fundwin = window.open(link,'fundInfo','width=400,height=400,menubar=yes,toolbar=yes,directories=yes,location=no,scrollbars=yes,status=yes,resizable=yes');
	fundwin.focus();
    }

   function HUBRIS_popFundAnnReport(link)
   {
   	if (link.length == 0)
    		link = "http://www.hsbc.com.hk/1/2/hk/investments/ut/disclaimer";
    	var fundwin = window.open(link,'fundInfo','width=400,height=400,menubar=yes,toolbar=yes,directories=yes,location=no,scrollbars=yes,status=yes,resizable=yes');
		fundwin.focus();
   }

   function HUBRIS_popFundIntReport(link)
   {
   	if (link.length == 0)
    		link = "http://www.hsbc.com.hk/1/2/hk/investments/ut/disclaimer";
    	var fundwin = window.open(link,'fundInfo','width=400,height=400,menubar=yes,toolbar=yes,directories=yes,location=no,scrollbars=yes,status=yes,resizable=yes');
		fundwin.focus();
   }

	function HUBRIS_popupBalance(link,action,x)
	{
		link=HUBRIS_getlink(link);
		var str1 = '<html><title>online@hsbc</title><body bgcolor="#FFFFFF">';
		var str2 = '<form autocomplete=off name=Form1 action="' + action + '" method="POST"><input type=hidden name=Acc value="'+x+'"></form></body></html>';
		var balancewin = window.open(link,'balance','width=308,height=165,menubar=no,toolbar=no,directories=no,location=no,scrollbars=auto,status=yes,resizable=yes');
		balancewin.document.open();
		balancewin.document.write(str1);
		balancewin.document.writeln(str2);
		balancewin.document.close();
		balancewin.document.Form1.submit();
		balancewin.focus();
	}

	function HUBRIS_popupCalFutureVal(link,action,DepCur, LnkCur, Amount, DbAcct, DpAcct, DpTerm)
	{	var height;
		if(LnkCur == "")	// Normal get Rate
			height = 180;
		else
			if(DpTerm == "")	// DPS get all in rate
				height = 330;
			else	// DPS get rate
				height = 240;

		link=HUBRIS_getlink(link);
		var str1 = '<html><title>online@hsbc</title><body bgcolor="#FFFFFF">';
		var str2 = '<form autocomplete=off name=Form1 action="' + action + '" method="POST"><input type=hidden name=url value="TdIn"><input type=hidden name=DepCur value="'+DepCur+'"><input type=hidden name=LnkCur value="'+LnkCur+'"><input type=hidden name=TxnAmt value="'+Amount+'"><input type=hidden name=DebitAcct value="'+DbAcct+'"><input type=hidden name=DepAcct value="'+DpAcct+'"><input type=hidden name=DepTerm value="'+DpTerm+'"></form></body></html>';
		var calwin = window.open(link,'calFutureVal','width=310,height='+height+',menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		calwin.document.open();
		calwin.document.write(str1);
		calwin.document.writeln(str2);
		calwin.document.close();
		calwin.document.Form1.submit();
		calwin.focus();
	}
	function HUBRIS_popupCalFutureValSid(link, action, DepCur, LnkCur, Amount, DbAcct, DpAcct, DpTerm)
	{
		link=HUBRIS_getlink(link);
		var height = 210;
		var str1 = '<html><title>online@hsbc</title><body bgcolor="#FFFFFF">';
		var str2 = '<form autocomplete=off name=Form1 action="' + action + '" method="POST"><input type=hidden name=url value="TdSidApplyIn"><input type=hidden name=DepCur value="'+DepCur+'"><input type=hidden name=LnkCur value="'+LnkCur+'"><input type=hidden name=TxnAmt value="'+Amount+'"><input type=hidden name=DebitAcct value="'+DbAcct+'"><input type=hidden name=DepAcct value="'+DpAcct+'"><input type=hidden name=DepTerm value="'+DpTerm+'"></form></body></html>';
		var calwin = window.open(link,'calFutureValSid','width=310,height='+height+',menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		calwin.document.open();
		calwin.document.write(str1);
		calwin.document.writeln(str2);
		calwin.document.close();
		calwin.document.Form1.submit();
		calwin.focus();
	}
	function HUBRIS_popupForCurrGetRate(link,action,BA, RC, RA, DA, TAC, WhichAccount, OA)
	{	
		link=HUBRIS_getlink(link);
		var str1 = '<html><title>online@hsbc</title><body bgcolor="#FFFFFF">';
		var str2 = '<form autocomplete=off name=Form1 action="' + action + '" method="POST"><input type=hidden name=source value="ForeignCurr"><input type=hidden name=OtherAccount value="'+BA+'"><input type=hidden name=DebitAmountCurrency value="'+RC+'"><input type=hidden name=DebitAmount value="'+RA+'"><input type=hidden name=DebitAccount value="'+DA+'"><input type=hidden name=TargetAccountCurrency value="'+TAC+'"><input type=hidden name=WhichAccount value="'+WhichAccount+'"><input type=hidden name=OwnAccount value="'+OA+'"></form></body></html>';
		var forecurrencygetratewin = window.open(link,'GetRate','width=310,height=180,menubar=no,toolbar=no,directories=no,location=no,scrollbars=auto,status=yes,resizable=yes');
		forecurrencygetratewin.document.open();
		forecurrencygetratewin.document.write(str1);
		forecurrencygetratewin.document.writeln(str2);
		forecurrencygetratewin.document.close();
		forecurrencygetratewin.document.Form1.submit();
		forecurrencygetratewin.focus();
	}

	function HUBRIS_popupBuySellGoldGetRate(link,action,RA, DA, OA)
	{
		link=HUBRIS_getlink(link);
		var str1 = '<html><title>online@hsbc</title><body bgcolor="#FFFFFF">';
		var str2 = '<form autocomplete=off name=Form1 action="' + action + '" method="POST"><input type=hidden name=source value="BuySellGold"><input type=hidden name=DebitAmount value="'+RA+'"><input type=hidden name=DebitAccount value="'+DA+'"><input type=hidden name=OwnAccount value="'+OA+'"></form></body></html>';
		var buysellgoldgetratewin = window.open(link,'GetRate','width=310,height=180,menubar=no,toolbar=no,directories=no,location=no,scrollbars=auto,status=yes,resizable=yes');
		buysellgoldgetratewin.document.open();
		buysellgoldgetratewin.document.write(str1);
		buysellgoldgetratewin.document.writeln(str2);
		buysellgoldgetratewin.document.close();
		buysellgoldgetratewin.document.Form1.submit();
		buysellgoldgetratewin.focus();
	}

	function HUBRIS_popupRemGetRate(link,action,CA, RC, RA, DA)
	{	
		link=HUBRIS_getlink(link);
		var str1 = '<html><title>online@hsbc</title><body bgcolor="#FFFFFF">';
		var str2 = '<form autocomplete=off name=Form1 action="' + action + '" method="POST"><input type=hidden name=source value="Remittance"><input type=hidden name=u_BeneficiaryAccount value="'+CA+'"><input type=hidden name=RemittanceAmountCurrency value="'+RC+'"><input type=hidden name=u_RemittanceAmount value="'+RA+'"><input type=hidden name=DebitAccount value="'+DA+'"></form></body></html>';
		var remgetratewin = window.open(link,'GetRate','width=310,height=180,menubar=no,toolbar=no,directories=no,location=no,scrollbars=auto,status=yes,resizable=yes');
		remgetratewin.document.open();
		remgetratewin.document.write(str1);
		remgetratewin.document.writeln(str2);
		remgetratewin.document.close();
		remgetratewin.document.Form1.submit();
		remgetratewin.focus();
	}

	function HUBRIS_popupBuyingPower(link, action, SecAcct, SetAcct)
	{
		link=HUBRIS_getlink(link);
		var str1 = '<html><title>online@hsbc</title><body bgcolor="#FFFFFF">';
		var str2 = '<form autocomplete=off name=Form1 action="' + action + '" method="POST"><input type=hidden name=SecurityAcct value="'+SecAcct+'"><input type=hidden name=SettlementAcct value="'+SetAcct+'"></form></body></html>';
		var buypowerwin = window.open(link,'IvBuyingPower','width=481,height=310,menubar=no,toolbar=no,directories=no,location=no,scrollbars=auto,status=no,resizable=yes');
		buypowerwin.document.open();
		buypowerwin.document.write(str1);
		buypowerwin.document.writeln(str2);
		buypowerwin.document.close();
		buypowerwin.document.Form1.submit();
		buypowerwin.focus();
	}
	function HUBRIS_popupFundsOfTheQuarter()
	{	 		
		var fundsOfTheQuarterWin = window.open('http://www.banking.hsbc.com.hk/data/hk/personal/invest/unit/pdf/ut_sl_00001_bl.pdf','foq','width=400,height=500,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		fundsOfTheQuarterWin.focus();
		
	}
	function HUBRIS_openTimetable(link)
	{
		var Timetable=window.open(link,'TimeTable', 'width=575,height=430,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		Timetable.focus();
	}

    	function HUBRIS_popMerchantList()
    	{
        	var listwin = window.open('http://www.hsbc.com.hk/1/2/hk/banking/payments/merchant-list','MerchantList','width=400,height=500,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		listwin.focus();
	}

	function HUBRIS_popUpUTRestriction(link)
	{
        var UTRestrictionwin = window.open(link,'Restriction','width=550,height=450,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		UTRestrictionwin.focus();
	}

	function HUBRIS_popUpMpfHotline(link)
	{
	var MpfHotlinewin = window.open(link,'MpfHotline','width=550,height=450,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		MpfHotlinewin.focus();
	}

	function HUBRIS_popUpMpfInvPerfReport() {
		var MpfInvPerfReportwin = window.open('http://www.banking.hsbc.com.hk/hk/mpf/pdf/invrptec.pdf','MpfInvPerfReport','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		MpfInvPerfReportwin.focus();
	}

	

	function HUBRIS_popPICS(PICS){
        var picswin = window.open(PICS,'PersonalInformationCollectionStatement','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		picswin.focus();
	}

	function HUBRIS_popInsuranceMakeClaim() {
		var argArray = HUBRIS_popInsuranceMakeClaim.arguments;
		var makeClaimURL = '';
		if(argArray!=null && argArray[0]!=null && argArray[0]=="YB")
			makeClaimURL = 'http://www.hsbc.com.hk/1/2/hk/insurance/claims-assist/make-claim?pwscmd=cmd_init';
		else
			makeClaimURL = 'http://www.hsbc.com.hk/1/2/hk/insurance/claims-assist/make-claim?pwscmd=cmd_init';

		var popInsMkClmWin = window.open(makeClaimURL, "MkClm", "menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,resizable=yes");
		popInsMkClmWin.focus();
	}
	function HUBRIS_popInsuranceAmendPolicy() {
		var argArray = HUBRIS_popInsuranceAmendPolicy.arguments;
		var amendPolicyURL = '';
		if(argArray!=null && argArray[0]!=null && argArray[0]=="YB")
			amendPolicyURL = 'http://www.hsbc.com.hk/1/2/hk/insurance/amend-policy';
		else
			amendPolicyURL = 'http://www.hsbc.com.hk/1/2/hk/insurance/amend-policy';

		var popInsAmdPlcyWin = window.open(amendPolicyURL, "AmdPlcy", "menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,resizable=yes");
		popInsAmdPlcyWin.focus();
	}
	function HUBRIS_popInsuranceProductHighlight(product) {
		var insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance";
		if (product == "ACS")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/accident/highlights";
		else if (product == "TRS")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/travel/highlights";
		else if (product == "MTI")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/travel/highlights";
		else if (product == "HMS")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/home/highlights";
		else if (product == "HPN")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/health/hospital/highlights";
		else if (product == "TML")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/life/term-life/highlights";
		else if (product == "IGO")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/golfer/highlights";
		else if (product == "IDH")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/helper/highlights#helpercoverage";
        else if (product == "IHR")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/health/refund-hospital/highlights";
		else if (product == "IOP")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance";
		else if (product == "IFI")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/fire/highlights";
		else if (product == "IFIH")
			insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance/home";
	
		var argArray = HUBRIS_popInsuranceProductHighlight.arguments;
		if(argArray!=null && argArray[1]!=null && argArray[1]=="YB")
			insUrl += '?appCust=YB';

		var popInsPdtHiLgtWin = window.open(insUrl, "PdtHiLgt", "width=500,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,resizable=yes");
		popInsPdtHiLgtWin.focus();
	}
	function HUBRIS_popupInsuranceCmcProductHighlight(){
        	var insCmcPdtHiLgtWin = window.open("http://www.hsbc.com.hk/1/2/hk/insurance/travel/highlights#chinaMedicalCard",'Insurance','width=390,height=400,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		insCmcPdtHiLgtWin.focus();
	}
	function HUBRIS_popupInsuranceCmcTC(){
        	var insCmcPdtTcWin = window.open("http://www.banking.hsbc.com.hk/hk/personal/insur/travel/pop_mta.htm",'Insurance','width=390,height=400,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		insCmcPdtTcWin.focus();
	}
	function HUBRIS_popInsuranceHazardousActList() {
		var popHazActLstWin = window.open("http://www.banking.hsbc.com.hk/hk/personal/insur/accid/hazact.htm", "hazact", "width=500,height=500,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes");
		popHazActLstWin.focus();
	}
	function HUBRIS_popUpInsuranceHealthCheckUp() {
		var popInsHeaChkWin = window.open("http://www.hsbc.com.hk/1/2/hk/insurance/helper/checkup", "HealthCheckUp", "width=500,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,resizable=yes");
		popInsHeaChkWin.focus();
	}
	function HUBRIS_popInsuranceSummaryOfCover(product) {
		var insUrl = "http://www.hsbc.com.hk/1/2/hk/insurance";
		if (product == "ACS")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/accide.pdf";
		else if (product == "TRS")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/travele.pdf";
		else if (product == "MTI")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/travele.pdf";
		else if (product == "HMS")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/homee.pdf";
		else if (product == "HPN")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/hospe.pdf";
		else if (product == "TML")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/easye.pdf";
		else if (product == "IGO")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/golfere.pdf";
		else if (product == "IDH")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/helpere.pdf";
		else if (product == "IHR")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/refhose.pdf";
		else if (product == "IOP")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/outpate.pdf";
		else if (product == "IFI")
			insUrl = "/content/hongkong/pws_pdf/hk/personal/pdf/firee.pdf";	
		
		HUBRIS_pws_hbap_popupPdf(insUrl ,'SummaryCover', 'width=500,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,resizable=yes');
		
	}
	function HUBRIS_popUpInsuranceCardRepaymentProtectionPlanFeature() {
		var inCCRPFeature = window.open("http://www.hsbc.com.hk/1/2/hk/insurance/more/card-repay", 'inCCRPFeature','width=600,height=450,resizable=yes,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes');
		inCCRPFeature.focus();
	}

	function HUBRIS_popISMoreInfo(form1) {
		//var isMoreInfoWin = window.open(link, "ISTellMeMore", "top=260,left=130,width=500,height=310,location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes");
		//isMoreInfoWin.focus();
		var win_link=HUBRIS_transgif_url;
		var isMoreInfoWin = window.open(win_link, "ISTellMeMore", "top=260,left=130,width=500,height=310,location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes");
		form1.submit();
		isMoreInfoWin.focus();
	}
	
	function HUBRIS_goISResponse(obj, url, id, from) {
		obj.href = url + "?" + "key=" + id + "&from=" + from;
	}

	function HUBRIS_popTimeTable(TimeTable){
        var ttwin = window.open(TimeTable,'TimeTable','width=600,height=260,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		ttwin.focus();
	}

	function HUBRIS_popProspectusWindow(link)    {
	        var listwin = window.open(link,'SummaryofExplanatoryMemorandum','width=400,height=500,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes,resizable=yes');
		listwin.focus();
	}

	function HUBRIS_dimMsg() {
		alert('Please set your account parameters before you use the banking services online.');
		return false;
	}

    function HUBRIS_getCookie(name)
    {
        var cookieFound = false;
        var start = 0;
        var end = 0;
        var cookieString = document.cookie;
        var i = 0;

        // SCAN THE COOKIE FOR name
        while (i <= cookieString.length)
        {
            start = i;
            end = start + name.length;
            if (cookieString.substring(start,end) == name)
            {
                cookieFound = true;
                break;
            }
            i++;
        }

        // IS name FOUND?
        if (cookieFound)
        {
            start = end + 1;
            end = document.cookie.indexOf(";",start);
            if (end < start)
                end = document.cookie.length;
            return document.cookie.substring(start,end);
        }
        return "";
    }

	function HUBRIS_isIE()
	{	return (navigator["appName"].indexOf("Microsoft Internet Explorer")!=-1);
	}


	function HUBRIS_isVersionFive()
	{	return (navigator["appVersion"].indexOf("MSIE 5.0;")!=-1);
	}

	function HUBRIS_isIEVersionFive()
	{	return (HUBRIS_isIE() && HUBRIS_isVersionFive());
	}

	function HUBRIS_toggleLang (form, lang, country, needWarning){
		return HUBRIS_finaltoggleLang(form, lang, country, needWarning);
	}

	function HUBRIS_finaltoggleLang (form, lang, country, needWarning){
	var cl = true;
	var ToggleMsg = "The data you entered will not be stored if you switch to the other language.  Do you want to continue?";
	var IEVersion5 = "Attention: For Microsoft Internet Explorer (IE) users, the Chinese version of online@hsbc has to be run on IE 5.01 or above.\n\n";
	var WarnMsg = "";

	if (HUBRIS_isIEVersionFive())
	{	WarnMsg = IEVersion5;
	}

	if (needWarning)
	{	WarnMsg += ToggleMsg ;
	}

	if (WarnMsg.length!=0)
	{	if(!confirm(WarnMsg))
		{	cl = false;
		}
	}

	if (cl) {
		form.LANGTAG.value = lang;
		form.COUNTRYTAG.value = country;
		form.submit();
		if (parent.QuickQuote != null) {
          	parent.QuickQuote.document.changeLang.LANGTAG.value = lang;
			parent.QuickQuote.document.changeLang.COUNTRYTAG.value = country;
            parent.QuickQuote.document.changeLang.submit();
        }
   	}
}

//i-STT
        var HUBRIS_isNetscape = false;

	function HUBRIS_trimStringWithCharacter(x, index)
	{
		tempx = "";
		for(i=0; i<x.length; ++i) {
			cha = x.substring(i, i+1);
			if(cha != index)
				tempx = tempx + cha;
		}
		return tempx;
	}

	function HUBRIS_redemption(link)
	{
		if(confirm(HUBRIS_Msg_004))
		{
			HUBRIS_removeCookie();
			parent.location.replace(link +escape('https://www.banking.hsbc.com.hk/script/hk/personal/card/bonus/default.asp'));
		}
	}
	
function HUBRIS_popUpAssetPortLink(link)
{
	var url = "";

	if(link == "CPI")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/sp/spep/detail";
	else if(link == "DPS")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/sp/dps";
	else if(link == "UT")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/ut";
	else if(link == "DEP")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/sp";
	else if(link == "Bond")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/bonds";
	else if(link == "Premier")
		url = "http://www.hsbc.com.hk/1/2/hk/premier/recognition";
	else if(link == "LifeInsurance")
		url = "http://www.hsbc.com.hk/1/2/hk/insurance/life";
	else if(link == "SMF")
		url = "http://www.banking.hsbc.com.hk/hk/personal/special/02Oct02a.htm";
	else if(link == "GFund")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/ut/range";
	else if(link == "CD")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/cd/detail";
	else if(link == "SecTradingService")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/mkt-info/stock";
	else if(link == "Insurance")
		url = "http://www.hsbc.com.hk/1/2/hk/insurance";
	else if(link == "UTSearch")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/ut";
	else if(link == "ELI")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/sp/dcdc-eli/detail";
	else if(link == "MIP")
		url = "http://www.hsbc.com.hk/1/2/hk/investments/stocks/smip";
	else if(link == "FinPlan")
		url = "http://www.hsbc.com.hk/1/2/hk/finplan";
	else if(link == "ForCurr")
		url = "http://www.hsbc.com.hk/1/2/hk/banking/accounts";
	else if(link == "RMPDep")
		url = "http://www.hsbc.com.hk/1/2/hk/banking/rmb";

	HUBRIS_popupWindowWithDimension(url, '', 800, 550);
}

function HUBRIS_popAutopayRecipientList(){
	var recipientWin = window.open('http://www.hsbc.com.hk/1/2/hk/banking/payments/recipient-list','MerchantList','width=400,height=500,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
	recipientWin.focus();
}

function HUBRIS_redirectIPO(link)
{
	if(confirm(HUBRIS_Msg_008))
	{
		HUBRIS_removeCookie();
		parent.location.replace(link+escape('http://www.hsbc.com.hk/1/2/hk/investments/ipo'));
	}
}

function HUBRIS_popUpOTPHelp(alink) {
	var otpHelpWin = window.open(alink,'OTPHelp','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
	otpHelpWin.focus();
}

function HUBRIS_popUpFCYTfLimit(){
		var fcyTfLimit = window.open('http://www.banking.hsbc.com.hk/hk/personal/bank/forex_limit.htm','fcyTfLimit','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
		fcyTfLimit.focus();
}
/**
 * @author Kelly Mai
 */
function HUBRIS_redemption(logoffURL, redirectPageID)
{
    if(confirm(HUBRIS_Msg_004))
    {
        HUBRIS_removeCookie();
        parent.location.replace(logoffURL +"&nextPage="+redirectPageID);
    }
}
function HUBRIS_popUpRpqFaq(link) {
	var win = window.open(link,'faq','width=400,height=400,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,resizable=yes');
	win.focus();
} 

function HUBRIS_popUpSubscribe_EIPO_LogOff(logoffURL, redirectPageID) {
    if(confirm(HUBRIS_Msg_008))
     {
        HUBRIS_removeCookie();
        parent.location.replace(logoffURL +"&nextPage="+redirectPageID);
    }
}


function HUBRIS_popUpReward_Card_LogOff(logoffURL, redirectPageID) {
    if(confirm(HUBRIS_Msg_004))
     {
        HUBRIS_removeCookie();
        parent.location.replace(logoffURL +"&nextPage="+redirectPageID);
    }
}

// set the value of text box according to the order type
function HUBRIS_blurOrderPrice(List, Textbox) // argument: pulldownlist, corresponding textbox
{
    Value = List.options[List.selectedIndex].value;
    	
	Start = Value.lastIndexOf("~~") + 2;
	Temp = Value.substring(Start, Value.length);		
	if(Temp == "At-Auction Order")
	{	
		Textbox.blur();		
		Textbox.value = "N/A";
	}
	else if (Temp == "At-Auction Limit Order")
	{
	    if(Textbox.value == "N/A")
			Textbox.value = "";
	}
	else if(Temp == "Market Order")
	{
		Textbox.blur();
		Textbox.value = "N/A";		
	}
	else{
	    if (Textbox.value == "N/A")
		Textbox.value = "";		
	}		
}


