function best_keyword()
{
	var form = document.frm ;
	if(form.keyword.value == "Å°¿öµå¸¦ Á¶È¸ÇÏ¼¼¿ä!") {

		alert("°Ë»öÇÒ Å°¿öµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		form.keyword.focus();
		return false;
	}
	else if(form.keyword.value == "") {
	
		alert("°Ë»öÇÒ Å°¿öµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		form.keyword.focus();
		return false;	
	}

	var keyword = form.keyword.value;
	var popup_width=300;
	var popup_height=600;
	var screen_w=screen.width;
	var screen_h=screen.height;
	var popup_left=(screen_w - popup_width) / 2 ;
	var popup_top=(screen_h - popup_height) / 2 ;

	window.open("/index.htm?mode=best_keyword&keyword=" + keyword,"","width=" + popup_width + ",height=" + popup_height + ",status=no,resizable=no,toolbar=no,menubar=no,scrollbars=yes,titlebar=no,top=" + popup_top + ",left=" + popup_left);
}

// ÀÎ±âÅ°¿öµå
function popular(keyword)
{
	var space_check = /^\s+|\s+$/g;
	var key_word = keyword.replace(space_check, '');

	// °Ë»ö¾î »çÀüÃ¼Å©
	if(key_word == "" || key_word == "Å°¿öµå¸¦ Á¶È¸ÇÏ¼¼¿ä!") {

		document.frm_key.keyword.focus();
		alert("°Ë»öÇÒ Å°¿öµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		return false;
	}
	else {

		var popup_width=400;
		var popup_height=300;
		var screen_w=screen.width;
		var screen_h=screen.height;
		var popup_left=(screen_w - popup_width) / 2 ;
		var popup_top=(screen_h - popup_height) / 2 ;

		window.open("/index.htm?mode=popular&keyword=" + keyword,"","width=" + popup_width + ",height=" + popup_height + ",status=no,resizable=no,toolbar=no,menubar=no,scrollbars=yes,titlebar=no,top=" + popup_top + ",left=" + popup_left);
		return false;
	}
}

function popupWindow(url, w, h) {
        var posX = (screen.width - w) / 2;
        var posY = (screen.height - h) / 2;
        var option = ",resizable=no,scrollbars=no,status=no";
        window.open(url, "new_win","width="+w+",height="+h+",left="+posX +",top="+posY+option);
}

// ÄíÅ° ±Á±â
function setCookie (name, value, expires) {
	document.cookie = name + "=" + escape (value) + "; path=/; expires=" + expires.toGMTString();
}

// ÄíÅ° ¾ò±â
function getCookie(Name) {
	var search = Name + "=";

	if (document.cookie.length > 0) { // ÄíÅ°°¡ ¼³Á¤µÇ¾î ÀÖ´Ù¸é
		offset = document.cookie.indexOf(search)
		
		if (offset != -1) { // ÄíÅ°°¡ Á¸ÀçÇÏ¸é
			offset += search.length
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset)
			// ÄíÅ° °ªÀÇ ¸¶Áö¸· À§Ä¡ ÀÎµ¦½º ¹øÈ£ ¼³Á¤
			if (end == -1)
				end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		}
	}
	return "";
}

// ÄíÅ°¿¡ ¾ÆÀÌµð ±â¾ïÇÏ±â ¼³Á¤
function saveLoginID(form) {

	var expdate = new Date();
	
	// ±âº»ÀûÀ¸·Î 30ÀÏµ¿¾È ±â¾ïÇÏ°Ô ÇÔ. ÀÏ¼ö¸¦ Á¶ÀýÇÏ·Á¸é * 30¿¡¼­ ¼ýÀÚ¸¦ Á¶ÀýÇÏ¸é µÊ
	if (form.chk_mem.checked) expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30ÀÏ
	else expdate.setTime(expdate.getTime() - 1); // ÄíÅ° »èÁ¦Á¶°Ç
	
	setCookie("MEMBER_ID", form.member_id.value, expdate);
}

function checkit(form) {

	saveLoginID(form);
}