// 뒤로가기 키 방지
//window.history.forward(0);

//첨부파일 다운로드 -- 암호화 기능 적용 2008-11-06 김동규 추가
function downCryptAttchFl(attchFlSeq , seq){

//window.open( kbl.APPLICATION_CONTEXT_ROOT + "/cn//cnFileDownload.do?attchFlSeq="+attchFlSeq + "&seq=" + seq ,
// '_blank','top=100, left=100, height=120, width=180, status=no, menubar=no, resizable=no, scrollbars=no, toolbar=no, location=no, directories=no');
location.href = kbl.APPLICATION_CONTEXT_ROOT + "/cn/cnFileDownload.do?attchFlSeq="+encodeURIComponent(attchFlSeq)+ "&seq=" + seq;
}



// 문서가 불려온뒤 실행하는 스크립트들


window.onload = function(){
	var url = document.location;
	var urlText = url + "";
	if(urlText.indexOf("/KBLCM/cy/") > -1) {
		document.oncontextmenu = new Function('return false');
		document.ondragstart = new Function('return false');
		document.onselectstart = new Function('return false'); 
	}
window.onresizeListener = new Array();
//레이어 컨트롤러 생성
if(top.layers == null){
layers = new Layers();
layers.createBackground();
}
//탭 초기화
ActivateTab();
//화면보다 큰 이미지를 화면에 맞게 축소
makeBoardImageFitIntoFrame();
//TTS초기화
//f_VoiceInit();

onloadPage();
onloadPage2();

addOnresizeListener(resizeMenuFlash);
//addOnresizeListener(relocateFooter);

addOnresizeListener(
function() {
try{
top.layers.handleResize();
}catch(e){}
}
);

window.onresize = resizeElements;

try {
top.window.scroll(0,0);
} catch (e) {window.scroll(0,0);}// frameset을 사용한 kyobofa.co.kr의 경우 cross-scripting 문제가 있으므로, top을 사용하지 않는다


setInterval("relocateFooter()",1000);


// body에 onkeydown 이벤트를 붙여서 F5키를 막는다.
document.body.onkeydown = LockF5;

try {
top.document.title = "교보생명";
document.title = "교보생명";
window.document.title = "교보생명";
} catch (e) {}
}




// F5키를 막는다.
function LockF5() {
//alert(window.event);
if (event.keyCode==116) {
event.keyCode=0; 
return false;
}
}

// window의 크기가 변경되었을 때 실행할 함수를 등록한다. 
function addOnresizeListener(func) {
window.onresizeListener[window.onresizeListener.length] = func;
}

// window 크기가 변경되었을 때 등록된 함수들을 실행한다.
function resizeElements() {
for (var i=0; i<window.onresizeListener.length; i++) {
var func = window.onresizeListener[i];
func.call();
}
}

function getWindowHeight() {
var windowHeight = 0;
if (typeof(top.window.innerHeight) == 'number') {
windowHeight = top.window.innerHeight;
}
else {
if (top.document.documentElement && top.document.documentElement.clientHeight) {
windowHeight = top.document.documentElement.clientHeight;
}
else {
if (top.document.body && top.document.body.clientHeight) {
windowHeight = top.document.body.clientHeight;
}
}
}
return windowHeight;
}


function relocateFooter(){
try{
//화면의 높이를 가져옴.
var height = getWindowHeight();
var objectContent;

//footer 객체를 가져옴.
var objFooter = top.document.getElementById('footer');
if(!objFooter){
objFooter = top.document.getElementById('ir_footer');
}
if(!objFooter){
objFooter = top.document.getElementById('fa_footer');
}

var footerTopOnWindow = parseInt(height - objFooter.offsetHeight); 

//컨텐츠를 가져옴.
objectContent = top.document.getElementById("resultDiv");
if(objectContent == null)
objectContent = top.document.body;

//dummy엘리먼트를 컨텐츠에 append함(append하지 않을 경우,높이 인식을 하지 못하는 경우가 발생)
objDummy = top.document.createElement("div");
objDummy.style.width = "0px";
objDummy.style.height = "0px";
objDummy.style.overflow = "hidden";
objDummy.id = "divDummy";
objectContent.appendChild(objDummy);
contentBottom = getOffsetTop(objDummy);
objectContent.removeChild(objDummy);

// resultDiv와 body의 높이를 비교하여, 높이가 더 높은 엘리먼트의 높이를 인식한다.
if (objectContent != top.document.body && contentBottom < top.document.body.scrollHeight) {
contentBottom = top.document.body.scrollHeight;
}

if(footerTopOnWindow < contentBottom){
objFooter.style.top = contentBottom + "px";
}else if(footerTopOnWindow > contentBottom){
objFooter.style.top = footerTopOnWindow + "px";
}
//alert(contentBottom);
} catch(e) {
}

}


function onloadPage() {}
function onloadPage2() {}
function onloadCommonLayer() {}

/** 플래쉬 관련 함수 ****************************************************************/

