function setCookie(strName, strValue, expiredays) { 
	var todayDate = new Date(); 
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = strName + "=" + strValue + "; path=/; 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 " ";
}

/**
* ¹®ÀÚ¿­À» ÀÚ¸¥´Ù.
* len		: ¹®ÀÚ¿­À» ÀÚ¸¦ ±æÀÌ
* tail		: ÀÚ¸¥ÈÄ µÚ¿¡ ºÙÈú Ã·ÀÚ
* ex> strMsg.cut(20, '...');
*/
String.prototype.cut = function(len, tail) 
{
    var str = this;
    var l = 0;
    for (var i=0; i<str.length; i++) 
    {
        l += (str.charCodeAt(i) > 128) ? 2 : 1;
        if (l > len) return str.substring(0,i) + tail;
    }
    return str;
}

/**
* ¹®ÀÚ¿­ÀÇ ¾ÕµÚ °ø¹éÀ» ¾ø¾Ø´Ù
* ex> strMsg.trim();
*/
String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
}

/**
* ÆË¾÷À» ¸ð´ÏÅÍ Á¤ °¡¿îµ¥ ¶Ù¿î´Ù.
* nWidth	: ÆË¾÷ °¡·Î »çÀÌÁî
* nHeight	: ÆË¾÷ ¼¼·Î »çÀÌÁî
* strUrl	: ÆË¾÷ ÆäÀÌÁö URL
* strName	: ÆË¾÷¸í
* strScroll	: ½ºÆ®·Ñ¹Ù(auto, yes, no)
* strStatus	: »óÅÂ¹Ù(yes, no)
*/
function OnPopUp(nWidth, nHeight, strUrl, strName, strScroll, strStatus, strMenubar)  {
	cw = screen.availWidth; // È­¸é ³Êºñ
	ch = screen.availHeight; // È­¸é ³ôÀÌ

	sw = nWidth;// ¶ç¿ï Ã¢ÀÇ ³Êºñ
	sh = nHeight;// ¶ç¿ï Ã¢ÀÇ ³ôÀÌ

	ml = (cw-sw)/2;// °¡¿îµ¥ ¶ç¿ì±âÀ§ÇÑ Ã¢ÀÇ xÀ§Ä¡
	mt = (ch-sh)/2;// °¡¿îµ¥ ¶ç¿ì±âÀ§ÇÑ Ã¢ÀÇ yÀ§Ä¡

	strScroll	= strScroll=="" ? "no" : strScroll;
	strStatus	= strStatus=="" ? "no" : strStatus;
	strMenubar	= strMenubar=="" ? "no" : strMenubar;

	NewWindow = window.open(strUrl,strName,'width='+sw+',height='+sh+',top='+mt+',left='+ml+',toobar=no,scrollbars='+strScroll+',menubar='+strMenubar+',status='+strStatus+',directories=no,');
	NewWindow.focus();

	/*
	icheE_pop=window.open('http://pot.wooribank.com/pot/pib/tech/evt/wpevt_20090923_01t.jsp?redraw=no', 'iche_popup_event','width=530,top=200,height=410,left=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
	icheE_pop.focus();
	*/
}

/**
* ÆË¾÷À» ¸ð´ÏÅÍ Á¤ °¡¿îµ¥ ¶Ù¿î´Ù.
* nWidth	: ÆË¾÷ °¡·Î »çÀÌÁî
* nHeight	: ÆË¾÷ ¼¼·Î »çÀÌÁî
* strUrl	: ÆË¾÷ ÆäÀÌÁö URL
* strName	: ÆË¾÷¸í
* strScroll	: ½ºÆ®·Ñ¹Ù(auto, yes, no)
* strStatus	: »óÅÂ¹Ù(yes, no)
*/
function OnDialog(nWidth, nHeight, strUrl, strScroll, strStatus)  {
	try{
	cw = screen.availWidth; // È­¸é ³Êºñ
	ch = screen.availHeight; // È­¸é ³ôÀÌ

	sw = nWidth;// ¶ç¿ï Ã¢ÀÇ ³Êºñ
	sh = nHeight;// ¶ç¿ï Ã¢ÀÇ ³ôÀÌ

	ml = (cw-sw)/2;// °¡¿îµ¥ ¶ç¿ì±âÀ§ÇÑ Ã¢ÀÇ xÀ§Ä¡
	mt = (ch-sh)/2;// °¡¿îµ¥ ¶ç¿ì±âÀ§ÇÑ Ã¢ÀÇ yÀ§Ä¡

	strScroll = strScroll=="" ? "no" : strScroll;
	strStatus = strStatus=="" ? "no" : strStatus;

	//NewWindow = window.open(strUrl,strName,'width='+sw+',height='+sh+',top='+mt+',left='+ml+',toobar=no,scrollbars='+strScroll+',menubar=no,status='+strStatus+',directories=no,');
	//dialogTop:" + mt + "px; dialogLeft:" + ml + "px;
	NewWindow = window.showModalDialog(strUrl, self, "dialogWidth:" + sw + "px; dialogHeight:" + sh + "px; center:yes; resizable:no; scroll:" + strScroll + "; status:" + strStatus + ";");
	} catch (e) {
		alert(e);
	}
}

