﻿
//ICS 
var icsWnd = null;
var switchWnd = null;
function fLoginICS() {
    var nWinLeft = (screen.width - 600) / 2;
    var nWinTop = (screen.height - 400) / 2;
    if (icsWnd != null)
        icsWnd.close();
    icsWnd = window.open('https://forum.cmbchina.com/cmu/icslogin.aspx?from=B&logincmu=0', 'icslogin', 'width=600,height=400,status=yes,left=' + nWinLeft + ',top=' + nWinTop);
}

function creditcardlogin() {
    open('https://pbsz.ebank.cmbchina.com/CmbBank_GenShell/UI/GenShellPC/Login/Login.aspx?logintype=C', 'creditcard', 'menubar=no,toolbar=no,location=no,directories=no,scrollbars=yes,status=yes,resizable=yes');
}

function applySchedule() {
    open('https://pbsz.ebank.cmbchina.com/CmbBank_CreditCardV2/UI/CreditCardPC/CreditCardV2/na_QuerySchedule.aspx', 'Schedule', 'menubar=no,toolbar=no,location=no,directories=no,scrollbars=yes,status=yes,resizable=yes');
}

function EnforceCardProtocol() {
    open('https://pbsz.ebank.cmbchina.com/CmbBank_CreditCardV2/UI/CreditCardPC/CreditCardV2/cs_ProOfActivate.aspx', 'EnforceCardProtocol', 'menubar=no,toolbar=no,location=no,directories=no,scrollbars=yes,status=yes,resizable=yes');
}


function EWallet() {
    open('http://www.cmbchina.com/cmbpb/v36/pb.htm', 'EWallet', 'menubar=no,toolbar=no,location=no,directories=no,status=yes,resizable=no,scrollbars=no,width=600,height=400,top=60,left=100');
}

//Credit Card Apply Window
function CCApply(cardid, param) {
//    if (isNaN(cardid)) {
//        window.open('https://ccclub.cmbchina.com/CrdCardApply/LoginChannelSelect.aspx?cardsel=&Source_Addr=' + param);
//    }
//    else {        
        window.open('https://ccclub.cmbchina.com/CrdCardApply/LoginChannelSelect.aspx?cardsel=' + cardid + '&Source_Addr=' + param);

//    }
}

function goUrl(url) {
    window.open(url);
}

function getQuery(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return unescape(r[2]);
    }
    return null;
}

function showMenu(id, element) {
    var curMenu = document.getElementById(id);
    curMenu.style.display = 'block';
    var offsetTop = element.offsetTop;
    var offsetLeft = element.offsetLeft;
    var offsetWidth = element.offsetWidth;
    var offsetHeight = element.offsetHeight;
    while (element = element.offsetParent) {
        offsetTop += element.offsetTop;
        offsetLeft += element.offsetLeft;
    }
    curMenu.style.left = offsetLeft + "px";
    curMenu.style.top = offsetTop + 32 + "px";
    if (id == "ccclub") {
        curMenu.style.top = offsetTop + 30 + "px";
    }
}

function hideMenu(id) {
    var curMenu = document.getElementById(id);
    curMenu.style.display = 'none';    
}

