	// ＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊ ★
	// + 필수 폼 체크에 이미지 달기
	function formChkImg(className, formName) {

		// + 같은 페이지에서 formChk를 여러개 사용할 경우 입니다.
		if(formName == undefined) {
			var obj = $(':text,:password,:file');
		} else {
			var obj = $('form[name='+formName+'] :text, form[name='+formName+'] :password, form[name='+formName+'] :file');
		}

		$(obj).each(function(){
			if($(this).attr('chk') != null){
				$(this).addClass(className);
			}
		});
	}

	// ＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊ ★
	// + 옵션기능 [ formChk [ 폼체크 ] 연동 기능 ]
	function optionFormChk(option,me) {

		var chkResult = true;

		// + 추가 옵션 실행
		if($(option).size() > 0) {
			$.each(option, function(n){

				var optionFunctionAndAlertText = option[n].split('/');
				var optionFunction = optionFunctionAndAlertText[0];
				var optionAlertText = optionFunctionAndAlertText[1];
				var regexpText = optionFunctionAndAlertText[2]; // + 정규표현식 사용

				// + 정규표현식 사용에 따른 예외 처리
				if(optionFunction == 'regexp' && optionAlertText == '') {
					optionAlertText = '유효한 값이 아닙니다. 다시 입력해 주세요.';
				}

				// + 구분자로 설정해놓은 '/' 이 구문을 정규표현식에서 사용할 경우 정규표현식 구문으로 다시 조립한다.
				if(optionFunction == 'regexp') {
					var arrayCount = optionFunctionAndAlertText.length;
					if(arrayCount != 3) {
						for(var i=2;i<arrayCount;i++) {
							regexpText += '/'+optionFunctionAndAlertText[i];
						}
					}
				}

				// ＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊ ★
				// + 정규 표현식 등록

				var functionArray = new Array();

				// + numeral [ 숫자만 가능 ] [ 0 ~ 9 ] 주의 : 띄어쓰기 불가능
				// + ex) chk="numeral/경고문구";
				functionArray['numeral_defaultAlertText'] = '숫자형식으로만 입력이 가능 합니다.';
				functionArray['numeral_distinguish'] = /^[0-9]+$/;

				// + email [ 이메일 형식만 가능 ] [ test@nate.com ]
				// + ex) chk="email/경고문구";
				functionArray['email_defaultAlertText'] = '이메일 형식으로 작성해 주세요.';
				functionArray['email_distinguish'] = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;

				// + kor [ 한글만 가능 ] [ 가나다라 ... ] 주의 : ㄱㄴㄷ... 형식으로는 입력 불가능 , 띄어쓰기 불가능
				// + ex) chk="kor/경고문구":
				functionArray['kor_defaultAlertText'] = '한글만 입력 가능합니다.';
				functionArray['kor_distinguish'] = /^[가-힣]+$/;

				// + kors [ 한글만 가능 ] [ 가나다라 ... ] 주의 : ㄱㄴㄷ... 형식으로는 입력 불가능 , 띄어쓰기 가능
				// + ex) chk="kor/경고문구":
				functionArray['kors_defaultAlertText'] = '한글만 입력 가능합니다.';
				functionArray['kors_distinguish'] = /^[가-힣\s]+$/;
	
				// + eng [ 영문만 가능 ]
				functionArray['eng_defaultAlertText'] = '대소문자 영문만 입력 가능합니다.';
				functionArray['eng_distinguish'] = /^[a-zA-Z]+$/;

				// + engs [ 영문, 띄어쓰기만 가능 ]
				functionArray['engs_defaultAlertText'] = '대소문자 영문만 입력 가능합니다.';
				functionArray['engs_distinguish'] = /^[a-zA-Z\s]+$/;

				// + phone [ 전화번호 형태 000-0000-0000 만 받는다. ]
				functionArray['phone_defaultAlertText'] = '전화번호 형태로 작성해 주세요. ex) 000-0000-0000';
				functionArray['phone_distinguish'] = /^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/;

				// + domain [ 도메인 형태 : http:// https:// 포함해도 되고 안되도 된다. ]
				functionArray['domain_defaultAlertText'] = '도메인 형식으로 작성해 주세요.';
				functionArray['domain_distinguish'] = /^(((http(s?))\:\/\/)?)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/\S*)?$/;

				// + domain1 [ 도메인 형태 : http:// https:// 꼭 포함 ]
				functionArray['domain1_defaultAlertText'] = '도메인 형식으로 작성해 주세요. http:// 또는 https:// 를 포함한 도메인 주소를 입력해 주세요.';
				functionArray['domain1_distinguish'] = /^((http(s?))\:\/\/)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/\S*)?$/;

				// + domain2 [ 도메인 형태 : http:// https:// 포함하면 안됨 ]
				functionArray['domain2_defaultAlertText'] = '도메인 형식으로 작성해 주세요. http:// 또는 https://의 빼고 입력해 주세요.';
				functionArray['domain2_distinguish'] = /^[^((http(s?))\:\/\/)]([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/\S*)?$/;

				// + kor_eng [ 한글과 영문만 가능함 ]
				functionArray['kor_eng_defaultAlertText'] = '한글과 영문만으로 작성하실수 있습니다.';
				functionArray['kor_eng_distinguish'] = /^[가-힣a-zA-Z]+$/;

				// + numeral_eng [ 숫자와 알파벳만 가능함 ]
				functionArray['numeral_eng_defaultAlertText'] = '숫자와 영문만으로 작성하실수 있습니다.';
				functionArray['numeral_eng_distinguish'] = /^[a-zA-Z0-9]+$/;

				// + emailx [ daum.net 과 , hanmail.net 은 사용할수 없음 ]
				functionArray['emailx_defaultAlertText'] = 'daum.net과 hanmail.net은 이메일로 사용할수가 없습니다. 다른 이메일을 입력해주세요.';
				functionArray['emailx_distinguish'] = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;

				// + regexp [ 정규표현식으로 폼체크를 사용하실수 있습니다. ] 
				// + ex) chk="regexp/경고문구/정규표현식"
				functionArray['regexp_defaultAlertText'] = optionAlertText;
				functionArray['regexp_distinguish'] = new RegExp(regexpText);
	
				// ＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊ ★

				// + 정규 표현식 폼체크
				if(functionArray[optionFunction+'_distinguish'] != undefined) {
					if(functionArray[optionFunction+'_distinguish'].test($(me).val()) === false) {
						if(optionAlertText == undefined) {
							alert(functionArray[optionFunction+'_defaultAlertText']);
						} else {
							alert(optionAlertText);
						}
						chkResult = false;
						return false;
				}

				} else {

					// + 정규 표현식 아닌 것들에 대한 폼체크
					switch(optionFunction) {

						// + 주민번호 체크
						case('ssn') :
							var value = $(me).val();
							value = value.replace('-', '');

							var ssnCheck = 0;
							for (var i = 0; i < 12; i++) {
								ssnCheck += (i % 8 + 2) * value.charAt(i);
							}
							ssnCheck = (11 - ssnCheck % 11) % 10;

							if(ssnCheck != value.charAt(12)) {
								if(optionAlertText == undefined) {
									alert('올바른 주민번호가 아닙니다. 주민번호를 확인해 주세요.');
								} else {
									alert(optionAlertText);
								}
								chkResult = false;
								return false;
							}
							break;

						// + 사업자 등록번호
						case('bssn') :

							var value = $(me).val();
							value = value.replace(/-/g, '');

							var sum = 0;
							var getlist =new Array(10);
							var chkvalue =new Array("1","3","7","1","3","7","1","3","5");
							for(var i=0; i<10; i++) { getlist[i] = value.substring(i, i+1); }
							for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }
							sum = sum + parseInt((getlist[8]*5)/10);
							sidliy = sum % 10;
							sidchk = 0;
							if(sidliy != 0) { sidchk = 10 - sidliy; }
							else { sidchk = 0; }
							if(sidchk != getlist[9]) {
								if(optionAlertText == undefined) {
									alert('올바른 사업자 번호가 아닙니다. 사업자 번호를 확인해 주세요.');
								} else {
									alert(optionAlertText);
								}
								chkResult = false;
								return false;
							}
							break;

							// + nsb [ numeral small big 의 약자 ] [ 숫자의 값의 최소와 최대를 정하여 조건을 설정합니다. ex] option/min/max/alert ]
							case('nsb') :

								var nsbOption = option[n].split('/');
								var min = parseInt(nsbOption[1]);
								var max = parseInt(nsbOption[2]);
								var optionAlertText = nsbOption[3];
								var value = parseInt($(me).val());

								if(min != 0 && max != 0) {
									if(value < min || value > max) {
										if(optionAlertText == undefined) {
											alert(min+'보다 크거나 같고'+max+'보다 작거나 같은 값이어야 합니다.');
										} else {
											alert(optionAlertText);
										}
										chkResult = false;
										return false;
									}
								} else if(min == 0 && max != 0) {
									if(value > max) {
										if(optionAlertText == undefined) {
											alert(max+'이거나 작은 값이어야 합니다.');
										} else {
											alert(optionAlertText);
										}
										chkResult = false;
										return false;
									}
								} else if(min != 0 && max == 0) {
									if(value <= min) {
										if(optionAlertText == undefined) {
											alert(min+'보다 큰 값이어야 합니다.');
										} else {
											alert(optionAlertText);
										}
										chkResult = false;
										return false;
									}
								}

								break;

							// + tsb [text small big 의 약자 ] [ 문자열 길이 최소와 최대를 정하여 조건을 설정합니다. ]
							case('tsb') :

								var nsbOption = option[n].split('/');
								var min = nsbOption[1];
								var max = nsbOption[2];
								var optionAlertText = nsbOption[3];
								var value = $(me).val();

								var valueLength = value.length;

								if(min != 0 && max != 0) {
									if(valueLength < min || valueLength > max) {
										if(optionAlertText == undefined) {
											alert(min+'~'+max+' 자릿수로 입력해주세요.');
										} else {
											alert(optionAlertText);
										}
										chkResult = false;
										return false;
									}
								} else if(min == 0 && max != 0) {
									if(valueLength > max) {
										if(optionAlertText == undefined) {
											alert(max+'거나 작은 자릿수로 입력해 주세요.');
										} else {
											alert(optionAlertText);
										}
										chkResult = false;
										return false;
									}
								} else if(min != 0 && max == 0) {
									if(valueLength <= min) {
										if(optionAlertText == undefined) {
											alert(min+'거나 큰 자릿수로 입력해 주세요.');
										} else {
											alert(optionAlertText);
										}
										chkResult = false;
										return false;
									}
								}
								break;
							
							// + march [ 지금 현재 값과 비교하려는 정보의 값이 일치한지를 비교 합니다. ]
							case('march') :
								
								var value = $(me).val();
								var marchOption = option[n].split('/');
								var marchName = marchOption[1];
								var optionAlertText = marchOption[2];
								var marchText = $('input[name='+marchName+']').val();

								if(marchText != value) {
									if(optionAlertText == undefined) {
										alert('값이 일치하지 않습니다. 다시한번더 확인해 주세요.');
									} else {
										alert(optionAlertText);
									}
									chkResult = false;
									return false;
								}
								break;

							// + 선택된 라디오 버튼의 값이 들어와야 합니다.
							case('thisRadio') :
								if($(me).attr('checked') === false) {
									if(optionAlertText == undefined) {
										alert('약관의 동의해 해주세요.');
									} else {
										alert(optionAlertText);
									}
									chkResult = false;
									return false;
								}
								break;

							// + 체크박스의 값이 하나도 업으면 안되고 몇게 이상으로 선택 가능합니다.
							case('emptyCheck') :

								var value = $(me).val();
								var emptyCheckOption = option[n].split('/');
								var completeNum = emptyCheckOption[1];
								var chkName = emptyCheckOption[2];
								var optionAlertText = emptyCheckOption[3];
								var helloNum = 0;
								
								if($(me).attr('checked') == true) {
									helloNum++;
								} 

								$(':checkbox').each(function() {
									if($(this).attr(chkName) != null) {
										if($(this).attr('checked') == true) {
											helloNum++;		
										}
									}
								});

								if(helloNum < completeNum) {
									if(optionAlertText == undefined) {
										alert(completeNum+'개 이상 선택 하셔야 합니다.');
									} else {
										alert(optionAlertText);
									}
									chkResult = false;
									return false;
								}
								break;

							// + 선택된 라디오 버튼의 값이 들어와야 합니다.
							case('same') :

								var value = $(me).val();
								var sameOption = option[n].split('/');
								var sameText = sameOption[1];
								var optionAlertText = sameOption[2];

								if(value != sameText) {
									if(optionAlertText == undefined) {
										alert('원하는 값이 아닙니다. 다시 입력해 주세요.');
									} else {
										alert(optionAlertText);
									}
									chkResult = false;
									return false;
								}
								break;

					} // + switch 끝
				} // + 정규 표현식 폼체크 끝

			}); // + $.each 끝
		} // + 추가 옵션 실행 끝

		if(chkResult === true) {
			return true;
		} else {
			return false;
		}

	} // + 옵션 끝

	// ＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊ ★
	// + 폼체크
	function formChk(formName) {

		var returnChk = true;
		var chkResult = true;
		var defaultAlertText = '필수 입력 사항 입니다.';
		
			// + 같은 페이지에서 formChk를 여러개 사용할 경우 입니다.
			if(formName == undefined) {
				var obj = $('input, select, textarea');
			} else {
				var obj = $('form[name='+formName+'] input, form[name='+formName+'] select, form[name='+formName+'] textarea');
			}
				
			$(obj).each(function() {
			
			if($(this).attr('chk') != null) {
				var me = this;
				var option = $(this).attr('chk');
				var alt = $(this).attr('alt');
				var hid = $(this).css("display");
				if(hid == "none")
					return ;

				// + 옵션명을 나눈다.
				if(option != '') {
					option = option.split(',');
				}

				// + 각타입에 따라 필수 검사를 한다.
				switch($(this).attr('type')){
					case 'text' :

						if(returnChk === false || chkResult === false) { return false; }

						if($(this).val() == '') {
							if(alt == '') {
								alert(defaultAlertText);
							} else {
								alert(alt);
							}
							$(this).focus();
							returnChk = false;
							return false;
						}

						chkResult = optionFormChk(option,this);

						if(chkResult === false) {
							$(this).focus();
						}
						
						break;

					case 'file' :

						if(returnChk === false || chkResult === false) { return false; }

						if($(this).val() == '') {
							if(alt == '') {
								alert(defaultAlertText);
							} else {
								alert(alt);
							}
							$(this).focus();
							returnChk = false;
							return false;
						}

						chkResult = optionFormChk(option,this);

						if(chkResult === false) {
							$(this).focus();
						}

						break;

					case 'select-one' :

						if(returnChk === false || chkResult === false) { return false; }

						if($(this).find(':selected').val() == '') {
							if(alt == '') {
								alert(defaultAlertText);
							} else {
								alert(alt);
							}
							$(this).focus();
							returnChk = false;
							return false;
						}

						break;

					case 'checkbox' :

						if(returnChk === false || chkResult === false) { return false; }

						if($(this).attr('checked') == false) {
							if(alt == '') {
								alert(defaultAlertText);
							} else {
								alert(alt);
							}
							$(this).focus();
							returnChk = false;
							return false;
						}

						chkResult = optionFormChk(option,this);

						if(chkResult === false) {
							$(this).focus();
						}

						break;

					case 'radio' :

						if(returnChk === false || chkResult === false) { return false; }

						var radioName = $(this).attr('name');
						if($(':radio[name='+radioName+']:checked').val() == undefined) {
							if(alt == '') {
								alert(defaultAlertText);
							} else {
								alert(alt);
							}
							$(this).focus();
							returnChk = false;
							return false;
						}

						chkResult = optionFormChk(option,this);

						if(chkResult === false) {
							$(this).focus();
						}

						break;

					case 'textarea' :

						if(returnChk === false || chkResult === false) { return false; }

						if($(this).val() == '') {
							alert($(this).attr('alt'));
							$(this).focus();
							returnChk = false;
							return false;
						}

						break;

					case 'password' :
						if(returnChk === false || chkResult === false) { return false; }

						if($(this).val() == '') {
							if(alt == '') {
								alert(defaultAlertText);
							} else {
								alert(alt);
							}
							$(this).focus();
							returnChk = false;
							return false;
						}

						chkResult = optionFormChk(option,this);

						if(chkResult === false) {
							$(this).focus();
						}

						break;
				
				} // + switch 끝

			} 
			
			// + nochk [ 필수 입력 사항은 아니지만 값을 적었을 경우 폼 체크를 합니다. ]
			if($(this).attr('nochk') != null) {

				var me = this;
				var option = $(this).attr('nochk');
				var alt = $(this).attr('alt');

				// + 옵션명을 나눈다.
				if(option != '') {
					option = option.split(',');
				}

				// + 각타입에 따라 필수 검사를 한다.
				switch($(this).attr('type')){
					case 'text' :
						if(returnChk === false || chkResult === false) { return false; }

						if($(this).val() != '') {
							chkResult = optionFormChk(option,this);
							if(chkResult === false) {
								$(this).focus();
							}
						}
						
						break;

					case 'file' :

						if(returnChk === false || chkResult === false) { return false; }

						if($(this).val() != '') {
							chkResult = optionFormChk(option,this);
							if(chkResult === false) {
								$(this).focus();
							}
						}

						break;

					case 'select-one' :

						if(returnChk === false || chkResult === false) { return false; }

						if($(this).find(':selected').val() != '') {
							chkResult = optionFormChk(option,this);
							if(chkResult === false) {
								$(this).focus();
							}
						}

						break;

					case 'checkbox' :

						if(returnChk === false || chkResult === false) { return false; }

						chkResult = optionFormChk(option,this);
						if(chkResult === false) {
							$(this).focus();
						}

						break;

					case 'radio' :

						if(returnChk === false || chkResult === false) { return false; }

						var radioName = $(this).attr('name');
						if($(':radio[name='+radioName+']:checked').val() != undefined) {
							chkResult = optionFormChk(option,this);
							if(chkResult === false) {
								$(this).focus();
							}
						}

						break;

					case 'textarea' :

						if(returnChk === false || chkResult === false) { return false; }

						if($(this).val() != '') {
							chkResult = optionFormChk(option,this);
							if(chkResult === false) {
								$(this).focus();
							}
						}

						break;

					case 'password' :
						if(returnChk === false || chkResult === false) { return false; }

						if($(this).val() != '') {
							chkResult = optionFormChk(option,this);
							if(chkResult === false) {
								$(this).focus();
							}
						}

						break;
				} // + switch 끝
			
			}

		}); // + each 끝

		if(returnChk === true && chkResult === true) {
			return true;
		} else {
			return false;
		}

	} // + 폼체크 끝