/**
* ActiveX HtmlÀ» ¾´´Ù.
* strClassId	: Å¬·¢½º ¾ÆÀÌµð
* strParam		: ÆÄ¶ó¸ÞÅÍ ¹®ÀÚ¿­
* width			: °¡·Î »çÀÌÁî
* height		: ¼¼·Î »çÀÌÁî
*/
function showObjectHtmlTag(strId, strClassId, strCodeBase, strParam, width, height) 
{
	document.write(setObject(strId, strClassId, strCodeBase, strParam, width, height));
}

/**
* ActiveX HtmlÀ» ¸¸µç´Ù.
* strClassId	: Å¬·¢½º ¾ÆÀÌµð
* strParam		: ÆÄ¶ó¸ÞÅÍ ¹®ÀÚ¿­
* width			: °¡·Î »çÀÌÁî
* height		: ¼¼·Î »çÀÌÁî
*/
function setObject(strId, strClassId, strCodeBase, strParam, width, height)
{
	objHtml = "<object id='" + strId + "' classid='clsid:" + strClassId + "'";

	if(strCodeBase != "")
		objHtml = objHtml + " codebase='" + strCodeBase + "'";

	objHtml = objHtml + " + width='" + width + "' height='" + height + "'>";
	objHtml = objHtml + "\r\n" + strParam;
	objHtml = objHtml + "</object>";
	return objHtml;
}

/**
* ÇÊµåÃ¼Å© À¯È¿¼º Ã¼Å©ÈÄ alert ¸Þ¼¼Áö ¹ÝÈ¯
* objField		: À‰µåÆû + ÇÊµå¸í
* strMsg		: À¯È¿¼ºÃ¼Å©ÈÄ º¸¿©ÁÙ ¸Þ¼¼Áö
* nLen			: ¹®ÀÚ Á¦ÇÑ ±æÀÌ
* ex> OnFieldCheck(form.field, 'ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.', 20)
*/
function OnTextFieldCheck(objField, strMsg, nLen)
{
	var field = eval(objField);

	if(field.value == "" || field.value.trim().length <= 0)
	{
		alert(strMsg);
		field.focus();
		return false;
	}
	else if(nLen > 0 && field.value.length > nLen)
	{
		alert("¹®ÀÚ¿­ÀÇ ±æÀÌ´Â " + nLen + "ÀÚ ÀÌÇÏ¸¸ Çã¿ëÇÕ´Ï´Ù.");
		field.value = field.value.cut(nLen, "");
		field.focus();
		return false;
	}
	else
		return true;
}

/**
* ÇÊµåÃ¼Å© À¯È¿¼º Ã¼Å©ÈÄ true, false ¹ÝÈ¯
* objField		: À‰µåÆû + ÇÊµå¸í
* strMsg		: À¯È¿¼ºÃ¼Å©ÈÄ º¸¿©ÁÙ ¸Þ¼¼Áö
* ex> OnDataCheck(form.field);
*/
function OnDataCheck(objField)
{
	var field = eval(objField);
	if(field.value != "" && field.value.trim().length > 0)
		return true;
	else
		return false;
}

/**
* ÇÊµåÀÇ ¹ÙÀÌÆ®¼ö°¡ Á¦ÇÑµÈ±æÀÌº¸´Ù ±æ´Ù¸é ÀÚ¸¥´Ù(ÇÑ±ÛÀº 2¹ÙÀÌÆ® Ã³¸®ÇÔ)
* objField		: À‰µåÆû + ÇÊµå¸í
* len			: Á¦ÇÑ ±æÀÌ
* ex> OnCheckField('form.field', 20)
*/
function OnCheckField(objField, len)
{
	var str = objField.value;
	var nLen = getByteLength(objField);

	if(len < nLen)
		objField.value = objField.value.cut(len, "");
}

