/*****************************************************************************
 *                ÅëÇÕÇÁ·¹ÀÓ ÀÚµ¿ ¸®»çÀÌÁî µÇµµ·Ï ±â´ÉÀ» ¼öÁ¤ÇÑ´Ù.                   *
 *                        2007-11-28  by YESNO                               *
 *****************************************************************************/
	var referer = document.referrer;
	if(referer != null && typeof(referer)!= "undefined") {
		if(referer.indexOf("epeople.go.kr") < 0) {
			var domain = referer.substring(0, referer.indexOf("/", 8));		
			setCookie("frame_domain", domain, 1);			
		} 
	}

	/** ÇÁ·¹ÀÓ Á¶Àý¿ë iframe °´Ã¼¸¦ »ý¼ºÇÏ¿© body element¿¡ appendÇÑ´Ù. **/
	function resizeFrame(event) {
		try {
			var domain = getCookie("frame_domain");
			if(domain != "" && typeof(domain)!= "undefined") {

				/* ÇÁ·¹ÀÓÅëÇÕ°¡ÀÌµå¿¡ ¸í½ÃµÈ epeople_frame.html  ÆÄÀÏÀÌ ±â°ü ¹èÆ÷°¡ ³¡³­ °æ¿ì
				 * ¾Æ·¡ if ±¸ºÐ 2ÁÙÀ» »èÁ¦ÇÏ¸é ½ºÅ©·Ñ¹Ù°¡ ±ôºýÀÌ´Â Çö»óÀ» Á¦°Å ÇÒ ¼ö ÀÖ´Ù.  
				 * Internet ExplorerÀ» À§ÇÑ ÄÚµå*
				 * ÀÌ ÆÄÀÏ°ú jsFrameForOpener.js ÆÄÀÏ¿¡µµ ¼öÁ¤»çÇ×ÀÌ ÀÖÀ¸¹Ç·Î ÇÔ²² ¼öÁ¤ÇØ¾ß ÇÑ´Ù.*/
				if(window.navigator.appName.indexOf("Explorer") != -1)
					document.body.scroll="auto";
				/* ¾Æ·¡ ¶óÀÎÀº »çÆÄ¸®¿Í ¿ÀÆä¶ó¸¦ À§ÇÑ ±¸¹®ÀÌ³ª µÎ ºê¶ó¿ìÀú´Â ½ºÅ©·Ñ¹Ù°¡ ¾ø¾î¼­ ¸¶¿ì½º ÈÙ
				 * ¶Ç´Â Tab, ¹æÇâÅ°·Î ÀÌµ¿ÀÌ °¡´ÉÇÏ¹Ç·Î ½ºÅ©·Ñ¹Ù¸¦ »ý¼ºÅ°½ÃÁö´Â ¾Ê´Â´Ù. ÇÊ¿ä½Ã ÁÖ¼® ÇØÁ¦ */
				//else 
				//	document.body.style.overflowY="auto";

				var frameW = document.body.scrollWidth + (document.body.offsetWidth-document.body.clientWidth);
				var frameH = parseInt(document.body.scrollHeight)+100;
				var srcUrl = domain+"/epeople/frame/epeople_frame.html?height="+frameH+"&width="+frameW;

				var ifrm = document.createElement("iframe");
				ifrm.setAttribute("title", "±¹¹Î½Å¹®°í ÅëÇÕ¼­ºñ½º");
				ifrm.setAttribute("src", srcUrl);
				ifrm.setAttribute("name", "epeople_reframe");
				ifrm.setAttribute("id", "epeople_reframe");
				ifrm.setAttribute("height", "0");
				ifrm.setAttribute("width", "0");
				ifrm.setAttribute("scrolling", "no");
				
				var epeopleReframe = document.getElementById("epeople_reframe");
				if(epeopleReframe == null) {
					document.body.appendChild(ifrm);
				} else {
					document.body.replaceChild(ifrm, epeopleReframe);
				}
			}
		} catch (e) { }
	}

