
function hbwindows() {
    open('https://pbsz.ebank.cmbchina.com/CmbBank_GenShell/UI/GenShellPC/Login/Login.aspx', 'newhb', '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');
}

//客服在线
//
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 ToAddFavorite(type, code) {
    /*if (url) {
        ShowPopupBox("FavoriteAddBox.aspx?productType=" + type + "&productCode=" + code + "&productUrl=" + escape(url));

        return;
    }*/
   /* else {*/
        switch (type) {

            case 0:
                {
                    ShowPopupBox("FavoriteAddBox.aspx?productType=" + type + "&productCode=" + code + "&productUrl=" + escape('FundPrdDetail.aspx?fundid=') + code);
                    return;
                }
            case 1:
                {
                    ShowPopupBox("FavoriteAddBox.aspx?productType=" + type + "&productCode=" + code + "&productUrl=" + escape('FinPrdInfo.aspx?PrdCode=') + code);
                    return;
                }
           case 2:
               {
                 ShowPopupBox("FavoriteAddBox.aspx?productType=" + type + "&productCode=" + code + "&productUrl=" + escape('InsPrdDetail.aspx?PrdCode=') + code);
                 return;
               }
        }
   /* }*/
}

//保险比较移除全部
function removeTable(elementid) {
    var obj = document.getElementById(elementid);
    obj.style.display = 'none';
}

//保险比较移除所选保险产品列
function removeCol(id,elementid) {
    var obj = document.getElementById(elementid);
    for (i = 0; i < obj.rows.length; i++) {
        obj.rows[i].cells[id].style.display = 'none';
    }
}

//保险产品比较
function InsCompare()
{
	var INSPID = "";
	var url = preurl+"Product/InsCompare.aspx?prdcodes=";
	var cbs = document.getElementById('prodtb').getElementsByTagName('INPUT');
	
	for(i=0; i<cbs.length; i++)
	{
		var type = cbs[i].getAttribute("type").toLowerCase();
		if(type == "checkbox" && cbs[i].checked)
		{
			INSPID += cbs[i].value + "|";			
		}
	}
	var prdcount = INSPID.split('|');
	
	if(prdcount.length-1 > 1 && prdcount.length-1 < 4)
	{
		url += INSPID;
		open(url);
	}
	else if(prdcount.length-1 < 2)
	{
		alert("请您最少选择2个产品做比较！");
	}
	else if(prdcount.length-1 > 3)
	{
		alert("请您最多选择3个产品做比较！");
	}
}

/****************ProductBuyBox**************************/
var w3c = (document.getElementById) ? true : false;
var agt = navigator.userAgent.toLowerCase();
var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
function IeTrueBody() {
    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}
function GetScrollTop() {
    return ie ? IeTrueBody().scrollTop : window.pageYOffset;
}

/**********************
*弹出层的网页
**********************/
function ShowWin(url) {
    var shield = document.createElement("DIV");
    shield.id = "shield";
    shield.style.position = "absolute";
    shield.style.left = "0px";
    shield.style.top = "0px";
    shield.style.width = document.body.clientWidth + "px"; //"100%";

    shield.style.height = document.body.scrollHeight+"px";
    shield.style.background = "#333";
    shield.style.textAlign = "center";
    shield.style.zIndex = "10000";
    shield.style.filter = "alpha(opacity=50)";
    shield.style.opacity = 0.5;
    var alertFram = document.createElement("DIV");
    alertFram.id = "alertFram";
    alertFram.style.position = "absolute";
    alertFram.style.left = (document.body.clientWidth - 540) / 2 + "px";
    alertFram.style.top = "20%";
    alertFram.style.marginLeft = "-0px";
    var scrollTop = GetScrollTop();
    alertFram.style.marginTop = -45 + scrollTop + "px";
    alertFram.style.width = "540px";
    alertFram.style.height = "300px";
    alertFram.style.background = "#ccc";
    alertFram.style.textAlign = "center";
    alertFram.style.lineHeight = "90%";
    alertFram.style.zIndex = "10001";
    strHtml = "<ul style=\"list-style:none;margin:0px;padding:0px;width:100%\">\n";
    strHtml += " <li style=\"background:#D3D3D3;text-align:left;padding-left:20px;margin:0;padding:0;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px solid #A40B06;\"><span style=\"float:left;margin-left:8px;\"><FONT color=\"#fff\">[产品购买]</FONT></span>\n";
    strHtml += " <span style=\"height:25px;line-height:25px;float:right;margin-right:8px;margin-top:3px;\"><input style=\"border:1px solid #666;cursor:pointer;\" type=\"button\" value=\" X \" id=\"do_OK\" onclick=\"doOk()\" /></span></li>\n";
    strHtml += " <li style=\"background:#fff;text-align:center;font-size:14px;border:1px solid #A40B06;border-top:none;margin:0;padding:0;\"><iframe height=300px width=98% scrolling=\"no\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" src=" + url + "></iframe></li>\n";
     strHtml += "</ul>\n";
    alertFram.innerHTML = strHtml;
    document.body.appendChild(alertFram);
    document.body.appendChild(shield);
 
    this.doOk = function() {

        document.body.removeChild(alertFram);
        document.body.removeChild(shield);

        document.body.onselectstart = function() { return true; }
        document.body.oncontextmenu = function() { return true; }
    }

    document.body.onselectstart = function() { return false; }
    document.body.oncontextmenu = function() { return false; }
    window.onscroll = function() {
        setTimeout(function() {
        if (document.getElementById("alertFram")) {
            var scrollTop = GetScrollTop();
            document.getElementById("alertFram").style.marginTop = -45 + scrollTop + "px";
            }
        }, 50);
    }
}


function InsToBuyBox(type,code,buymode,url) {
    if( buymode == 'A' )
    {
     if (url != null && url != '')
        window.open(url);
    }
    else
    {
     ShowWin(preurl + "Product/ProductBuyBox.aspx?productCode=" + code);
    }
}
/****************ProductBuyBox**************************/

//左右对齐高度
function AutoDivHeight(left, right) {
    if (left != null && right != null) {
        if (left.clientHeight < right.clientHeight) {
            left.style.minHeight = right.clientHeight + "px";
            if(window.ActiveXObject) 
            {
                var browser=navigator.appName 
                var b_version=navigator.appVersion 
                var version=b_version.split(";"); 
                var trim_Version=version[1].replace(/[ ]/g,""); 
                if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0") 
                {
                  left.style.height = right.clientHeight + "px";
                }
            }
            else{
                             left.style.minHeight = right.clientHeight + "px";
            }
        }
        else {
            right.style.height = left.clientHeight + "px";
        }
    }
}

function OpenSalerUrl(saname, sacity)
{
     var url = preurl+"sales/salerdetail.aspx?saname="+escape(saname)+"&sacity="+escape(sacity);
     window.open(url);
}