function link(command ,url, urlData) {
// 금융 상품 페이지의 금융 상품 검색에 대한 특별 처리
if ( command.indexOf("/KBLCM/mm/mmConsult.do")==0 ) {
//XecureSubmitToWindow('form1', command, 'abcd', 610, 700, "true");	
	var url = "/KBLCM/mm/mmConsultIntP.do?url="+command;
	window.open(url, "resultPop", "left=307,top=170,width=607,height=600,scrollbars=yes"); 
return ;
} else if ( url.indexOf("/KBLCM/lp/lpConsult.do")==0 ) {
		XecureSubmitToWindow('form1', url, 'abcd', 610, 700, "true");	
		return ;
	}  else if ( url == "false" ) {
url = command;
command = "0";
}

command = command + "";
command = command.toLowerCase();
url = url + "";
url = url.split('^').join('&') ;
url = url.replace(/&$/, "");

if(urlData == null || urlData == '')
urlData = '';

if(url == 0 || url == '0'){
temp = url;
url = command;
command = temp; 
}

switch(command){
case "xecure": // xecure 보안이 필요한 페이지인 경우의 처리
try {
XecureNavigate(url+urlData, "_self");
}catch(err){
top.location.href = "/KBLCM/content/secu_enabler.jsp?target=" + url + urlData;
}
break;
case "window": //새창으로 띄우기
eval("var data = " + url);
windowOpenCenter(data['src'], data['id'], data['width'], data['height'], data['scroll']);
break;
case "newpage": //새페이지로 띄우기
window.open(url, 'external', ''); 
break;
case "layer": //레이어로 띄우기
eval("var data = " + url);
top.layers.create({id:data['id'], src:data['src'], width:data['width']});
break;
default:
if(url){
top.location.href = url + urlData;
} 
break;
}

}

function coreVoiceFn(str){
OnSendText(str);
}

function gnb_height(num) {
document.getElementById("gnbFlash").style.height = num;
}

function resizeMenuFlash(){
try{
objMenuFlash = top.document.getElementById("menuFlash");
objMenuFlash.width = "100%";

objGnbFlash = top.document.getElementById("gnbFlash");
objGnbFlash.width = "100%";
}catch(e){}
}

function myMenuAdd(url) {
top.layers.create({id:'myFavorite', src:'/KBLCM/cm/my/CMMY_FavoriteinsAction.do?favoriteUrl='+url, width:'425', objId:'btnMypage', objH:'left', objV:'top',x:-310, y:85, isBackground:'false' });
}

function myMenuView() {
top.layers.create({id:'myFavorite', src:'/KBLCM/cm/my/CMMY_FavoritelstAction.do', width:'425', objId:'btnMypage', objH:'left', objV:'top',x:-310, y:85, isBackground:'false' });
}


function insertFlash(fId, fMovie, fWidth, fHeight, fWmode, fClass, fStyle, fParam){
document.write('<object id="' +fId+ '" class="' +fClass+ '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' +fWidth+ '" height="' +fHeight+ '" align="middle" style="' + fStyle+ '">');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="allowFullScreen" value="false" />');
document.write('<param name="wmode" value="' +fWmode+ '" />');
document.write('<param name="movie" value="' +fMovie+ '" />');
document.write('<param name="quality" value="best" />');
document.write('<param name="bgcolor" value="#ffffff" />');
document.write(fParam);
document.write('</object>');
}


/*******************************************************************************/




/* 
게시판 상세보기 페이지에서, 사용자가 업로드한 이미지가 게시판의 너비보다 큰 경우,
해당 이미지 크기를 게시판의 너비에 맞도록 축소한다.
@paramwidth 
지정한 값보다 너비가 큰 이미지의 경우, width 값으로 축소한다. 기본값은 670이다.
*/

function makeBoardImageFitIntoFrame(width) {
if (width==null) width=670;
var divs = document.getElementsByTagName("div");
for (var i=0;i<divs.length;i++) {
if (divs[i].className == "cnt_board_view") {
// 상세보기 테이블에서, img를 모두 가져온다.
var imgs = divs[i].getElementsByTagName("img");
for (var j=0; j<imgs.length; j++) {
if (imgs[j].width > width) {
imgs[j].width = width;
}
}
}
}
}

//팝업을 띄우고, 해당 팝업에 현재 다큐먼트의 폼을 Submit한다.
function submitToWindow(formId, windowSrc, windowId, width, height, scroll){

objForm = document.getElementById(formId);
originAction = objForm.action; 
originTarget = objForm.target;

windowOpenCenter('', windowId, width, height, scroll);

objForm.target = windowId;
objForm.action = windowSrc;
objForm.submit();
objForm.action = originAction;
objForm.target = originTarget;
}

//제큐어 + 팝업을 띄우고, 해당 팝업에 현재 다큐먼트의 폼을 Submit한다.
function XecureSubmitToWindow(formId, windowSrc, windowId, width, height, scroll){

objForm = document.getElementById(formId);
originAction = objForm.action; 
originTarget = objForm.target;

windowOpenCenter('', windowId, width, height, scroll);

objForm.target = windowId;
objForm.action = windowSrc;
XecureSubmit(objForm);
objForm.action = originAction;
objForm.target = originTarget;
}

