	/* ¼ýÀÚ ½ºÆ®¸µ Ã¼Å© */
	function digitstr(pstr) {
		var valid = "0123456789";
		return checkstr(pstr, valid, 0);
	}

	/* ¿µ¹®ÀÚ,¼ýÀÚ ½ºÆ®¸µ Ã¼Å© */
	function alphadigitstr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
		return checkstr(pstr, valid, 0);
	}

	/* ¿µ¹®ÀÚ,¼ýÀÚ,Æ¯¼ö¹®ÀÚ ½ºÆ®¸µ Ã¼Å© */
	function charstr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^*()_+`-={}|[]\\:\";'<>?,./&";
		return checkstr(pstr, valid, 0);
	}

	/* ·Î±×ÀÎ */
	function emailidstr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-@.";
		return checkstr(pstr, valid, 0);
	}

	/* ´Ð³×ÀÓ(º°¸í) ½ºÆ®¸µ Ã¼Å© */
	function nickstr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.^/* ";
		return checkstr(pstr, valid, 1);
	}

	/* »óÈ£ ½ºÆ®¸µ Ã¼Å© */
	function corpstr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^*()_+`-={}|[]\\:\";'<>?,./& ";
		return checkstr(pstr, valid, 1);
	}

	/* ÇØ¿Ü°ÅÁÖ °¡ÀÔÀÚ ÀÌ¸§ Ã¼Å© */
	function fuserstr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz., ";
		return checkstr(pstr, valid, 1);
	}

	/* ¹®ÀÚ¿­ÀÇ BYTE ±æÀÌ ±¸ÇÏ±â */
	function bytelength(pstr) {
		var i, ch;
		len = pstr.length;
		for (i = 0; i < pstr.length; i++) {
			ch = pstr.substr(i,1).charCodeAt(0);
			if (ch > 127) { len++; }
		}
		return len;
	}

	/* ÇÑ±Û ½ºÆ®¸µ Ã¼Å© */
	function hanstr(pstr) {
		var i, ch;
		for (i = 0; i < pstr.length; i++) {
			ch = escape(pstr.charAt(i));        //ISO-Latin-1 ¹®ÀÚ¼ÂÀ¸·Î º¯°æ
			//°¡ ==> %uAC00
			//Èþ ==> %uD79D
			//ÆR ==> %uD7A3
			if (strCharByte(ch) != 2) {
				return false;
			}
		}
		return true;
	}

	/* ÇÑ±Û byte Ã¼Å© */
	function strCharByte(chStr) {

		if (chStr.substring(0, 2) == '%u') {

			/* alert(chStr.substring(2,6)); */
			if (chStr.substring(2,6) >= "AC00" && chStr.substring(2,6) <= "D7A3") {
				return 2;			/* ÇÑ±Û */
			} else {
				return 1;
			}

			/* ±¸¹öÀü */
			/*
			if (chStr.substring(2,4) == '00')
				return 1;
			else
				return 2;
			*/

		} else if (chStr.substring(0,1) == '%') {
			if (parseInt(chStr.substring(1,3), 16) > 127)
				return 2;			/* ÇÑ±Û */
			else
				return 1;
		} else {
			return 1;
		}

	}

	function checkstr(pstr, pvalid, han) {
		var valid = pvalid;
		var tmp;
		var flag = true;

		for (var i = 0; i < pstr.length; i++) {
			flag = true;
			tmp = "" + pstr.substring(i, i+1);

			if (han != 1) {
				if (valid.indexOf(tmp) == "-1") {
					return false;
				}
			} else {
				ch = escape(pstr.charAt(i));        //ISO-Latin-1 ¹®ÀÚ¼ÂÀ¸·Î º¯°æ
				if (valid.indexOf(tmp) == "-1" &&
					strCharByte(ch) != 2) {
					return false;
				}
			}
		}
		return true;;
	}

	function deleteCookie (name)
	{
		var exp = new Date();
		exp.setTime ( exp.getTime() - 1 );// This cookie is history
		var cval = getCookie (escape(name));
		document.cookie = escape(name) + "=" + cval + "; expires=" + exp.toGMTString() + "; path=/";
	}

	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 "";
	}

	function setCookie (name, value) {
		var argv = setJSCookie.arguments;
		var argc = setJSCookie.arguments.length;
		var expires = (2 < argc)? argv[2] : null;
		var path = (3 < argc)	? argv[3] : null;
		var domain = (4 < argc)	? argv[4] : null;
		var secure = (5 < argc)	? argv[5] : false;
		document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
	}

	/* ¹®ÀÚ¿­ÀÇ ¾çÂÊ(¿ÞÂÊ, ¿À¸¥ÂÊ) °ø¹é Á¦°Å */
	function trim(pstr) {
		var search = 0
		while (pstr.charAt(search) == " ") {
			search = search + 1
		}
		pstr = pstr.substring(search, (pstr.length))
		search = pstr.length - 1
		while (pstr.charAt(search) ==" ")
		{
			search = search - 1
		}
		return pstr.substring(0, search + 1)
	}

	function emailstr(emailStr) {

		/* The following variable tells the rest of the function whether or not
		   to verify that the address ends in a two-letter country or well-known
		   TLD.  1 means check it, 0 means don't. */

		var checkTLD = 1;

		/* The following is the list of known TLDs that an e-mail address must end with. */

		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

		/* The following pattern is used to check if the entered e-mail address
		   fits the user@domain format.  It also is used to separate the username
		   from the domain. */

		var emailPat = /^(.+)@(.+)$/;

		/* The following string represents the pattern for matching all special
		   characters.  We don't want to allow special characters in the address.
		   These characters include ( ) < > @ , ; : \ " . [ ] */

		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

		/* The following string represents the range of characters allowed in a
		   username or domainname.  It really states which chars aren't allowed.*/

		var validChars="\[^\\s" + specialChars + "\]";

		/* The following pattern applies if the "user" is a quoted string (in
		   which case, there are no rules about which characters are allowed
		   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
		   is a legal e-mail address. */

		var quotedUser="(\"[^\"]*\")";

		/* The following pattern applies for domains that are IP addresses,
		   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
		   e-mail address. NOTE: The square brackets are required. */

		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

		/* The following string represents an atom (basically a series of non-special characters.) */

		var atom = validChars + '+';

		/* The following string represents one word in the typical username.
		   For example, in john.doe@somewhere.com, john and doe are words.
		   Basically, a word is either an atom or quoted string. */

		var word="(" + atom + "|" + quotedUser + ")";

		// The following pattern describes the structure of the user

		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

		/* The following pattern describes the structure of a normal symbolic domain,
		   as opposed to ipDomainPat, shown above. */

		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

		/* Finally, let's start trying to figure out if the supplied address is valid. */

		/* Begin with the coarse pattern to simply break up user@domain into
		   different pieces that are easy to analyze. */

		var matchArray=emailStr.match(emailPat);

		if (matchArray == null) {

		/* Too many/few @'s or something; basically, this address doesn't
		   even fit the general mould of a valid e-mail address. */

			// alert("Email address seems incorrect (check @ and .'s)");
			return false;
		}

		var user=matchArray[1];
		var domain=matchArray[2];

		// Start by checking that only basic ASCII characters are in the strings (0-127).

		for (i=0; i<user.length; i++) {
			if (user.charCodeAt(i)>127) {
				// alert("Ths username contains invalid characters.");
				return false;
			}
		}

		for (i=0; i<domain.length; i++) {
			if (domain.charCodeAt(i)>127) {
				// alert("Ths domain name contains invalid characters.");
				return false;
			}
		}

		// See if "user" is valid
		if (user.match(userPat) == null) {

			// user is not valid

			// alert("The username doesn't seem to be valid.");
			return false;
		}

		/* if the e-mail address is at an IP address (as opposed to a symbolic
		   host name) make sure the IP address is valid. */

		var IPArray = domain.match(ipDomainPat);
		if (IPArray != null) {

			// this is an IP address
			for (var i = 1; i <= 4; i++) {
				if (IPArray[i] > 255) {
					// alert("Destination IP address is invalid!");
					return false;
				}
			}
			return true;
		}

		// Domain is symbolic name.  Check if it's valid.

		var atomPat = new RegExp("^" + atom + "$");
		var domArr = domain.split(".");
		var len = domArr.length;
		for (i = 0; i < len; i++) {
			if (domArr[i].search(atomPat)==-1) {
				// alert("The domain name does not seem to be valid.");
				return false;
			}
		}

		/* domain name seems valid, but now make sure that it ends in a
		   known top-level domain (like com, edu, gov) or a two-letter word,
		   representing country (uk, nl), and that there's a hostname preceding
		   the domain or country. */

		if (checkTLD && domArr[domArr.length-1].length!=2 &&
			domArr[domArr.length-1].search(knownDomsPat)==-1) {
			// alert("The address must end in a well-known domain or two letter " + "country.");
			return false;
		}

		// Make sure there's a host name preceding the domain.
		if (len<2) {
			// alert("This address is missing a hostname!");
			return false;
		}

		// If we've gotten this far, everything's valid!
		return true;
	}

	/* ¾ÆÀÌµð Ã¼Å© */
	function validUserid(fuserid) {
		var str = fuserid.value;
		var len = bytelength(str);

		if (str == "" || len == 0) {
			alert("¾ÆÀÌµð´Â ¹Ýµå½Ã ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù. ¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fuserid.focus();
			return false;
		}

        if (len < 4 || len > 12) {
            alert("¾ÆÀÌµð´Â 4±ÛÀÚ ÀÌ»ó 12±ÛÀÚ ÀÌÇÏÀÌ¾î¾ß ÇÕ´Ï´Ù. ¾ÆÀÌµð¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
            fuserid.focus();
           return false;
        }

		if (str.indexOf(" ") != -1) {
			alert("¾ÆÀÌµð¿¡´Â °ø¹éÀ» ³ÖÀ» ¼ö ¾ø½À´Ï´Ù. ¾ÆÀÌµð¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fuserid.focus();
            return false;
		}

        if (!alphadigitstr(str)) {
            alert("¾ÆÀÌµð´Â ¿µ¹®ÀÚ¿Í ¼ýÀÚ·Î¸¸ ÀÌ·ç¾îÁ®¾ß ÇÕ´Ï´Ù. ¾ÆÀÌµð¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
            fuserid.focus();
            return false;
        }

        return true;
	}

	/* ºñ¹Ð¹øÈ£ Ã¼Å© */
	function validPasswd(fpasswd, fname) {
		var str = fpasswd.value;
		var len = bytelength(str);
		if (!fname)		fname = "ºñ¹Ð¹øÈ£";

		if (str == "" || len == 0) {
			alert(fname+"´Â ¹Ýµå½Ã ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù. "+fname+"¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fpasswd.focus();
			return false;
		}

		if (str.indexOf(" ") != -1) {
			alert(fname+"¿¡´Â °ø¹éÀ» ³ÖÀ» ¼ö ¾ø½À´Ï´Ù. "+fname+"¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fpasswd.focus();
			return false;
		}

        if (!charstr(str)) {
            alert(fname+"´Â ¿µ¹®, ¼ýÀÚ, Æ¯¼ö¹®ÀÚ·Î¸¸ ÀÌ·ç¾îÁ®¾ß ÇÕ´Ï´Ù. "+fname+"¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
            fpasswd.focus();
            return false;
        }

        return true;
    }

	/* °ü¸®ÀÚ ºñ¹Ð¹øÈ£ Ã¼Å© */
	function admValidPasswd(fpasswd, fname) {
		var str = fpasswd.value;
		var len = bytelength(str);
		if (!fname)		fname = "ºñ¹Ð¹øÈ£";

		if (str.indexOf(" ") != -1) {
			alert(fname+"¿¡´Â °ø¹éÀ» ³ÖÀ» ¼ö ¾ø½À´Ï´Ù. "+fname+"¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fpasswd.focus();
			return false;
		}

        if (!charstr(str)) {
            alert(fname+"´Â ¿µ¹®, ¼ýÀÚ, Æ¯¼ö¹®ÀÚ·Î¸¸ ÀÌ·ç¾îÁ®¾ß ÇÕ´Ï´Ù. "+fname+"¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
            fpasswd.focus();
            return false;
        }

        return true;
    }


    /* ¸éÇã¹øÈ£ ¹øÈ£ Ã¼Å© */
    function licenseValid(flicense, fname) {
    	var str = flicense.value;
    	var len = bytelength(str);

		if (str.length == 0) {
			alert(fname+"¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			flicense.focus();
			return false;
		}

    	if (str.indexOf(" ") != -1) {
			alert(fname+"¿¡´Â °ø¹éÀ» ³ÖÀ» ¼ö ¾ø½À´Ï´Ù. "+fname+"¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			flicense.focus();
			return false;
		}

		if (!digitstr(str)) {
			alert(fname+"´Â ¼ýÀÚ·Î¸¸ ÀÌ·ç¾îÁ®¾ß ÇÕ´Ï´Ù. "+fname+"¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			flicense.focus();
			return false;
		}

		return true;
	}

	/* °ø¹éÀ» Á¦¿ÜÇÑ ½ºÆ®¸µÀÌ nullÀÎ°¡ Ã¼Å© */
	function isEmpty(fstr, fname) {
		var str = fstr.value;
		var len = bytelength(str);

		if (str.length == 0) {
			alert(fname+"¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fstr.focus();
			return false;
		}

		if (str.length != 0 && trim(str).length == 0) {
			alert(fname+"¿¡´Â °ø¹é°ª¸¸À» ³ÖÀ» ¼ö ¾ø½À´Ï´Ù. "+fname+"¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fstr.focus();
			return false;
		}

		return true;
	}

	/* °ø¹éÀ» Á¦¿ÜÇÑ ½ºÆ®¸µÀÌ nullÀÎ°¡ Ã¼Å© */
	function isEmpty2(fstr, fname) {
		var str = fstr.value;
		var len = bytelength(str);

		if (str.length != 0 && trim(str).length == 0) {
			alert(fname+"¿¡´Â °ø¹é°ª¸¸À» ³ÖÀ» ¼ö ¾ø½À´Ï´Ù. "+fname+"¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fstr.focus();
			return false;
		}

		return true;
	}

	/* ÀüÈ­(ÇÚµåÆù)¹øÈ£ Ã¼Å© bool:ÇÊ¼ö¿©ºÎ */
	function ponNumValid(fnum, fname, bool) {
		var str = fnum.value;
		var len = bytelength(str);

		if (bool == 1 && str.length == 0) {
			alert(fname+"¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fnum.focus();
			return false;
		}

    	if (str.indexOf(" ") != -1) {
			alert(fname+"¿¡´Â °ø¹éÀ» ³ÖÀ» ¼ö ¾ø½À´Ï´Ù. "+fname+"¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fnum.focus();
			return false;
		}

		if (!digitstr(str)) {
			alert(fname+"´Â ¼ýÀÚ·Î¸¸ ÀÌ·ç¾îÁ®¾ß ÇÕ´Ï´Ù. "+fname+"¸¦ ´Ù½Ã ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			fnum.focus();
			return false;
		}

		return true;
	}