/****************************************************************
 * À©µµ¿ì°¡ onload ÀÌº¥Æ® ¹ß»ý½Ã ¸®»çÀÌÁî °ü·Ã ÇÔ¼ö¸¦ È£ÃâÇÑ´Ù.  *
 ****************************************************************/
	var paid = {};
	paid.FrameEvent = {};
	paid.FrameEvent.addListener = function(element, event_name, userFunction, useCapture) {
	    useCapture = useCapture || false;
		try {	
			if (element.addEventListener) {
				element.addEventListener(event_name, userFunction, useCapture);
			} else if (element.attachEvent) {
				element.attachEvent('on' + event_name, userFunction);
			}
		} catch(exception) {
			alert("¿À·ù³»¿ë : " + exception + "\r\n´ë»ó °´Ã¼ : " + element 
				+ " : addListener() on" + event_name + "() ÇÔ¼ö Ãß°¡½Ã ¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù.");
		}		
	}
	paid.FrameEvent.addListener(window, "load", resizeFrame, false);
	paid.FrameEvent.addListener(document, "click", resizeFrame, false);

/****************************************************
 *                 Cookie ÄÜÆ®·Ñ ÇÔ¼ö                 *
 ****************************************************/
	function setCookie( name, value, expiredays ){
		var todayDate = new Date();
		todayDate.setDate( todayDate.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; domain=epeople.go.kr; expires=" + todayDate.toGMTString() + ";";
	}
	function getCookie( name ){
		var nameOfCookie = name + "=";
		var x = 0;
		while ( x <= document.cookie.length ){
			var y = (x+nameOfCookie.length);
			if ( document.cookie.substring( x, y ) == nameOfCookie ) {
					if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
							endOfCookie = document.cookie.length;
					return unescape( document.cookie.substring( y, endOfCookie ) );
			}
			x = document.cookie.indexOf( " ", x ) + 1;
			if ( x == 0 ){
				 break;
			}
		}
		return "";
	}

/***************************************************
 *           ÅëÇÕÇÁ·¹ÀÓ ÆË¾÷À» Ã¢À» °ü¸®ÇÑ´Ù.           *
 ***************************************************/
	function popUp() {
		var todayDate = new Date();
		var toYear = todayDate.getFullYear();
		var toMonth = (todayDate.getMonth() + 1);
		// ¼ýÀÚ ÇÕÀÌ ¹ß»ýÇÏÁö ¾Êµµ·Ï ³âµµ´Â ¹®ÀÚÇüÀ¸·Î º¯°æÇÑ´Ù.
		toYear = new String(toYear);
		var toDate = todayDate.getDate();
		var toHour= todayDate.getHours();
		if(toMonth < 10) toMonth = "0"+toMonth;
		if(toDate < 10) toDate = "0"+toDate;
		if(toHour < 10) toHour = "0"+toHour;
		// ¿À´Ã³¯Â¥
		var popup_date = toYear + toMonth + toDate + toHour+"";
		// ÆË¾÷ ´Ý´Â ³¯Â¥½Ã°£.
		var setTimePopupCloseDate_1 = '2006091710';
		// ÆË¾÷´Ý´Â ³¯Â¥ ÀÌÀü¿¡¸¸ ÆË¾÷ÀÌ ¶ßµµ·Ï ÇÑ´Ù.
	    if( popup_date < setTimePopupCloseDate_1 ) {
			if ( getCookie("noticeuserPopup") != "done" ) {
					popup_win('notice', 'paid_notice', '/html/CNoticeUser.html', '430', '530', 'no');
			}
		}
	}
	// ÆË¾÷Ã¢ÀÇ À§Ä¡ top=0,left=0 À» ÇÈ¼¿ ´ÜÀ§·Î ¼³Á¤ÇÑ´Ù.
	function popup_win(cookie_name, win_name, src, width, height, scroll_bar, menu_bar) {
			var small_window = window.open(src, win_name,
				'width='+width+',height='+height+',marginwidth=0,marginheight=0,top=5,left=5,'+
				'resizable=0,scrollbars='+scroll_bar+',menubar='+menu_bar);
	}

	// °øÁöÆË¾÷½ÇÇà
	popUp();