//팝업 화면 중앙에 띄우기 (id부여)
function windowOpenCenter(src, id, width, height, scroll) {
var winleft = (screen.width - width) / 2;
var wintop = (screen.height - height) / 2;
if (scroll=="true") {
winprops = 'width='+width+',height='+height+',top='+wintop+',left='+winleft+',resizable=no,scrollbars=yes,toolbars=no,status=no,menu=no';
} 
else
winprops = 'width='+width+',height='+height+',top='+wintop+',left='+winleft+',resizable=no,scrollbars=no,toolbars=no,status=no,menu=no';

win = window.open(src, id, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// 현재 엘리먼트의 top 포지션을 구한다.
function getOffsetTop(obj) {
var top = 0;
while (obj != null) {
top += obj.offsetTop;
obj = obj.offsetParent;
}
return top;
}

// 현재 엘리먼트의 left 포지션을 구한다.
function getOffsetLeft(obj) {
var left = 0;
while (obj != null) {
left += obj.offsetLeft;
obj = obj.offsetParent;
}
return left;
}

function resizeIframe(id){
ifm = document.getElementById(id);
ifm.onreadystatechange = function() {
if (ifm.readyState=="complete") {
ifm.height = ifm.contentWindow.document.body.offsetHeight;
}

relocateFooter();
}

}
function showPaging( div , currPage , totalCnt , blockSize , maxLinkedPages , functionName ){
try {
currPage = Number(currPage);
totalCnt = Number(totalCnt);
blockSize = Number(blockSize);
maxLinkedPages = Number(maxLinkedPages);


var totalPage = 0;
if( totalCnt%blockSize > 0 ){
totalPage = parseInt( ( totalCnt / blockSize) +1 );
} else {
totalPage = parseInt( totalCnt / blockSize );
}


var tempFirstPage = parseInt((currPage-1)/maxLinkedPages);
var firstLinkedPage = parseInt(tempFirstPage * maxLinkedPages + 1);
var lastLinkedPage = parseInt(firstLinkedPage + maxLinkedPages - 1)

if(lastLinkedPage > totalPage)
lastLinkedPage = totalPage;

var previouseLinkedPage = firstLinkedPage - 1;
var nextLinkedPage = lastLinkedPage + 1;

var isPreviousLinkedPage = parseInt(currPage/(maxLinkedPages+1));
var isNextLinkedPage = parseInt((totalPage-1)/maxLinkedPages);

var pageScript = "";


if(totalPage > 0 ){

pageScript += "<span class='cnt_paging_btn_prev'>";
pageScript += "<img src='/KBLCM/images/common/btn_prev_02.gif' onclick='"+ functionName + "(1)' style='cursor:hand'>"; 

if(isPreviousLinkedPage > 0 ){
pageScript += "<img src='/KBLCM/images/common/btn_prev_01.gif' onclick='"+ functionName + "("+ previouseLinkedPage + ")' style='cursor:hand'>"; 
}else{
pageScript += "<img src='/KBLCM/images/common/btn_prev_01.gif'>"; 
}
pageScript +="</span>";

for(var pageNo = firstLinkedPage ; pageNo <= lastLinkedPage ; pageNo++){
if(pageNo == currPage){
pageScript += "|<span class='cnt_paging_active'>" + pageNo + "</span>|";
}else{
pageScript += "<span> <a href='javascript:" + functionName + "(" + pageNo + ")'>" + pageNo + "</a> </span>";
}
}

pageScript += "<span class='cnt_paging_btn_next'>";
if(isPreviousLinkedPage < isNextLinkedPage ){
pageScript += "<img src='/KBLCM/images/common/btn_next_01.gif' onclick='"+ functionName + "("+ nextLinkedPage + ")' style='cursor:hand'>"; 
}else{
pageScript += "<img src='/KBLCM/images/common/btn_next_01.gif'>"; 
}
pageScript += "<img src='/KBLCM/images/common/btn_next_02.gif' onclick='"+ functionName + "(" + totalPage + ")' style='cursor:hand'>"; 

pageScript +="</span>";
}

$(div).innerHTML = pageScript;
}catch(e){
error(e);
}
}


function error(e){
errormessage = "name : " + e.name + " number : " + e.number + "\n"
+ "message : " + e.message + "\n"
+ "descript : \n" + e.description;

alert(errormessage);

}


/**
공통 첨부파일 다운로드
**/

function downAttchFl(attchFlSeq , seq){

//window.open( kbl.APPLICATION_CONTEXT_ROOT + "/cn//cnFileDownload.do?attchFlSeq="+attchFlSeq + "&seq=" + seq ,
// '_blank','top=100, left=100, height=120, width=180, status=no, menubar=no, resizable=no, scrollbars=no, toolbar=no, location=no, directories=no');
//location.href = kbl.APPLICATION_CONTEXT_ROOT + "/cn//cnFileDownload.do?attchFlSeq="+attchFlSeq + "&seq=" + seq;
location.href = kbl.APPLICATION_CONTEXT_ROOT + "/cn/cnFileDownload.do?attchFlSeq=" + encodeURIComponent(attchFlSeq) + "&seq=" + seq;
}

/**
URL 을 이용한 파일 다운로드
**/

function downUrlFl(url){
//window.open( kbl.APPLICATION_CONTEXT_ROOT + "/cn/UrlDownload.do?fileName="+url ,
// '_blank','top=100, left=100, height=120, width=180, status=no, menubar=no, resizable=no, scrollbars=no, toolbar=no, location=no, directories=no');
location.href = kbl.APPLICATION_CONTEXT_ROOT + "/cn/UrlDownload.do?fileName="+url;

}


/**
파일의 용량 및 파일 타입을 체크한다.[차후구현]
size : 파일 사이즈 kilo byte 단위 
types : 파일 확장자 ( 이미지 : "image" , 동영상 : "movie" , 기타 : 해당 확장자)
예 ) 최대 1메가 동영상 및 이미지 : <input type="file" onChange="checkFile(1024 , 'image,move')">
최대 2메가 이미지 및 pdf , xls : <input type="file" onChange="checkFile(2048 , 'image,xls,pdf')"> 

URL 을 이용한 파일 다운로드
**/

function checkFile(size , types){
return;
}


/**
숫자 입력만 가능한 폼 
예: <input type="text" style="ime-mode:distable" onkeydown="isOnlyNumber()">
**/
function isOnlyNumber() {
//숫자열 0 ~ 9 : 48 ~ 57, 키패드 0 ~ 9 : 96 ~ 105 ,8 : backspace, 46 : delete
if (event.keyCode >= 48 && event.keyCode <= 57 || 
event.keyCode >= 96 && event.keyCode <= 105 || 
event.keyCode == 8 || event.keyCode == 46 || event.keyCode == 9) {
//숫자가 아니면 넣을수 없다.
} else { 
event.returnValue=false;
}
}



///////////////////////////////////////////////////////////////////////////////////
// Text To Speech(음성읽기) 관련 스크립트
var ttsState = 1;

function f_set()
{
var strXTag;
strXTag = "<OBJECT ID='CoreWebGen' CLASSID='CLSID:3A3DE2B1-6B19-4B5E-A054-1E939FD531D3' CODEBASE='http://203.233.85.11/CoreWebGen2.1.1.14.cab#version=2,1,1,14' width='0' height='0' tabindex='-1'>"
strXTag += "<PARAM NAME='rI' value='3BAE9CA1A0A5A4A4B6BEBAA8A9BDACB2BBBFB0E3'>";
strXTag += "<PARAM NAME='SP' value='-1'>";
strXTag += "<PARAM NAME='gT' value='1'>";
strXTag += "<PARAM NAME='Dc' value='1'>";
strXTag += "<PARAM NAME='Da0' value='6F01'>";
strXTag += "</OBJECT>";
document.body.insertAdjacentHTML("BeforeEnd",strXTag);
} 

/*----------------------------------------------------------------------------*/
/*-레지스트리에 activeX가 설치되있는지 검사--*/
/*----------------------------------------------------------------------------*/
function DetectActiveXControl()
{
try
{
var xObj = new ActiveXObject("VoiceActX.CoreActiveX.1");
if(xObj)
{
Installed = true;
}
else
{
Installed = false;
}
}
catch(ex)
{
Installed = false;
}

if (Installed == true)
{ 
return true;
}
else{
return false;
}
}

/*----------------------------------------------------------------------------*/ 
/* NAME : IsAvailable() */ 
/* DESC : 처음 Load되었을 때 음성모듈이 사용가능한 상태인지 체크하는 함수 */ 
/*----------------------------------------------------------------------------*/ 
function IsAvailable()
{
var sRes;
sRes = DetectActiveXControl();

if(sRes)
{
IsCoreExist = document.getElementById('CoreWebGen');
if(IsCoreExist)
{
sRes = 1;
}
else
{
sRes = 0;
}
}
else
{
sRes = 0;
}
return sRes;
}


/*----------------------------------------------------------------------------*/ 
/* NAME : OnSetSpeed() */ 
/* DESC : 음성 속도 설정 함수 */ 
/*----------------------------------------------------------------------------*/ 
function OnSetSpeed(lSpeed)//Speed 버튼 클릭시 
{ 
if(CoreWebGen.object) 
{ 
CoreWebGen.SetSpeed(lSpeed, 0); 
} 
} 

/*----------------------------------------------------------------------------*/ 
/* NAME : OnSetVolume() */ 
/* DESC : 음성 볼륨 설정 함수 */ 
/*----------------------------------------------------------------------------*/ 
function OnSetVolume(lVolume) //Volume 버튼 클릭시 
{ 
if(CoreWebGen.object) 
{ 
CoreWebGen.SetVolume(lVolume, 1); 
} 
} 

/*----------------------------------------------------------------------------*/ 
/* NAME : OnSendText() */ 
/* DESC : 음성으로 변환하는 함수 */ 
/*----------------------------------------------------------------------------*/ 
function OnSendText(bText) // bText:보낼 텍스트 
{ 
if(IsAvailable() && CoreWebGen.object && bText.length > 0) 
{ 
CoreWebGen.SendSentence(bText); 
} 
} 

/*----------------------------------------------------------------------------*/ 
/* NAME : OnStart() */ 
/* DESC : 음성시작함수 */ 
/*----------------------------------------------------------------------------*/ 

function OnStart()//음성설정 시작시 
{
var sRes; 
if(IsAvailable()) 
{
if(CoreWebGen.object){
setCookie("voiceStart", "start", 1);
sRes = CoreWebGen.CoreXStart();
}
}
else{
f_set();  
if(CoreWebGen.object){
setCookie("voiceStart", "start", 1);
sRes = CoreWebGen.CoreXStart();
}
}
return sRes; 
} 

/*----------------------------------------------------------------------------*/ 
/* NAME : OnStop() */ 
/* DESC : 음성중지함수 */ 
/*----------------------------------------------------------------------------*/ 
function OnStop()//음성설정 중지시 
{ 
if(IsAvailable()){ 
if(CoreWebGen.object) 
{ 
setCookie("voiceStart", "stop", 1); 
CoreWebGen.CoreXStop(); 
} 
} 
} 

// var sVol = 3;
// var sSpeed = 3; 

function f_setVoiceSpeed(mode)
{
if ( readCookie("voiceSpeed").length == 0 ) sSpeed = 3;
else sSpeed = readCookie("voiceSpeed");


var strPlay = "";

var sRes;
sRes = IsAvailable();

if (sRes != 0)
{
if( mode == "up" ){

if( sSpeed < 5 ) sSpeed = parseInt(sSpeed) + 1;
OnSendText("속도" + sSpeed);

}else if( mode == "down" ){
if( sSpeed > 1 ) sSpeed = parseInt(sSpeed) - 1;
OnSendText("속도" + sSpeed);

}
OnSetSpeed(sSpeed);
}
//Cookie 재설정
setCookie( "voiceSpeed", sSpeed, 1 );
OnSetSpeed(sSpeed);
}

function f_setVoiceVolume(mode)
{
if ( readCookie("voiceVolum").length == 0 ) sVol = 3;
else sVol = readCookie("voiceVolum");

if( mode == "up" ){
if( sVol < 5 ){
sVol = parseInt(sVol) + 1;
}
OnSendText("볼륨 "+ sVol);
}else if( mode == "down" ){
if( sVol > 1 ){
sVol = parseInt(sVol) - 1;
}
OnSendText("볼륨 "+ sVol);
}else{
//NO JOBS
}
OnSetVolume(sVol);

//Cookie 재설정
setCookie( "voiceVolum", sVol, 1 );
OnSetVolume(sVol);
} 

//문자확대,축소
if(top.currentFontSize == null)
currentFontSize = 2;

function resizeFont(state){
try{
var idx;
var arrFontSize = new Array();

arrFontSize[0] = "10";
arrFontSize[1] = "11";
arrFontSize[2] = "12";
arrFontSize[3] = "16";
arrFontSize[4] = "18";

switch(state)
{
case "plus":
idx = top.currentFontSize + 1;
top.currentFontSize = idx;
break;
case "minus":
idx = top.currentFontSize - 1;
top.currentFontSize = idx;
break;
case "default":
idx = 2;
top.currentFontSize = idx;
break;
default:
idx = top.currentFontSize;
break;
}

if(idx == -1){
alert("최소 글자 크기 입니다.");
idx = 0;
}
if(idx == 5){
alert("최대 글자 크기 입니다.");
idx = 4;
}

searchAndResize(window.frames, arrFontSize[idx]);
}catch(e){}
}

function searchAndResize(obj, fontSize){
for(var i in obj){

if(i.indexOf("iframe") >= 0 || i == "document" ){

var objDocument;
if(i == "document")
objDocument = obj[i];
else
objDocument = obj[i].document;

for(var j in objDocument.all){
switch(objDocument.all[j].nodeName){
case "DIV":
case "DT":
case "DD":
case "LI":
case "SPAN":
case "TEXT":
case "TH":
case "TD":
case "TABLE":
if(fontSize == 12){
objDocument.all[j].style.fontSize = "";
}else{
if(objDocument.all[j].id != "mainMenuMessage"){
objDocument.all[j].style.fontSize = fontSize + "px";
}

}
break;
}
}

if(i.indexOf("iframe") >= 0)
searchAndResize(obj[i].frames, fontSize);
}
}
}


function font_size(d, v)
{
scale = readCookie("ttsarea");

if(v==1)
scale = '150%';
else if(v==2)
scale = '80%';
else if(v==0)
scale = '100%'; 


var objDocument = top.document.all;

top.document.body.style.zoom = scale;
//top.document.getElementById("mainMenu").style.zoom = scale;
//top.document.getElementById("GNB").style.zoom = scale;


/*
for(var k in objDocument){
objElement = objDocument[k];
switch(objElement.nodeName){
case "DIV":
case "OBJECT":
case "IMG":
if(objElement.style.position == "absolute"){
objElement.style.zoom = scale;
alert(objElement.id);
alert(objElement.style.zoom);
}
break;
}
}
*/

setCookie("ttsarea", scale, 1 );

}

function readCookie( str )
{
var key = str + "=" ;
var key_len = key.length ;
var cookie_len = document.cookie.length;
var i = 0;

while (i < cookie_len )
{
var j = i + key_len;
if ( document.cookie.substring( i, j ) == key )
{
var cookie_end = document.cookie.indexOf(";",j);

if (cookie_end == -1)
{
cookie_end = document.cookie.length;
}
return document.cookie.substring(j,cookie_end );
}
i++
}
return ""
}


function setCookie( key, value, term ){
var expire = new Date(); 
expire.setDate( expire.getDate() + term );
document.cookie = key + "=" + escape( value ) + "; path=/; expires=" + expire.toGMTString() + ";";
}

function f_VoiceInit(){
//var scale = readCookie("ttsarea");
//document.getElementById('ttsarea').style.zoom = scale;
var vStart = readCookie("voiceStart");
if (vStart == "start")
OnStart();
else
OnStop();
}

/**
* 저장 시 사용할 공통 메소드
* @param formName 
* @param closeFunction [옵션]화면닫기를 클릭했을 경우 발생시킬 이벤트
* @param url [옵션]호출 할 url 
* @return
*/

function createAction(formName , closeFunction , url ){
top.layers.create({id:'createMessagePop', src:'' , width:410});

var form = $(formName);

if(!url) url = form.action;

var a = document.createElement("<input type=hidden>");

a.name = "closeFunction";
a.value = closeFunction;
form.appendChild(a);

var oldTarget = form.target;

form.action = url;
form.target = 'createMessagePop';
form.submit();

form.target = oldTarget;
form.removeChild(a);
}


function goBack(back_url){

var f = document.createElement("<form name=backform method=post></form>");
f.action = back_url;
var tempParams = $("temp_back_data").innerText;
var params = tempParams.split("|");
var length = params.length;
for(var i=0;i<length;i++){
var p = params[i].split("~");
if(p.length == 2){
var a = document.createElement("<input type=hidden>");
a.name = p[0];
a.value = p[1];
f.appendChild(a);
}
}
document.body.appendChild(f);
f.submit();
} 


// document에서 name 속성의 값이 파라미터인 객체들의 배열을 검색, 반환
function getElementsByNM(name){
var objDocument = document.all;
var objResult = new Array();
for(var k in objDocument){
if(objDocument[k].name == name)
objResult.push(objDocument[k]);
}

return objResult;
}



/**
문서 내의 각 엘리먼트의 class 이름과 전달인자로 넘어온 class 이름을 비교하여 일치하는 엘리먼트들의 배열을 리턴한다.
두 번째 전달인자인 root는 문서 내의 특정 엘리먼트를 루트로 한 서브트리 내에서 검색을 수행할 수 있도록 한다.
이 전달인자를 넘겨 주지 않은 경우, 문서의 최상위 엘리먼트에서부터 탐색을 시작한다.

@param cn - 비교할 클래스 이름 
@param root 비교를 시작할 HTML 문서의 서브트리의 루트 엘리먼트
*/
function getElementsByClassName(cn, root) {
var el = root==null ? document.all : root.all;
var arr = new Array();
for (var i=0; i<el.length; i++) {
if (el[i].className.indexOf(cn) != -1) 
arr.push(el[i]);
}
return arr; 
}

/*
XML 형식의 문자열을 입력으로 받아, XML 문서를 돌려주는 함수
*/
function getXMLDocument(text) {
var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');
xmlDocument.async = "false";
xmlDocument.loadXML(text);
return xmlDocument;
}
//
///////////////////////////////////////////////////////////////////////////////////

/********************************************************************************************
*
* 사용법
* param1 : zipName1 (우편번호 앞 3자리 필드)
* param2 : zipName2 (우편번호 뒤 3자리 필드)
* param3 : addrName1 (주소1-시구동 필드)
* param4 : addrName2 (주소2-번지 필드)
* param4 : frameName (해당 필드 이름은 레이어에서 레이어를 띄울때 사용하며 부모 레이어 이름을 써주면 됩니다. 사용하지 않을때는 걍 '' 주세요)
* 
* 
*
* onclick="zipPop('zipName1', 'zipName2', 'addrName1', 'addrName2', 'frameName');"
* 
* <form name="form1" id="form1" method="post">
* <input type="text" class="text" name="homeZipNo1" id="homeZipNo1" maxlength="3" readonly="readonly"/>-
* <input type="text" class="text" name="homeZipNo2" id="homeZipNo2" maxlength="3" readonly="readonly"/>
* <img onclick="zipPop('homeZipNo1', 'homeZipNo2', 'homeAddr1', 'homeAddr2');" src="/KBLCM/images/common/btn_zipcodeSearch2.gif" align="absmiddle" class="ML10"/>
* <input type="text" class="text" name="homeAddr1" id="homeAddr1" maxlength="100" readonly="readonly"/>
* <input type="text" class="text" name="homeAddr2" id="homeAddr2" maxlength="100"/>
*
********************************************************************************************/
function zipPop(zipName1, zipName2, addrName1, addrName2, frameName, frmObj) {
var param = "?";

param += "zipName1=" + zipName1;
param += "&zipName2=" + zipName2;
param += "&addrName1=" + addrName1;
param += "&addrName2=" + addrName2;
param += "&frameName=" + frameName;

var url = "/KBLCM/cm/CMLCWJInformationInsZipPopAction.do";

//top.layers.create({id:'zipLayer', src:url+param, width:415, height:380});
//top.zipFrm = frmObj;

var x = (screen.width - 415) / 2;
var y = (screen.height - 430) / 2;
window.open(url+param, 'timeSelect', 'width=415, height=380, left='+x+', top='+y);
}

// 우편번호 팝업창 (어드민 페이지)
function zipPopup(zipName1, zipName2, addrName1, addrName2, frameName) {
var param = "?";

param += "zipName1=" + zipName1;
param += "&zipName2=" + zipName2;
param += "&addrName1=" + addrName1;
param += "&addrName2=" + addrName2;
param += "&frameName=" + frameName;

var url = "/KBLCM/cm/CMLCWJInformationInsZipPopupAction.do";
window.open(url+param,'zipLayer','location=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=415,height=380' );
//top.layers.create({id:'zipLayer', src:url+param, width:415, height:380});
}

//공통 이메일 체크 -- 삭제하면 안됨!!!! (류대리님 제발 삭제좀 하지 마세요!!!)
function changeEmailCombo( target ) {
var selectedValue = event.srcElement.value;

if (selectedValue == "") {
$(target).value = "";
$(target).readOnly = false;
} else {
$(target).value = selectedValue;
$(target).readOnly = true;
}
}

/* 
PHP의 in_array와 동일한 기능을 하는 함수.
전달인자로 넘겨받은 배열(haystack)에서 특정 값(needle)이 있는지 검색하여 결과를 boolean 형식으로 돌려준다. 
*/
function in_array(needle, haystack) {
// http://kevin.vanzonneveld.net
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);
// * returns 1: true
var found = false, key, strict = !!strict;

for (key in haystack) {
if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
found = true;
break;
}
}
return found;
}

