function openLogin(type) {
    if (type=='eb')
    		window.open("https://eb.bankcomm.com.hk/eb/eblogin.action?lang=en_US","Login","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=1024,height=768,left=0, top=0");
        //window.open("https://www.bankcomm.com.hk/EB/chn_webbank/chn_loginpg.jsp","Login","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=0, top=0");
    else if (type=='it')
        window.open("http://www.bankcomm.com.hk/itrade/big5/","Login","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=50,top=10");
    else if (type=='mpf')
        window.open("https://www.bankcomm.com.hk/MPF/GenLogin.do?lang=1","Login","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=0, top=0");
    else if (type=='ebloan')
        window.open("https://www.bankcomm.com.hk/EB/servlet/com.hkboc.servlet.iBankServlet?txType=CBL&gotoPage=LOGIN_C&webLang=C&isLoan=YES&loanType=1","Login","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=0, top=0");
    else if (type=='loan')
        window.open("https://www.bankcomm.com.hk/EB/servlet/com.hkboc.servlet.iBankServletNotLogin?txType=REQ&gotoPage=PER_LOAN_MAIN_NOT_LOGIN_1_C&webLang=C","Loan","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=0, top=0");
    else if (type=='ebtaxloan')
        window.open("https://www.bankcomm.com.hk/EB/servlet/com.hkboc.servlet.iBankServlet?txType=CBL&gotoPage=LOGIN_C&webLang=C&isLoan=YES&loanType=2","Login","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=0, top=0");
    else if (type=='taxloan')
        window.open("https://www.bankcomm.com.hk/EB/servlet/com.hkboc.servlet.iBankServletNotLogin?txType=REQ&gotoPage=TAX_LOAN_MAIN_NOT_LOGIN_1_C&webLang=C","Loan","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=0, top=0");
    else if (type=='mortgage')
        window.open("https://www.bankcomm.com.hk/EB/chn_webbank/Loan/loan_house_order.jsp","Mortgage","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=0, top=0");
    else if (type=='ccgift')
        window.open("https://eb.bankcomm.com.hk/eb/ccGiftList.action?reference=web&lang=en_US");
}

function getLogin() {
    var clogin = document.loginForm.clogin;

    for (i=0;i<clogin.length;i++) {
        if (clogin[i].checked) {
            openLogin(clogin[i].value);
            break;
        }
    }
}

function openDemo(type) {
    if (type=='eb')
        window.open("/ebdemo/en/login_0_1_1.html","Demo","toolbar=no,status=yes,menubar=no,scrollbars=no,revisable=yes,width=1024,height=768,left=0, top=0"); 
        //window.open("http://www.bankcomm.com.hk/EB/demo/chn_webbank/chn_loginpg.htm","Demo","toolbar=no,status=yes,menubar=no,scrollbars=no,revisable=yes,width=795,height=570,left=0, top=0");
    else if (type=='it')
        window.open("http://www.bankcomm.com.hk/itrade/zh_TW/demo/index.html","Demo","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=0, top=0");
    else if (type=='mpf')
        window.open("http://www.bankcomm.com.hk/MPF/demo/chn_login.htm","Demo","toolbar=no,status=yes,menubar=no,scrollbars=yes,revisable=yes,width=795,height=570,left=0, top=0");
}

function getDemo() {
    var clogin = document.loginForm.clogin;

    for (i=0;i<clogin.length;i++) {
        if (clogin[i].checked) {
            openDemo(clogin[i].value);
            break;
        }
    }
}

function setLogin(tt) {
    document.loginForm.loginType.value = tt;
}

