/************************************************************

ÆÄ   ÀÏ   ¸í : YUtil.js (Utility °ü·Ã)

ÀÛ   ¼º   ÀÚ : ±è ¿ë ÁØ

ÀÛ   ¼º   ÀÏ : 2007-05-15

ÆÄ ÀÏ ¼³ ¸í : À¯Æ¿ ½ºÅ©¸³Æ® ¸ðÀ½

¼ö   Á¤   ÀÏ : 2008-01-03

¼ö Á¤ ³» ¿ë : ÇÔ¼ö Ãß°¡

************************************************************/

var U = {

	/***********************************************************************************************
	
	Utility
	
	isIE
	IEVersion
	isGecko
	addEvent
	removeEvent
	getEl
	getX
	getY
	getScrollLeft
	getScrollTop
	getClientHeight
	getClientWidth
	getObjLeft
	getObjTop
	setObjLeft
	setObjTop
	getObjoffsetTop
	getObjoffsetLeft
	allChecked
	trim
	byte
	nextFocus
	clipboardCopy
	execCopy
	request
	numChk
	setNum
	contentImgResize


	************************************************************************************************/

	//ÀÍ½ºÇÃ·Î·¯ ¶ó¸é IE´Â true ¾Æ´Ï¶ó¸é False
	isIE : navigator.userAgent.indexOf("MSIE") != -1
	,
	//ÀÍ½ºÇÃ·Î·¯ ¹öÁ¯ ÇöÀç ¹öÁ¯ÀÌ 6 ÀÌ¸é 6°ªÀÌ ³ª¿È
	IEVersion : navigator.userAgent.indexOf("MSIE") != -1 ? parseFloat(navigator.appVersion.split("MSIE")[1]) : 0
	,
	//ºê¶ó¿ìÁ® Gecko ¿©ºÎ
	isGecko : navigator.product == "Gecko"	
	,
	//ÀÌº¥Æ® Ãß°¡
	//obj = window | document | div | iframe
	//eve = onload | onmousedown | onblur
	//fnc = ½ÇÇà½ÃÅ³ Æã¼Ç
	//¿¹) U.addEvent(window,"onload", new Function( "s_load('00000')" ) );
	// U.addEvent(window,"onload", init);
	addEvent : function(obj,eve,fnc){
		if(window.attachEvent){ //IE
			obj.attachEvent(eve , fnc);
		}else{ //±âÅ¸ ¸ðÁú¶ó
			eve=eve.replace("on","");
			obj.addEventListener(eve , fnc, false);
		}
	}
	,
	//ÀÌº¥Æ® »èÁ¦
	removeEvent : function(obj,eve,fnc){
		if(window.detachEvent){ //IE
			obj.detachEvent(eve , fnc);
		}else{ //±âÅ¸ ¸ðÁú¶ó
			eve=eve.replace("on","");
			obj.removeEventListener(eve , fnc, false);
		}	
	}
	,
	//ÇØ´ç ¾ÆÀÌµð °³Ã¼ Ã£±â
	getEl : function(strId){
		if (document.getElementById) return document.getElementById(strId); 
		if (document.all) return document.all[strId]; 
		if (document.layers) return document.layers[strId]; 
	}
	,
	//ÀÌº¥Æ® X °ª
	getX : function (e){if(!e) e = window.event;return e.clientX;}
	,
	//ÀÌº¥Æ® Y °ª
	getY : function (e){if(!e) e = window.event;return e.clientY;}
	,
	//½ºÅ©·Ñ left °ª
	getScrollLeft : function(){
		if (document.documentElement && document.documentElement.scrollLeft > 0){
			return document.documentElement.scrollLeft;
		}else{
			return document.body.scrollLeft;
		}
	}
	,
	//½ºÅ©·Ñ top °ª
	getScrollTop : function(){
		if(document.documentElement && document.documentElement.scrollTop > 0){
			return document.documentElement.scrollTop;
		}else{
			return document.body.scrollTop;
		}
	}
	,
	//ºê¶ó¿ìÁ® ³ôÀÌ
	getClientHeight : function(){
		if(document.documentElement && document.documentElement.clientHeight > 0){
			return document.documentElement.clientHeight;
		}else{
			return document.body.clientHeight;
		}
	}
	,
	//ºê¶ó¿ìÁ® ³ÐÀÌ
	getClientWidth : function(){
		if (document.documentElement && document.documentElement.clientWidth > 0){
			return document.documentElement.clientWidth;
		}else{
			return document.body.clientWidth;
		}
	}
	,
	getObjLeft : function(obj){ return parseInt(obj.style.left);}
	,
	getObjTop : function(obj){ return parseInt(obj.style.top);}
	,
	setObjLeft : function(obj,ex){ obj.style.left = ex+"px";}
	,
	setObjTop : function(obj,ey){obj.style.top = ey+"px";}
	,
	getObjoffsetTop : function(obj){
		if(obj.offsetParent) return obj.offsetTop + this.getObjoffsetTop(obj.offsetParent);
		else return obj.offsetTop;
	}
	,
	getObjoffsetLeft : function(obj){
		if (obj.offsetParent) return obj.offsetLeft + this.getObjoffsetLeft(obj.offsetParent);
		else return obj.offsetLeft;
	}
	,
	createDiv : function(sId, nWidth, nHeight, sBorder, sBgColor, sDisplay, sOver, sPosition, sZindex ){
		var d = document.createElement("div");
		if(sId) d.id = sId;
		if(nWidth) d.style.width = nWidth;
		if(nHeight) d.style.height = nHeight;
		if(sBorder) d.style.border = sBorder;	
		if(sBgColor) d.style.backgroundColor = sBgColor;
		if(sDisplay) d.style.display = sDisplay;
		if(sOver) d.style.overflow = sOver;
		if(sPosition) d.style.position = sPosition;
		if(sZindex) d.style.zIndex = sZindex;
		return d;
	}
};

