	var ApplexServer    = true;	
	var OperationCode   = 0;
	var Ax_Version      = '3,0,0,0';										//업데이트 버전
	var ApplexHost      = 'www.ddm.go.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.txt';   //환경파일 주소 
	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
		if( navigator.appName.indexOf('Netscape') != -1 ) 
		{
			//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;
		}
		else
		{
			// 알수 없음
			OperationCode = 4;
		}
	}


	/**********************************************
	 * 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);
					this.location = "http://www.ddm.go.kr/applex_wdigm/help/popup_install.htm";
					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);
					this.location = "http://www.ddm.go.kr/applex_wdigm/help/popup_install.htm";
					return false;
				}
				break;
			}
			case 4 : // Opera Browser System OR None Browser
			{
				return true;

				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.ddm.go.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);
				this.location = "http://www.ddm.go.kr/applex_wdigm/help/popup_install.htm";
				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;
		}																				
	}	
