﻿document.title = "Beyond Card BCcard";
document.write("<script type='text/javascript' src='/redapple/inc/js/common_url.js'></script>");

var IE = (navigator.appName.indexOf("Microsoft")>-1);
var IE6 = IE&&(navigator.userAgent.indexOf("MSIE 6")>-1);
var IE7 = IE&&(navigator.userAgent.indexOf("MSIE 7")>-1);
var IE8 = IE&&(navigator.userAgent.indexOf("MSIE 8")>-1);
var safari = (navigator.appName.indexOf("Netscape")>-1)&&(navigator.userAgent.indexOf("Safari")>-1);
var opera = (navigator.appName.indexOf("Opera")>-1);

var hn="0",sn="0",cn="0", tn="0", globalId="",flaFarm="", flaVisual="";
var userLog = ReadCookie("InitechEamUID"); //1:로그인상태, 0:로그아웃상태
function mnav(){ //상단네비    
	var DepthName = new Array("hn","sn","cn","tn");
	for(i=0;i<arguments.length;i++){
		if(i==0) hn =  arguments[i];if(i==1) sn =  arguments[i];if(i==2) cn =  arguments[i];if(i==3) tn =  arguments[i];
		if(arguments[i]!="") globalId = (i==0) ? arguments[i] : globalId+"_"+arguments[i] ;
		if(arguments[i]!="") flaFarm = (i==0) ?  DepthName[i]+"="+arguments[i] : flaFarm+"&"+DepthName[i]+"="+arguments[i] ;
		if(arguments[i]!="") flaVisual = (i==0) ? arguments[i] : flaVisual+"_"+arguments[i] ;
	}

	//alert(flaFarm);
	document.write('<div class="gnb-container">');
	Flash("mnavFla","/redapple/fla/swf/gnbContainer_sub.swf?swfPath=/redapple/fla/swf/&"+flaFarm+"&isLogin="+userLog,"880","129","","transparent");
	document.write('</div>');
	
}

//로그인 인,아웃시 상단네비 플래시 값 던져줌.
function checkLogin(){
	try{parent.document.getElementById("mnavFla").SetVariable("isLogin", userLog);}catch(e){ try{document.getElementById("mnavFla").SetVariable("isLogin", userLog);}catch(e){}}
	try{parent.document.getElementById("mnavFla").SetVariable("check", 1);}catch(e){ try{document.getElementById("mnavFla").SetVariable("check", 1);}catch(e){}}
}


function snav(){
	Flash("snavFla","/redapple/fla/leftNavi/leftNavi"+hn+".swf?"+flaFarm,"199","370","","transparent");	
}

function topVisual(){
	Flash("flaVisual","/redapple/fla/visual/visualLoader.swf?swfPath=/redapple/fla/visual/&"+flaFarm,"681","260","","transparent");
}


 function classChg(id,cName){
		document.getElementById(id).className=cName;
}

//gnb util 메뉴
function topMenu(num){
	switch (num)
	{
		
		case 1:location.href='/redapple/etc/login.html'; break;
		case 2: location.href='mailto:lotme0225@bcline.com'; break;
		case 3: window.open('http://www.bccard.com/company/'); break;
		case 4: window.open('http://www.bccard.com/company/eng/eng_overview.html'); break;
		case 9: location.href='http://www.bccard.com/app/card/redappleLogoutNewActn.do'; break;
	}
}


function company() {window.open('http://www.bccard.com/company/index.html');}

function link(){
	var url = "";
	var depth = arguments.length;
	try {
		if(depth==0) return;
		else for(i=0;i<depth;i++) url += ((i==0)?"u":"_") + arguments[i];
		url = eval(url)[0];
		if(url=="") alert("준비중입니다.");
		else location.href = url;
	}catch(e) { alert(e.message); }
}

function $(element) {
  if (arguments.length > 1) {
    for (var i = 0, elements = [], length = arguments.length; i < length; i++) elements.push($(arguments[i]));
    return elements;
  }
  if (typeof element == 'string') element = document.getElementById(element);
  return element;
}