/**
* ¾²±â
* @param str ¹®ÀÚ¿­
*/
U.dw = function( str ){
	document.write(str); 
}

/**
*»õÃ¢ ¶ç¿ö¼­ Æ÷Ä¿½º ÁÖ±â
*@param pUrl »õÃ¢ url
*@param pName »õÃ¢ ÀÌ¸§
*@param pW Ã¢ ³ÐÀÌ
*@param pH Ã¢ ³ôÀÌ
*@param sb ½ºÅ©·Ñ ¿©ºÎ (yes|no)
*@param rs ¸®»çÀÌÁî ¿©ºÎ (yes|no)
*@param pL Ã¢ ÁÂÃø À§Ä¡ °ªÀÌ ¾øÀ¸¸é ÇØ»óµµ °¡·Î°ª
*@param pT Ã¢ Å¾ À§Ä¡ °ªÀÌ ¾ø´Ù¸é ÇØ»óµµ ¼¼·Î°ª
*
*À§Ä¡ ÁöÁ¤ ¾ÈÇÏ¸é ÇØ»óµµ °¡¿îµ¥·Î
*winOpen('ÁÖ¼Ò','À©µµ¿ìÀÌ¸§',500,400,'yes','no')
*
*À§Ä¡ ÁöÁ¤ÇÏ¸é ÇØ´ç À§Ä¡·Î
*winOpen('ÁÖ¼Ò','À©µµ¿ìÀÌ¸§',500,400,'yes','no',100,100)
*/
function winOpen(pUrl,pName,pW,pH,sb,rs,pL,pT){
	if(typeof(pL)=="undefined") pL = parseInt((window.screen.width-pW)/2); //ÇØ»óµµ°¡·Î
	if(typeof(pT)=="undefined") pT = parseInt((window.screen.height-pH)/2); //ÇØ»óµµ¼¼·Î
	var newWin=window.open(pUrl,pName,"width="+pW+",height="+pH+",scrollbars="+sb+",resizable="+rs+",left=" + pL + ",top=" + pT+",directories=no,status=no,menubar=no");
	newWin.focus();
}

/**
* ÄíÅ° ¼ÂÆÃ
* @param name ÄíÅ°ÀÌ¸§
* @param value ÄíÅ°°ª
* @param expiredays ³¯Â¥ ( 1:ÇÏ·ç )
*
* setCookie( "Notice", "done" , 1); ÇÏ·çµ¿¾È ÄíÅ° ÀúÀå
*/
function setCookie( name, value, expiredays ){ 
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";";
}
function setCookie_onmamwww( name, value, expiredays ){ 
    var todayDate = new Date();
    todayDate.setDate( todayDate.getDate() + expiredays ); 
    document.cookie = name + "=" + escape( value ) + "; domain=.onmam.com; path=/; expires=" + todayDate.toGMTString() + ";";
}

