var var_kLicense;
var kdfv_domain = window.location.hostname;

// 2006.07¿ù ÀÓ½Ã ¶óÀÌ¼¾½º
var_kLicense = "3ffa42a839d18d2fdf983bce8510268d8d9dd914baff095211dbda8e0b79c2e9c0";

if(kdfv_domain.search("\\.iprovest.com") != -1)
{
  	var_kLicense = "ab919445ae8fa3581f89d88a257bf5bf3edca6715da8ac9ce8799cddf0c8d8bff0";
}
else if(kdfv_domain.search("iprovest.com") != -1)
{
  	var_kLicense = "cbddea469bc1d52be78f24814f6950fea63107fe10bf1c0a5e6ea15ddf30dba251";
}
if(kdfv_domain.search("\\.iprovest.co.kr") != -1)
{
  	var_kLicense = "9b63191ab9c4a9eb4436cd8f6ce92ecfa1d2ae55b814abd0a89951be87cd796340";
}
else if(kdfv_domain.search("iprovest.co.kr") != -1)
{
  	var_kLicense = "ffb254f8bd57b452ae74d8b6c8ba110358692240bdf1f96f653858e2decc56dc80";
}
if(kdfv_domain.search("\\.kyobotrade.com") != -1)
{
  	var_kLicense = "8820c935998229547e44d7049b70bd2c7ea23f05127b08d83c942e631f6c293430";
}
else if(kdfv_domain.search("kyobotrade.com") != -1)
{
  	var_kLicense = "e19972fad759da541fa58c1d28879ba79660a248ac4fe94421fa31ba4266990ce0";
}
if(kdfv_domain.search("\\.kyobotrade.co.kr") != -1)
{
  	var_kLicense = "0ca4bede98c0ba71d1b95d7c10d637ef8647ca4c991b5eaebc4051e20d157aef40";
}
else if(kdfv_domain.search("kyobotrade.co.kr") != -1)
{
  	var_kLicense = "a1d05d4d9fe71f9978c7b978f79b0eedae48bf40c40759e0e7755cbe57653a41b0";
}


/**************************************************************************************
 ************* k-Defence (KINGS Á¤º¸Åë½Å Å°º¸µå º¸¾È) *********************************
 **************************************************************************************/
if (window.ActiveXObject)
{
	var request_IE = navigator.userAgent;
	request_IE = request_IE.toLowerCase();

	if(request_IE.indexOf("msie 6.") > 0)
	{
		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/kdfx320/kdfense8.cab#Version=8,3,2,0"');
		document.write('   height=0 width=0 align=left size=0 style="display:none;">');
	}

	document.write('   <PARAM name="nOption" value=6>');

	document.write('	<PARAM name="nModuleVersion" value="410070901">');
	document.write('	<PARAM name="szModulePath" value="http://kings.nefficient.co.kr/kings/kdfinj6x/410070901_6022/kdfinj.dll">');
	document.write('	<PARAM name="szModuleHash" value="CE110A7C72E467FB5F9E169914EB858E">');
		
	document.write('    <PARAM name="nExModuleVersion" value="710060401">');
	document.write('    <PARAM name="szExModulePath" value="http://kings.nefficient.co.kr/kings/kdfmod3x/710060401/kdfmod.dll">');
	document.write('    <PARAM name="szExModuleHash" value="C222DB05A80E2E8690CAD8FF1F318D7D">');

	document.write('   <PARAM name="szGKey" value="58c705643199c2ff067850db4181dff9f0d63edeecde16ab33ac57c24703d22ff0">');
	document.write('   <PARAM name="kLicense" value=', var_kLicense, '>');
	document.write('</object>');
}

/**************************************************************************************
 ************* k-Defence (KINGS Á¤º¸Åë½Å Å°º¸µå º¸¾È) *********************************
 **************************************************************************************/