/* 
장병국;
팝업 리사이즈 함수 
*/
function resize_window(wid,hei) {
var n = navigator.userAgent, isIE = false;

if(n.indexOf("MSIE 7") != -1) {
wid += 10;
hei += 36;
isIE = true;
}else if(n.indexOf("MSIE 6") != -1) {
wid += 10;
hei += 36;
isIE = true;
}else if(n.indexOf("Firefox") != -1) {
wid += 6;
hei += 54;
}
if(hei < document.body.scrollHeight && isIE) {
wid += 18;
window.document.body.scroll = "yes";
}

window.resizeTo(wid,hei);
};

function tabInit() {
var tab = document.getElementsByTagName("LI");
for(var i = 0; i < tab.length; i++) {
if(!tab[i].getAttribute("tabGroup")) return;
if(tab[i].getAttribute("activeTab") == "true" && tab[i].getAttribute("tabSeq") != 1) {
tab[i].style.display = "none";
} else if(tab[i].getAttribute("activeTab") == "false" && tab[i].getAttribute("tabSeq") == 1) {
tab[i].style.display = "none";
}
}
}
//이용 가능할 경우에만 실행되도록 작업 되었습니다.
/*
try {
Event.observe(document, "dom:loaded", function() { tabInit() });
} catch(e) {
}
*/

