function charcheck(values) 
{ 
	var result;
	var filter=/^[a-zA-Z0-9_]+$/;
	if (filter.test(values)) 
		result=true;
	else
		result=false;
	return result;
}

function beAllowStr(str, allowStr) {
    var i;
    var ch;
    for (i=0;i<str.length;i++) {
        ch = str.charAt(i);
        if (allowStr.indexOf(ch) < 0) {
            return false;
        }
    }
    return true;
}

function checkEmail(email)
{
  if (beAllowStr(email, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@.-_") == false) 
	{
		return false;
	}
	var atCnt = 0;
	var dotCnt = 0;
  for (i = 0; i < email.length ; i++) 
	{ 
    ch = email.charAt(i);
		if (ch == "@") 
			atCnt++;
		if (ch == ".") 
		{
			dotCnt++;
		}
	}
	if (atCnt != 1 || dotCnt < 1) 
	{
		return false;
	}
	var atIndex = 0;
  atIndex = email.indexOf("@");
	if (atIndex <= 0) {
		return false;
	}
	return true;
}

function IsNum(txt)
{
	var tmptxt = txt;
	for(var i=0;i < tmptxt.length; i++)
	{
		var ch=tmptxt.substring(i,i+1);
		if(ch < "0" || ch > "9")
		{
			return false;
		}
	}
	return true;
}
function IsValidID(UserID)
{
	var tmptxt = UserID;
	first = tmptxt.charAt(0);		


	for(var i=0;i < tmptxt.length; i++)
	{
		var ch=tmptxt.substring(i,i+1);
	

		if(ch == "~" || ch == "`" || ch == "!" || ch == "@" || ch == "#" ||
		   ch == "$" || ch == "%" || ch == "^" || ch == "&" || ch == "*" ||
		   ch == "(" || ch == ")" || ch == "+" || ch == "=" || ch == "{" ||
		   ch == "}" || ch == "[" || ch == "]" || ch == ":" || ch == ";" ||
		   ch == "<" || ch == ">" || ch == "," || ch == "." || ch == "?" || 
		   ch == "/" || ch == "\\" || ch == "|" || ch == "'" || ch == "\"" || ch == " ")
		{
            return false; 
		}
	}

	if (IsNum(first) || first == "-" || first == "_")
	{	
        return false; 
	}
	
	
	if (IsKoreanChar(tmptxt))
	{
        return false; 
	}
	else
	{
		if (tmptxt.length < 4 || tmptxt.length > 12 )
		{
            return false; 
		}
	}
	
	return true;
}
function IsValidUserName(UserName)
{
	var tmptxt = UserName;
	

	for(var i=0;i < tmptxt.length; i++)
	{
		var ch=tmptxt.substring(i,i+1);

		if(ch == "~" || ch == "`" || ch == "!" || ch == "@" || ch == "#" ||
		   ch == "$" || ch == "%" || ch == "^" || ch == "&" || ch == "*" ||
		   ch == "(" || ch == ")" || ch == "+" || ch == "=" || ch == "{" ||
		   ch == "}" || ch == "[" || ch == "]" || ch == ":" || ch == ";" ||
		   ch == "<" || ch == ">" || ch == "," || ch == "." || ch == "?" || 
		   ch == "/" || ch == "\\" || ch == "|" || ch == "'" || ch == "\"")
		{
           return false; 
		}
	}

	if (!IsKoreanChar(tmptxt))
	{
        return false;
		
	}
	
	return true;
}


function IsKoreanChar(strkor)
{
	var tmptxt = strkor.toLowerCase();

	for(var i=0;i < tmptxt.length; i++)
	{
		var ch=tmptxt.substring(i,i+1);

		if( (ch < "0" || ch > "9" ) && (ch < "a" || ch > "z" ) && (ch !="-") && (ch !="_") )
		{
				return true;
		}
	}

	return false;
}

function checkSpace(value)
{
	if(/^\s*$/.test(value))
	   return false;
	return true;
}
function Check_Digit(str) {
	for(i = 0;i < str.length;i++) {
		if(str.charAt(i) < '0' || str.charAt(i) > '9')
			return;
	}
	return true;
}