/**
* ÀÔ·Â°ªÀÌ NULLÀÎÁö Ã¼Å©
*/
function isNull(input) 
{
    if (input.value == null || input.value == "")
        return true;

    return false;
}

/**
* ÀÔ·Â°ª¿¡ ½ºÆäÀÌ½º ÀÌ¿ÜÀÇ ÀÇ¹ÌÀÖ´Â °ªÀÌ ÀÖ´ÂÁö Ã¼Å©
* ex) if (isEmpty(form.keyword)) {
*         alert("°Ë»öÁ¶°ÇÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
*     }
*/
function isEmpty(input) 
{
    if (input.value == null || input.value.replace(/ /gi,"") == "")
        return true;

    return false;
}

/**
* ÀÔ·Â°ª¿¡ Æ¯Á¤ ¹®ÀÚ(chars)°¡ ÀÖ´ÂÁö Ã¼Å©
* Æ¯Á¤ ¹®ÀÚ¸¦ Çã¿ëÇÏÁö ¾ÊÀ¸·Á ÇÒ ¶§ »ç¿ë
* ex) if (containsChars(form.name,"!,*&^%$#@~;")) {
*         alert("ÀÌ¸§ ÇÊµå¿¡´Â Æ¯¼ö ¹®ÀÚ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
*     }
*/
function containsChars(input,chars) 
{
    for (var inx = 0; inx < input.value.length; inx++) 
	{
       if (chars.indexOf(input.value.charAt(inx)) != -1)
           return true;
    }

    return false;
}

/**
* ÀÔ·Â°ªÀÌ Æ¯Á¤ ¹®ÀÚ(chars)¸¸À¸·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
* Æ¯Á¤ ¹®ÀÚ¸¸ Çã¿ëÇÏ·Á ÇÒ ¶§ »ç¿ë
* ex) if (!containsCharsOnly(form.blood,"ABO")) {
*         alert("Ç÷¾×Çü ÇÊµå¿¡´Â A,B,O ¹®ÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
*     }
*/
function containsCharsOnly(input,chars) 
{
    for (var inx = 0; inx < input.value.length; inx++) 
	{
       if (chars.indexOf(input.value.charAt(inx)) == -1)
           return false;
    }

    return true;
}

/**
* ÀÔ·Â°ªÀÌ ¾ËÆÄºªÀÎÁö Ã¼Å©
* ¾Æ·¡ isAlphabet() ºÎÅÍ isNumComma()±îÁöÀÇ ¸Þ¼Òµå°¡
* ÀÚÁÖ ¾²ÀÌ´Â °æ¿ì¿¡´Â var chars º¯¼ö¸¦ 
* global º¯¼ö·Î ¼±¾ðÇÏ°í »ç¿ëÇÏµµ·Ï ÇÑ´Ù.
* ex) var uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
*     var lowercase = "abcdefghijklmnopqrstuvwxyz"; 
*     var number    = "0123456789";
*     function isAlphaNum(input) {
*         var chars = uppercase + lowercase + number;
*         return containsCharsOnly(input,chars);
*     }
*/
function isAlphabet(input) 
{
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    return containsCharsOnly(input,chars);
}

/**
* ÀÔ·Â°ªÀÌ ¾ËÆÄºª ´ë¹®ÀÚÀÎÁö Ã¼Å©
*/
function isUpperCase(input) 
{
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    return containsCharsOnly(input,chars);
}

/**
* ÀÔ·Â°ªÀÌ ¾ËÆÄºª ¼Ò¹®ÀÚÀÎÁö Ã¼Å©
*/
function isLowerCase(input) 
{
    var chars = "abcdefghijklmnopqrstuvwxyz";
    return containsCharsOnly(input,chars);
}

/**
* ÀÔ·Â°ª¿¡ ¼ýÀÚ¸¸ ÀÖ´ÂÁö Ã¼Å©
*/
function isNumber(input) 
{
    var chars = "0123456789";
    return containsCharsOnly(input,chars);
}

