try
{
	ApplexServer = false;
}
catch(e)
{
	alert('¾÷µ¥ÀÌÆ® ¼­¹ö¿¡ Á¢±Ù¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.\n¾÷µ¥ÀÌÆ®¸¦ Ãë¼Ò ÇÕ´Ï´Ù.\n'+e.message);
	var OperationCode   = 0;
	var Ax_Version      = '2,2,0,8';										 //¾÷µ¥ÀÌÆ® ¹öÀü
	var ApplexHost      = 'www.ndsl.kr';								 //¾÷µ¥ÀÌÆ® ¼­¹öÁÖ¼Ò

	var Ax_Location     = 'http://'+ApplexHost+'/applex_wdigm/activex/';	 //¼³Ä¡ÆÄÀÏ ÁÖ¼Ò : ¿¢Æ¼ºê¿¢½º
	var App_Location    = 'http://'+ApplexHost+'/applex_wdigm/applet/';		 //¼³Ä¡ÆÄÀÏ ÁÖ¼Ò : ¿¡ÇÃ¸´
	var Applex_Conf     = 'http://'+ApplexHost+'/applex_wdigm/active.jsp';  //È¯°æÆÄÀÏ ÁÖ¼Ò
	var Applex_Share    = 'http://'+ApplexHost+'/applex_wdigm/share/';

	/**********************************************
	 * Event   : Page Loaded
	 * Context : Browser Version Check
	 **********************************************/
	if(navigator.appVersion.indexOf('MSIE') != -1)
	{
		if(navigator.appVersion.indexOf('Windows NT 6') != -1)
		{	//Windows Vista/7
			document.write('<OBJECT	classid="clsid:AA032EDB-99A5-4F30-81DF-508B6D7F4B24"');
			document.write('codebase="' + Ax_Location + '/PrivacyScannerVista.cab#version='+Ax_Version+'"');
			document.write('width="0" height="0"');
			document.write('id="ActiveXPrivacyScannerVista"></OBJECT>');
			OperationCode = 2;
		}
		else
		{	//Windows 98/ME/2K/NT/XP
			document.write('<OBJECT	classid="clsid:77646142-F7D6-472E-A2FB-E3E02BCED107"');
			document.write('codebase="' + Ax_Location + '/PrivacyScannerXP.cab#version='+Ax_Version+'"');
			document.write('width="0" height="0"');
			document.write('id="ActiveXPrivacyScannerXP"></OBJECT>');
			OperationCode = 1;
		}
	}
	else
	{	//Other Operation System
		//Linux, Unix, FireFox, Mozila
		document.write("<DIV ID='wdigm_applet_tags' STYLE='position:absolute;left:0px;top:0px;'></DIV>");
		document.write("<SCRIPT SRC='"+Applex_Share+"install_jre.js'></SCRIPT>");
		OperationCode = 3;
	}



	/**********************************************
	 * Event   : Function
	 * Context : Privacy Scanning
	 **********************************************/
	function beScan_local(pConfig, pContent, pFilelist)
	{
		var objActiveX = null;
		var TmpConf    = '';
		if (pConfig == ''){	TmpConf  = Applex_Conf;	}

		switch(OperationCode)
		{
			case 1 : // Is micro$oft xp operation system
			{
				try
				{
					objActiveX = document.ActiveXPrivacyScannerXP;
				}
				catch (e)
				{
					alert('[1] ÇÁ¶óÀÌ¹ö½Ã ½ºÄ³³Ê°¡ ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù.\n' + e.message);
					location.href = this.location;
					return false;
				}
				break;
			}
			case 2 : // Is micro$oft vista operation system
			{
				try
				{
					objActiveX = document.ActiveXPrivacyScannerVista;
					objActiveX = objActiveX.Elevation();
				}
				catch (e)
				{
					alert('[2] ÇÁ¶óÀÌ¹ö½Ã ½ºÄ³³Ê°¡ ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù.\n' + e.message);
					location.href = this.location;
					return false;
				}
				break;
			}
			default : //Is not micro$oft operation system
			{
				var wdigm_applet = '';
				pContent  = pContent.replace(/[\s\t><]/g, "$");
				pFilelist = pFilelist.replaceAll("\r\n", "&nbsp;");
				pFilelist = pFilelist.replaceAll(" ", "^");

				wdigm_applet = wdigm_applet + "<APPLET CODEBASE='.'                                                     ";
				wdigm_applet = wdigm_applet + "	CODE   = 'kr.co.wdigm.ui.Applet1.class'                                 ";
				wdigm_applet = wdigm_applet + "	ARCHIVE= "+App_Location+"PrivacyScannerApplet.jar						";
				wdigm_applet = wdigm_applet + "	ID     = 'PrivacyScannerApplet'                                         ";
				wdigm_applet = wdigm_applet + "	WIDTH  = '0' HEIGHT = '0' ALIGN = 'middle' VSPACE = '0' HSPACE = '0'>   ";
				wdigm_applet = wdigm_applet + "	<PARAM NAME=iniUrl       VALUE="+TmpConf+">								";
				wdigm_applet = wdigm_applet + "	<PARAM NAME=snUrl        VALUE=http://www.wdigm.co.kr/applex_wdigm/share/> ";
				wdigm_applet = wdigm_applet + "	<PARAM NAME=content      VALUE="+pContent+">        ";
				wdigm_applet = wdigm_applet + "	<PARAM NAME=file1        VALUE="+pFilelist+">       ";
				wdigm_applet = wdigm_applet + "	<PARAM NAME=page         VALUE="+this.location+">   ";
				wdigm_applet = wdigm_applet + "</APPLET>                                            ";

				document.getElementById("wdigm_applet_tags").innerHTML = wdigm_applet;
				break;
			}
		}


		if (objActiveX == null)
		{

			try
			{
				document.getElementById("PrivacyScannerApplet").width  = 400;
				document.getElementById("PrivacyScannerApplet").height = 300;

				var applet_top = (document.body.clientHeight / 2) - 150;
				var applet_lef = (document.body.clientWidth  / 2) - 200;

				document.getElementById("wdigm_applet_tags").style.left = applet_lef + 'px';
				document.getElementById("wdigm_applet_tags").style.top  = applet_top + 'px';

				var Applet_Result = document.getElementById("PrivacyScannerApplet").getFindCount();

				if (!Applet_Result)
				{
					alert('°³ÀÎÁ¤º¸°¡ °ËÃâµÇ¾ú½À´Ï´Ù.\n ÇØ´ç Á¤º¸¸¦ »èÁ¦ ÈÄ µî·Ï ÇÏ¿©ÁÖ½Ê½Ã¿À.');
					document.getElementById("PrivacyScannerApplet").width  = 0;
					document.getElementById("PrivacyScannerApplet").height = 0;
				}
			}
			catch(e)
			{
				alert( 'JRE °¡ ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù. ÇØ´ç ÇÃ·¯±×ÀÎÀ» ¼³Ä¡ÇÏ°í ´Ù½Ã ½ÃÀÛÇÏ¿© ÁÖ½Ê½Ã¿À.' + e.message );
				this.location = "http://java.sun.com/javase/downloads/index.jsp";
				return false;
			}
			return Applet_Result;
		}
		else
		{
			try
			{
				var AxResult = objActiveX.beScanner(TmpConf, '', '', this.location, pContent, pFilelist);
			}
			catch (e)
			{
				alert('[3] ÇÁ¶óÀÌ¹ö½Ã ½ºÄ³³Ê°¡ ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù.\n' + e.message);
				location.href = this.location;
				return false;
			}
			return CheckResult(AxResult);
		}


	}

	/**********************************************
	 * Event   : Function
	 * Context : ActiveX Result Set
	 **********************************************/
	function CheckResult(Ax_Method_Result)
	{
		switch(Ax_Method_Result)
		{
			case 1:
			{
				alert('°³ÀÎÁ¤º¸°¡ °ËÃâµÇ¾ú½À´Ï´Ù.\n ÇØ´ç Á¤º¸¸¦ »èÁ¦ ÈÄ µî·Ï ÇÏ¿©ÁÖ½Ê½Ã¿À.');
				return false;
			}
			case 2:
			{
				if (confirm('°³ÀÎÁ¤º¸°¡ °ËÃâµÇ¾ú½À´Ï´Ù.\n Á¤¸» µî·Ï ÇÏ½Ã°Ú½À´Ï±î?') == true)
				{
					alert('*°æ°í*\n°³ÀÎÁ¤º¸°¡ µî·ÏµÈ °Ô½Ã¹°\n»ç¿ëÀÚ¿¡ ÀÇÇÏ¿© µî·ÏµÇ¾ú½À´Ï´Ù');
					return true;
				}
				else
				{
					alert('°³ÀÎÁ¤º¸°¡ µî·ÏµÈ °Ô½Ã¹°\n»ç¿ëÀÚ¿¡ ÀÇÇÏ¿© Ãë¼ÒµÇ¾ú½À´Ï´Ù');
					return false;
				}
			}
			default :
			{
				return true;
			}
		}
	}

	/**********************************************
	 * Event   : Function
	 * Context : Applet String Paser
	 **********************************************/
	String.prototype.replaceAll = function(searchStr, replaceStr) {
		var temp = this;
		while( temp.indexOf(searchStr) != -1 ) {
			temp = temp.replace(searchStr, replaceStr);
		}
		return temp;
	}

	/*--
	 !----------------------------------------------------------------------------------------!
	 ! Descript : if clients browser firefox then call to netscape security privileage manager!
	 !----------------------------------------------------------------------------------------!
	--*/
	if (navigator.userAgent.indexOf("Firefox")!=-1 )
	{
		try
		{
		  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		}
		catch (e)
		{
			alert('·ÎÄÃ ÆÄÀÏ º¸¾È ¼³Á¤À¸·Î ÀÎÇØ ºê¶ó¿ìÀú¿¡ Á¢±ÙÇÒ ¼ö ¾ø½À´Ï´Ù. \n´ÙÀ½ÀÇ ¼ø¼­´ë·Î º¸¾È±ÇÇÑÀ» Çã°¡ÇØ ÁÖ¼¼¿ä : \n\n(1) ºê¶ó¿ìÀúÀÇ URL ÀÔ·Â¶õ¿¡  "about:config"¸¦ ÀÔ·ÂÇÕ´Ï´Ù. \n(2) "°í±Þ ±â´É »ç¿ë µ¿ÀÇ" ¹öÆ°À» Å¬¸¯ÇÕ´Ï´Ù. \n(3) "signed.applets.codebase_principal_support" ¶óÀÎÀ» ´õºí Å¬¸¯ÇÏ¿© °ªÀ» true·Î º¯°æÇÕ´Ï´Ù. \n\nº¸¾È¼³Á¤ º¯°æ ÈÄ ´Ù½Ã ½ÇÇàÇØ ÁÖ¼¼¿ä');
			window.open(Applex_Share + "popup/applet/firefox_setup.htm", '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=650,height=333');
			history.go(-1);
		}
	}
	/*--
	!----------------------------------------------------------------------------------------!
	! File Control Event Call Back Function                                                  !
	! Description    : FireFox Browser enable PrivilegeManager                               !
	! Example JavaScript Function                                                            !
	!----------------------------------------------------------------------------------------!
	--*/
	var g_filelist   = '';
	var g_privileage = true;
	function attach_wdigm(FileControl)
	{
		if (navigator.userAgent.indexOf("Firefox")!=-1 )
		{
			try
			{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

				g_privileage = true;
				g_filelist   = g_filelist + '|' + FileControl.value;
			}
			catch (e)
			{
				g_privileage = false;
				alert('·ÎÄÃ ÆÄÀÏ º¸¾È ¼³Á¤À¸·Î ÀÎÇØ ºê¶ó¿ìÀú¿¡ Á¢±ÙÇÒ ¼ö ¾ø½À´Ï´Ù. \n´ÙÀ½ÀÇ ¼ø¼­´ë·Î º¸¾È±ÇÇÑÀ» Çã°¡ÇØ ÁÖ¼¼¿ä : \n\n(1) ºê¶ó¿ìÀúÀÇ URL ÀÔ·Â¶õ¿¡  "about:config"¸¦ ÀÔ·ÂÇÕ´Ï´Ù. \n(2) "°í±Þ ±â´É »ç¿ë µ¿ÀÇ" ¹öÆ°À» Å¬¸¯ÇÕ´Ï´Ù. \n(3) "signed.applets.codebase_principal_support" ¶óÀÎÀ» ´õºí Å¬¸¯ÇÏ¿© °ªÀ» true·Î º¯°æÇÕ´Ï´Ù. \n\nº¸¾È¼³Á¤ º¯°æ ÈÄ ´Ù½Ã ½ÇÇàÇØ ÁÖ¼¼¿ä');
				window.open(Applex_Share + "popup/applet/firefox_setup.htm", '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=650,height=333');
				history.go(-1);
			}
		}
		else
		{
			g_filelist   = g_filelist + '|' + FileControl.value;
			g_privileage = true;
		}
	}
}