function save_latestHompi( hompi_num ) { 
    //ÃÖ±Ù ¹æ¹®ÇÑ È¨ÇÇ 5°³ ÀúÀåÇÏ±â
    hdnHompinum = hompi_num;
    var NextSavedVistedHompi = getCookie("NextSavedVistedHompi");
    var VisitedHompiNum1 = getCookie("VisitedHompiNum1");
    var VisitedHompiNum2 = getCookie("VisitedHompiNum2");
    var VisitedHompiNum3 = getCookie("VisitedHompiNum3");
    var VisitedHompiNum4 = getCookie("VisitedHompiNum4");
    var VisitedHompiNum5 = getCookie("VisitedHompiNum5");
    var expDate = 365*10;

    if (NextSavedVistedHompi == "")
        NextSavedVistedHompi = "1";

    if (VisitedHompiNum1 != hdnHompinum && VisitedHompiNum2 != hdnHompinum && VisitedHompiNum3 != hdnHompinum &&
        VisitedHompiNum4 != hdnHompinum && VisitedHompiNum5 != hdnHompinum)
    {
        if (NextSavedVistedHompi == "1")
        {
            setCookie_onmamwww("VisitedHompiNum1", hdnHompinum, expDate);
            setCookie_onmamwww("NextSavedVistedHompi", "2", expDate);
        }
        else if (NextSavedVistedHompi == "2")
        {
            setCookie_onmamwww("VisitedHompiNum2", hdnHompinum, expDate);
            setCookie_onmamwww("NextSavedVistedHompi", "3", expDate);
        }
        else if (NextSavedVistedHompi == "3")
        {
            setCookie_onmamwww("VisitedHompiNum3", hdnHompinum, expDate);
            setCookie_onmamwww("NextSavedVistedHompi", "4", expDate);
        }
        else if (NextSavedVistedHompi == "4")
        {
            setCookie_onmamwww("VisitedHompiNum4", hdnHompinum, expDate);
            setCookie_onmamwww("NextSavedVistedHompi", "5", expDate);
        }
        else if (NextSavedVistedHompi == "5")
        {
            setCookie_onmamwww("VisitedHompiNum5", hdnHompinum, expDate);
            setCookie_onmamwww("NextSavedVistedHompi", "1", expDate);
        }
    }
    //ÃÖ±Ù ¹æ¹®ÇÑ È¨ÇÇ 5°³ ÀúÀåÇÏ±â
}