/**
* ÀÔ·Â°ªÀÌ ¾ËÆÄºª,¼ýÀÚ·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
*/
function isAlphaNum(input) 
{
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    return containsCharsOnly(input,chars);
}

/**
* ÀÔ·Â°ªÀÌ ¼ýÀÚ,´ë½Ã(-)·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
*/
function isNumDash(input) 
{
    var chars = "-0123456789";
    return containsCharsOnly(input,chars);
}

/**
* ÀÔ·Â°ªÀÌ ¼ýÀÚ,ÄÞ¸¶(,)·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
*/
function isNumComma(input) 
{
    var chars = ",0123456789";
    return containsCharsOnly(input,chars);
}

/**
* ÀÔ·Â°ªÀÌ »ç¿ëÀÚ°¡ Á¤ÀÇÇÑ Æ÷¸Ë Çü½ÄÀÎÁö Ã¼Å©
* ÀÚ¼¼ÇÑ format Çü½ÄÀº ÀÚ¹Ù½ºÅ©¸³Æ®ÀÇ `regular expression`À» ÂüÁ¶
*/
function isValidFormat(input,format) 
{
    if (input.value.search(format) != -1)
        return true; //¿Ã¹Ù¸¥ Æ÷¸Ë Çü½Ä

    return false;
}

/**
* ÀÔ·Â°ªÀÌ ÀÌ¸ÞÀÏ Çü½ÄÀÎÁö Ã¼Å©
* ex) if (!isValidEmail(form.email)) {
*         alert("¿Ã¹Ù¸¥ ÀÌ¸ÞÀÏ ÁÖ¼Ò°¡ ¾Æ´Õ´Ï´Ù.");
*     }
*/
function isValidEmail(input) 
{
//    var format = /^(\S+)@(\S+)\.([A-Za-z]+)$/;
    var format = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/;
    return isValidFormat(input,format);
}

/**
* ÀÔ·Â°ªÀÌ ÀüÈ­¹øÈ£ Çü½Ä(¼ýÀÚ-¼ýÀÚ-¼ýÀÚ)ÀÎÁö Ã¼Å©
*/
function isValidPhone(input) 
{
    var format = /^(\d+)-(\d+)-(\d+)$/;
    return isValidFormat(input,format);
}

/**
* ÀÔ·Â°ªÀÇ ¹ÙÀÌÆ® ±æÀÌ¸¦ ¸®ÅÏ
* ex) if (getByteLength(form.title) > 100) {
*         alert("Á¦¸ñÀº ÇÑ±Û 50ÀÚ(¿µ¹® 100ÀÚ) ÀÌ»ó ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.");
*     }
* Author : Wonyoung Lee
*/
function getByteLength(input) 
{
    var byteLength = 0;
    for (var inx = 0; inx < input.value.length; inx++) 
	{
        var oneChar = escape(input.value.charAt(inx));
        if ( oneChar.length == 1 )
            byteLength ++;
        else if (oneChar.indexOf("%u") != -1)
            byteLength += 2;
        else if (oneChar.indexOf("%") != -1)
            byteLength += oneChar.length/3;
    }
    return byteLength;
}

/**
* ÀÔ·Â°ª¿¡¼­ ÄÞ¸¶¸¦ ¾ø¾Ø´Ù.
*/
function removeComma(input) 
{
    return input.value.replace(/,/gi,"");
}

/**
* ¼±ÅÃµÈ ¶óµð¿À¹öÆ°ÀÌ ÀÖ´ÂÁö Ã¼Å©
*/
function hasCheckedRadio(input) 
{
    if (input.length > 1) 
	{
        for (var inx = 0; inx < input.length; inx++) 
		{
            if (input[inx].checked)
				return true;
        }
    } 
	else 
	{
        if (input.checked) 
			return true;
    }

    return false;
}

/**
* ¼±ÅÃµÈ Ã¼Å©¹Ú½º°¡ ÀÖ´ÂÁö Ã¼Å©
*/
function hasCheckedBox(input) 
{
    return hasCheckedRadio(input);
}

<!--///////////////////////////board search inputbox value "°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä" Ç¥½Ã/////////////////////////////////////////-->
function reset_search_keyword(check)
{
	if(check.value == check.defaultValue)
	check.value = '';
}
function restore_search_keyword(check)
{
	if(check.value == '')
	check.value = check.defaultValue;
}

