 var chkCKKeyPro_VERSION = '3.1.0.4';

function printCKKeyObject(){
	var CKKeyPro_CLSID="clsid:6CE20149-ABE3-462E-A1B4-5B549971AA38";	

		
	var CKKeyPro_CODEBASE_x64= "http://ck.softforum.co.kr/CKKeyPro/ibk/TouchEnkey3104_64k.cab";
	var CKKeyPro_CODEBASE_x86= "http://ck.softforum.co.kr/CKKeyPro/ibk/TouchEnkey3104_32k.cab";

	//var CKKeyPro_CODEBASE_x64= "/ibs/js/CKKeyPro/TouchEnkey3104_64k.cab";
	//var CKKeyPro_CODEBASE_x86= "/ibs/js/CKKeyPro/TouchEnkey3104_32k.cab";
	
		
	var CKKeyPro_VERSION="version=3,1,0,4";
		


	var USING_CKKeyPro = "1";

	var USING_CUSTOM_IMAGE = 0;

	//var CUSTOM_IMAGE_URL = "http://www.mybank.co.kr/ibkimg/CKKeyPro_ibk.bmp";
//	var CUSTOM_IMAGE_URL = "http://" + window.location.host + "/ibs/js/CKKeyPro/CKKeyPro_ibk.bmp";
	var CUSTOM_IMAGE_URL = "http://ck.softforum.co.kr/CKKeyPro/ibk/CKKeyPro_ibk2.bmp|69FBF1DD07A0B80BB90AF2564EFF08AF8CFCCA66|8D5561D07B21B8FCF74FABA46DCDADE3F2DB9E973814D209D534B85344DC46DD9DE141FFB102E68FDCA810B24F8B77E6290B9BCBC53D6B0FFAFE625C1B1D670322A4D3439ED4EADFA0DA0F9B96EE103ABEE230333DBCF7EF758AE137F5BDA500BAB95760ECC2F3496B47AD82EF7DA66B5CFC2F6C07B9BDEBDA1D1BFB494608D6";
	//alert(CUSTOM_IMAGE_URL);

	if (USING_CKKeyPro == "1")
	{
			var Str="";
			
			Str+= '<object classid="' + CKKeyPro_CLSID + '"';
				// for IE8
				if( (navigator.appName == "Microsoft Internet Explorer") && (navigator.userAgent.toLowerCase().indexOf("trident/4.0") != -1) )
				{
					//var CKKeyPro_VERSION="version=3,0,1,8";
					if(navigator.cpuClass.toLowerCase() == "x64")
					{
						Str+= '\n\t codebase="' + CKKeyPro_CODEBASE_x64 + '#' + CKKeyPro_VERSION + '"';
					}
					else
					{
						Str+= '\n\t codebase="' + CKKeyPro_CODEBASE_x86 + '#' + CKKeyPro_VERSION + '"';
					}
				}
				else
				{
			if(navigator.cpuClass.toLowerCase() == "x64")
			{
					Str+= '\n\t codebase="' + CKKeyPro_CODEBASE_x64 + '#' + CKKeyPro_VERSION + '"';
			}
			else
			{
					Str+= '\n\t codebase="' + CKKeyPro_CODEBASE_x86 + '#' + CKKeyPro_VERSION + '"';
			}
				}
			Str+= '\n\tvspace="0" hspace="0" width="0" id="CKKeyPro" style="display:none;" onError="XlsError(2);">';
			Str+= '\n\t <PARAM name="PKI" value="XecureWebEx">';
			Str+= '\n\t <PARAM name="DefaultEnc" value="On">';
			Str+= '\n\t <PARAM name="ClearBufferOnEmpty" value="true">';
			Str+= '\n\t <PARAM name="AllowDuplicates" value="true">';
			if(USING_CUSTOM_IMAGE)
				Str+= '\n\t <PARAM name="ImageURL" value="' + CUSTOM_IMAGE_URL + '">';

			//Str+= '\n\tNo CKKeyPro Plugin';
			Str+= '</object>';
				
			document.write(Str);

			//printCKKeyAppObject();
			
			
	} 
}