//키보드 보안 시작.
//document.write('\<script language=javascript src=\'/js/kdf_kyobo.js\'></script> \n');

var var_kLicense;
var kdfv_domain = window.location.hostname;


if(kdfv_domain.search(".kyobo.com") != -1)
{
  	var_kLicense = "89cd8988b283c08fa0b1bbd0beafb82d4d8fbbcafd22422bb6de5c119e74102fd0";
}
else if(kdfv_domain.search("kyobo.com") != -1)
{
  	var_kLicense = "d2d8bdd271650fa7aab53a405bd7f68acebedad0c5e844b12e97f636e620fa2161";
}
else if(kdfv_domain.search(".kyobo.co.kr") != -1)
{
  	var_kLicense = "4f803de059cfe85daccc04c31e1308b3633e44ad397c08fc678c0400ece7301df0";
}
else if(kdfv_domain.search("kyobo.co.kr") != -1)
{
  	var_kLicense = "36ba0d8a88790e8b2267efc5bfdbc59fffbf7770ce176fbb9f3452130e36430621";
}
else if(kdfv_domain.search(".directlife.co.kr") != -1)
{
  	var_kLicense = "f2d6aad191b0823960da05b45ce678ba937221ea456b458b2215aa792ed6cd7a40";
}
else if(kdfv_domain.search("directlife.co.kr") != -1)
{
  	var_kLicense = "12021647e26fe7c87c11ab74bffc548313355e8bb9ff05ebb1a3ee44693ee645f0";
}
else if(kdfv_domain.search(".kyobohrd.co.kr") != -1)
{
  	var_kLicense = "0dc2c72023b72372478370f21df53f779c58f499d8a26202733daed78bffbe6ca0";
}
else if(kdfv_domain.search("kyobohrd.co.kr") != -1)
{
  	var_kLicense = "1fa7233735c83a76fd5b2e4dc8d7f2cb8c9e90eaf7c1048b37abe649267e5b0090";
}
else if(kdfv_domain.search("10.33.3.17") != -1)
{
  	var_kLicense = "214a2a9db55a7f657d931279567d10eaa6fea46ffa688029659a24f7cf704d3910";
}
else if(kdfv_domain.search("203.233.85.11") != -1)
{
  	var_kLicense = "486fde91d2c8067e5d5603badf73f8f0a54f857ffdae5db6676e905fe2e114b0f0";
}
else if(kdfv_domain.search("203.233.85.12") != -1)
{
  	var_kLicense = "9ee2c51041d13cedaa7db137e6a3fc415c447f253d48f45d4754858c23d63f9000";
}