//K-Defense ¼öµ¿ ¼³Ä¡ÆäÀÌÁö ÀÌµ¿
//try
//{
//	if(document.getElementById("kdefense").GetOCXVersion() == "")
//		{
//			location.href = "<¼öµ¿ ¼³Ä¡ ¾È³» ÆäÀÌÁö>";    //"/defense/kdf/kdfense.html?ValueName="+ValueName;
//		}
//}
//catch(e)
//{
//	location.href = "<¼öµ¿ ¼³Ä¡ ¾È³» ÆäÀÌÁö>";    //"/defense/kdf/kdfense.html?ValueName="+ValueName;
//}

/**************************************************************************************
 ************* nProtect Netizen (À×Ä«ÀÎÅÍ³Ý PC ¹æÈ­º®) ********************************
 URL: http://update.nprotect.net/nprotect2006/iprovest/netizenv4.js
 **************************************************************************************/
if(navigator.appVersion.toUpperCase().indexOf("Windows NT 6.0".toUpperCase(), 0) > 0 || navigator.appVersion.toUpperCase().indexOf("Windows NT 6.1".toUpperCase(), 0) > 0)
{
  if( (navigator.appName == "Microsoft Internet Explorer") && (navigator.userAgent.toLowerCase().indexOf("trident/4.0") != -1) )  //IE8.0 ´ëÀÀ Vista ¸ðµâ
  {
    document.write('<OBJECT ID="nPCom2" WIDTH=0 HEIGHT=0 CLASSID="CLSID:51B1D5ED-67DC-43F0-A3F8-8502F1A5E404"')
    document.write('codebase="http://update.nprotect.net/nprotect2007/iprovest/npstarter3.cab#version=2007,7,1,1">')
    document.write('<PARAM NAME="PolicyUrl"      VALUE="http://update.nprotect.net/ebiz_up/app/npnv45_new/kor/update_enc.conf">')		// °øÅë ³×Æ¼Áð ÀüÃ¼¸ðµâ
    document.write('<PARAM NAME="RunHead"        VALUE="1">')
    document.write('</OBJECT>')
  }
  else
  {
    document.write('<OBJECT ID="nPCom2" WIDTH=0 HEIGHT=0 CLASSID="CLSID:51B1D5ED-67DC-43F0-A3F8-8502F1A5E404"')
    document.write('codebase="http://update.nprotect.net/nprotect2007/iprovest/npstarter2.cab#version=2007,5,18,2">')
    document.write('<PARAM NAME="PolicyUrl"      VALUE="http://update.nprotect.net/ebiz_up/app/npnv45_new/kor/update_enc.conf">')		// °øÅë ³×Æ¼Áð ÀüÃ¼¸ðµâ
    document.write('<PARAM NAME="RunHead"        VALUE="1">')
    document.write('</OBJECT>')
  }
}
else
{
  if (navigator.appName == "Microsoft Internet Explorer")
  {
    document.write('<OBJECT ID="Npz" WIDTH=0 HEIGHT=0 CLASSID="CLSID:DC4207CE-C03E-4449-ACB1-032CA4137053"')
    document.write('codebase="http://update.nprotect.net/nprotect2007/iprovest/npz2.cab#version=2008,9,22,1">')
    document.write('<PARAM NAME="UpdateURL1"      VALUE="http://update.nprotect.net/ebiz_up/app/npnv45/update_enc.conf">') // °øÅë ³×Æ¼Áð ¾îÇÃ¸®ÄÉÀÌ¼Ç¸ðµâ
    document.write('<PARAM NAME="UpdateURL2"      VALUE="http://update.nprotect.net/ebiz_up/drv/npfw/update_enc.conf">') // ¹æÈ­º®µå¶óÀÌ¹ö ¸ðµâ
    document.write('<PARAM NAME="UpdateURL3"      VALUE="http://update.nprotect.net/nprotect2006/iprovest/skin/update_enc.conf">') // ½ºÅ² ¸ðµâ
    document.write('<PARAM NAME="UpdateURL4"      VALUE="http://update.nprotect.net/ebiz_up/ptn/update_enc.conf">') // ¹ÙÀÌ·¯½º ¿£Áø ÄÁÆ®·Ñ·¯
    document.write('<PARAM NAME="UpdateURL5"      VALUE="http://update.nprotect.net/ebiz_up/ptn/av/update_enc.conf">') // INCA AV ¿£Áø&ÆÐÅÏ
    document.write('<PARAM NAME="AdvertURL"       VALUE="pay_1">')
    document.write('<PARAM NAME="ChannelURL"      VALUE="1">')
    document.write('<PARAM NAME="boRun"           VALUE="1073938517">')  
    document.write('<PARAM NAME="boRun2"          VALUE="142737410">') //¹æÈ­º® °­Á¦offÃß°¡
    document.write('<PARAM NAME="boRun3"          VALUE="1024">')
    document.write('<PARAM NAME="InformURL"       VALUE="1">')
    document.write('<PARAM NAME="PaymentURL"      VALUE="http://kr.yahoo.com">')
    document.write('<PARAM NAME="OnlineScanURL"   VALUE="http://update.nprotect.net/npscan2006/kor/nps.htm">')
    document.write('<PARAM NAME="npID"            VALUE="npnv4">')
    document.write('<PARAM NAME="Skin"            VALUE="npn_web_kyobo">')//½ºÅ²¸í º¯°æ½Ã ÇØ´ç ½ºÅ²¸íÀ¸·Î º¯°æÇØ ÁÖ¼Å¾ß ÇÕ´Ï´Ù.
    document.write('<PARAM NAME="RunHead"        VALUE="1">')
    document.write('</OBJECT>')
  } 
} 
/**************************************************************************************
 ************* nProtect Netizen (À×Ä«ÀÎÅÍ³Ý PC ¹æÈ­º®) ********************************
 **************************************************************************************/

