
// CKKeyPro¸¦ ·ÎµåÇÏ±â À§ÇÑ Element ¼±¾ð
var KeyPro_Container_Object = document.createElement("<div id='KeyPro_Contaner_Div'><div>");


var CKKeyPro_CLSID="clsid:6CE20149-ABE3-462E-A1B4-5B549971AA38";	

var CKKeyPro_CODEBASE_x64= "http://www.joycity.com/module/CKKeyPro3004_64.cab";
var CKKeyPro_CODEBASE_x86= "http://www.joycity.com/module/CKKeyPro30011_32k.cab";

var CKKeyPro_VERSION="version=3,0,0,4";

var USING_CKKeyPro = "1";

var USING_CUSTOM_IMAGE = 0;

var CUSTOM_IMAGE_URL = "";
var bCreated = false;	
	
function CreateCKKeyProObject()
{
	if(bCreated == true)
		return;
		
	if (USING_CKKeyPro == "1")// && navigator.appName.indexOf("Microsoft")!=-1 && navigator.platform == "Win32" && navigator.appVersion.indexOf("4.")!=-1) 
	{
			{
				var Str="";
	
				Str+= '<object classid="' + CKKeyPro_CLSID + '"';
				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;">';
				Str+= '\n\t <PARAM name="PKI" value="Simple">';
				Str+= '\n\t <PARAM name="DefaultEnc" value="Off">';
				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+= '\n</object>';
				
				//alert(Str);
				//document.write(Str);
				if(KeyPro_Container_Object != null)
					KeyPro_Container_Object.innerHTML = Str;

			}
	}
	bCreated = true;
} 

// Å°º¸µåº¸¾È CKKeyPro Object ·Îµå
function ClearCKKeyProObject()
{	
	if(bCreated == false)
		return;

	KeyPro_Container_Object.innerHTML = "";
	bCreated = false;
}


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)
{
		//È®Àå E2E PKI=XecureWebEx ÀÏ¶§ ¾Æ·¡ ÁÙ ÀÌ¿ë
		//return xgate_addr;
}
