//included
if (REQUIRE_ONCE == null)
{
    // ÇÑ¹ø¸¸ ½ÇÇàµÇ°Ô
    var REQUIRE_ONCE = true;

    var VerifyMsg = "";
    var VerifyFld = null;
    var VerifyFldDefaultColor = "";
    var VerifyFldBackColor = "";
    var arrAttr  = new Array ("required", "trim", "minlength", "email", "nospace", "number", "charonly", "english");

    // subject ¼Ó¼º°ªÀ» ¾ò¾î return, ¾øÀ¸¸é tagÀÇ nameÀ» ³Ñ±è
    function VerifyItemname(fld)
    {
        var itemname = fld.getAttribute("itemname");
        if (itemname != null && itemname != "")
            return itemname;
        else
            return fld.name;
    }

    // ¾çÂÊ °ø¹é ¾ø¾Ö±â
    function VerifyTrim(fld) 
    {
        var pattern = /(^\s*)|(\s*$)/g; // \s °ø¹é ¹®ÀÚ
        fld.value = fld.value.replace(pattern, "");
        return fld.value;
    }

    // ÇÊ¼ö ÀÔ·Â °Ë»ç
    function VerifyRequired(fld)
    {
        if (VerifyTrim(fld) == "") {
            if (VerifyFld == null) {
								if(fld.type == "select-one")
                	VerifyMsg = VerifyItemname(fld) + " ¼±ÅÃÇØÁÖ¼¼¿ä.       \n";
								else
                	VerifyMsg = VerifyItemname(fld) + " ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.       \n";
                VerifyFld = fld;
            }
        }
    }

    // ÃÖ¼Ò ±æÀÌ °Ë»ç
    function VerifyMinlength(fld)
    {
        var len = fld.getAttribute("minlength");
        if (fld.value.length < len) {
            if (VerifyFld == null) {
                VerifyMsg = VerifyItemname(fld) + " ÃÖ¼Ò " + len + "ÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä.       \n";
                VerifyFld = fld;
            }
        }
    }

    // ÀüÀÚ¸ÞÀÏÁÖ¼Ò Çü½Ä °Ë»ç
    function VerifyEmail(fld) 
    {
        if (!VerifyTrim(fld)) return;

        //var pattern = /(\S+)@(\S+)\.(\S+)/; ÀüÀÚ¸ÞÀÏÁÖ¼Ò¿¡ ÇÑ±Û »ç¿ë½Ã
        var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
        if (!pattern.test(fld.value)) {
            if (VerifyFld == null) {
                VerifyMsg = VerifyItemname(fld) + " ÀüÀÚ¸ÞÀÏÁÖ¼Ò Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.       \n";
                VerifyFld = fld;
            }
        }
    }

    // °ø¹é °Ë»çÈÄ °ø¹éÀ» "" ·Î º¯È¯
    function VerifyNospace(fld)
    {
        var pattern = /(\s)/g; // \s °ø¹é ¹®ÀÚ
        if (pattern.test(fld.value)) {
            if (VerifyFld == null) {
                VerifyMsg = VerifyItemname(fld) + " °ø¹éÀÌ ¾ø¾î¾ß ÇÕ´Ï´Ù.       \n";
                VerifyFld = fld;
            }
        }
    }


	 // ÀÚ¿¬¼ö °Ë»ç
    function VerifyNumber(fld)
    {
        if (isNaN(fld.value)||fld.value<0) {
            if (VerifyFld == null) {
                VerifyMsg = VerifyItemname(fld) + " 0 ÀÌ»óÀÇ ¼ýÀÚ·Î ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.       \n";
				fld.value="";
                VerifyFld = fld;
            }
        }
    }
	
	// ¿µ¼ýÀÚ Çü½Ä °Ë»ç
    function VerifyChar(fld) 
    {
        if (!VerifyTrim(fld)) return;

        var pattern = /[0-9a-zA-Z]+/;
		if (!pattern.test(fld.value)) {
            if (VerifyFld == null) {
                VerifyMsg = VerifyItemname(fld) + " ¿¡´Â ¿µ¼ýÀÚ¸¸ ÀÔ·ÂÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.       \n";
				fld.value="";
                VerifyFld = fld;
            }
        }
    }

	// ¿µÀÚ Çü½Ä °Ë»ç
    function VerifyEnglish(fld) 
    {
        if (!VerifyTrim(fld)) return;

        var pattern = /[a-zA-Z_-]+/;
		if (!pattern.test(fld.value)) {
            if (VerifyFld == null) {
                VerifyMsg = VerifyItemname(fld) + " ¿¡´Â ¿µ¹®¸¸ ÀÔ·ÂÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.       \n";
				fld.value="";
                VerifyFld = fld;
            }
        }
    }


    // submit ÇÒ ¶§ ¼Ó¼ºÀ» °Ë»çÇÑ´Ù.
    function VerifySubmit()
    {
        VerifyMsg = "";
        VerifyFld = null;

        var attr = null;

        // ÇØ´çÆû¿¡ ´ëÇÑ ¿ä¼ÒÀÇ °¹¼ö¸¸Å­ µ¹·Á¶ó
        for (var i = 0; i < this.elements.length; i++) {
            // Input tag ÀÇ type ÀÌ text, file, password ÀÏ¶§¸¸
            if (this.elements[i].type == "text" || 
                this.elements[i].type == "file" || 
                this.elements[i].type == "password" ||
				this.elements[i].type == "select-one" || 
                this.elements[i].type == "textarea") {
                // ¹è¿­ÀÇ ±æÀÌ¸¸Å­ µ¹·Á¶ó
                for (var j = 0; j < arrAttr.length; j++) {
                    // ¹è¿­¿¡ Á¤ÀÇÇÑ ¼Ó¼º°ú ºñ±³ÇØ¼­ ¼Ó¼ºÀÌ ÀÖ°Å³ª °ªÀÌ ÀÖ´Ù¸é
                    if (this.elements[i].getAttribute(arrAttr[j]) != null) {
                        // ±âº» »ö»óÀ¸·Î µ¹·Á³õ°í
                        this.elements[i].style.backgroundColor = VerifyFldDefaultColor;
                        switch (arrAttr[j]) {
                            case "required"  : VerifyRequired(this.elements[i]); break;
                            case "trim"      : VerifyRequired(this.elements[i]); break;
                            case "minlength" : VerifyMinlength(this.elements[i]); break;
                            case "email"     : VerifyEmail(this.elements[i]); break;
                            case "nospace"   : VerifyNospace(this.elements[i]); break;
							case "number"   : VerifyNumber(this.elements[i]); break;
							case "charonly"   : VerifyChar(this.elements[i]); break;
							case "english"   : VerifyEnglish(this.elements[i]); break;
                            default : break;
                        }
                    }
                }
            }
        }

        // ÇÊµå°¡ null ÀÌ ¾Æ´Ï¶ó¸é ¿À·ù¸Þ¼¼Áö Ãâ·ÂÈÄ Æ÷Ä¿½º¸¦ ÇØ´ç ¿À·ù ÇÊµå·Î ¿Å±è
        // ¿À·ù ÇÊµå´Â ¹è°æ»ö»óÀ» ¹Ù²Û´Ù.
        if (VerifyFld != null) {
            alert(VerifyMsg);
            VerifyFld.style.backgroundColor = VerifyFldBackColor;
            VerifyFld.focus();
            return false;
        }

        if (this.oldsubmit && this.oldsubmit() == false)  {
            return false;
        }

        return true;
    }

    // ÃÊ±â¿¡ onsubmitÀ» °¡·ÎÃ¤µµ·Ï ÇÑ´Ù.
    function formcheck_init()
    {
        for (var i = 0; i < document.forms.length; i++) {
            // onsubmit ÀÌº¥Æ®°¡ ÀÖ´Ù¸é ÀúÀåÇØ ³õ´Â´Ù.
            if (document.forms[i].onsubmit) document.forms[i].oldsubmit = document.forms[i].onsubmit;
            document.forms[i].onsubmit = VerifySubmit;
            for (var j = 0; j < document.forms[i].elements.length; j++) {
                // ÇÊ¼ö ÀÔ·ÂÀÏ °æ¿ì´Â * ¹è°æÀÌ¹ÌÁö¸¦ ÁØ´Ù.
                if (document.forms[i].elements[j].getAttribute("required") != null) {
                    //document.forms[i].elements[j].className = "text";
                    document.forms[i].elements[j].style.backgroundColor = VerifyFldDefaultColor;
					document.forms[i].elements[j].style.backgroundImage="url('/image/icon/required.gif')";
                    document.forms[i].elements[j].style.backgroundPosition = "top right";
                    document.forms[i].elements[j].style.backgroundRepeat = "no-repeat";
                }
            }
        }
    }

	// ÁÖ¹Îµî·Ï¹øÈ£ °Ë»ç
	function jumin_check(j1, j2) 
	{
			if (j1.value.length < 6 || j2.value.length < 7)
					return false;
	
			var sum_1 = 0;
			var sum_2 = 0;
			var at=0;
			var juminno= j1.value + j2.value;
			sum_1 = (juminno.charAt(0)*2)+
							(juminno.charAt(1)*3)+
							(juminno.charAt(2)*4)+
							(juminno.charAt(3)*5)+
							(juminno.charAt(4)*6)+
							(juminno.charAt(5)*7)+
							(juminno.charAt(6)*8)+
							(juminno.charAt(7)*9)+
							(juminno.charAt(8)*2)+
							(juminno.charAt(9)*3)+
							(juminno.charAt(10)*4)+
							(juminno.charAt(11)*5);
			sum_2=sum_1 % 11;
	
			if (sum_2 == 0) {
					at = 10;
			} else {
					if (sum_2 == 1) 
							at = 11;
					else 
							at = sum_2;
			}
			att = 11 - at;
			if (juminno.charAt(12) != att) {
					return false;
			}
	
			return true
	}

	

	

	

}