//*********************************************************
//³¯Â¥ °Ë»öÃ¢ ¿ÀÇÂÃ¢
//*********************************************************
var objDateForm;
function show_framecal(dateFormType , calURL , calnum) {
    CalendarClose();
    objDateForm = dateFormType;
    document.all.calframe.src=calURL;
    eval("var objCalPosition = document.all.calendarimg"+calnum+";");
    objCalPosition.innerHTML = document.all.calendarimg.innerHTML;
    objCalPosition.style.visibility = "visible";
}    

//*********************************************************
//¿ÀÇÂÃ¢ ¿­±â
//*********************************************************
function window_open(strUrl, width, height) {
	window.open(strUrl, "openw", "scrollbars=no,directories=no,location=no,menubar=no,status=no,toolbar=no,resizable=no,width="+width+",height="+height+", left=" + (window.screen.availWidth/2 - width/2) + ",top=" + (window.screen.availHeight/2 - height/2)); 
}

function window_open2(strUrl, width, height) {
	window.open(strUrl, "openw", "scrollbars=yes,directories=no,location=no,menubar=no,status=no,toolbar=no,resizable=yes,width="+width+",height="+height+", left=" + (window.screen.availWidth/2 - width/2) + ",top=" + (window.screen.availHeight/2 - height/2)); 
}

function window_open3(strUrl, width, height) {
	window.open(strUrl, "openw2", "scrollbars=no,directories=no,location=no,menubar=no,status=no,toolbar=no,resizable=no,width="+width+",height="+height+", left=" + (window.screen.availWidth/2 - width/2) + ",top=" + (window.screen.availHeight/2 - height/2)); 
}

function window_open4(strUrl, width, height) {
	window.open(strUrl, "openw2", "scrollbars=no,directories=no,location=no,menubar=no,status=no,toolbar=no,resizable=no,width="+width+",height="+height+", left=" + ((window.screen.availWidth/2 - width/2)+20) + ",top=" + ((window.screen.availHeight/2 - height/2)+20)); 
}

//***********************************************************
//¸Þ´º°Ë»ö
//***********************************************************
function memuSearch(){
		var	url="/weblogic/CMMUSearchServlet?scr_id=259";
	    window_open(url,'640','410');
}	
//*********************************************************
//³¯Â¥ °Ë»öÆû¿¡ ³¯Â¥ ÀÔ·Â
//*********************************************************
function onCalendarChange(y,m,d){
	objDateForm.value=y + "/" + m + "/" +  d;
	//CalendarClose();
}