function copyRight(){
	var footer ='';
	footer +='<ul id="f-menu">';
	footer +='	<li><a href="#" onclick="footerMenu(1); return false;"><img src="/redapple/img/common/f_menu01.gif" alt="비씨카드" /></a></li>';
	footer +='	<li><a href="#" onclick="footerMenu(2); return false;"><img src="/redapple/img/common/f_menu02.gif" alt="사회공헌" /></a></li>';
	footer +='	<li><a href="#" onclick="footerMenu(3); return false;"><img src="/redapple/img/common/f_menu03.gif" alt="이용약관" /></a></li>';
	footer +='	<li><a href="#" onclick="footerMenu(4);return false; "><img src="/redapple/img/common/f_menu04.gif" alt="개인정보취급방침" /></a></li>';
	footer +='	<li class="bgnone"><a href="#" onclick="link(5); return false;"><img src="/redapple/img/common/f_menu05.gif" alt="사이트맵" /></a></li>';
	footer +='</ul>';
	footer +='<address><img src="/redapple/img/common/copyright.gif" alt="서울시 서초구 1587 비씨카드(주) 대표이사 장형덕 사업자번호 214-81-37726 고객상담 1588-4000, 1566-4000 이메일 webmaster@bccard.com COPYRIGHT(C)2009 BCCARD.ALL RIGHTS RESERVED" title="" /></address>';
	footer +='<div id="footer-sel" class="sel-close"><div id="fla" class="flaAClose"><script>Flash("footer","/redapple/fla/swf/bc_footer.swf","144","243","","transparent")</script></div></div>';
	document.write(footer);
}



/* footerSelect 리사이즈 */
function footerResize(type){

	if(type=="1"){
		document.getElementById("fla").className = "flaAOpen";
		document.getElementById("footer-sel").className = "sel-open";
		
	}
	else {
		document.getElementById("fla").className = "flaAClose";
		document.getElementById("footer-sel").className = "sel-close";
		
	}
}


