function CheckEmail(emailaddr)
{
	at_idx=-1;
	at_cnt=0;
	dot_idx=-1;

// by syrup, 2002/03 : length ==0 -> true
	if(emailaddr.length == 0)
		return true;

	for(i=0; i<emailaddr.length; i++)
	{
	//alert('idx:'+i+':'+emailaddr.substring(i,i+1));
		if(emailaddr.substring(i,i+1) == '@')
		{
			at_idx = i;
			at_cnt++;
		}
		else if(emailaddr.substring(i,i+1) == '.')
		{
			dot_idx= i;
		}
		else if(!IsAlphaNumeric(emailaddr, i) && 
				emailaddr.substring(i,i+1) != '_' && 
				emailaddr.substring(i,i+1) != '-' &&
				emailaddr.substring(i,i+1) != '/')
		{
		//alert("case1:"+i+":"+emailaddr.substring(i,i+1));
			return false;
		}
		else
		{
	//	alert("alphanum");
		}
		
	} // end for
	if (at_idx < 1 || dot_idx < 2 || at_idx+2 > dot_idx || dot_idx >= emailaddr.length-1)
	{
		//alert("at:"+at_idx+",dot:"+dot_idx);
		return false;
	}
	else
	{
		return true;
	}

}

function IsAlphaNumeric(str, idx)
{
	if(IsAlpha(str,idx) || IsNumber(str,idx))
	{
		return true;
	}
	return false;
}

function IsAlpha(str, idx)
{
	if(IsLower(str,idx) || IsUpper(str,idx))
	{
		return true;
	}
	return false;
}

function IsNumber(str, idx)
{
	if(str.charCodeAt(idx) >= 48 && str.charCodeAt(idx) <= 57)
	{
		return true;
	}
	return false;
}

function IsLower(str, idx)
{
	if(str.charCodeAt(idx) >= 97 && str.charCodeAt(idx) <= 122)
	{
		return true;
	}
	return false;
}

function IsUpper(str, idx)
{
	if(str.charCodeAt(idx) >= 65 && str.charCodeAt(idx) <= 90)
	{
		return true;
	}
	return false;
}

function yesHan( chk_str2 ) //ÇÑ±Û¸¸ ÀÔ·ÂµÇ¾ú´ÂÁö È®ÀÎ
{
    var str_num2 = chk_str2.length;
       
    for( i=0; i < str_num2; i++ )
    {
    	
      if ( chk_str2.charCodeAt(i) < 128)
      {          		
          return false;
      }
    }
    
    return true;
}


function check_jumin(jumin){ 	
  var weight = "234567892345";    
  var sum = 0; 
  var val = jumin.replace("-",""); // "-"(ÇÏÀÌÇÂ) Á¦°Å 

  if(val.length != 13) { return false; } 

  for(i=0;i<12;i++) { 
      sum += parseInt(val.charAt(i)) * parseInt(weight.charAt(i)); 
  } 

  var result = (11 - (sum % 11)) % 10; 
  var check_val = parseInt(val.charAt(12)); 

  if(result != check_val) { return false; } 
  return true; 
}