function printLogin() {
var pathname = window.location +"";
var s1 = pathname.lastIndexOf("/");
var s2 = pathname.substring(0, s1).lastIndexOf("/");

//if (pathname.substring(s2+1, s1) != "zh" && pathname.substring(s2+1, s1) != "en" && pathname.substring(s2+1, s1) != "gb")
if(pathname.lastIndexOf("index.htm")== -1)
{
	var img_header = "../";
}
else
{
	var img_header = "";	
}

document.write('<table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">');
document.write('<form name="loginForm">');
document.write('<tr>');
document.write('<td>');
document.write('<img src="'+img_header+'images/front/tit_login.gif" width="158" height="25">');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td>');
document.write('<table width="0" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td rowspan="2">');
document.write('<img src="'+img_header+'images/front/img_login01.gif" width="9" height="90">');
document.write('</td>');
document.write('<td>');
document.write('<table width="0" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td>');
document.write('<table width="0" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td valign="bottom" background="'+img_header+'images/front/img_radio01.gif" bgcolor="EFF6FF">');
document.write('<input name="clogin" type="radio" value="eb">');
document.write('</td>');
document.write('<td>');
document.write('<img src="'+img_header+'images/front/tit_loginbankserv.gif" width="129" height="21">');
document.write('</td>');
document.write('</tr>');
document.write('</table>');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td>');
document.write('<img src="'+img_header+'images/front/img_login02.gif" width="149" height="6">');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td>');
document.write('<table width="0" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td background="'+img_header+'images/front/img_radio02.gif" bgcolor="EFF6FF">');
document.write('<input name="clogin" type="radio" value="it">');
document.write('</td>');
document.write('<td>');
document.write('<img src="'+img_header+'images/front/tit_loginstcok.gif" width="129" height="21">');
document.write('</td>');
document.write('</tr>');
document.write('</table>');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td>');
document.write('<img src="'+img_header+'images/front/img_login03.gif" width="149" height="5">');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td>');
document.write('<table width="0" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td background="'+img_header+'images/front/img_radio03.gif" bgcolor="#FFFFFF">');
document.write('<input name="clogin" type="radio" value="mpf">');
document.write('</td>');
document.write('<td>');
document.write('<img src="'+img_header+'images/front/tit_loginmpf.gif" width="129" height="21">');
document.write('</td>');
document.write('</tr>');
document.write('</table>');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td>');
document.write('<img src="'+img_header+'images/front/img_login04.gif" width="149" height="3">');
document.write('</td>');
document.write('</tr>');
document.write('</table>');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td>');
document.write('<img src="'+img_header+'images/front/img_login05.gif" width="149" height="13">');
document.write('</td>');
document.write('</tr>');
document.write('</table>');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td>');
document.write('<table width="0" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td>');
document.write('<img src="'+img_header+'images/front/img_login07.gif" width="9" height="28">');
document.write('</td>');
document.write('<td>');
document.write('<a href="#" onclick="javascript:getLogin()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'btn_login\',\'\',\''+img_header+'images/front/btn_login_on.gif\',1)">');
document.write('<img src="'+img_header+'images/front/btn_login_off.gif" name="btn_login" width="67" height="28" border="0">');
document.write('</a>');
document.write('</td>');
document.write('<td>');
document.write('<a href="#" onclick="javascript:getDemo()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'btn_demo\',\'\',\''+img_header+'images/front/btn_demo_on.gif\',1)">');
document.write('<img src="'+img_header+'images/front/btn_demo_off.gif" name="btn_demo" width="66" height="28" border="0">');
document.write('</a>');
document.write('</td>');
document.write('<td>');
document.write('<img src="'+img_header+'images/front/img_login06.gif" width="16" height="28">');
document.write('</td>');
document.write('</tr>');
document.write('</table>');
document.write('</td>');
document.write('</tr>');
document.write('<input type="hidden" name="loginType">');
document.write('</form>');
document.write('</table>');
}

function cardactivate() {
	window.open("https://www.bankcomm.com.hk/EB/servlet/com.hkboc.servlet.iBankServlet?txType=CBL&gotoPage=CARD_ACT_E&webLang=E","","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=0, top=0");
}

function cardstatus() {
	window.open("https://www.bankcomm.com.hk/EB/servlet/com.hkboc.servlet.iBankServlet?txType=CBL&gotoPage=NEW_CARD_QUERY1_E&webLang=E","","toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,revisable=yes,width=795,height=570,left=0, top=0");
}