//*********************************************************
//ÄíÅ°°ª ÀÔ·Â, Ãâ·Â
//*********************************************************
function setCookie( name, value, expiredays ) 
{ 
		var todayDate = new Date(); 
		todayDate.setDate( todayDate.getDate() + expiredays ); 
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"; 
} 


function getCookie(name) {
	var Found = false; 
	var start, end; 
	var i = 0; 
	
	while(i <= document.cookie.length) { 
		start = i; 
		end = start + name.length; 
		if(document.cookie.substring(start, end) == name) { 
			Found = true; 
			break;
		} 
		i++; 
	} 
	
	if(Found == true) { 
		start = end + 1; 
		end = document.cookie.indexOf(";", start); 
		if(end < start) 
			end = document.cookie.length; 
		return document.cookie.substring(start, end); 
	} 
	return "";
} 


//********************************************************
//ÀÌ¸ÞÀÏ Ã¼Å·
//********************************************************

function email_chk(str) {
	if (str <= 6 || str.indexOf('@', 0) == -1 || str.indexOf ('.', 0) == -1) {
      	alert("¿Ã¹Ù¸¥ ÀÌ¸ÞÀÏÁÖ¼ÒÇü½ÄÀÌ ¾Æ´Õ´Ï´Ù!");
      	return false;
	}
	return true;
}


//********************************************************
//³¯Â¥ Close
//********************************************************
function CalendarClose() {
   
     var divnum = 6;
     for(var i=0; i<divnum; i++){
        eval("var objCalPosition = document.all.calendarimg"+i+";");
        if ( objCalPosition ) {
             objCalPosition.style.visibility = "hidden"; 
        }
     }
}
// str : ¹®ÀÚ¿­ chan : Á¦°ÅÇÒ ¹®ÀÚ
function changeReplace(str , chan) {
   for (; str.indexOf(chan) != -1 ;)
   { 
     str = str.replace(chan,"");
   }
    
    return str;
 }


//*********************************************************
// ÇÁ¸°Æ®Ã¢ ¿ÀÇÂ
//*********************************************************
function popup_print() {
	var pos = "left="+(window.screen.availWidth-635)/2 + ",top="+(window.screen.availHeight-600)/2;
	window.open('/common/print/popup_print.html','printview','toolbar=no,location=No,scrollbars=yes,width=633 height=360, resizable=no,'+pos);
}
function popup_print2() {
	var pos = "left="+(window.screen.availWidth-635)/2 + ",top="+(window.screen.availHeight-600)/2;
	window.open('/common/print/popup_print2.html','printview','toolbar=no,location=No,scrollbars=yes,width=633 height=360, resizable=no,'+pos);
}
function popup_print3() {
	document.all.popup_print3.src="/common/print/popup_print3.html";
}
var KeyCode;
function openStSearch(codeKey){
    keyCode = codeKey;
    window_open('/common/code/codehelp.html','220','373');
}
function onCodeChange(codeKey) {
    objCodeForm = eval("document.all."+KeyCode);
    objCodeForm.value=codeKey;
}
function onCodeName(codeName) {
    KeyCodeName = KeyCode+"Name";
    objCodeForm = eval("document.all."+KeyCodeName);
    if (objCodeForm != null )  {   
        objCodeForm.innerHTML = codeName;
    }
}        

/**
function openStSearch1(){
    window.open('/webkor/market/st/st_cd_ck_1.jsp','code_srch','width=250,height=320,left=300 , top=300 , scrollbars=no noresize toolbars=no');
}
*/

