if (navigator.childWin == null)
{
   navigator.childWin = new Array();
}
var childWin = navigator.childWin;


function showChild(ID, ChildHTMLFile, Rules)
{
  if (!Rules)
    childWin[ID] = window.open(ChildHTMLFile,ID,'dependent=yes,resizable=yes,width=640,height=500,screenX=0,screenY=0,left=0,top=0,titlebar=yes,scrollbars=yes');
  else
    childWin[ID] = window.open(ChildHTMLFile,ID,Rules);
	
  return childWin[ID];
}

function closeChild(ID)
{
  if (childWin[ID] != null)
  {
    childWin[ID].close();
    childWin[ID] = null;
  }
}

function closeAll()
{
  closeChild(1);
  closeChild(2);
  closeChild(3);
  closeChild(4);
  closeChild(5);
  closeChild(6);
  closeChild(7);
  closeChild(8);
  closeChild(9);
  closeChild(10);
  closeChild('help');
  closeChild('Timer'); 
  closeChild('Alert');  

}


function showProductSpecificInterestRateInquiry(url, productType, currency)
{
	if ((currency > 0) && (productType > 0))
	{

   	showChild(1, (url+'&accountType='+productType+'&depositCurrency='+currency), 'dependent=yes,width=480,height=510,screenX=0,screenY=0,left=0,top=0,titlebar=yes');
	return false;
	}
	else
	{

		return true;
	}
}

function showInterestRateInquiry(url)
{
	showChild(1, url, 'scrollbars=yes,dependent=yes,width=600,height=500,screenX=0,screenY=0,left=0,top=0,titlebar=yes');
}


function showCheckBalance(url, debitAccountIndex)
{ 
  return showChild(6, url+'&debitAccountIndex='+debitAccountIndex, 'dependent=yes,width=480,height=510,screenX=0,screenY=0,left=0,top=0,titlebar=yes');
}  


function showAcHistoryPrint(url)
{
  return showChild(9, url, 'scrollbars=yes,dependent=yes,width=700,height=500,screenX=0,screenY=0,left=0,top=0');
}

function showCheckBalance(url)
{
  return showChild(6, url, 'scrollbars=yes,dependent=yes,width=600,height=500,screenX=0,screenY=0,left=0,top=0');
}



function showProductFeatures(nextPage)
{
	showChild(2, nextPage, 'scrollbars=yes,width=600,height=500,screenX=0,screenY=0,left=0,top=0,titlebar=yes');
}


function showHelp(url)
{
	showChild('help', url, ' width=650, height=400, menubar=no, resizable-no, toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,copyhistory=0');
}

function showTimeout(url)
{

	showChild('Timer', url, 'dependent=yes,width=390,height=300,resizable=no,menubar=no,toolbar=no,directories=no,location=no,scrollbars=no,status=no, fullscreen=no, titlebar=no, alwaysRaised=yes, hotkeys=no');
}

function showAlert(url)
{
	return showChild('Alert', url, 'dependent=yes,resizable=no,screenX=0,screenY=0,left=0,top=0,titlebar=yes,scrollbars=no');
}


function showPdf(pdfIndex, form)
{
	var id = 10;
	form.pdfDwnldIndex.value = pdfIndex;
	form.target=id;
	var rules = 'menubar=no, toolbar=no,directories=no,location=no,scrollbars=no,status=yes,copyhistory=0, height=700,width=700,left=300,top=10';
	childWin[id] = window.open("", id, rules);

}

function showLogonHelp(Lang)
{
  if (Lang)
    showChild('help', contextRoot + contextPath + '/Helptext/en/Logon.htm', 'width=650, height=400, menubar=no, resizable-no, toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,copyhistory=0');
  else
    showChild('help', contextRoot + contextPath + '/Helptext/zh/Logon.htm', 'width=650, height=400, menubar=no, resizable-no, toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,copyhistory=0');
}

function showOrAckHelp(Lang)
{
  if (Lang)
    showChild('help', contextRoot + contextPath + '/Helptext/en/OrAck.htm', 'width=650, height=400, menubar=no, resizable-no, toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,copyhistory=0');
  else
    showChild('help', contextRoot + contextPath + '/Helptext/zh/OrAck.htm', 'width=650, height=400, menubar=no, resizable-no, toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,copyhistory=0');
}

function showTermsAndConditionsHelp(Lang)
{
  if (Lang)
    showChild('help', contextRoot + contextPath + '/Helptext/en/TermsAndConditions.htm', 'width=650, height=400, menubar=no, resizable-no, toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,copyhistory=0');
  else
    showChild('help', contextRoot + contextPath + '/Helptext/zh/TermsAndConditions.htm', 'width=650, height=400, menubar=no, resizable-no, toolbar=no,directories=no,location=no,scrollbars=yes,status=yes,copyhistory=0');
}

function showCalendar()
{
//P2G5002#2647  top.newWin=showChild(4,  contextRoot + contextPath + '/jsp/calendar.html', 'dependent=yes,width=280,height=700,screenX=0,screenY=0,left=0,top=0,titlebar=yes');
top.newWin=showChild(4, 'javascript:document.write(parent.opener.calDocAll);self.focus();', 'dependent=yes,width=280,height=700,screenX=0,screenY=0,left=0,top=0,titlebar=yes');
  return top.newWin;
}

function showCalendarPortlet(url)
{
  top.newWin=showChild(4, url, 'dependent=yes,width=280,height=700,screenX=0,screenY=0,left=0,top=0,titlebar=yes');
  return top.newWin;
}

function showDisclaimer(disclaimerPath)
{
    return showChild(5, disclaimerPath, 'resizable=yes,width=700,height=500,left=0,top=0,scrollbars=yes');
}

function toLogon(url) 
{
  if (confirm('You have decided to reject the terms and conditions for using the Internet Banking service.  Click OK to exit from the registration process or click Cancel to resume your registration process.'))
    {
		window.open(url,'PreLogon');
    }
}

function logonAgain(url) 
{
	window.open(url,'PreLogon');
}