/**
* ÄíÅ°°ª °¡Á®¿À±â
* @param name ÄíÅ°ÀÌ¸§
* @return String ÄíÅ°°ª
*
* getCookie(ÄíÅ°ÀÌ¸§)
*/
function getCookie(name){
	var prefix = name + "=";
	var cookieStartIndex = document.cookie.indexOf(prefix);
	if (cookieStartIndex == -1)
		return "";
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length;
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

/**
* ÄíÅ° ¼Ò¸ê
* @param name ÄíÅ°ÀÌ¸§
*/
function clearCookie(name) {
	var today = new Date();
	//¾îÁ¦ ³¯Â¥¸¦ ÄíÅ° ¼Ò¸ê ³¯Â¥·Î ¼³Á¤ÇÑ´Ù.
	var expire_date = new Date(today.getDate() - 1);
	document.cookie = name + "= " + "; path=/; expires=" + expire_date.toGMTString();
}

/**
* ÇÃ·¡½Ã ¾²±â
* @param fSrc ÇÃ·¡½Ã°æ·Î
* @param sWidth ³ÐÀÌ
* @param sHeight ³ôÀÌ
* @param fVars °ªµé
* @param fId ¾ÆÀÌµð
* @param fName ÀÌ¸§
* @param fBgcolor ¹è°æ»ö
* @param fWmode wmode
*/



function writeFlash(URL, width, height, vars, fId, fName, bgColor, winmode){
	
	var id = URL.split("/")[URL.split("/").length-1].split(".")[0];
    var strCheck = "0123456789~`!@#$%%^&*-=+\|[{]};:\',<.>/?";

	id = id.split("(").join("").split(")").join("");
    
    var i, j;
    var flag = false;

	for(i = 0; i < id.length; i++)
	{
        for(j = 0; j < strCheck.length; j++)
        {
            if(id.charAt(i) == strCheck.charAt(j))
            {   
                id = id.replace(id.charAt(i), " ");                
            }
        }
	}
	
	if (vars == null) vars = '';
	if (bgColor == null) bgColor = '#FFFFFF';
	if (winmode == null) winmode = 'transparent';

	document.write("	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0' "); 
	document.write("		width='" + width + "' height='" + height + "' id='" + id + "' name='" + id + "' align='middle'> ");
	document.write("	<param name='allowScriptAccess' value='always' /> ");
	document.write("	<param name='movie'	value='" + URL + "' /> ");
	document.write("	<param name='FlashVars'		value='" + vars + "' /> ");
	document.write("	<param name='wmode'	value='" + winmode + "' /> ");
	document.write("	<param name='menu'			value='false' /> ");
	document.write("	<param name='quality'		value='high' /> ");
	document.write("	<param name='bgcolor'	value='" + bgColor + "' /> ");
	document.write("	<embed src='" + URL + "' flashVars='" + vars + "' wmode='" + winmode + "' menu='false' quality='high' ");
	document.write("		bgcolor='" + bgColor + "' width='" + width + "' height='" + height + "' id='" + id + "' name='" + id + "' align='middle' ");
	document.write("		allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/go/getflashplayer' /> ");
	document.write("	</object> ");
	
	eval("window." + id + " = document.getElementById('" + id + "');");

}

/**
* ÀÌ¹ÌÁö È®´ëº¸±â
* @param imgSrc ÀÌ¹ÌÁö °æ·Î
* @param pW
* @param pH
* @param pL
* @param pT
*/
function popImgWin(imgSrc,pW,pH,pL,pT){
		
	if(typeof(pW)=="undefined") pW = 100;
	if(typeof(pH)=="undefined") pH = 100;
		
	var viewSrc;
	var src1,src2;
	if( imgSrc.lastIndexOf("/")>-1 ){
		src1 = imgSrc.substring(0, imgSrc.lastIndexOf("/")+1 );
		src2 = imgSrc.slice(imgSrc.lastIndexOf("/")+1);
	}else{
		src1 = "";
		src2 = imgSrc;
	}	
	viewSrc = src1+escape(src2);	//ÀÌ¹ÌÁö¸í ÀÎÄÚµù ÇÑ±Û ÆÄÀÏ¸íÀÏ°æ¿ì ¿¡·¯
		
	var swfPattern = /\.(swf|wmv)$/ig;//È®ÀåÀÚ ÇÃ·¡½Ã ÆÐÅÏ
	var imgPattern = /\.(jpg|gif)$/ig;//ÀÌ¹ÌÁö È®ÀåÀÚ ÆÐÅÏ

	var strhtml = "";
	
	//ÀÌ¹ÌÁö ÆÄÀÏ ÀÌ¶ó¸é
	if( imgPattern.test( imgSrc ) ){
	
		strhtml +="<html><head><title>ÀÌ¹ÌÁöÈ®´ëº¸±â</title><style>body{margin:0;}</style>";
		strhtml +="<s"+"cript language=\"JavaScript\">";
		strhtml +="function win_resize(){";
		strhtml +="var imgWidth  = parseInt(document.content_img.offsetWidth);";
		strhtml +="var imgHeight = parseInt(document.content_img.offsetHeight);";
		strhtml +="var winWidth  = window.screen.width;";
		strhtml +="var winHeight  = window.screen.height;";
		strhtml +="var reWidth,reHeight;";
		strhtml +="if(imgWidth>winWidth-100){";
		strhtml +="reWidth  = winWidth-100;";
		strhtml +="}else{";
		strhtml +="reWidth = imgWidth+50;";
		strhtml +="}";
		strhtml +="if(imgHeight>winHeight-100){";
		strhtml +="reHeight = winHeight-100;";
		strhtml +="}else{";
		strhtml +="reHeight = imgHeight+100;";
		strhtml +="}";
		strhtml +="window.moveTo(parseInt((winWidth-reWidth)/2),parseInt((winHeight-reHeight)/2));";
		strhtml +="window.resizeTo(reWidth,reHeight);";
		strhtml +="window.focus();";
		strhtml +="}";
		
		strhtml +="</s"+"cript>";
		strhtml +="</head><body onload='win_resize()'>";
		strhtml +="<table width='100%' height='100%' cellspacing='0' cellpadding='0'><tr>";
		strhtml +="<td align='center' valign='center'>";
		strhtml +="<img src='"+viewSrc+"' name='content_img' id='content_img' border=0 onclick='window.close();' style='cursor:hand;'>";
		strhtml +="</td></tr></table></body></html>";
	}else{
		if(pW==100) pW = 400;
		if(pH==100) pH = 300;
		
		strhtml +="<html><head><title>È®´ëº¸±â</title><style>body{margin:0;}</style>";
		strhtml +="</head><body>";
		strhtml +="<table width='100%' height='100%' cellspacing='0' cellpadding='0'><tr>";
		strhtml +="<td align='center' valign='center'>";
		strhtml +="<embed src='"+viewSrc+"' width='100%' height='100%'>";
		strhtml +="</td></tr></table></body></html>";
	}

	if(typeof(pL)=="undefined") pL = parseInt((window.screen.width-pW)/2); //ÇØ»óµµ°¡·Î
	if(typeof(pT)=="undefined") pT = parseInt((window.screen.height-pH)/2); //ÇØ»óµµ¼¼·Î
	
	var imageWin = window.open('', "imageWin", "width="+pW+",height="+pH+",left=" + pL + ",top=" + pT+",scrollbars=1,resizable=1,status=1,toolbar=0,menubar=0,location=0,directories=0"); 
	imageWin.document.open(); 
	imageWin.document.write(strhtml);
	imageWin.document.close();
	imageWin.focus();
}




/**
* Ã¼Å© ¹Ú½º ¸ðµÎ ¼±ÅÃ , ÇØÁ¦
* @param obj 
* @param bool true | false 
* ¿¹) allChecked(ÆûÀÌ¸§.ÀÌ¸§, true ¶Ç´Â false);
	allChecked(document.f.a, true);
*/
U.allChecked = function( obj, bool ){
	if(obj){
		if(!obj.length) {
			obj.checked = bool;  //Ã¼Å©¹Ú½º°¡ ÇÏ³ªÀÏ °æ¿ì
		}else{
			for (var i = 0; i < obj.length; i++) {  //¿©·¯°³ÀÏ °æ¿ì
				obj[i].checked = bool;
			}
		}
	}
}


/**
* ¹®ÀÚÀÇ ÁÂ, ¿ì °ø¹é Á¦°Å
* @param str ¹®ÀÚ
* @return : String
*/
U.trim = function(str){
	return str.replace(/(^\s*)|(\s*$)/g, "");
}

/**
* ¹®ÀÚ¿­ÀÇ byte ±æÀÌ ¹ÝÈ¯
* @param str ¹®ÀÚ
* @return int
*/
U.byte = function(str){
	var cnt = 0;
	for (var i = 0; i < str.length; i++) {
		if (str.charCodeAt(i) > 127) cnt += 2;
		else cnt++;
	}
	return cnt;
}

/**
* ¹®ÀÚ¿­ ÁÂÃø¿¡¼­ ¹ÙÀÌÆ® ±æÀÌ ¸¸Å­ ÀÚ¸£±â
* @param str ¹®ÀÚ
* @param nLen ±æÀÌ
* @return String
*/
U.cutLeftStr = function (str, nLen){
	var cnt = 0;
	var i = 0;
	for (i = 0; i < str.length; i++) {
		if (str.charCodeAt(i) > 127) cnt += 2;
		else cnt++;
			
		if(nLen<=cnt) break;
		
	}
	var strCut = str.substring(0, i+1);
	if( str!=strCut ) strCut += "...";
	
	return strCut;
}

/**
* ÁöÁ¤ÇÑ ±æÀÌ¸¸Å­ ÀÔ·ÂµÇ¸é ´ÙÀ½ÀÔ·ÂÆûÀ¸·Î Æ÷Ä¿½º ÀÌµ¿
* @param obj ÀÔ·ÂÆû
* @param len ±æÀÌ
* @param nextObj ´ÙÀ½ ÀÔ·ÂÆû
* ¿¹)  onkeyup="U.nextFocus(this, 5, document.writeForm.n2);"
*/
U.nextFocus = function(obj, len, nextObj){ 
	if(nextObj.value==""){
		if (obj.value.length==len){
			nextObj.focus();
			return;
		}
	}
}

/**
* Å¬¸³º¸µå¿¡ ÀúÀå
* @param txt text
* ¿¹) clipboardCopy(text)
*/
U.clipboardCopy = function(txt){
	window.clipboardData.setData("Text", txt);
	alert("º¹»çµÇ¾ú½À´Ï´Ù.");
}

/**
* Å¬¸³º¸µå¿¡ ÀúÀå
* @param el DIV id
* ¿¹) U.execCopy("id")
*/
U.execCopy = function(el){
	var obj = document.getElementById(el);
	var t = document.body.createTextRange();
	t.moveToElementText(obj);
	t.execCommand("Copy");
	alert("º¹»çµÇ¾ú½À´Ï´Ù.");
}

/**
* javascript·Î ±¸ÇöÇÑ Request
* @param valuename
* @return String ´ë¼Ò¹®ÀÚ ±¸ºÐ¾øÀÌ ÇØ´ç°ªÀÌ ¾øÀ»¶§ "" °ø¹é ¸®ÅÏ
*/
U.request = function(valuename){
	var rtnval = "";
	var nowAddress = unescape(location.href);
	var parameters = (nowAddress.slice(nowAddress.indexOf("?")+1,nowAddress.length)).split("&");
    
	for(var i = 0 ; i < parameters.length ; i++){
		var varName = parameters[i].split("=")[0];
		if(varName.toUpperCase() == valuename.toUpperCase())
		{
			rtnval = parameters[i].split("=")[1];
			break;
		}
	}
	return rtnval;
}

/**
* ¼ýÀÚ¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ°Ô ÇÑ´Ù.
* ¿¹) onkeypress='U.numChk()' onblur='U.setNum(this)' style='IME-MODE: disabled'
*/
U.numChk = function(e){
	if(!e) e = window.event;
	if ((e.keyCode<48)||(e.keyCode>57)){
		alert("¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.");
		e.returnValue=false;
	}
}
/**
* ¼ýÀÚ °ªÀÌ ¾Æ´Ï¶ó¸é °ø¹éÀ¸·Î
* ¼ýÀÚ °ªÀÌ ¸Â´Ù¸é int °ªÀ¸·Î
* ¿¹) onblur='U.setNum(this)'
*/
U.setNum = function(obj){
	var val = obj.value;
	if(val!=""){
		if(isNaN(val)){//¼ýÀÚ°¡ ¾Æ´Ï¶ó¸é
			obj.value="";
		}else{//¼ýÀÚ¶ó¸é
			obj.value=parseInt(val);
		}
	}
}

/**
* ³»¿ëÁß¿¡ Å« ÀÌ¹ÌÁö ÁÙÀÌ±â
* @param divId ³»¿ë id
* @param reWidth ÁÙÀÏ ÀÌ¹ÌÁö ³ÐÀÌ
*/
U.contentImgResize = function(divId, reWidth){
	var obj = document.getElementById(divId);
	var colIMG = obj.getElementsByTagName("IMG");
	for( var i=0 ; i < colIMG.length ; i++ ){
		if (colIMG[i].width>reWidth ){
			colIMG[i].width = reWidth;
			colIMG[i].style.width = "";
		}
	} 
}



var arrMovingDiv = [];

/**
* DIV ÁÂ ¿ì ¶Ç´Â À§ ¾Æ·¡ ·Î ¿òÁ÷ÀÌ°Ô
* @param nSize ·¹ÀÌ¾î ³ôÀÌ¶Ç´Â ³ÐÀÌ
* @param nWait Ã³À½ ·Îµå½Ã ´ë±â½Ã°£	
* @param tblr top | bottom | left | right
*/
function MovingDiv(nSize, nWait, tblr){

	this.nSize = nSize; //·¹ÀÌ¾î ³ôÀÌ¶Ç´Â ³ÐÀÌ
	this.nWait = nWait; //Ã³À½ ·Îµå½Ã ´ë±â½Ã°£		
	this.tblr = tblr; //top | bottom | left | right
		
	this.idx = arrMovingDiv.length; //ÀÚ½ÅÀÇ ¹øÈ£°ª
	arrMovingDiv[this.idx] = this; //°´Ã¼¸¦ ¹è¿­¿¡ ´ã±â
	
	this.divBox = null;
	
	this.nSpeed = 1; //¼Óµµ

	this.bMouse = true; //¸¶¿ì½º on ¸ØÃã out ½ÃÀÛ
	this.bStart = false;
	
	this.arrText = []; //·¹ÀÌ¾î ¾È ³»¿ë
	this.arrTextWait = []; //·¹ÀÌ¾îº° ´ë±â½Ã°£
	
	this.addText = function(txt, nTextWait){
		var nLen = this.arrText.length;
		
		var str = "<div style=\"position:absolute;";
		if( this.tblr=="top" ){
			str += "width:100%;left:0px;height:"+this.nSize+"px;top:"+(this.nSize*nLen)+"px;";
		}else if( this.tblr=="bottom" ){
			str += "width:100%;left:0px;height:"+this.nSize+"px;top:"+((-1)*this.nSize*nLen)+"px;";
		}else if( this.tblr=="left" ){
			str += "width:"+this.nSize+"px;left:"+(this.nSize*nLen)+"px;height:100%;top:0px;";
		}else if( this.tblr=="right" ){
			str += "width:"+this.nSize+"px;left:"+((-1)*this.nSize*nLen)+"px;height:100%;top:0px;";
		}			
		str += "\" id=\"MovingDiv_item_"+this.idx+"_"+nLen+"\">";	
		str += txt;
		str += "</div>";
		
		this.arrText.push(str);
		this.arrTextWait.push(nTextWait); //´ÙÀ½ ·¹ÀÌ¾î ´ë±â½Ã°£
	}
	
	this.onoff = function(s){ //¸¶¿ì½º on ¸ØÃã out ½ÃÀÛ
		if(s=="on") this.bMouse = true;
		else this.bMouse = false;
	}
	
	this.show = function(){
		var str = "<div style=\"position:relative;overflow:hidden;";

		if( this.tblr=="top" || this.tblr=="bottom" ){
			str += "width:100%;height:"+this.nSize+"px;";
		}else{
			str += "width:"+this.nSize+"px;height:100%;";
		}
		str += "\" id=\"MovingDiv_"+this.idx+"\"></div>";

		document.write(str);
		
		this.divBox = document.getElementById( "MovingDiv_"+this.idx );
		
		this.divBox.onmouseover = new Function( "arrMovingDiv["+this.idx+"].onoff('off')" );
		this.divBox.onmouseout = new Function( "arrMovingDiv["+this.idx+"].onoff('on')" );
		
		for(var i=0; i<this.arrText.length; i++){
			this.divBox.innerHTML+=this.arrText[i];
		}
		
		setInterval("arrMovingDiv["+this.idx+"].move()", 1);
	}	
	
	this.nMove = 0;	
	this.nTemp = 0;
	this.nTextWait = 0;
	
	this.move = function(){
		
		if(this.nMove > this.nWait){
			this.bStart = true;
			this.nWait = 0;
			this.nMove = 0;
		}	
		
		this.nMove++;	
			
		if (this.bMouse && this.bStart){
				
			for(var i=0; i<this.arrText.length; i++){
				this.nTemp++;	
						
				var tmpDivStyle = document.getElementById("MovingDiv_item_"+this.idx+"_"+i).style; 
				
				if( this.tblr=="top" ){
					tmpDivStyle.top = parseInt(tmpDivStyle.top)-this.nSpeed;
					if( parseInt(tmpDivStyle.top) <= this.nSize*(-1) ){
						tmpDivStyle.top = this.nSize*(this.arrText.length-1);
						this.nTextWait = this.arrTextWait[i];
					}
				}else if( this.tblr=="bottom" ){
					tmpDivStyle.top = parseInt(tmpDivStyle.top)+this.nSpeed;					
					if( parseInt(tmpDivStyle.top) >= this.nSize ){
						tmpDivStyle.top = (-1)*this.nSize*(this.arrText.length-1);
						this.nTextWait = this.arrTextWait[i];
					}
				}else if( this.tblr=="left" ){
					tmpDivStyle.left = parseInt(tmpDivStyle.left)-this.nSpeed;
					if( parseInt(tmpDivStyle.left) <= this.nSize*(-1) ){
						tmpDivStyle.left = this.nSize*(this.arrText.length-1);
						this.nTextWait = this.arrTextWait[i];
					}
				}else if( this.tblr=="right" ){
					tmpDivStyle.left = parseInt(tmpDivStyle.left)+this.nSpeed;
					if( parseInt(tmpDivStyle.left) >= this.nSize ){
						tmpDivStyle.left = (-1)*this.nSize*(this.arrText.length-1);
						this.nTextWait = this.arrTextWait[i];
					}
				}
																
				if (this.nTemp>=this.nSize*this.arrText.length){
					this.bStart = false;
					this.nTemp = 0;
					this.nWait = this.nTextWait;
				}
			}
		}	
	}
}

var TextScroll = {
	textSpace : "                ", textValue : "" , textScroll : "", textObj : null, tID : null
}
TextScroll.init = function (obj){
	TextScroll.textObj = obj;
	TextScroll.textValue = obj.value;
	TextScroll.textScroll = TextScroll.textSpace + TextScroll.textValue + TextScroll.textSpace + TextScroll.textValue;
	
	TextScroll.tID = setInterval("TextScroll.tScroll()", 180);
}
TextScroll.tScroll = function(){
	var val = TextScroll.textObj.value;
	TextScroll.textObj.value = val.substring(1);
	if (TextScroll.textObj.value==""){
		TextScroll.textObj.value = TextScroll.textScroll;
	}
}
TextScroll.tEnd = function(){
	clearInterval(TextScroll.tID);		
	TextScroll.textObj.value = TextScroll.textValue;
}


U.createForm = function(nm,mt,at,tg) {
	var f=document.createElement("form");
	f.name=nm;
	f.method=mt;
	f.action=at;
	f.target=tg;
	return f;
}
U.addHidden = function(f,n,v) {
	var i=document.createElement("input");
	i.type="hidden";
	i.name=n;
	i.value=v;
	f.insertBefore(i);
	return f;
}
//°Ô½Ã¹°¿¡¼­ ³»¿ë ÀÌ¹ÌÁö ¸®»çÀÌÁî ½ÃÅ°±â
U.img_resize = function(imgId,size) {
    var fix_w = size;
	if(size > 0) 
		fix_w = size; 
	var pre_img = document.all[imgId];
	if(pre_img)
	{
		if(pre_img.width>fix_w)
		{
			pre_img.height = parseInt((fix_w * pre_img.height) / pre_img.width);
			pre_img.width=fix_w;
			
			pre_img.onclick = function(){ popImgWin(pre_img.src); };
			pre_img.style.cursor = "pointer";
			
		}
		for(var i = 0;i<pre_img.length;i++)
		{
			if(pre_img[i].width>fix_w)
			{
				pre_img[i].height = parseInt((fix_w * pre_img[i].height) / pre_img[i].width);
				pre_img[i].width=fix_w;
				
				pre_img[i].onclick = new Function( "popImgWin('"+pre_img[i].src+"')" );
				pre_img[i].style.cursor = "pointer";
			}
		}
    } 
}

//¾ÆÀÌÇÁ·¹ÀÓ ¸®»çÀÌÁî
U.resizeFrame = function(Id){
	var obj = document.getElementById(Id);
	try {
		var contentObj;
		if(obj.contentWindow) contentObj = obj.contentWindow.document;
		else contentObj = eval(Id+".document");
		
		var Body;
		if(obj.contentWindow)
		{
			Body = contentObj.getElementsByTagName('BODY');
			Body = Body[0];
		}
		else 
			Body = contentObj.body;
		
		obj.style.height = Body.scrollHeight;

	}catch(e) {		
	}
	
	setTimeout("U.resizeFrame('"+Id+"')", 200);
}