function printCKKeyAppObject(){
	var CKApp_CLSID="CLSID:8FD68F8A-641E-4204-AE47-DD835C1AE756";	
	var CKApp_CODEBASE="http://ck.softforum.co.kr/CKKeyPro/ibk/CKAppPro.cab";	
	//var CKApp_CODEBASE="/ibs/js/CKKeyPro/CKAppPro.cab";	

	var CKApp_VERSION="version=1,0,0,22";

	var USING_CKApp = "1";

	if (USING_CKApp == "1" && navigator.appName.indexOf("Microsoft")!=-1 && navigator.platform == "Win32" && navigator.appVersion.indexOf("4.")!=-1) 
	{

			{
				var Str="";

				Str+= '<object classid="' + CKApp_CLSID + '"';
				Str+= '\n\t codebase="' + CKApp_CODEBASE + '#' + CKApp_VERSION + '"';
				Str+= '\n\tvspace="0" hspace="0" width="0" id="secukey" style="display:none;" onError="XlsError(2);">';
				Str+='\n\t	<PARAM name="XGrid" value="true">';
				Str+='\n\t	<PARAM name="TrayIcon" value="show">';
				Str+= '\n\tNo CKAppPro Plugin';
				Str+= '\n</object>';
				
				document.write(Str);
	//			alert(Str);
			}
	} 
	else if (navigator.appName.indexOf("Netscape")!=-1) {
			USING_CKApp = "0";
			alert("ÇöÀç °í°´´Ô²²¼­´Â ¼³Ä¡ ºÒ°¡´ÉÇÑ ½Ã½ºÅÛÀ» »ç¿ëÇÏ°í °è½Ê´Ï´Ù.\n\nXecureCK for X-InternetÀ» »ç¿ëÇÏ½Ã·Á¸é Windows 95ÀÌ»ó \n\nInternet Explorer 5.5ÀÌ»óÀÌ¾î¾ß ÇÕ´Ï´Ù.");
	}
}

function XecureCK_UIEevents(frm,ele,event,keycode)
{
	var obj;
	var eventObj;

	try{
		obj=document.forms[frm].elements[ele];
		if( document.createEventObject )
		{
			eventObj = document.createEventObject();
			eventObj.keyCode=keycode;
			if(obj)
			{
				obj.fireEvent(event,eventObj);
			}
		}
	}
	catch(e) {}
}

/*
	Rescan the current HTML Document & protects newly added elements.
	Call this function if you are adding Input Elements through JavaScript.
*/

function CKKeyPro_ReScan()
{
	if(document.CKKeyPro==null || typeof(document.CKKeyPro) == "undefined" || document.CKKeyPro.object==null)
	{
		//CKKeyPro is not running in current document.
		return;
	}
	document.CKKeyPro.ReScanDocument();
}

function HaveControl_CK()
{
	if(document.CKKeyPro==null || typeof(document.CKKeyPro) == "undefined" ||document.CKKeyPro.object==null)
	{
		alert("Å°º¸µå º¸¾È ÇÁ·Î±×·¥ÀÌ ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù.");
		return false;
	}
	else
		return true;
}

function CKKeyPro_Clear(frmName,eleName)
{
 	if(document.CKKeyPro==null || typeof(document.CKKeyPro) == "undefined" || document.CKKeyPro.object==null)
        {
                //XecureCK is not running in current document.
                return;
        }
	document.CKKeyPro.Clear(frmName,eleName,0);
}

function CKKeyPro_GetVariable(name)
{
	if(name == "XW_E2E_MODE")
	{
		var KeyPro_E2E_KeyType = "0";

		try
		{
			if(E2E_keytype == 1)	//E2E_keytype defined in XW.js
				KeyPro_E2E_KeyType = "1";
		}
		catch (e)
		{
		}

		return KeyPro_E2E_KeyType;
	}
	
	//È®Àå E2E PKI=XecureWebEx ÀÏ¶§ ¾Æ·¡ ÁÙ ÀÌ¿ë	
	//for ClientSM V7.2.1.7  20080311
	var xObj; 
	if(document.XecureWeb==null || typeof(document.XecureWeb) == "undefined" ||document.XecureWeb.object==null) 
	{
  	try 
  	{
   		xObj = new ActiveXObject("Xwctl40.XecCtl40");
  	}
  	catch(ex)
  	{
   		//alert("XecureWeb Client not installed");
   		//return;
  	}
	} 
 	else 
	{ 
  	xObj = document.XecureWeb;
 	}  
 
 	if(xObj.GetVerInfo(0) >= '7, 2, 1, 7')
  	enc_xgate = xObj.GetEncUserData(xgate_addr);
 	else
  	enc_xgate = xgate_addr;
  
 	return enc_xgate;
}


//HaveControl_CK();
