function checkString(str) {
	var strLen = 0;
	var maxLen = 0;
	for (var i=0;i<str.length;i++) {
		if (str.charAt(i) == " ")  strLen++;
	}
	if (strLen == str.length) return false;
	else                      return true;
}

function checkEmail(strEmail) {	
	var arrMatch = strEmail.match(/^(\".*\"|[A-Za-z0-9_-]([A-Za-z0-9_-]|[\+\.])*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9][A-Za-z0-9_-]*(\.[A-Za-z0-9][A-Za-z0-9_-]*)+)$/);
	if (arrMatch == null) return false;

	var arrIP = arrMatch[2].match(/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/);
	if (arrIP != null) {
		for (var i = 1; i <= 4; i++) {
			if (arrIP[i] > 255)  return false;
   		}
	}
	return true;
}

function checkIP(strIP) {	
	var arrMatch = strIP.match(/^(\".*\"|[A-Za-z0-9_-]([A-Za-z0-9_-]|[\+\.])*).(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9][A-Za-z0-9_-]*(\.[A-Za-z0-9][A-Za-z0-9_-]*)+)$/);
	if (arrMatch == null) return false;

	var arrIP = arrMatch[2].match(/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/);
	if (arrIP != null) {
		for (var i = 1; i <= 4; i++) {
			if (arrIP[i] > 255)  return false;
   		}
	}
	return true;
}

function checkRadio(check) {
	var temp = "no";
	for(var i=0; i < check.length; i++) {
		if (check[i].checked == true) temp = "yes";
	}
	if (temp == "yes") return true;
	else               return false;
}

function checkSelect(o) {
	if (o.options[0].selected == true) return false;
	else                               return true;
}

function checkDate(strDate) {
	var arrDate;
	var chkDate
	
	if (strDate.indexOf("-") != -1)  arrDate = strDate.split("-");
	else                             arrDate = strDate.split("/");

	if (arrDate.length != 3)         return false;
	
	chkDate = new Date(arrDate[0] + "/" + arrDate[1] + "/" + arrDate[2]);
	
	if (isNaN(chkDate) == true ||
		(arrDate[1] != chkDate.getMonth() + 1 || arrDate[2] != chkDate.getDate())) {
		return false;
	}
	
	return true;
}

function checkDateForm(strDate, chrSplit) {
	var s1, s2;
	s1 = strDate.substr(4,1);
	s2 = strDate.substr(7,1);
	if (s1 == chrSplit && s2 == chrSplit)   return true;
	else                                    return false;
}
function checkSSN(ssn1,ssn2) {
	if ((ssn1.value == "") || (ssn1.value == null))	{
		alert("주민등록번호를 입력하여 주세요.")
		ssn1.focus();
		ssn1.select();
		return true;
	}
	
	var chk =0;
	var yy = ssn1.value.substring(0,2);
	var mm = ssn1.value.substring(2,4);
	var dd = ssn1.value.substring(4,6);
	var sex = ssn2.value.substring(0,1);
	
	if ((ssn1.value.length!=6)||(yy <25||mm <1||mm>12||dd<1)){
		alert ("주민등록번호를 바로 입력하여 주십시오.");
		ssn1.focus();
		ssn1.select();
		return true;
	}

	if ((sex != 1 && sex !=2 )||(ssn2.value.length != 7 )){
		alert ("주민등록번호를 바로 입력하여 주십시오.");
		ssn2.focus();
		ssn2.select();
		return true;
	}

// 주민등록번호 체크//

	for (var i = 0; i <=5 ; i++){ 
		chk = chk + ((i%8+2) * parseInt(ssn1.value.substring(i,i+1)));
	}

	for (var i = 6; i <=11 ; i++){ 
		chk = chk + ((i%8+2) * parseInt(ssn2.value.substring(i-6,i-5)));
	}

	chk = 11 - (chk %11);
	chk = chk % 10;

	if (chk != ssn2.value.substring(6,7)) {
		alert ("유효하지 않은 주민등록번호입니다.");
		ssn2.focus();
		ssn2.select();
		return true;
	}	
}

function n_check(Objectname) {
	  var intErr
	  var strValue = Objectname.value
	  var retCode = 0

	  for (i = 0; i < strValue.length; i++) {
		var retCode = strValue.charCodeAt(i)
		var retChar = strValue.substr(i,1).toUpperCase()
		retCode = parseInt(retCode)

		if (retChar < "0" || retChar > "9") {
		  intErr = -1;
		  break;
		}
	  }
	  return (intErr);
}