//»õÃ¢ ¶ç¿ì±â
function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  //statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';

  statusbar_str = 'yes';
  height = height + 25;

  window.open(url, 'eng_91tv_' + name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

//·Î±×ÀÎ È®ÀÎ
function check_login() {
	window.alert("Please access after logging in.¡¡");
	top.document.top_login_form.rdcturl.value = top.window.location.href;
	top.document.top_login_form.submit();
}

//°ø¹é Á¦°Å
function clear_space(t_item) {
	var li_length = t_item.value.length;
	if (li_length > 0) {
		if (t_item.value.substring(li_length - 1, li_length) == " ") {
			t_item.value = t_data.value.substring(0, li_length - 1);
		}
	}
}

//¼ýÀÚ ÀÔ·Â È®ÀÎ
function numeric_item_onblur(t_item) {
	if (isNaN(t_item.value) == true) {
		//window.alert("¼ýÀÚ·Î ÀÔ·ÂÇÏ½Ê½Ã¿À.");
		t_item.focus();	
		return false;
	}
}


//ÇÊ¼ö ÀÔ·ÂÇ×¸ñ È®ÀÎ
function check_must(t_data) {
	var ls_space = " ";
	var lb_check_ok = true;

	if (t_data.length == 0) {
		return false;
	}

	for (var i=0; i < t_data.length; i++) {
		if (ls_space.indexOf(t_data.charAt(i)) != -1) {
			lb_check_ok = false;
		}
		else {
			lb_check_ok = true;
			break;
		}
	}

	if (lb_check_ok == false) {
		return false;
	}
	
	return true;
}


//¼ýÀÚ È®ÀÎ
function check_numeric(t_data) {
	if (isNaN(t_data) == true) {
		return false;
	}
	
	return true;
}


//ID, PW È®ÀÎ
function check_id_pw(t_id_pw) {
	if (t_id_pw.length < 4) { 
	    return false;
	}

	var ls_tmp_str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

	for (var i=0; i < t_id_pw.length; i++) {
		if (ls_tmp_str.indexOf(t_id_pw.charAt(i)) == -1) {
			return false;
		}
	}

	return true;
}


//e-mail È®ÀÎ
function check_email(t_email) {
	if (t_email.length = 0) {
		return false;
	}

	var ls_tmp_str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@.-_;";

	for (var i=0; i < t_email.length; i++) {
		if (ls_tmp_str.indexOf(t_email.charAt(i)) == -1) {
			return false;
		}
	}
		
	if (t_email.indexOf("@") == -1) {
		return false;
	}
		
	if (t_email.indexOf(".") == -1) {
		return false;
	}
	
	return true;
}


//URL È®ÀÎ
function check_url(t_url) {
	if (t_url.length = 0) {
		return false;
	}

	var ls_tmp_str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_/:";

	for (var i=0; i < t_url.length; i++) {
		if (ls_tmp_str.indexOf(t_url.charAt(i)) == -1) {
			return false;
		}
	}
	
	return true;
}


//³¯Â¥ È®ÀÎ
function check_date(t_year, t_month, t_day) {
	if ((t_year.length = 0) || (t_month.length = 0) || (t_day.length = 0)) {
		return false;
	}

	if ((isNaN(t_year) == true) || (isNaN(t_month) == true) || (isNaN(t_day) == true)) {
		return false;
	}

	if (t_year.length != 4) { 
	    return false;
	}
	if (t_month.length > 2) { 
	    return false;
	}
	if (t_day.length > 2) { 
	    return false;
	}
    t_month = double_figures(t_month);
    t_day = double_figures(t_day);
		
	/*
	if ((t_year <= 2000) || (t_year >= 2010)) {
		return false;
	}
	*/
			
	if ((t_month < 1) || (t_month > 12)) {
		return false;
	}
			
	if ((t_month == 1) || (t_month == 3) || (t_month == 5) || (t_month == 7) || (t_month == 8) || (t_month == 10) || (t_month == 12)) {
		if ((t_day < 1) || (t_day > 31)) {
			return false;
		}
	}
			
	if ((t_month == 4) || (t_month == 6) || (t_month == 9) || (t_month == 11)) {
		if ((t_day < 1) || (t_day > 30)) {
			return false;
		}
	}
			
	if (t_month == 2) {
		if ((t_year % 4 == 0 && t_year % 100 != 0) || t_year % 400 == 0) {
	    	if ((t_day < 1) || (t_day > 29)) {
				return false;
			}
		}
		else {
			if ((t_day < 1) || (t_day > 28)) {
				return false;
			}
		}
	}
	
	return true;
}


//ÇÑ ÀÚ¸®¼ö·Î º¯È¯
function single_figures(t_number) {
	if ((t_number.length == 2) && (t_number.substring(0,1) == "0")) { 
	    t_number = t_number.substring(1,2);
	}
	return t_number;
}


//µÎ ÀÚ¸®¼ö·Î º¯È¯
function double_figures(t_number) {
	if (t_number.length == 1) { 
	    t_number = "0" + t_number;
	}
	return t_number;
}


//Currency ÇüÅÂ·Î º¯È¯
function currency_type(t_number) {
	var t_string = t_number + '';
	var li_length = t_string.length; 
	var n_string = ''; 
		
	for (var i=0; i < li_length; i++) { 
	    n_string += t_string.substring(i, i + 1);         
	    if (((li_length - i-1) % 3) == 0 && (li_length - i - 1) > 0 ) n_string += ','; 
	} 
	
	return n_string;
}


//ÀÌ¹ÌÁö Å©±â º¯È¯
function img_resize(obj_t_nm, li_t_width, li_t_height) {
	var li_obj_width = obj_t_nm.width;
	var li_obj_height = obj_t_nm.height;
	var li_resize_width = li_obj_width;
	var li_resize_height = li_obj_height;

	if (li_resize_width > li_t_width) {
		li_resize_width = li_t_width;
		li_resize_height = parseInt((li_obj_height * li_resize_width) / li_obj_width);
	}
	if(li_resize_height > li_t_height) {
		li_resize_width = parseInt((li_resize_width * li_t_height) / li_resize_height);
		li_resize_height = li_t_height;
	}
	obj_t_nm.width = li_resize_width;
	obj_t_nm.height = li_resize_height;
}


//ÀÌ¹ÌÁö º¸±â
function btn_img_disp_onclick(t_img_file) {
	window.open("/common/img_disp.asp?img_file=" + t_img_file, "win_img_disp", "width=1, height=1, left=0, top=0, marginwidth=0, marginheight=0, menubar=no, directories=no, resizable=no, status=yes, scrollbars=yes");
}


//iframe Å©±â º¯°æ
function resize_iframe(t_iframe_nm, t_width, t_height) {
    var ls_iframe_body = document.frames(t_iframe_nm).document.body;
    var ls_iframe_nm = document.all(t_iframe_nm);

    var li_resize_width = ls_iframe_body.scrollWidth + (ls_iframe_body.offsetWidth - ls_iframe_body.clientWidth);
    var li_resize_height = ls_iframe_body.scrollHeight + (ls_iframe_body.offsetHeight - ls_iframe_body.clientHeight);
    
    ls_iframe_nm.style.width = li_resize_width;
    
    if (li_resize_width < t_width) {
		li_resize_width = t_width;
	}
    if (li_resize_height < t_height) {
		li_resize_height = t_height;
	}

    ls_iframe_nm.style.width = li_resize_width;
    ls_iframe_nm.style.height = li_resize_height;
}

//¿ÞÂÊ °ø¹é Á¦°Å
String.prototype.ltrim = function() {
	var Rtn = /\s*((\S+\s*)*)/;
	return this.replace(Rtn, "$1");
}

//¿À¸¥ÂÊ °ø¹é Á¦°Å
String.prototype.rtrim = function() {
	var Rtn = /((\s*\S+)*)\s*/;
	return this.replace(Rtn, "$1");
}

//°ø¹é Á¦°Å
String.prototype.trim = function() {
	return this.ltrim().rtrim();
}


