function checkID(id) {
	if (id.value.trim() == "") {
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		id.focus();
		id.select();
		return false;
	}
	if (id.value.length < 3 || id.value.length > 15) {
		alert("¾ÆÀÌµð´Â 3ÀÚ ÀÌ»ó 15ÀÚ ÀÌÇÏ¸¦ »ç¿ëÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		id.focus();
		id.select();
		return false;
	}
	if (checkSpace(id.value)) {
		alert("¾ÆÀÌµð¿¡´Â ºóÄ­ÀÌ ÀÖÀ»¼ö ¾ø½À´Ï´Ù.");
		id.focus();
		id.select();
		return false;
	}
	if (checkLetter(id.value)) {
		alert("¾ÆÀÌµð´Â ¿µ¾î³ª ¼ýÀÚ¸¸ »ç¿ëÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		id.focus();
		id.select();
		return false;
	}
	return true;
}

function checkCode(code) {
	if (code.value.trim() == "") {
		alert("ÄÚµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		code.focus();
		code.select();
		return false;
	}
	if (code.value.length < 3 || code.value.length > 15) {
		alert("ÄÚµå´Â 3ÀÚ ÀÌ»ó 15ÀÚ ÀÌÇÏ¸¦ »ç¿ëÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		code.focus();
		code.select();
		return false;
	}
	if (checkSpace(code.value)) {
		alert("ÄÚµå¿¡´Â ºóÄ­ÀÌ ÀÖÀ»¼ö ¾ø½À´Ï´Ù.");
		code.focus();
		code.select();
		return false;
	}
	if (checkLetter(code.value)) {
		alert("ÄÚµå´Â ¿µ¾î³ª ¼ýÀÚ¸¸ »ç¿ëÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		code.focus();
		code.select();
		return false;
	}
	return true;
}

function checkName(name) {
	if (name.value.trim() == "") {
		alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä.");
		name.focus();
		return false;
	}
	for (var k = 0; k <= (name.value.length - 1); k++) {
		if (name.value.indexOf(" ") >= 0 ){
			alert("ÀÌ¸§¿¡´Â ºóÄ­ÀÌ ÀÖÀ» ¼ö ¾ø½À´Ï´Ù.");
			name.focus();
			name.select();
			return false;
		}
	}
	return true;
}

function checkPassword(pw, repw) {
	if (pw.value.trim() == "") {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		pw.focus();
		pw.select();
		return false;
	}
	if (pw.value.length < 4 || pw.value.length > 15) {
		alert("ºñ¹Ð¹øÈ£´Â 4ÀÚ ÀÌ»ó 15ÀÚ ÀÌÇÏ¸¦ »ç¿ëÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		pw.focus();
		pw.select();
		return false;
	}
	if (checkSpace(pw.value)) {
		alert("ºñ¹Ð¹øÈ£¿¡´Â ºóÄ­ÀÌ ÀÖÀ» ¼ö ¾ø½À´Ï´Ù.");
		pw.focus();
		pw.select();
		return false;
	}
	if (checkSpace(repw.value)) {
		alert("ºñ¹Ð¹øÈ£¿¡´Â ºóÄ­ÀÌ ÀÖÀ» ¼ö ¾ø½À´Ï´Ù.");
		repw.focus();
		repw.select();
		return false;
	}
	if (pw.value != repw.value) {
		alert("ºñ¹Ð¹øÈ£°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù.");
		pw.value = repw.value = "";
		pw.focus();
		pw.select();
		return false;
	}
	return true;
}

function checkEmail(email) {
	if (email.value.trim() == "") {
		alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		email.focus();
		email.select();
		return false;
	}
	if (email.value.indexOf(" ") != -1) {
		alert("ÀÌ¸ÞÀÏ¿¡´Â °ø¹éÀÌ Çã¿ëµÇÁö ¾Ê½À´Ï´Ù.");
		email.focus();
		email.select();
		return false;
	}
	if (email.value.indexOf("+") > -1) {
		alert("'+' ´Â ÀÌ¸ÞÀÏ¿¡ Æ÷ÇÔµÉ ¼ö ¾ø½À´Ï´Ù.");
		email.focus();
		email.select();
		return false;
	}
	if (email.value.indexOf("/") > -1) {
		alert("'/' ´Â ÀÌ¸ÞÀÏ¿¡ Æ÷ÇÔµÉ ¼ö ¾ø½À´Ï´Ù.");
		email.focus();
		email.select();
		return false;
	}
	if (email.value.indexOf(":") > -1) {
		alert("':' ´Â ÀÌ¸ÞÀÏ¿¡ Æ÷ÇÔµÉ ¼ö ¾ø½À´Ï´Ù."); 
		email.focus();
		email.select();
		return false;
	}
	if (email.value.indexOf("@") < 1) {
		alert("ÀÌ¸ÞÀÏ¿¡´Â '@'°¡ ´©¶ôµÇ¾ú½À´Ï´Ù.");
		email.focus();
		email.select();
		return false;
	}
	if (email.value.indexOf(".") == -1) {
		alert("ÀÌ¸ÞÀÏ¿¡¼­ '.'ÀÌ ´©¶ôµÇ¾ú½À´Ï´Ù.");
		email.focus();
		email.select();
		return false;
	}
	if (email.value.indexOf(".") - email.value.indexOf("@") == 1) {
		alert("ÀÌ¸ÞÀÏ¿¡´Â '@' ´ÙÀ½¿¡ ¹Ù·Î '.'ÀÌ ¿Ã ¼ö ¾ø½À´Ï´Ù.");
		email.focus();
		email.select();
		return false;
	}
	if (email.value.charAt(email.value.length - 1) == ".") {
		alert("'.'Àº ÀÌ¸ÞÀÏ ³¡¿¡ ¿Ã ¼ö ¾ø½À´Ï´Ù.");
		email.focus();
		email.select();
		return false;
	}
	return true;
}

function checkAddress(addr1, addr2) {
	if (addr1.value.trim() == "") {
		alert("¿ìÆí¹øÈ£°Ë»ö ¹öÆ°À» Å¬¸¯ÇØ¼­ ÁÖ¼Ò¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		addr1.focus();
		addr1.select();
		return false;
	} else if (addr2.value.trim() == "") {
		alert("»ó¼¼ÁÖ¼Ò¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		addr2.focus();
		addr2.select();
		return false;
	}
	return true;
}

function checkPhone(ph1, ph2, ph3) {
	if (ph1.value.trim() == "" || ph2.value.trim() == "" || ph3.value.trim() == "") {
		alert("ÀüÈ­¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		ph1.focus();
		ph1.select();
		return false;
	}
	if (!checkNumber(ph1.value)) {
		alert("ÀüÈ­¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		ph1.focus();
		ph1.select();
		return false;
	}
	if (!checkNumber(ph2.value)) {
		alert("ÀüÈ­¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		ph2.focus();
		ph2.select();
		return false;
	}
	if (!checkNumber(ph3.value)) {
		alert("ÀüÈ­¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		ph3.focus();
		ph3.select();
		return false;
	}
	return true;
}

function checkMobile(mobile1, mobile2, mobile3) {
	if (mobile1.value.trim() == "" || mobile2.value.trim() == "" || mobile3.value.trim() == "") {
		alert("ÈÞ´ëÆù¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		mobile1.focus();
		mobile1.select();
		return false;
	}
	if (!checkNumber(mobile1.value)) {
		alert("ÈÞ´ëÆù¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		mobile1.focus();
		mobile1.select();
		return false;
	}
	if (!checkNumber(mobile2.value)) {
		alert("ÈÞ´ëÆù¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		mobile2.focus();
		mobile2.select();
		return false;
	}
	if (!checkNumber(mobile3.value)) {
		alert("ÈÞ´ëÆù¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		mobile3.focus();
		mobile3.select();
		return false;
	}
	return true;
}

function checkFax(fax1, fax2, fax3) {
	if (fax1.value.trim() == "" || fax2.value.trim() == "" || fax3.value.trim() == "") {
		alert("ÆÑ½º¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		fax1.focus();
		fax1.select();
		return false;
	}
	if (!checkNumber(fax1.value)) {
		alert("ÆÑ½º¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		fax1.focus();
		fax1.select();
		return false;
	}
	if (!checkNumber(fax2.value)) {
		alert("ÆÑ½º¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		fax2.focus();
		fax2.select();
		return false;
	}
	if (!checkNumber(fax3.value)) {
		alert("ÆÑ½º¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		fax3.focus();
		fax3.select();
		return false;
	}
	return true;
}

function checkSSN(ssn1, ssn2) {
	if (ssn1.value.trim() == "") {
		alert("ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		ssn1.focus();
		ssn1.select();
		return false;
	}
	if (ssn2.value.trim() == "") {
		alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		ssn2.focus();
		ssn2.select();
		return false;
	}
	if (!checkNumber(ssn1.value)) {
		alert("ÁÖ¹Îµî·Ï¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		ssn1.focus();
		ssn1.select();
		return false; 
	}
	if (!checkNumber(ssn2.value)) {
		alert("ÁÖ¹Îµî·Ï¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		ssn2.focus();
		ssn2.select();
		return false;
	}
	if (ssn1.value.length > 0 && ssn1.value.length != 6) {
		alert("ÁÖ¹Îµî·Ï¹øÈ£¿¡ ¿À·ù°¡ ÀÖ½À´Ï´Ù.");
		ssn1.focus();
		ssn1.select();
		return false;
	}
	if (ssn2.value.length > 0 && ssn2.value.length != 7) {
		alert("ÁÖ¹Îµî·Ï¹øÈ£¿¡ ¿À·ù°¡ ÀÖ½À´Ï´Ù.");
		ssn1.focus();
		ssn1.select();
		return false;
	}
	if (ssn1.value.length == 6 && ssn2.value.length == 7) {
		var temp = "" + ssn1.value + ssn2.value;
		if (!checkJuminNumber(temp) && !checkForeignNumber(temp)) {
			alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
			ssn1.focus();
			ssn1.select();
			return false;
		}
	}
	return true;
}

function checkTax(tax1, tax2, tax3) {
	if (tax1.value.trim() == "") {
		alert("»ç¾÷ÀÚµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		tax1.focus();
		tax1.select();
		return false;
	}
	if (tax2.value.trim() == "") {
		alert("»ç¾÷ÀÚµî·Ï¹øÈ£ °¡¿îµ¥ÀÚ¸®¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		tax2.focus();
		tax2.select();
		return false;
	}
	if (tax3.value.trim() == "") {
		alert("»ç¾÷ÀÚµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		tax3.focus();
		tax3.select();
		return false;
	}
	if (!checkNumber(tax1.value)) {
		alert("»ç¾÷ÀÚµî·Ï¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		tax1.focus();
		tax1.select();
		return false; 
	}
	if (!checkNumber(tax2.value)) {
		alert("»ç¾÷ÀÚµî·Ï¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		tax2.focus();
		tax2.select();
		return false;
	}
	if (!checkNumber(tax3.value)) {
		alert("»ç¾÷ÀÚµî·Ï¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		tax3.focus();
		tax3.select();
		return false;
	}
	if (tax1.value.length > 0 && tax1.value.length != 3) {
		alert("»ç¾÷ÀÚµî·Ï¹øÈ£¿¡ ¿À·ù°¡ ÀÖ½À´Ï´Ù.");
		tax1.focus();
		tax1.select();
		return false;
	}
	if (tax2.value.length > 0 && tax2.value.length != 2) {
		alert("»ç¾÷ÀÚµî·Ï¹øÈ£¿¡ ¿À·ù°¡ ÀÖ½À´Ï´Ù.");
		tax2.focus();
		tax2.select();
		return false;
	}
	if (tax3.value.length > 0 && tax3.value.length != 5) {
		alert("»ç¾÷ÀÚµî·Ï¹øÈ£¿¡ ¿À·ù°¡ ÀÖ½À´Ï´Ù.");
		tax3.focus();
		tax3.select();
		return false;
	}
	if (tax1.value.length == 3 && tax2.value.length == 2 && tax3.value.length == 5) {
		var temp = "" + tax1.value + tax2.value + tax3.value;
		if (!checkBusinessNumber(temp)) {
			alert("»ç¾÷ÀÚµî·Ï¹øÈ£°¡ ¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
			tax1.focus();
			tax1.select();
			return false;
		}
	}
	return true;
}

function checkPeriod(sdate_yy, sdate_mm, sdate_dd, edate_yy, edate_mm, edate_dd) {
	var sdate = sdate_yy.value + "-" + sdate_mm.value + "-" + sdate_dd.value;
	var edate = edate_yy.value + "-" + edate_mm.value + "-" + edate_dd.value;
	if (sdate_yy.value.trim() == "") {
		alert("±â°£ÀÇ ½ÃÀÛÀÏ Áß ³âµµ¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		sdate_yy.focus();
		return false;
	}
	if (sdate_mm.value.trim() == "") {
		alert("±â°£ÀÇ ½ÃÀÛÀÏ Áß ´ÞÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		sdate_mm.focus();
		return false;
	}
	if (sdate_dd.value.trim() == "") {
		alert("±â°£ÀÇ ½ÃÀÛÀÏ Áß ÀÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		sdate_dd.focus();
		return false;
	}
	if (edate_yy.value.trim() == "") {
		alert("±â°£ÀÇ ¸¶Áö¸·ÀÏ Áß ³âµµ¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		edate_yy.focus();
		return false;
	}
	if (edate_mm.value.trim() == "") {
		alert("±â°£ÀÇ ¸¶Áö¸·ÀÏ Áß ´ÞÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		edate_mm.focus();
		return false;
	}
	if (edate_dd.value.trim() == "") {
		alert("±â°£ÀÇ ¸¶Áö¸·ÀÏ Áß ÀÏÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		edate_dd.focus();
		return false;
	}
	if (sdate > edate) {
		alert("±â°£ÀÇ ¸¶Áö¸·³¯ÀÌ ½ÃÀÛ³¯º¸´Ù ÀÌÀüÀÏ ¼ö´Â ¾ø½À´Ï´Ù.");
		sdate_yy.focus();
		return false;
	}
	return true;
}

function checkToday(sdate_yy, sdate_mm, sdate_dd) {
	var sdate = sdate_yy.value + "-" + sdate_mm.value + "-" + sdate_dd.value;
	var cur_date, temp = new Date();
	cur_date = temp.getYear();
	if (temp.getMonth() + 1 < 10) cur_date += "-0" + (temp.getMonth() + 1);
	else cur_date += "-" + (temp.getMonth() + 1);
	if (temp.getDate() < 10) cur_date += "-0" + temp.getDate();
	else cur_date += "-" + temp.getDate();
	if (cur_date > sdate) {
		alert("¼±ÅÃÇÏ½Å ³¯Àº ¿À´Ãº¸´Ù ÀÌÀüÀÏ ¼ö´Â ¾ø½À´Ï´Ù.");
		sdate_yy.focus();
		return false;
	}
	return true;
}

function checkAttachment(attach) {
	if (attach.value.trim() == "") {
		alert("Ã·ºÎÆÄÀÏÀ» ¼±ÅÃÇØ ÁÖ½Ê½Ã¿À.");
		attach.focus();
		return false;
	} else {
		if (attach.value.toLowerCase().match("\.exe") || attach.value.toLowerCase().match("\.php") || attach.value.toLowerCase().match("\.cgi") || attach.value.toLowerCase().match("\.htm") || attach.value.toLowerCase().match("\.html")) {
			alert("½ÇÇà ÆÄÀÏ È¤Àº ½ºÅ©¸³Æ® ÆÄÀÏÀº Ã·ºÎ°¡ ºÒ°¡´ÉÇÕ´Ï´Ù.\n´Ù½Ã ¼±ÅÃÇÏ¼¼¿ä.");
			attach.focus();
			return false;
		}
	}
	return true;
}

function checkPhoto(attach) {
	if (attach.value.trim() == "") {
		alert("»çÁøÆÄÀÏÀ» ¼±ÅÃÇØ ÁÖ½Ê½Ã¿À.");
		attach.focus();
		return false;
	} else {
		if (!(attach.value.toLowerCase().match("\.jpg"))) {
			alert("ÀÌ¹ÌÁö ÆÄÀÏÀÌ ¾Æ´Õ´Ï´Ù.\n\nJPG Çü½ÄÀÇ ÀÌ¹ÌÁö ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù.");
			attach.focus();
			return false;
		}
	}
	return true;
}

function checkPhotoGIF(attach) {
	if (attach.value.trim() == "") {
		alert("»çÁøÆÄÀÏÀ» ¼±ÅÃÇØ ÁÖ½Ê½Ã¿À.");
		attach.focus();
		return false;
	} else {
		if (!(attach.value.toLowerCase().match("\.jpg") || attach.value.toLowerCase().match("\.gif"))) {
			alert("ÀÌ¹ÌÁö ÆÄÀÏÀÌ ¾Æ´Õ´Ï´Ù.\n\nJPG, GIF Çü½ÄÀÇ ÀÌ¹ÌÁö ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù.");
			attach.focus();
			return false;
		}
	}
	return true;
}