if (window.ActiveXObject)

	{
		var request_IE = navigator.userAgent;
		request_IE = request_IE.toLowerCase();

		if(request_IE.indexOf("msie 6.") > 0)
		{
			//ie6
			document.write('<object id=kdefense classid="CLSID:A4508A45-F1C4-40f3-99B4-0CA08AC77E3B"');                                    
			document.write('	codebase="http://kings.nefficient.co.kr/kings/kdfx/kdfx327/kdfense8.cab#Version=8,3,2,7"');
			document.write('	height=0 width=0 align=left size=0>');          
		}
		else
		{
			document.write('<object id=kdefense classid="CLSID:A4508A45-F1C4-40f3-99B4-0CA08AC77E3B"');
			document.write('	codebase="http://kings.nefficient.co.kr/kings/kdfx/kdfx327/kdfense8.cab#Version=8,3,2,7"');
			document.write('	height=0 width=0 align=left size=0>');
		}

		document.write('	<PARAM name="nOption" value=6>');
		document.write('	<PARAM name="nOptionEx" value=', parseInt("0x01010001",16), '>');
		document.write('	<PARAM name="nOptionEx2" value=', parseInt("0x00000004",16), '>');	//예, 한글일 때, 숫자보호
		
		document.write('	<PARAM name="szIconON" value="http://kings.nefficient.co.kr/kings/ksite/kyobolife/iconon.ico">');
		document.write('	<PARAM name="szIconONHash" value="26700AF92D43D48C2D61387C4C24AEF7">');
		document.write('	<PARAM name="szIconOFF" value="http://kings.nefficient.co.kr/kings/ksite/kyobolife/iconoff.ico">');
		document.write('	<PARAM name="szTipImage" value="http://kings.nefficient.co.kr/kings/ksite/kyobolife/kyobo.bmp">');
		document.write('	<PARAM name="szTipImageHash" value="D9083BBFD891AACA93222F89A039564D">');
		
		/*	키보드보안 업그레이드 이전버전
		document.write('	<PARAM name="nModuleVersion" value="39100501">');
		document.write('	<PARAM name="szModulePath" value="http://kings.nefficient.co.kr/kings/kdfinj5x/39100501/kdfinj.dll">');
		document.write('	<PARAM name="szModuleHash" value="982F7BA5A53EB5B75D5B63A7C2004FA8">');
		*/
		document.write('	<PARAM name="nModuleVersion" value="410051301">');
		document.write('	<PARAM name="szModulePath" value="http://kings.nefficient.co.kr/kings/kdfinj6x/410051301_6015/kdfinj.dll">');
		document.write('	<PARAM name="szModuleHash" value="0CD8E441CB29FE6778AD3489902E6A30">');
			
		document.write(' <PARAM name="nExModuleVersion" value="79020401">');
		document.write(' <PARAM name="szExModulePath" value="http://kings.nefficient.co.kr/kings/kdfmod3x/79020401/kdfmod.dll">');
		document.write(' <PARAM name="szExModuleHash" value="E17D649AB38C8BCB4FD5829A2D89FEEA">');
		
		document.write('	<PARAM name="szGKey" value="58c705643199c2ff067850db4181dff9f0d63edeecde16ab33ac57c24703d22ff0">');
		document.write('	<PARAM name="kLicense" value=', var_kLicense, '>');
		document.write('</object>');
	}
//키보드 보안 끝.

