	var bWebMode = true;
	var startPage = null;
	var goPage = null;

	var addressParams = null;

	var selectedLayer = null;
	var selectedFlash = null;

	var saveData = "";
	var iFrameCount = 0;

	// Major version of Flash require
	var requiredMajorVersion = 9;
	// Minor version of Flash required
	var requiredMinorVersion = 0;
	// Minor version of Flash required
	var requiredRevision = 124;	
	// Flash Player Version Detection - Rev 1.6
	// Detect Client Browser type
	// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
	var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
	var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;	
	var isFirefox = (navigator.userAgent.indexOf("Firefox") != -1) ? true : false;	
	var isChrome = (navigator.userAgent.indexOf("Chrome") != -1) ? true : false;	
	
	/******************************************/
	/*  Layer 관련 함수 ( show, hide, load )  */
	/******************************************/
	
	document.write("<script src='js/AC_OETags.js'></script>");	
	function loadContents(layer, url, id)
	{
		var newHTML = "";
		var path = url.slice(0, url.indexOf("."));

		// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
		var hasProductInstall = DetectFlashVer(6, 0, 65);
		// Version check based upon the values defined in globals
		var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);	
		
		// DO NOT MODIFY THE FOLLOWING FOUR LINES
		// Location visited after installation is complete if installation is required
		if(hasProductInstall && !hasRequestedVersion) 
		{
			var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
			var MMredirectURL = window.location;
			document.title = document.title.slice(0, 47) + " - Flash Player Installation";
			var MMdoctitle = document.title;
			
			newHTML = getContent(
					"src", "playerProductInstall",
					"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
					"width", "100%",
					"height", "100%",
					"align", "middle",
					"id", id,
					"name", id,
					"quality", "high",
					"bgcolor", "#ffffff",
					"allowScriptAccess","always",
					"allowfullscreen","true",
					"type", "application/x-shockwave-flash",
					"pluginspage", "http://www.adobe.com/go/getflashplayer"
			      );			
		}
		// if we've detected an acceptable version
		// embed the Flash Content SWF when all tests are passed
		else if(hasRequestedVersion)
		{
			newHTML = getContent(
					"src", path,
					"width", "100%",
					"height", "100%",
					"align", "middle",
					"id", id,
					"name", id,
					"quality", "high",
					"wmode", "opaque",
					"allowScriptAccess","always",
					"allowfullscreen","true",
					"type", "application/x-shockwave-flash",
					"pluginspage", "http://www.adobe.com/go/getflashplayer"
			      );	
		}
		// flash is too old or we can't detect the plugin
	 	else 
		{  
		    newHTML = 'Alternate HTML content should be placed here. '
					+ 'This content requires the Adobe Flash Player. '
					+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
		}	

		layer.innerHTML = newHTML;
	}

	function showContents(layer, id, url, flag)
	{
		if(checkStartMode())
		{
			windowClose();
		}
		else
		{
			var element = document.getElementById(layer);
			loadContents(element, url, id);
			element.style.display = "block";

			if(flag)
			{
				loadContentsComplete(layer, id);
			}
		}
	}

	function hideContents()
	{
		if(selectedLayer)
		{
			selectedLayer.style.display = "none";
			selectedLayer.innerHTML = "";
			selectedFlash = null;
		}
	}

	function showMainContents(url)
	{
		showContents("mainLayer", "mainContents", url, true);
	}

	function showSubContents(url)
	{
		showContents("subLayer", "subContents", url, false);
	}

	function showLinkContents(url)
	{
		if(selectedLayer.id == "subLayer")
		{
			showContents("linkLayer", "linkContents", url, false);
			selectedFlash.stopEbook();
		}
		else
		{
			showContents("linkLayer", "linkContents", url, true);
		}
	}

	function hideLinkContents()
	{
		var element = document.getElementById("linkLayer");

		element.style.display = "none";
		element.innerHTML = "";
		purge(element);

		selectedFlash.play();
	}

	function showTooltipContents(cinfo, _x, _y)
	{
		var tooltip = document.getElementById("tooltipLayer");		
		
		if(cinfo.tooltip != "null")
		{
			var msg = cinfo.tooltip.replace("\n","<BR>");		
			tooltip.innerHTML = "<p style='font-size:11px'>"+msg+"</p>";
			tooltip.style.display = "block";
		}
	}

	function hideTooltipContents(msg)
	{
		var tooltip = document.getElementById("tooltipLayer");		

		if(tooltip.style.display == "block")
		{
			tooltip.style.display = "none";
		}
	}

	function showHelp()
	{
	    var wndHelp = window.open("help.swf", "JBookHelp", "scrollbars=no,status=no,toolbar=no,resizable=no,location=no,menu=no, width=950,height=600");
	    wndHelp.focus();
	}

	function loadContentsComplete(layer, id)
	{
		var element = document.getElementById(layer);

		goPage = null;
		startPage = null;

		if(selectedLayer != element)
		{
			if(selectedLayer)
			{
				hideContents();
				purge(selectedLayer);
			}

			selectedLayer = element;
			selectedFlash = getFlash(id);
		}
	}


	/******************************************/
	/*    ebook 관련  함수 ( page, home )     */
	/******************************************/
	
	function goHome(url)
	{
		showContents("mainLayer", "mainContents", url, true);
	}

	function startEbook(url)
	{
		showContents("subLayer", "subContents", url, false);
	}

	function startEbookToPage(page)
	{
		startPage = page;
		setEbookPage(page);
	}

	function goEbookPage(page)
	{
		goPage = page;
		setEbookPage(page);
	}

	function setEbookPage(page) 
	{
		if(!selectedLayer || selectedLayer.id != "subLayer")
		{	
			showContents("subLayer", "subContents", "JBook.swf", false);
		}
		else
		{	
			selectedFlash.goPage(page);
		}
	}
	
	function initEBookComplete(id)
	{
		if(goPage)
		{
			getFlash(id).goPage(goPage);
		}	

		loadContentsComplete("subLayer", id);
	}
	


	/******************************************/
	/*            AC_OETags.js  함수          */
	/******************************************/
	
	document.write("<script src='js/AC_OETags.js'></script>");
	function getContent()
	{
		try
		{
			var ret = AC_GetArgs(arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash");
			return generateObj(ret.objAttrs, ret.params, ret.embedAttrs);
		}
		finally
		{
			ret.embedAttrs = null;
			ret.params = null;
			ret.objAttrs = null;
			ret = null;
		}
	}

	function generateObj(objAttrs, params, embedAttrs) 
	{ 
		var str = '';
	
		if (isIE && isWin && !isOpera)
		{
			str += '<object ';
			for (var i in objAttrs)
				str += i + '="' + objAttrs[i] + '" ';
			str += '>';
			for (var i in params)
				str += '<param name="' + i + '" value="' + params[i] + '" /> ';
			str += '</object>';
		} else {
			str += '<embed ';
			for (var i in embedAttrs)
				str += i + '="' + embedAttrs[i] + '" ';
			str += '> </embed>';
		}
	
		return str;
	}

	function purge(element) 
	{
		if(element)
		{
			var attr = element.attributes;
			var idx, length, attrName;

			if(attr) 
			{
				length = attr.length;

				for(idx = 0; idx < length; idx++) 
				{
					attrName = attr[idx].name;
					
					if(typeof element[attrName] === "function") 
					{
						element[attrName] = null;
					}
				}
			}

			attr = element.childNodes;

			if(attr)
			{
				length = attr.length;

				for(idx = 0; idx < length; idx++)
				{
					purge(element.childNodes[idx]);
				}
			 }
		}
	}



	/******************************************/
	/*             popup, cmd 함수            */
	/******************************************/
	
	function popupWindow(_x,_y,_w,_h,_wname,_addr,_fullscreen,_resizable,_centerAlign){
		var channelMode = "";
		var resizable = "";
		var _addr2=_addr;
		
		if("true"==_fullscreen){
			channelMode = ",channelMode";
		}
		
		if("true"==_resizable){
		   resizable = ",resizable=yes";
		}
		
		if("true"==_centerAlign){
			_x = (screen.availWidth - _w)/2.0;
			_y = (screen.availHeight - _h) / 2.0;
		}
		
		//웹 모드가 아니고 플래시 파일일 경우 뷰어에서 플래시를 띄워준다.
		if(_addr.indexOf('?')>0){
			_addr2 = _addr.substring(0,_addr.lastIndexOf('?'));
		}
		
		if(".swf"==_addr2.substr(_addr.lastIndexOf('.')) && !bWebMode){
			CmdToApp("ext_flash",_x+"#"+_y+"#"+_w+"#"+_h+"#"+_wname+"#"+_addr.replace('?','$')+"#"+_fullscreen+"#"+_resizable);
			return;
		}
		
		if(_wname=="null"){
			window.open(_addr,"_blank","left="+_x+", top="+_y+", width="+_w+", height="+_h+" "+channelMode+resizable);
		}else{
			window.open(_addr,_wname,"left="+_x+", top="+_y+", width="+_w+", height="+_h+" "+channelMode+resizable);
		}		
	}
		
	function popupWindow2(param){
		var _x = param.split(",")[0];
		var _y = param.split(",")[1];
		var _w = param.split(",")[2];
		var _h = param.split(",")[3];
		var _addr = param.split(",")[4];
		window.open(_addr,"_blank","left="+_x+", top="+_y+", width="+_w+", height="+_h);
	}
	
	function popupFromEBook(address,windowName,left,top,width,height,fullscreen,resizable,centerAlign){
		if(fullscreen){
			params  = 'width='+screen.width;
			params += ', height='+screen.height;
			params += ', top=0, left=0'
			params += ', fullscreen=yes';
			
			popup = window.open(address,windowName,params);		

			if (window.focus) {popup.focus()}	
		}else{
			params = "toolbar=0,location=0,status=0,menubar=0,scrollbars=0";
			params += ",resizable="+(resizable ? '1' : '0');
			params += ",width="+width;
			params += ",height="+height;
			if(centerAlign){
				params += ",left="+(screen.width - left)/2.;
				params += ",top="+(screen.height - top)/2.;						
			}else{
				params += ",left="+left;
				params += ",top="+top;			
			}
					
			popup = window.open(address,windowName,params);	
			
			if (window.focus) {popup.focus()}
		}	
	}

	// [whitrue_MODIFY] 2012.03.23
	function fullScreenPopupOpen(address)
	{
		params  = 'width='+screen.width;
		params += ', height='+screen.height;
		params += ', top=0, left=0'
		params += ', fullscreen=1';
		params += ', toolbar=0,location=0,status=0,menubar=0,scrollbars=0';
		
		popup = window.open(address, "", params);
		if (window.focus) {popup.focus()}	
	}

	/* 	// whitrue_ADD 2012.03.22
	function fullScreenPopupOpen(page)
	{
		var address = unescape(location.href);
		address += address.indexOf("?") != -1 ? "&" : "?";

		if(page == -100)
		{
			address += "fullScreen=true";
		}
		else
		{
			address += "page=" + page + "&fullScreen=true";
		}

		params  = 'width='+screen.width;
		params += ', height='+screen.height;
		params += ', top=0, left=0'
		params += ', fullscreen=1';
		params += ', toolbar=0,location=0,status=0,menubar=0,scrollbars=0';
		
		popup = window.open(address, "", params);
		if (window.focus) {popup.focus()}	
	}*/

	function fullScreenPopupClose(page)
	{
		if(isIE)
		{
		    var ebook = opener.window["subContents"];
		}
		else
		{
			var ebook = opener.document["subContents"];
		}

		if(ebook != null)
		{
			if(page == -100)
			{
				ebook.goCover();
			}
			else
			{
				ebook.goPage(page, false, true);
			}
		}

		window.close();
	}
	
	function CmdFromApp(str_cmd, str_param)
	{
		if( str_cmd == "notify" )
		{
			if( str_param == "app" )
			{
				bWebMode = false;
			}
		}
	}
	


	/**************************************************************
	* command : close, link, execute                              *
	*                                                             *
	* ex > CmdFromFlash( "execute", "file=xxx.exe#param=xxxx" );  *
	**************************************************************/

	function CmdToApp( str_cmd, str_param ){	
		var strCallType = "ebcp://";
		strCallType += str_cmd;
		strCallType += "?";
		strCallType += str_param;
		window.navigate(strCallType);
	}

	function CmdFromFlash(str_cmd, str_param)
	{	
		if(!bWebMode)
		{
			if(str_cmd=="link")
			{
				var idx = str_param.indexOf("?");
				var http = str_param.indexOf("http://");
				var html = str_param.indexOf(".htm");
				
				if(str_param.substr(idx+1,4)=="page" || (http==-1 && html!=-1))
				{
					location.href=str_param;
					return;
				}
			}
			else if(str_cmd == "exit")
			{
				str_cmd = "close";
			}
			else if(str_cmd == "save")
			{
				saveData = str_param;
				str_param = "";
			}

			var strCallType = "ebcp://";
			strCallType+=str_cmd;
			strCallType+="?";
			strCallType+=str_param;
			window.navigate(strCallType);
		}
		else 
		{
			if(str_cmd == "link")
			{
				location.href = str_param;
			}
			else if(str_cmd == "move")
			{
				var source = "", target = "", page = "";
				var url = location.href;
				var params = str_param.split("#");

				for(var idx = 0; idx < params.length; idx++)
				{
					var param = params[idx].split("=");
					
					if(param[0] == "source")
					{
						source = param[1];
					}
					else if(param[0] == "target")
					{
						target = param[1] + "/JBook.htm";
					}
					else if(param[0] == "page")
					{
						page = param[1];
					}
				}

				if(source == "")
				{
					var urlArray = location.href.split("/");
					source = urlArray[urlArray.length - 2];
				}

				if(page != "")
				{
					target += "?page=" + page;
				}

				url = url.substr(0, url.indexOf(source)) + target;
				location.href = url;
			}
			else if(str_cmd == "close" || str_cmd == "exit")
			{
				windowClose();
			}
		}
	}
	
	function windowClose()
	{
		if(isIE && getExplorerVersion() >= 7 || isChrome)
		{
			window.open('about:blank','_self').close();
		}
		else if(isFirefox)
		{
			netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");
			window.open('','_self');
			window.close();
		}
		else
		{
			window.opener = self; 
			self.close();
		}
	}



	/******************************************/
	/*           event handler 함수           */
	/******************************************/

	// [whitrue_ADD] 2012.04.18
	function MouseEventHandler(event)
	{
		if(!selectedFlash && selectedFlash.id == "subContents")
		{	
			selectedFlash.mouseEventHandlerInFlash(event.button);
		}
	}

    // [whitrue_ADD] 2012.05.16
	function KeyEventHandler(event)
	{
		if(!selectedFlash && selectedFlash.id == "subContents")
		{
			selectedFlash.keyEventHandlerInFlash(event.keyCode);
		}
	}



	/**************************************************************
	*                   Flash iframe                              *
	**************************************************************/

	var FlexIFrame = {
		get: function(id)
		{
			var iframe = document.getElementById(id);
			if(!iframe)
				return FlexIFrame.create(id);

			return iframe;
		},
	 
		create: function(id)
		{
			var iframe = document.createElement('iframe');
			iframe.id = id;
			iframe.frameborder = 0;
			iframe.style.position = "absolute";
			iframe.style.zIndex = 6 + iFrameCount;
			iframe.style.border = "none";
			iframe.style.display = "none";
			document.body.insertBefore(iframe, null);

			iFrameCount++;
			return iframe;
		},
	 
		resize: function(id, width, height)
		{
			var iframe = FlexIFrame.get(id);
			iframe.style.width = width + "px";
			iframe.style.height = height + "px";
		},
	 
		move: function(id, x, y)
		{
			var iframe = FlexIFrame.get(id);
			iframe.style.left = x + "px";
			iframe.style.top = y + "px";
			
			/*
			if(isIE && bWebMode)
			{
				iframe.style.left = (x - (x * iframeConvertValue))  + "px";
				iframe.style.top = (y - (y * iframeConvertValue))  + "px";
			}
			else
			{
				iframe.style.left = x + "px";
				iframe.style.top = y + "px";
			}*/
		},
	 
		navigate: function(id, url)
		{
			var iframe = FlexIFrame.get(id);
			iframe.src = url;
		},
	 
		visibility: function(id, visible)
		{
			var iframe = FlexIFrame.get(id);
			iframe.style.display = visible ? "block" : "none";
		}	
	}



	/******************************************/
	/*                  etc                   */
	/******************************************/

	function getFlash( str_name ){
	    if( isIE ) {
	        return window[str_name];
	    }
	    else {
	        return document[str_name];
	    }
	}

	function checkExplorer(){
		return isIE;
	}

	function checkWebMode(){
		return bWebMode;
	}

	function getExplorerVersion(){
		var rv = -1;
	
		if (navigator.appName == 'Microsoft Internet Explorer') {
			var ua = navigator.userAgent;
			var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
			if (re.exec(ua) != null)
			rv = parseFloat(RegExp.$1);
		}

		return rv;
	} 

	function getWebPageAddress(){
		if(startPage)
		{
			if(getAddressParam("page") == "")
			{
				if(addressParams != null)
				{
					return unescape(location.href) + "&page=" + startPage;
				}
				else
				{
					return unescape(location.href) + "?page=" + startPage;
				}
			}
		}
		else
		{
			return unescape(location.href);
		}
	}

	function getAddressParams()
	{
		var address = unescape(location.href);
		var pramIndex = address.indexOf("?");

		if(pramIndex > 0)
		{
			var pramStr = address.substr(pramIndex + 1);
			addressParams = pramStr.split("&");

			return addressParams.length;
		}
		else 
		{
			return -1;
		}
	}

	function getAddressParam(param)
	{
		if(getAddressParams() != -1)
		{
			for(var idx = 0; idx < addressParams.length; idx++)
			{
				var elements = addressParams[idx].split("=")[0];

				if(elements == param)
				{
					return addressParams[idx].split("=")[1];
				}
			}
		}

		return "";
	}

	function checkStartMode(id, url)
	{		
		if(getAddressParam("startMode") == "popup")
		{
			var address = unescape(location.href).split("?")[0];
			fullScreenPopupOpen(address);
			return true;
		}
		else
		{
			return false;
		}
	}

	function getSaveData()
	{
		return saveData;
	}

	function sleep(milliseconds){
		var start = new Date().getTime();
		for( var i = 0; i < 1e7; i++ ){
			if ((new Date().getTime() - start) > milliseconds){
				break;
			}
		}
	}

	function bin2String(array) 
	{
		var result = "";

		//for (var i = 0; i < array.length; i++)
		for (var i = 0; i < 100; i++)
		{
			result += String.fromCharCode(parseInt(array[i], 2));
		}

		return result;
	}

	function string2Bin(str)
	{
		var result = [];

		for (var i = 0; i < str.length; i++)
		{
			result.push(str.charCodeAt(i).toString(2));
		}

		return result;
	}

	function createFile(path, data)
	{
		var object = new ActiveXObject("Scripting.FileSystemObject");
		var file = object.CreateTextFile(path, true);
	
		file.WriteLine(data);
		file.Close();
	}

	function DetectActiveXControl()
	{
		try
		{
			var xObj = new ActiveXObject("ALDownXControl.ALDownX");

			if(xObj)
			  Installed = true;
			else
			   Installed = false;
		}
		catch(ex)
		{
			Installed = false;
		}

		if(Installed == true)
		{
			alert(!"ActiveX Control이 설치되었음");
		}
		else
		{
			alert(!"ActiveX Control이 설치되지 않았음");
		}
	}