var enColor  = "";
var disColor = "#F0F0F0";

function fn_onKeyOnlyNumber()
{
	var sValid = "0123456789-";

	var sValue = event.srcElement.value;
		  sValue = sValue.replace(/,/gi,"");
	var iKey = event.keyCode;
	var isShift = event.shiftKey;
	var isMove = false;
	var isCut  = false
	var isTrue = true;

	event.srcElement.style.imeMode = "inactive"; 

	var sReturnValue = "";
	for (var ii=0; ii < sValue.length; ii++) {
		if (sValid.indexOf(sValue.substring(ii, ii+1)) >= 0) {
			sReturnValue = sReturnValue + sValue.substring(ii, ii+1);
		}
	}
	if ( (iKey == 37 || iKey == 38 || iKey == 39 || iKey == 40) ||
		 (iKey == 13 || iKey == 8  || iKey == 46 || iKey == 9  || iKey == 16  || isShift) || 
     	 (iKey == 189) || (iKey == 109) || 
		 (iKey >= 48 && iKey <= 57) || (iKey >= 95 && iKey <= 105)) {
		for (var ii=0; ii < sValue.length; ii++) {
			if (sValid.indexOf(sValue.substring(ii, ii+1)) < 0) {
				event.returnValue = false;
				isCut  = true;
				isTrue = false;
				break;
			}
		}
	} else {
		event.returnValue = false;
		isTrue = false;
	}

	if (isCut || isTrue == false)
		event.srcElement.value = sReturnValue;

	if (iKey == 13) {
		event.keyCode = 0;
		return sReturnValue;
	} else {
		return sReturnValue;
	}
}


function fn_allClear(objForm)
{
   if( objForm == null ){
    return;
   } 
    var len= objForm.all.length;

    for (ii=0; ii<len; ii++) {
        // ÂüÁ¶: type == "text", "select-one", "select-multiple"; obj.isTextEdit
        if (objForm.all[ii].type == "text" || objForm.all[ii].type == "textarea" ) {
            objForm.all[ii].value = "";
		}
        if ( objForm.all[ii].type == "select-one" || objForm.all[ii].type == "select-multiple"){
            objForm.all[ii].selectedIndex = 0;
		}
    }
}
//disables Ã³¸®
function fn_allDisable(objForm)
{
   if( objForm == null ){
    return;
   } 
    var len= objForm.all.length;

    for (ii=0; ii<len; ii++) {
        objForm.all[ii].disabled = true;
        // ÂüÁ¶: type == "text", "select-one", "select-multiple"; obj.isTextEdit
        if (objForm.all[ii].type == "text" || objForm.all[ii].type == "textarea" || objForm.all[ii].type == "select-one" || objForm.all[ii].type == "select-multiple")
            objForm.all[ii].style.background = "#F1F1F1";
    }
}
function fn_allUnReadonly(objForm)
{
   if( objForm == null ){
    return;
   }     
    var len= objForm.all.length;

    for (ii=0; ii<len; ii++) {
        // ÂüÁ¶: type == "text", "select-one", "select-multiple"; obj.isTextEdit
        if (objForm.all[ii].isTextEdit) {
            objForm.all[ii].readOnly = false;
            //objForm.all[ii].style.background = enColor;
        }
    }
}

function getObj(objName)
{
	obj = (IE4 == 1) ? eval("document.all." + objName) : document.forms[0].elements[objName];
	return obj;
}

function fn_focus(objTo, bSelection)
{
	if ( ((objTo.readonly == null) || (objTo.readonly != null && objTo.readonly == false)) &&
		 ((objTo.disabled == null) || (objTo.disabled != null && objTo.disabled == false)) &&
		 ((objTo.visible  == null) || (objTo.visible  != null && objTo.visible  == true )) &&
		 ((objTo.enabled  == null) || (objTo.enabled  != null && objTo.enabled  == true )) ) {
		objTo.focus();

		if ( (bSelection == null || (bSelection != null && bSelection == true)) &&
			 (objTo.isTextEdit) )
			objTo.select();
	}
	return;
}

function fn_setReadonly(obj)
{

    if (obj != null && obj.isTextEdit) {
        // ÂüÁ¶: type == "text", "select-one", "select-multiple"; obj.isTextEdit
        obj.readOnly = true;
        obj.style.background = disColor;
    }
}

function fn_allUnDisable(objForm)
{
   if( objForm == null ){
    return;
   } 
    var len= objForm.all.length;

    for (ii=0; ii<len; ii++) {
        objForm.all[ii].disabled = false;
        // ÂüÁ¶: type == "text", "select-one", "select-multiple"; obj.isTextEdit
        if (objForm.all[ii].type == "text" || objForm.all[ii].type == "textarea" || objForm.all[ii].type == "select-one" || objForm.all[ii].type == "select-multiple")
            objForm.all[ii].style.background = "White"
    }
}