function imgOver(obj){ obj.src = (obj.src.indexOf("_.gif")>-1)?obj.src.replace("_.gif",".gif"):obj.src.replace(".gif","_.gif") } //이미지 롤오버
function pop(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=no') } //Popup(스크롤바없음)
function pops(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=yes') } //Popup(스크롤바있음)
function newpop(url){ window.open(url) } //Popup(스크롤바있음)
function layerClose(name){ $(name).style.display = "none"; } //레이어 히든
function layerOpen(name){ $(name).style.display = "block"; } //레이어 히든

/*ActiveX 플래쉬 // t: wmode (none/transparent/opaque) */
function Flash(id,url,w,h,bg,t,b){
document.write("\
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width="+w+" height="+h+" id="+id+">\
<param name='movie' value="+url+" />\
<param name='wmode' value="+t+" />\
<param name='bgcolor' value="+bg+" />\
<param name='allowScriptAccess' value='sameDomain' />\
<param name='quality' value='high' />\
<param name='menu' value='false' />\
<param name='base' value="+b+" />\
<embed src="+url+" wmode="+t+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" allowScriptAccess='sameDomain' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
</object>\
");
}


/* 텝바꾸기 */
function tabView(obj,id,viewCont,num) {
	var tabBox = document.getElementById(id).getElementsByTagName('li');
	for(i=1;i<=tabBox.length;i++){
		var tabImg = tabBox[i-1 ].getElementsByTagName("img")[0];
		var tabOn = document.getElementById(id).getElementsByTagName("li")[i-1];
		if(obj == tabImg){
			if(tabImg.src.indexOf("_on.gif")<0) tabImg.src = tabImg.src.replace("_off.gif","_on.gif");
			document.getElementById(viewCont+num).style.display = "block";
			tabOn.className="on";
		}else{
			tabImg.src = tabImg.src.replace("_on.gif","_off.gif");
			document.getElementById(viewCont+i).style.display = "none";
			tabOn.className="";
		}
	}
}


//특정영역 인쇄  ---------

var ie = /MSIE/.test(navigator.userAgent); 
var moz = !ie && navigator.product == "Gecko"; 

function printDiv() {
  if (document.getElementById('objContents') && window.print) {
	if(moz){
		window.onbeforeprint = beforeDivs();
		window.onafterprint = afterDivs();
	}else{
		window.onbeforeprint = beforeDivs;
		window.onafterprint = afterDivs;
	}
	window.print();
	
  }
}

function beforeDivs() {
  if (document.getElementById('print_contents')) {
	if(moz){
		document.getElementById('objContents').style.display = 'none';
		var obj = document.getElementById('print_contents');
		outerHTML = (new XMLSerializer).serializeToString(obj);
		document.getElementById('objSelection').innerHTML = outerHTML;
		
	}else{
		
		document.getElementById('objContents').style.display = 'none';
		document.getElementById('objSelection').innerHTML = document.getElementById('print_contents').innerHTML; // 이곳에서 ID를 지정
	}
  }
}

function afterDivs() {
  if (document.getElementById('print_contents')) {
	if (moz)
	{
		document.getElementById('objContents').style.display = 'block';
		document.getElementById('objSelection').innerHTML = ''; 
		
	}else{
		document.getElementById('objContents').style.display = 'block';
		document.getElementById('objSelection').innerHTML = "";
	}
  }
}
//---------특정영역 인쇄

// 팝업리사이즈
function resizeFrm( win){
	var g_fIsSP2 = false;
	var IE6 = false;
	var init_gap = 30;
	var winBody = win.document.body;
	var wid = winBody.scrollWidth + (winBody.offsetWidth - winBody.clientWidth);
	var target = document.getElementsByTagName("DIV")[0];	
	var hei = target.offsetHeight + init_gap;

	target.style.display = "inline";
	g_fIsSP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
	IE6 = (window.navigator.userAgent.indexOf("MSIE 6") != -1)

	if (g_fIsSP2 = true){
		
		if(IE6){
			win.resizeTo(wid + 10, hei + 30);
		}else{			
			win.resizeTo(wid + 10, hei + 6);
		}
		
	}else{
		win.resizeTo(wid + 10, hei);
	}

	if(document.documentElement.scrollHeight > winBody.scrollHeight){
		var y_gap = document.documentElement.scrollHeight - winBody.scrollHeight;
		win.resizeBy(0, -y_gap); 
	}else if(document.documentElement.scrollHeight < target.offsetHeight){
		var y_gap = target.offsetHeight - document.documentElement.scrollHeight
		win.resizeBy(0, y_gap);
	}

 }




 function menuVisible(menuId){
	document.getElementById(menuId).style.display='block';
}



/*개발

function ifrmLink(uurl, encData, target, style){
    var sFrame;
 
    sFrame = window.top.secureframe;
 
    var tgt =  document.getElementById(target)
    if(encData != "")
    {
        if(uurl.indexOf('?', 0) < 0)
            uurl += "?";
        if((uurl.charAt(uurl.length-1)!='?') && (uurl.charAt(uurl.length-1)!='&'))
            uurl += "&";
        uurl += encData;
    }
    window.open(uurl, target, style);
}

*/

//이포넷 스크립
//-----------------------------------------------------------------------------
// 타입 유효성 검사
// @return : boolean
//-----------------------------------------------------------------------------
function isType(item) {
    if ( typeof(item)=='undefined' || item==null ) {
        return false;
    }
    return true;
}
//-----------------------------------------------------------------------------
// 문자의 좌, 우 공백 제거
// @return : String
//-----------------------------------------------------------------------------
String.prototype.trim = function() {
   return this.replace(/(^\s*)|(\s*$)/g, "");
}
//-----------------------------------------------------------------------------
// 숫자만 가져 오기
// @return : String
//-----------------------------------------------------------------------------
String.prototype.num = function() {
    var st = this;
    if ( st==null || st=="" ) {
        st = "0";
    }
    return parseInt(st.trim().replace(/[^0-9]/g, ""));
}

/// 쿠키 체크
function ReadCookie(cookieName) {
	var theCookie = "" + document.cookie;
	var ind = theCookie.indexOf(cookieName);
	var ssoCheck = "0";
	if (ind == -1 || cookieName == "") ssoCheck = "0";
	else ssoCheck = "1";
	var ind1=theCookie.indexOf(';',ind);

	if (ind1 == -1) ind1 = theCookie.length;
	if (ssoCheck != "0") {
		//alert( unescape(theCookie.substring(ind+cookieName.length+1,ind1)) );
	}
	return ssoCheck;
}

// 쿠키값 가져오기
function ReadCookieValue(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
   begin = dc.indexOf(prefix);
   if (begin != 0) return null;
  } else
   begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
   end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

/// Inline Frame 처리
var iframeids=["incframe","actionframe", "smsframe", "submainframe"];
var iframeidswidth = { "incframe": 681, "actionframe": 928, "smsframe": 681, "submainframe":930 }
var iframehide="yes";
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0;
var iframeDefaultHeight = 500;
var iframeUserHeight = 0;

function setIfrmHeight(h){
	iframeUserHeight = h;
}

function resizeCaller() {
    var dyniframe=new Array()
    for (i=0; i<iframeids.length; i++){
        if (document.getElementById) { resizeIframe(iframeids[i]); }
        if ((document.all || document.getElementById) && iframehide=="no") {
            var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i]);
            tempobj.style.display="block";
        }
    }
	//로그인 Set
	checkLogin();
}

function resizeIframe(frameid){
    var currentfr = document.getElementById(frameid);
    var currentfrdiv;

    if (currentfr && !window.opera) {
        currentfr.style.display = "block";
        if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) {
            currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;

            // 추가소스 : 디폴트 싸이즈 아닐때 가로정보
			//<div id=frameid + "info" pagewidth="928" pageheight="210" style="display:none;"></div>
            currentfrdiv = currentfr.contentDocument.getElementById(frameid+'info');
            // 추가소스 : 디폴트 싸이즈 아닐때 가로정보


        }
        else if (currentfr.document && currentfr.document.body.scrollHeight) {
			var ifrmObj;
        	var ifrmH;
        	var isCrossSite = false;
        	try{
            	ifrmObj = currentfr.Document.body;
            	ifrmH = ifrmObj.scrollHeight;
            	//iframeDefaultHeight = ifrmH;
				// 추가소스 : 디폴트 싸이즈 아닐때 가로정보
				currentfrdiv = currentfr.document.getElementById(frameid+'info');
				// 추가소스 : 디폴트 싸이즈 아닐때 가로정보
            }
            catch(e){
            	isCrossSite = true;
            	ifrmObj = currentfr.document.body;
            	//ifrmH = iframeDefaultHeight;
           		ifrmH = currentfr.style.height;
            }
			if(iframeUserHeight != 0) {
				iframeDefaultHeight = iframeUserHeight;
			}

            if(isCrossSite) {
            	//alert("crosss : " + ifrmH);
				if(IE7) {
					currentfr.height = (ifrmH > iframeDefaultHeight) ? ifrmH : iframeDefaultHeight;
				}
				else {
					ifrmH = String(ifrmH).num();
					currentfr.style.height = ((ifrmH > iframeDefaultHeight) ? ifrmH : iframeDefaultHeight);
				}
			}
			else {
				if(iframeUserHeight != 0) {
					ifrmH = ((ifrmH > iframeUserHeight) ? ifrmH : iframeUserHeight);
				}
				currentfr.style.height = ifrmH;
			}

		}


// 추가소스 시작 ( 고정넓이, 고정높이 )
        var currentFrameHeight = String(currentfr.style.height).num();
        if ( isType(currentfrdiv) ) {
            currentfr.style.width = currentfrdiv.getAttribute('pagewidth') + 'px';
            var pheight = currentfrdiv.getAttribute('pageheight');
            if ( isType(pheight) && currentFrameHeight < parseInt(pheight) ) {
                currentfr.style.height = pheight + 'px';
            }
        } else {
            currentfr.style.width = iframeidswidth[frameid] + 'px';
        }

// 추가소스 종료 ( 고정넓이, 고정높이 )


        if (currentfr.addEventListener) {
            currentfr.addEventListener("load", readjustIframe, false);
        } else if (currentfr.attachEvent){
            currentfr.detachEvent("onload", readjustIframe);
            currentfr.attachEvent("onload", readjustIframe);
        }
    }
}

