<!--
function ChkID(){
	//alert("hello");
	if (event.keyCode<13 || (event.keyCode>13 && event.keyCode<48) || (event.keyCode>57 && event.keyCode<97) || event.keyCode>122) {
		//alert("กรุณาใส่ตัวอักษรพิมพ์เล็กภาษาอังกฤษ หรือตัวเลขเท่านั้น");
		event.returnValue = false;
	}
}

function ChkNumber(){
	if (event.keyCode<13 || (event.keyCode>13 && event.keyCode<48) || event.keyCode>57) {
		//alert("??????????????????????");
		event.returnValue = false;
	}
}

function ChkName(){
	if ((event.keyCode>47 && event.keyCode<58) || (event.keyCode>3663 && event.keyCode<3674)) {
		//alert("??????????????????????");
		event.returnValue = false;
	}
}

function trim(s) {
  while (s.substring(0,1) == ' ') {
	s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
	s = s.substring(0,s.length-1);
  }
  return s;
}	

function chkIDCard(strID){		
	var strTmp = new String(strID);
	var iSumDigit = 0; 
	var iCheckDigit = 0;
	strTmp = trim(strTmp);
	strExcep = "1234567891011";						
	
	if ( strTmp.length != 13 ){ return false; } 
	if ( strTmp == strExcep ){ return false; } 
	if ((strTmp.charCodeAt(0) == 48) || (strTmp.charCodeAt(0) == 57) ){ return false; }			
	
	for( var i = 0; i < strTmp.length - 1; i++ ) { 
		if ( !((strTmp.charCodeAt(i)>=48) && (strTmp.charCodeAt(i)<=57)) ){									
			return false;
		}
		if (i != 12) {
			iSumDigit += parseInt(strTmp.charAt(i),10) * (13 - i); 
		}
	} 				
	iCheckDigit = parseInt(strTmp.charAt(12),10); 
	iSumDigit = (iSumDigit % 11);
	if (iSumDigit == 0) 
		iSumDigit = 1;
	else if (iSumDigit == 1) 
		iSumDigit = 0;
	else
		iSumDigit = (11 - iSumDigit);			
		
	return (iCheckDigit == iSumDigit);  
}

function chkMail(mail) {
	if(mail == "") return true;
	if(mail.indexOf('@',0) < 1) { return true; }
	else if(mail.indexOf('.',0) == -1 || mail.lastIndexOf('.') == mail.length-1 || mail.lastIndexOf('@') != mail.indexOf('@',0)) { return true; }
	else if(mail.indexOf('.',0) == mail.indexOf('@',0)+1) { return true; }
	else {
		if (chk_char_email(mail)) {
			return false;
		}
		else {
			return true;
		}
	}
}

function chk_char_email(chkmsg) {
	chkstr = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@-_."
	chkstr += '"';
	for (count = 0;count < chkmsg.length;count++) {
		chk_ok = 0
		for (count2 = 0;count2 < chkstr.length;count2++) {
			if (chkmsg.charAt(count) == chkstr.charAt(count2)) {
				chk_ok = 1;
				break;
			}
		}
		if (chk_ok == 0) {
			if (chkmsg.charCodeAt(count) != 13 && chkmsg.charCodeAt(count) != 10) {
				return false;
			}
		}
	}
	return true;
}
function chk_char(chkmsg) {
	chkstr = "0123456789abcdefghijklmnopqrstuvwxyz"
	chkstr += '"';
	for (count = 0;count < chkmsg.length;count++) {
		chk_ok = 0
		for (count2 = 0;count2 < chkstr.length;count2++) {
			if (chkmsg.charAt(count) == chkstr.charAt(count2)) {
				chk_ok = 1;
				break;
			}
		}
		if (chk_ok == 0) {
			if (chkmsg.charCodeAt(count) != 13 && chkmsg.charCodeAt(count) != 10) {
				return false;
			}
		}
	}
	return true;
}
function chk_rude(chkmsg){
	var rude = new Array(20);
	rude = new Array("fuck","gamemaster","gamesmaster","webmaster","wm","dq","admin","ini3","galaxy","asshole","bitch","shit","dick","kuy","kvy","yed", "gm", "GM", "hanbitsoft", "aeonsoft", "ntreev", "ntreevsoft");
	for (var i=0;i<rude.length;i++){
		chk_ok = 0;
		if (chkmsg.match(rude[i])){
			chk_ok = 1;
			//alert("in");
			return false;
			//break;
		}
	}
	//if (chk_ok == 0) {
	//	return false;
	//}
	return true;
}
//-->