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), 'scrollbars=yes 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=635,height=630,screenX=0,screenY=0,left=0,top=0,titlebar=yes');
}


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


function showAcHistoryPrint(url)
{
     var screenHeight = Math.floor(screen.availHeight);
     var shiftUp=30;
     screenHeight=screenHeight-shiftUp;
   return showChild(9, url, 'scrollbars=yes,dependent=yes,width=700,height='+screenHeight+',screenX=0,screenY=0,left=315,top=0');
}

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



function showProductFeatures(nextPage)
{
	showChild(2, nextPage, 'scrollbars=yes,width=635,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, 'scrollbars=yes dependent=yes,width=610,height=390,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,scrollbars=yes');
top.newWin=showChild(4, 'javascript:document.write(parent.opener.calDocAll);self.focus();', 'dependent=yes,width=500,height=700,screenX=0,screenY=0,left=0,top=0,titlebar=yes,scrollbars=yes');
  return top.newWin;
}

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


function showDisclaimer(disclaimerPath)
{
    showChild(5, disclaimerPath, 'resizable=yes,width=650,height=600,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');
}
function killSession(url)
{
    if (window.event)
    {
        if ((window.event.clientX < -5000 && window.event.clientY < -5000) || 
            (window.event.clientX > 5000 && window.event.clientY > 5000))
        {
            window.open(url, "KillSession", "width=1,height=1,top=30000,left=30000,resizable=no,menubar=no,toolbar=no,directories=no,location=no,scrollbars=no,status=no, fullscreen=no, titlebar=no, alwaysRaised=no, hotkeys=no");
        }
    }
}

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