function readjustIframe(loadevt) {
    var crossevt=(window.event)? event : loadevt;
    var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement;
    if (iframeroot) { resizeIframe(iframeroot.id); }
}

if (window.addEventListener) {
    window.addEventListener("load", resizeCaller, false);
} else if (window.attachEvent) {
    window.attachEvent("onload", resizeCaller);
} else {
    window.onload=resizeCaller;
}


//iniSafe 로딩 후 처리
var start_time;
var end_time;
var loadIniSafeHtmlCnt = 0;
var installCnt = 0;
var loadingIniSafeHtml = "0";

function ifrmLink(uurl, encData, target, style){
	var sFrame;

	sFrame = window.top.secureframe;

//개발시 필요
	var tgt =  document.getElementById(target)
	if(encData != "")
	{
		if(uurl.indexOf('?', 0) < 0)
			uurl += "?";
		if((uurl.charAt(uurl.length-1)!='?') && (uurl.charAt(uurl.length-1)!='&'))
			uurl += "&";
		uurl += encData;
	}
	window.open(uurl, target, style);
}

//iniSafe 모듈 로드
function LoadIniSafeHtml(){
	var sFrame;

	sFrame = window.top.secureframe;

	if(sFrame.INIplugin==null || typeof(sFrame.INIplugin) == "undefined" || sFrame.INIplugin.object==null)
	{
		window.top.secureframe.location="/initech/plugin/INIplugin.html";
	}
}

//iniSafe 모듈 로드
function LoadnProtectHtml()
{
	var nprtFrame = window.top.nprotect_frame;

	if(nprtFrame.location != "/plugin/nprotect/nprotect_include_src_noimg.html")
	{
		nprtFrame.location="/plugin/nprotect/nprotect_include_src_noimg.html";
	}
}

function goMemberBank(evt) {
	var ctrl;
	evt = evt || window.event;
	if(!evt)
		return;

	if(evt.target)
		ctrl = evt.target;
	else if(evt.srcElement)
		ctrl = evt.srcElement;
	else
		return;

	//ifrmLink(ctrl.value, "","_blank","");
	if(ctrl.value.trim() != "") {
		window.open(ctrl.value, "_blank", "");
	}
}