//*********************************************************
// À©µµ¿ì »çÀÌÁî ÃÖ´ëÈ­
//*********************************************************
function maximise_win() {
	top.window.moveTo(0,0);
	if (document.all) {
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
}

//*********************************************************
// À©µµ¿ì »çÀÌÁî ÀçÁ¶Á¤
//*********************************************************
function resize_win(w_width,w_height) {
	LeftPosition = (screen.width)? (screen.width-w_width)/2 : 0;
	TopPosition = (screen.height)? (screen.height-w_height)/2 : 0;
	top.window.moveTo(LeftPosition,TopPosition);
	if (document.all) {
		top.window.resizeTo(w_width,w_height);
	}
}

//*********************************************************
// À©µµ¿ì »çÀÌÁî Á¶Á¤
//*********************************************************
function resize_win1(w_width,w_height) {
	LeftPosition = (screen.width)? (screen.width-w_width)/2 : 0;
	TopPosition = (screen.height)? (screen.height-w_height)/2 : 0;
	//top.window.moveTo(LeftPosition,TopPosition);
	if (document.all) {
		top.window.resizeTo(w_width,w_height);
	}
}


//*********************************************************
// À©µµ¿ì »çÀÌÁî ÀçÁ¶Á¤ ÈÄ À©µµ¿ìÃ¢À» ½ºÅ©¸° °¡¿îµ¥·Î
//*********************************************************
function resize_location(w_width,w_height) {
	window.resizeTo(w_width, w_height);
	var w = window.screen.availWidth/2-document.body.offsetWidth/2;
	var y = window.screen.availHeight/2-document.body.offsetHeight/2;
	window.moveTo(w, y);	
}

//*********************************************************
// ¹®ÀÚ¿­¾ÕµÚÀÇ °ø¹éÁ¦°Å
//*********************************************************
function trim (strSource) {
	re = /^\s+|\s+$/g;

	return strSource.replace(re, '');
}
//*********************************************************
// ¹®ÀÚ¿­¾ÕÀÇ °ø¹éÁ¦°Å
//*********************************************************
function ltrim (strSource) {
	re = /^\s+/g;

	return strSource.replace(re, '');
}

//*********************************************************
// ¹®ÀÚ¿­µÚÀÇ °ø¹éÁ¦°Å
//*********************************************************
function rtrim (strSource) {
	re = /\s+$/g;

	return strSource.replace(re, '');
}

//*********************************************************
// Å°º¸µåÀÇ Å°°¡ ¼ýÀÚÀÏ°æ¿ì¿¡¸¸ ÀÔ·ÂÀ» ¹Þµµ·Ï
// text box¿¡ Ãß°¡ : onkeypress="return check_key_number(event.keyCode)"
//*********************************************************
function check_key_number(ch) {
	if(ch>47 && ch<58)	return true;
	else	return false;
}

//*********************************************************
// Å°º¸µåÀÇ Å°°¡ ¼ýÀÚ¿Í '-'ÀÏ°æ¿ì¿¡¸¸ ÀÔ·ÂÀ» ¹Þµµ·Ï
// text box¿¡ Ãß°¡ : onkeypress="return check_key_number(event.keyCode)"
//*********************************************************
function check_key_number2(ch) {
	if(ch==189 || (ch>47 && ch<58))	return true;
	else	return false;
}

//*********************************************************
// ³Ñ¾î¿Â ¹®ÀÚ¿­ÀÌ ¼ýÀÚÀÎÁö È®ÀÎ
//*********************************************************
function check_str_number(str) {
	for (i = 0 ; i < str.length ; i++) {
		ch = str.charAt(i);
		if ((ch < '0' || ch > '9')) {
			return false;
		}
	}
	return true;
}

//*********************************************************
// ³Ñ¾î¿Â ¹®ÀÚ¿­ÀÌ ¼ýÀÚÀÌ°Å³ª ¿µ¹®ÀÚÀÎÁö È®ÀÎ
//*********************************************************		
function check_nonspecial(str) {
	for (i = 0 ; i < str.length ; i++) {
		ch = str.charAt(i);
		if ((ch < '0' || ch > '9')&&(ch < 'a' || ch > 'z')&&(ch < 'A' || ch > 'Z')) {
			return false;
		}
	}
	return true;
}


function comma() {                                                                                                      
                                                                                                                        
   var num = test.va1.value;                                                                                            
                                                                                                                        
         if (test.va1.value.length >= 4) {                                                                              
                                                                                                                        
                        re = /^\$|,/g;                                                                                  
                                                                                                                        
                        // "$" and "," ÀÔ·Â Á¦°Å                                                                        
                                                                                                                        
                        num = num.replace(re, "");                                                                      
                                                                                                                        
                                                                                                                        
                fl=""                                                                                                   
                if(isNaN(num)) { alert("¹®ÀÚ´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");return 0}                                          
                if(num==0) return num                                                                                   
                                                                                                                        
                if(num<0){                                                                                              
                                num=num*(-1)                                                                            
                                fl="-"                                                                                  
                }else{                                                                                                  
                                num=num*1 //Ã³À½ ÀÔ·Â°ªÀÌ 0ºÎÅÍ ½ÃÀÛÇÒ¶§ ÀÌ°ÍÀ» Á¦°ÅÇÑ´Ù.                               
                }                                                                                                       
                num = new String(num)                                                                                   
                temp=""                                                                                                 
                co=3                                                                                                    
                num_len=num.length                                                                                      
                while (num_len>0){                                                                                      
                                num_len=num_len-co                                                                      
                                if(num_len<0){co=num_len+co;num_len=0}                                                  
                                temp=","+num.substr(num_len,co)+temp                                                    
                }                                                                                                       
                                                                                                                        
                document.test.va1.value =  fl+temp.substr(1);                                                           
         }                                                                                                              
                                                                                                                        
}


function num_check() {                                                                                                          
        // ie¿¡¼­¸¸ ÀÛµ¿                                                                                                        
        var keyCode = event.keyCode                                                                                             
        if ( keyCode < 48 || keyCode > 57 ){                                                                                      
                alert("¹®ÀÚ´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."+"["+keyCode+"]")                                                             
                event.returnValue=false                                                                                         
        }                                                                                                                       
}  

//*********************************************************
// ÇöÀç°¡ ¿ÀÇÂÃ¢(ÆÄ¶ó¸ÞÅ¸ : Á¾¸ñÄÚµå)
//*********************************************************		

function openReal(code) 
{
	var url = "/wts/sise/stock/TR02010_10dan.html?"+code;
	window_open(url,'332','470');
}

//Â÷Æ® ¿ÀÇÂÃ¢

var chartWin;
function setChartCode(code) {
	try{
		if(chartWin==null){
		    chartWin = window.open("/wts/object/Chart_Popup.html?"+code,"kbcchart","width=670,height=510,scrollbars=no,toolbar=no,resizable=yes");
		} else {
	        chartWin.setCode(code);
		}
	}catch(e){
        chartWin = window.open("/wts/object/Chart_Popup.html?"+code,"kbcchart","width=670,height=510,scrollbars=no,toolbar=no,resizable=yes");
	}
	if(chartWin!=null){
		chartWin.focus();
	}
}

//ÁÖ¹®¿ÀÇÂ

function openOrder(code)
{
	
	var url = "/weblogic/TradeMenuServlet?pageId=OR_stock_m&code="+ code +"&scr_id=99999";
	XecureNavigate(url,'OR_stock_m','scrollbars=no,width=640,height=400,left=160,top=0');
}
/** ´Þ·ÂÃ¼Å© **/
function calender(num) {
	
	var keyCode = event.keyCode             
    if ( keyCode != 8 ) { 
	    if (num.length == 4 || num.length == 7 ) {
	    	   num = num+"/";
	    }
	}        
	return num;
}
function num_check2() {                                                                                                          
    var keyCode = event.keyCode       
    if ( keyCode < 48 || keyCode > 57 ){                                                                                      
        event.returnValue=false;                                                                                         
    }    
                                                                                                                                 
}  

function addrStrChange(str) {
	if( str.indexOf(unescape("%uC0FE")) >= 0) {
		tmpArr = str.split(unescape("%uC0FE"));
		tmpStr = tmpArr[0];
		for(i=1; i<tmpArr.length; i++) {
			tmpStr = tmpStr + "¼¥" + tmpArr[i];
		}
	} else {
		tmpStr = str;
	}
	return tmpStr;
}

