	/*
	  (c) 2007 <nox@ag.co.kr>, <noxajax@gmail.com> AhnGraphics Inc.
	  # Notice - required prototype.js
	*/

    var gChkId = 'allcheck';
    var gListChkName = 'msg_item';
	var gMsgNotSel = '¼±ÅÃµÈ °ÍÀÌ ¾ø½À´Ï´Ù.\nÇÏ³ª ÀÌ»óÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä!';

	function isStrEmpty (str) {
        if (null != str && 0 < getReplaceEmpty(str).length) {
            return false;
        }
        return true;
    }

    function getReplaceEmpty (str) {
        return str.replace(/\s+$/g, '');
    }

    function isNumber (str) {
        return !!str.match(/^\d+$/);
    }

	function isHangul (str) {
		return !!str.match(/^[°¡-ÆR]+$/);
	}

	function getOldYear (str) {
		// if (!isJumin(str)) return 0;
		var strYearKinds = str.substring(6, 7);
		if ('1' == strYearKinds || '2' == strYearKinds) {
			return parseInt('19' + str.substring(0, 2), 10);
		} else if ('3' == strYearKinds || '4' == strYearKinds) {
			return parseInt('20' + str.substring(0, 2), 10);
		} else {
			return 0;
		}
	}

	//ÁÖ¹Î¹øÈ£ Ã¼Å©
	function isJumin (str) {
		var num = getReplaceEmpty(str);
		if(13 == num.length) {
			num = num.substring(0, 6) + "-" + num.substring(6, 13);
		} else {
			return false;
		}
		num = num.match(/^([0-9]{6})-?([0-9]{7})$/);
		if(!num) return false;
		var num1 = RegExp.$1;
		var num2 = RegExp.$2;
		if(!num2.substring(0, 1).match(/^[1-4]{1}$/)) return false;
		num = num1 + num2;
		var sum = 0;
		var last = num.charCodeAt(12) - 0x30;
		var bases = "234567892345";
		for (i=0; i<12; i++) {
			sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
		}
		var mod = sum % 11;
		return ((11 - mod) % 10 == last) ? true : false;
	}

	//»ç¾÷ÀÚ ¹øÈ£ Ã¼Å©
	function isBizNum (str) {
		var num = getReplaceEmpty(str);
		if(10 == num.length) {
			num = num.substring(0, 3) + "-" + num.substring(3, 5) + "-" + num.substring(5, 10);
		}
		else {
			return false;
		}
		num = num.match(/([0-9]{3})-?([0-9]{2})-?([0-9]{5})/);
		if(!num) return false;
		num = RegExp.$1 + RegExp.$2 + RegExp.$3;
		var cVal = 0;
		for (var i=0; i<8; i++) {
			var cKeyNum = parseInt(((_tmp = i % 3) == 0) ? 1 : ( _tmp  == 1 ) ? 3 : 7);
			cVal += (parseFloat(num.substring(i,i+1)) * cKeyNum) % 10;
		}
		var li_temp = parseFloat(num.substring(i,i+1)) * 5 + '0';
		cVal += parseFloat(li_temp.substring(0,1)) + parseFloat(li_temp.substring(1,2));
		return (parseInt(num.substring(9,10)) == 10 - (cVal % 10)%10) ? true : false;
	}

	//¼ýÀÚ + ¾ËÆÄºª ÀÌ¿Ü ¹®ÀÚ Ã¼Å©
	function checkNumberAlphabet (event) {
		var reg = new RegExp('[^0-9|a-z|A-Z]', 'img');
		var objElement = Event.element(event);
        if (!!objElement && objElement.value.match(reg)) {
        	Event.stop(event);
        	alert('¼ýÀÚ ¶Ç´Â ¿µ¹®ÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
        	objElement.value = objElement.value.replace(reg, '');
        	objElement.focus();
        }
	}

	function checkPartNo (event) {
		//var reg = new RegExp('[^0-9|a-z|A-Z|-|/]', 'img');
		//var objElement = Event.element(event);
        //if (!!objElement && objElement.value.match(reg)) {
        //	Event.stop(event);
        //	alert('¼ýÀÚ ¶Ç´Â ¿µ¹®ÀÚ ¶Ç´Â "-" ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
        //	objElement.value = objElement.value.replace(reg, '');
        //	objElement.focus();
        //}
	}
	
	//¾ËÆÄºª ÀÌ¿Ü ¹®ÀÚ Ã¼Å©
	function checkAlphabet (event) {
		var reg = new RegExp('[^a-z|A-Z]', 'img');
		var objElement = Event.element(event);
        if (!!objElement && objElement.value.match(reg)) {
        	Event.stop(event);
        	alert('¿µ¹®ÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
        	objElement.value = objElement.value.replace(reg, '');
        	objElement.focus();
        }
	}
	
	//¼ýÀÚ ÀÌ¿Ü ¹®ÀÚ Ã¼Å©
    function checkNumber (event) {
    	var reg = new RegExp('[^0-9]', 'img');
        var objElement = Event.element(event);
        if (!!objElement && objElement.value.match(reg)) {
        	Event.stop(event);
        	alert('¼ýÀÚ¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
        	objElement.value = objElement.value.replace(reg, '');
        	objElement.focus();
        }
	}
	
	// ¾È¿¡ Value À¯¹« Ã¼Å©
    function checkForm(chkMsgs) {
        for (property in chkMsgs) {
            if (isStrEmpty($(property).value)) {
                alert(chkMsgs[property]);
		        $(property).focus();
		  	    return false;
            }
        }
	  return true;
	}
	
	// Ã¼Å©¹Ú½º ÇÑ¹ø¿¡ µÇ°Ô ÇÏ´Â function
    function selectCheckBoxAll(strName) {
		var tmpName = ('undefined' != typeof(strName) ? strName : gListChkName);
		eval('var chkStatus = typeof selectCheckBoxAll.' + tmpName + ';');
		if ('undefined' == chkStatus) {
			eval('selectCheckBoxAll.' + tmpName + ' = false;');
		}

		var nMax = getMsgLength(tmpName);
		var coll = document.getElementsByName(tmpName);
		for (var inx = 0; inx < nMax; inx++) {
			eval('coll[inx].checked = !selectCheckBoxAll.' + tmpName + ';');
		}
		eval('selectCheckBoxAll.' + tmpName + ' = !selectCheckBoxAll.' + tmpName + ';');
	}

	function getMsgLength(strName) {
		var nMax = 0;
		var coll = document.getElementsByName(strName);
		if (null != coll) {
			nMax = (typeof coll.length != 'undefined' ? coll.length : 1);
		}
		return nMax;
	}

    function isRowCheck(strName) {
		var tmpName = (typeof strName != 'undefined' ? strName : gListChkName);
		var nMax = getMsgLength(tmpName);
		var coll = document.getElementsByName(tmpName);
		for (var inx = 0; inx < nMax; inx++) {
			if (true ==  coll[inx].checked) return true;
		}
		return false;
	}

	function isAllSelectMsg(strName) {
		var tmpName = (typeof strName != 'undefined' ? strName : gListChkName);
		var nMax = getMsgLength(tmpName);
		var coll = document.getElementsByName(tmpName);
		for (var inx = 0; inx < nMax; inx++) {
		    if (true !=  coll[inx].checked) return false;
		}
		return true;
	}

	function setSelectAllCheckBox(chkAllObj, strName) {
		var tmpName = (typeof strName != 'undefined' ? strName : gListChkName);
	    if(true == isAllSelectMsg(strName)) {
	        eval('selectCheckBoxAll.' + tmpName + ' = true;');
	    } else {
	        eval('selectCheckBoxAll.' + tmpName + ' = false;');
	    }
	    eval('chkAllObj.checked = selectCheckBoxAll.' +  tmpName + ';');
	}

	//ÀÌ¸ÞÀÏ Ã¼Å©
	function isValidEmail (email) {
		var reg = new RegExp('^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$', 'img');
		return (!email.match (email) ? false : true);
	}

	function checkEmail (element) {
		if (!isValidEmail ($(element).value)) {
			alert ('¿Ã¹Ù¸£Áö ¾ÊÀº E-mail ÁÖ¼ÒÀÔ´Ï´Ù.');
			Element.focus ('element');
		}
	}

	//ÁÖ¹Îµî·Ï¹øÈ£ Æ÷Ä¿½ºÀÌµ¿
	function moveFocus(num,fromform,toform){
      var str = fromform.value.length;
      if(str == num) {
        toform.focus();
      }
    }