function fn_MsgPopFocus(obj, sMsg)
{
	alert(sMsg);
	fn_focus(obj); //obj.focus();
}

function fn_isNotNullByValue()
{
	var isTrue = true;
	var sStr = "";
	for (var ii=0; ii < arguments.length; ii++) {
		sStr = fn_trim(arguments[ii]);
		if (sStr == "" || sStr == "null" || sStr == "undefined") {
			isTrue = false;
			break;
		}
	}
	return isTrue;
}
function fn_trim(text)
{
	if (text == null) {
		return "";
	}

	var txt = text + "";
	var flag = false;

	// ¾ÕÂÊ Æ®¸²
	var ii = 0;

	while (!flag) {
		var ch = txt.charAt(ii);
		if ( (ch == ' ') || (ch == '\t') || (ch == '\n') || (ch == '\r') ) {
			if (ii < txt.length)
				ii++;
			else
				flag = true;
		} else
			flag = true;
	}

	if (ii == (txt.length))
		return "";
	else
		txt = txt.substring(ii);

	// µÚÂÊ Æ®¸²
	flag = false;
	var jj = txt.length - 1;

	while (!flag) {
		var ch = txt.charAt(jj);
		if ( (ch == ' ') || (ch == '\t') || (ch == '\n') || (ch == '\r') ) {
			if ( jj > 0 )
				jj--;
			else
				flag = true;
		} else
			flag = true;
	}

	txt = txt.substring(0, jj+1);
	return txt;
}


/** =============================================
Return : boolean
Comment: E-mail ÁÖ¼Ò Ã¼Å© ÇÔ¼ö
Usage  :
---------------------------------------------- */
function fn_isEmail(email_addr)
{
	if (email_addr == "") return false;

	var t = email_addr;

	var Alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var Digit = '1234567890';
	var Symbol='_-';
	var check = '@.' + Alpha + Digit + Symbol;

	for (i=0; i < t.length; i++)
		if(check.indexOf(t.substring(i,i+1)) < 0)    {
			return false;
		}

	var check = '@';
	var a = 0;
	for (i=0; i < t.length; i++)
		if(check.indexOf(t.substring(i,i+1)) >= 0)    a = i;

	var check = '.';
	var b = 0;

	for (i=a+1; i < t.length; i++)
		if(check.indexOf(t.substring(i,i+1)) >= 0)  b = i;

	if (a != 0 && b != 0 && b!=t.length-1 ) {
		return true;
	} else {
		return false;
	}
}

function fn_formatThousandSep(sNum, bDefaultZeroSet)
{
	sStr = new String(sNum);
	sStr = sStr.replace(/,/gi,"");

	var sign = "";

	if(isNaN(sStr)) {
		if (bDefaultZeroSet == null || bDefaultZeroSet == true)
			sStr = 0;
	}

	if (sStr < 0) {
		sStr = sStr * (-1);
		sign = "-";
	} else {
		sStr = sStr * 1;
	}

	if( sStr != 0) {
		sStr = new String(sStr)
		var temp = "";
		var pos = 3;
		sStr_len = sStr.length;

		while (sStr_len > 0){
			sStr_len = sStr_len - pos;
			if (sStr_len < 0) {
				pos = sStr_len + pos;
				sStr_len = 0;
			}
			temp="," + sStr.substr(sStr_len,pos) + temp;
		}

		sStr = sign + temp.substr(1);
	}

	if (bDefaultZeroSet != null || bDefaultZeroSet == false) {
		if (sStr == 0) {
			sStr = "";
		}
	}

	return sStr;
}

//===============================================

/** =============================================
Return : number
Comment: ÀÔ·Â¹ÞÀº ¹®ÀÚ¿­ÀÇ ¹ÙÀÌÆ® ±æÀÌ RETURN
Usage  :
---------------------------------------------- */
function fn_getByteLengthByVal(sVal)
{
	var iMaxlength  = sVal.length;
	var sOneByteStr = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 !@#$%^&*(),./<>?;':\"=-_+";
	var iByteLength = 0;

	for(var ii = 0; ii < iMaxlength; ii++) {
		if (sVal.charCodeAt(ii) > 127) { // if (sOneByteStr.indexOf(sVal.substring(ii, ii+1)) < 0) {  // if (sVal.charCodeAt(ii) > 127) {
			iByteLength++;
			iByteLength++;
		} else {
			iByteLength++;
		}
	}
	return iByteLength;
}
//===============================================


<!--
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

//-->

