// MM Functions
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  if (navigator.appName.indexOf("Netscape") != -1 && String(navigator.appVersion).charAt(0) == "5") { // Netscape 6
    for (i=0; i<(args.length-2); i+=3) if ((obj=document.getElementById(args[i]))!=null) { v=args[i+2];
      if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
      obj.visibility=v; }
  } else {
    for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
      if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
      obj.visibility=v; }
  }
}

// Custom Functions
function openBrWindow(theURL,winName,features) {
  newWin = window.open(theURL,winName,features);
  setTimeout("newWin.focus();",100);
}

function OpenForm(filename) {
	var path ,windowfeatures, target;
	
	windowfeatures = 'width=640,height=480,status=yes,menubar=yes,resizable=yes,scrollbars=yes,left=50,top=0';  
	path = '/ch/forms_download/' + filename;
	target = filename.indexOf('.',1);
	newWin = window.open(path, filename.substring(0,target) ,windowfeatures);
}


function ShowBoom(windowpath) {

		window.open(windowpath, 'boom', 'menubar=yes, status=yes, location=yes, toolbar=yes, scrollbars=yes, resizable=yes, height=400, width=700, left=1, top=0');

}


function calculators(calNum) {
	if (calNum == '1') {
		newWin = window.open('https://online.bnu.com.mo/ebank/bnu/calculators?lang=C', 'Calculators', 'scrollbars=yes,width=440,height=490');
	} else if (calNum == '2') {
		newWin = window.open('https://online.bnu.com.mo/ebank/bnu/calculators?lang=C&calType=pl', 'Calculators', 'scrollbars=yes,width=440,height=490');
	} else if (calNum == '3') {
		newWin = window.open('https://online.bnu.com.mo/ebank/bnu/calculators?lang=C&calType=hl', 'Calculators', 'scrollbars=yes,width=440,height=490');
	} else if (calNum == '4') {
		newWin = window.open('https://online.bnu.com.mo/ebank/bnu/calculators?lang=C&calType=cl', 'Calculators', 'scrollbars=yes,width=440,height=490');
	}
}

function OpenCGD(fullpath) {
	var winfeatures = 'width=750,height=450,status=no,menubar=yes,toolbar=yes,location=no,resizable=yes,scrollbars=yes,left=0,top=15';
	newWin = window.open(fullpath, 'CGD_File', winfeatures);
}

  // pop-up BNU Mobile Banking Demo
  function mobile_banking_demo() {
    var page = '/ch/personal_banking/mobile_demo/DemoMain01.htm';
  	var title = 'demo';
    var option = 'width=760,height=520,top=15,left=10,location=no,directories=no,menubar=no,toolbar=no,scrollbars=no,status=no,resizable=no';
  	var bnu = window.open(page, title, option);
  }

  function pop_FAQ() {
    var page = '/ch/for_bnu_online/faq_mobile_ch_info.html';
    var windowprops = "width=540,height=450,top=80,left=50,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes";
    window.open(page, "mobileFAQ", windowprops);
  }

  function open_platinum_detail(item) {
		var thePage = 'platinum_' + item + '.htm';
    	var windowprops = "width=640,height=450,top=20,left=20,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes";
    	window.open(thePage, "PlatinumCard", windowprops);
  }

// Open BNU Online and Investing Online
function open_BNUOnline(lang) {
  newWin = window.open('https://online.bnu.com.mo/ebank/bnu/login.jsp?lang=' + lang, 'ebank', 'resizable=yes,scrollbars=yes,status=yes,left=0,top=0,width=790,height=700');
}

function open_InvestingOnline() {
  newWin = window.open('https://www.boom.com.hk/client2/login_form.asp?goto=default&main_menu=default', 'boom_login', 'menubar=yes,toolbar=yes,scrollbars=yes,status=yes,location=yes,resizable=yes,left=0,top=0,width=790,height=408');
}

function write_BNUOnline(title) {
	document.writeln(" <table width=180 border=0 cellspacing=0 cellpadding=0 height=25>");
	document.writeln("   <tr>");
	document.writeln("     <td bgcolor=#003063><img src='/ch/image/shim.gif' width=5 height=25></td>");
	document.writeln("     <td bgcolor=#003063 class=menu nowrap width=100%><font size=3>" + title + "</font></td>");
	document.writeln("     <td bgcolor=#003063 width=22><img src='/ch/image/triangle.gif' width=22 height=22></td>");
	document.writeln("     <td bgcolor=#31659C><img src='/ch/image/shim.gif' width=3 height=25></td>");
	document.writeln("     <td bgcolor=#31659C class=topmenu width=41 height=25 align=center valign=middle>");
	document.writeln("        <a href=\"javascript:open_BNUOnline('C');\">");
	document.writeln("	                 <img src='/ch/image/loginy.gif' width=41 height=18 border=0></a></td>");
	document.writeln("     <td bgcolor=#F0F5FB><img src='/ch/image/corner3.gif' width=11 height=25></td>");
	document.writeln("   </tr>");
	document.writeln(" </table>");
}

function write_InvestingOnline(title) {
	document.writeln(" <table width=180 border=0 cellspacing=0 cellpadding=0 height=25>");
	document.writeln("   <tr>");
	document.writeln("     <td bgcolor=#003063><img src='/ch/image/shim.gif' width=5 height=25></td>");
	document.writeln("     <td bgcolor=#003063 class=menu nowrap width=100%><font size=3>" + title + "</font></td>");
	document.writeln("     <td bgcolor=#003063 width=22><img src='/ch/image/triangle.gif' width=22 height=22></td>");
	document.writeln("     <td bgcolor=#31659C><img src='/ch/image/shim.gif' width=3 height=25></td>");
	document.writeln("     <td bgcolor=#31659C class=topmenu width=41 height=25 align=center valign=middle>");
	document.writeln("        <a href=\"javascript:open_InvestingOnline();\">");
	document.writeln("			<img src='/ch/image/loginy.gif' width=41 height=18 border=0></a></td>");
	document.writeln("     <td bgcolor=#F0F5FB><img src='/ch/image/corner3.gif' width=11 height=25></td>");
	document.writeln("   </tr>");
	document.writeln(" </table>");
}

function openInterestRate() {
	newWin = window.open('https://online.bnu.com.mo/ebank/bnu/InterestRates?lv1ID=0&lv2ID=0&lang=C', 'irate', 'scrollbars=yes,status=yes,left=10,top=10,width=790,height=524');
}

function openExchangeRate() {
	newWin = window.open('https://online.bnu.com.mo/ebank/bnu/ExchangeRates?lv1ID=0&lv2ID=0&lang=C', 'erate', 'scrollbars=yes,status=yes,left=10,top=10,width=790,height=524');
}
