/*******************************************************************************
	ACTION script
*******************************************************************************/
function check_enter(id) {
	if(event.keyCode == 13) {
		if(id == "cmt_del") cmt_del();
		event.returnValue = false;
	}
}

/*******************************************************************************
	CHECK blank script
*******************************************************************************/
function isblank(str) {
	var re = /(&nbsp;|&shy;| )/g;
	if(str.replace(re, "") == "") return true;

	return false;
}

/*
 * Description		: This function checks whether the character of 'str' exists in valid.
 * Parameter		: type - 0(default) : all string is in valid(true)
 *					         1 : a string is in valid(true)
 * Last Modified	: 2002/09/05
 */
function check_valid(str, valid, type) {
	var flag, ch;

	if(type == 1) flag = 0;
	else flag = 1;

	for(var i = 0; i < str.length; i++) {
		ch = "" + str.substring(i, i+1);

		if(type == 1) {
			if(valid.indexOf(ch) != -1) flag = 1;	/* valid */
			if(flag) break;
		} else {
			if(valid.indexOf(ch) == -1) flag = 0;	/* not valid */
			if(!flag) break;
		}
	}

	return flag;
}

/*
 * Description		: This function checks whether 'str' is number.
 * Last Modified	: 2002/08/02
 */
function check_number(str, type) {
	var valid = "0123456789";
	return check_valid(str, valid, type);
}

function check_upper(str, type) {
	var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	return check_valid(str, valid, type);
}

function check_lower(str, type) {
	var valid = "abcdefghijklmnopqrstuvwxyz";
	return check_valid(str, valid, type);
}

function check_korean(str, type) {
	var flag;

	if(type == 1) flag = 0;
	else flag = 1;

	for(var i = 0; i < str.length; i++) {
		if(type == 1) {
			if(str.charCodeAt(i) > 128) flag = 1;
			if(flag) break;
		} else {
			if(str.charCodeAt(i) <= 128) flag = 0;
			if(!flag) break;
		}
	}

	return flag;
}

function check_blank(str, type) {
	var valid = " ";
	return check_valid(str, valid, type);
}

function check_symbol(str, type) {
	var valid = "~`!@#$%^&*()-_+=|\\{}[]:;\"'<>,.?/";
	return check_valid(str, valid, type);
}

/*
 * Description		: This function checks whether 'str' is email format.
 * Last Modified	: 2002/08/02
 */
function check_email(str) {
	if(str == "") return false;

	var regex = /[-!#$%&'*+/^_~{}|0-9a-zA-Z]+(.[-!#$%&'*+/^_~{}|0-9a-zA-Z]+)*@[-!#$%&'*+/^_~{}|0-9a-zA-Z]+(.[-!#$%&'*+/^_~{}|0-9a-zA-Z]+)*/;
	//var regex = /^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if(regex.test(str)) return true;
	else return false;
}

/*
 * Description		: This function checks ÁÖ¹Îµî·Ï¹øÈ£(ssn). The parameter
 *					  'str' is 13 figure number. (XXXXXX-XXXXXXX, excluding '-')
 * Last Modified	: 2002/09/03
 */
function check_jumin(str) {
	IDtot = 0;
	IDAdd = "234567892345";

	for(var i=0; i <= 11; i++)
		IDtot += str.charAt(i)*IDAdd.charAt(i);

	IDtot = 11 - (IDtot % 11);

	if(str.charAt(str.length-1) == (IDtot % 10)) return true;
	else return false;
}

/*
 * Description		: This function checks whether 'obj' is empty.
 * Last Modified	: 2003.02.26
 */
function check_empty(obj, msg) {
	if(obj.value == "") {
		alert(msg);
		obj.focus();
		return false;
	}

	return true;
}
function checkid(str){
	var string=str;
	var len = string.length;
	var val="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-";
	
	for(i=0;i<len;i++) {
		if(val.indexOf(string.substring(i,i+1)) < 0 ) return false;
	} 		
	return true;
}

function initblur(){
        var maxLinks;
        var blurthis;
        var i;
        maxLinks = document.links.length;       // ÆäÀÌÁö³»ÀÇ ÀüÃ¼ ¸µÅ© °¹¼ö°è»ê;
        blurthis = new Function("this.blur();");   // this.blur(); Æã¼Ç ¸¸µé±â

        for (i=0;i<maxLinks;i++)
                document.links[i].onfocus=blurthis;   // ÆäÀÌÁö³»ÀÇ ¸µÅ©¸¦ Â÷·Ê·Î Ä«¿îÆ®ÇÏ¸é¼­ À§¿¡¼­ ¸¸µé¾ú´ø this.blur() °¡ µéÀº Æã¼ÇÀ» ¿¬°á ½ÃÅ°±â.
}
onload=initblur;   // html ·ÎµùÀÌ ´Ù ³¡³­´ÙÀ½ È£Ãâ


