/*******************************************************************************
	Description		: GENERAL Script
	Last Modified	: 2003/08/03
*******************************************************************************/
/*******************************************************************************
	CHECKBOX script
*******************************************************************************/
function check_option() {
	// check option layer
	var obj = document.all["id_checkbox"];

	// set position
	obj.style.posLeft = event.x + document.body.scrollLeft - 8;
	obj.style.posTop = event.y + document.body.scrollTop - 7;
	obj.style.visibility = "visible";
}

function show_check_option() {
	document.all["id_checkbox"].style.visibility = "visible";
}

function hide_check_option() {
	document.all["id_checkbox"].style.visibility = "hidden";
}

function select_all() {
	for(var i = 1; i <= ARTICLE_ROWS; i++) {
		var obj = document.all["check" + i];

		if(obj) {
			obj.value = document.all["article" + i + "_idx"].value;
			document.all["check_img" + i].src = PATH_SKIN + "images/chkbox_on.gif";
		}
	}

	hide_check_option();
}

function cancel_all() {
	for(var i = 1; i <= ARTICLE_ROWS; i++) {
		var obj = document.all["check" + i];

		if(document.all["check" + i]) {
			obj.value = 0;
			document.all["check_img" + i].src = PATH_SKIN + "images/chkbox_off.gif";
		}
	}

	hide_check_option();
}

function reverse_chk() {
	for(var i = 1; i <= ARTICLE_ROWS; i++) {
		if(document.all["check" + i]) set_check(i);
	}

	hide_check_option();
}

function set_check(row_num) {
	var obj = document.all["check" + row_num];
	var idx = document.all["article" + row_num + "_idx"].value;

	if(obj.value == idx) {
		obj.value = 0;
		document.all["check_img" + row_num].src = PATH_SKIN + "images/chkbox_off.gif";
	} else {
		obj.value = idx;
		document.all["check_img" + row_num].src = PATH_SKIN + "images/chkbox_on.gif";
	}
}

/*******************************************************************************
	PREVIEW script
*******************************************************************************/
function preview(content) {
	var obj = document.all["id_preview"];

	// check content
	if(content == "") {
		obj.innerHTML = "";
		return;
	}

	var text = "";
	text =  "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
	text += "    <tr>";
	text += "        <td>";
	text += "            <td bgcolor='#FFFFFF' style='word-break:break-all; padding:5px;'>" + content + "</td>";
	text += "        </td>";
	text += "    </tr>";
	text += "</table>";

	obj.innerHTML = text;
	move_preview();
	obj.style.visibility = "visible";
}

function move_preview() {
	var obj = document.all["id_preview"];

	if(obj.innerHTML != "") {
		obj.style.posLeft = event.x - 40 + document.body.scrollLeft;
		obj.style.posTop = event.y + 20 + document.body.scrollTop;
	}
}

function hide_preview() {
	document.all["id_preview"].style.visibility = "hidden";
}

/*******************************************************************************
	USER_MENU script
*******************************************************************************/
function user_menu(id, name, email, url) {
	// user menu layer
	var obj = document.all["id_user_menu"];

	// set position
	obj.style.posLeft = event.x + document.body.scrollLeft;
	obj.style.posTop = event.y + document.body.scrollTop;

	var text = "";
	text += "";
	text += "<table width='100' border='0' cellspacing='0' cellpadding='0' align='center' class='border'>";
	text += "	<tr>";
	text += "		<td class='barcolor' height='12' style='padding-left:5px'><img src='" + PATH_SKIN + "images/user_menu_title.gif' width='59' height='5'></td>";
	text += "	</tr>";
	text += "	<tr>";
	text += "		<td bgcolor='#FFFFFF'>";
	text += "			<table width='100%' border='0' cellspacing='0' cellpadding='0' class='bordertb'>";

	// id or name
	if(id != "") {
		text += "				<tr height='18' onMouseOver=\"this.style.backgroundColor='#F5F5F5'\" onMouseOut=\"this.style.backgroundColor=''\">";
		text += "					<td width='5'></td>";
		text += "					<td align='center' width='20'><a href=\"javascript:search_by_id('" + id + "');\"><img src='" + PATH_SKIN + "images/usermenu_search.gif' border=0 width='11' height='11'></a></td>";
		text += "					<td><a href=\"javascript:search_by_id('" + id + "');\" class='menu' title='¾ÆÀÌµð·Î °Ë»ö'>Search Id</a></td>";
		text += "					<td width='5'></td>";
		text += "				</tr>";
		text += "				<tr height='18' onMouseOver=\"this.style.backgroundColor='#F5F5F5'\" onMouseOut=\"this.style.backgroundColor=''\">";
		text += "					<td width='5'></td>";
		text += "					<td align='center' width='20'><a href=\"javascript:search_by_name('" + name + "');\"><img src='" + PATH_SKIN + "images/usermenu_search.gif' border=0 width='11' height='11'></a></td>";
		text += "					<td><a href=\"javascript:search_by_name('" + name + "');\" class='menu' title='ÀÌ¸§À¸·Î °Ë»ö'>Search Name</a></td>";
		text += "					<td width='5'></td>";
		text += "				</tr>";
	} else {
		text += "				<tr height='18' onMouseOver=\"this.style.backgroundColor='#F5F5F5'\" onMouseOut=\"this.style.backgroundColor=''\">";
		text += "					<td width='5'></td>";
		text += "					<td align='center' width='20'><a href=\"javascript:search_by_name('" + name + "');\"><img src='" + PATH_SKIN + "images/usermenu_search.gif' border=0 width='11' height='11'></a></td>";
		text += "					<td><a href=\"javascript:search_by_name('" + name + "');\" class='menu' title='ÀÌ¸§À¸·Î °Ë»ö'>Search Name</a></td>";
		text += "					<td width='5'></td>";
		text += "				</tr>";
	}
	// email
	if(email != "") {
		text += "				<tr height='18' onMouseOver=\"this.style.backgroundColor='#F5F5F5'\" onMouseOut=\"this.style.backgroundColor=''\">";
		text += "					<td></td>";
		text += "					<td align='center'><a href=\"javascript:write_mail('" + email + "', '" + name + "', '');hide_user_menu();\"><img src='" + PATH_SKIN + "images/usermenu_mail.gif' border=0 width='12' height='10'></a></td>";
		text += "					<td><a href=\"javascript:write_mail('" + email + "', '" + name + "', '');hide_user_menu();\" class='menu' title='¸ÞÀÏº¸³»±â'>E-Mail</a></td>";
		text += "					<td></td>";
		text += "				</tr>";
	}

	// url
	if(url != "" && url != "http://" && url != "HTTP://") {
		text += "				<tr height='18' onMouseOver=\"this.style.backgroundColor='#F5F5F5'\" onMouseOut=\"this.style.backgroundColor=''\">";
		text += "					<td></td>";
		text += "					<td align='center'><a href=\"javascript:open_url('" + url + "');hide_user_menu();\"><img src='" + PATH_SKIN + "images/usermenu_home.gif' border=0 width='13' height='11'></a></td>";
		text += "					<td><a href=\"javascript:open_url('" + url + "');hide_user_menu();\" class='menu' title='È¨ÆäÀÌÁö'>Homepage</a></td>";
		text += "					<td></td>";
		text += "				</tr>";
	}

	// memo and personal info
	if(id != "")  {
		text += "				<tr height='18' onMouseOver=\"this.style.backgroundColor='#F5F5F5'\" onMouseOut=\"this.style.backgroundColor=''\">";
		text += "					<td></td>";
		text += "					<td align='center'><a href=javascript:write_memo('" + id + "');hide_user_menu();><img src='" + PATH_SKIN + "images/usermenu_memo.gif' width='13' height='13' border=0></a></td>";
		text += "					<td><a href=\"javascript:write_memo('" + id + "');hide_user_menu();\" class='menu' title='¸Þ¸ð º¸³»±â'>Memo</td>";
		text += "					<td></td>";
		text += "				</tr>";
		text += "					<tr height='18' onMouseOver=\"this.style.backgroundColor='#F5F5F5'\" onMouseOut=\"this.style.backgroundColor=''\">";
		text += "					<td></td>";
		text += "					<td align='center'><a href=javascript:user_info('" + id + "');hide_user_menu();><img src='" + PATH_SKIN + "images/usermenu_info.gif' width='11' height='12' border=0></a></td>";
		text += "					<td><a href=\"javascript:user_info('" + id + "');hide_user_menu();\" class='menu' title='È¸¿øÁ¤º¸'>Member Info</a></td>";
		text += "					<td></td>";
		text += "				</tr>";
	}

	text += "			</table>";
	text += "		</td>";
	text += "	</tr>";
	text += "	<tr>";
	text += "		<td class='barcolor' height='12' style='padding-right:5px; cursor:hand' align='right' onClick='javascript:hide_user_menu();'><img src='" + PATH_SKIN + "images/user_menu_close.gif' width='29' height='5' border='0'></td>";
	text += "	</tr>";
	text += "</table>";

	obj.innerHTML = text;
	obj.style.visibility = "visible";
}

function show_user_menu() {
	document.all["id_user_menu"].style.visibility = "visible";
}

function hide_user_menu() {
	document.all["id_user_menu"].style.visibility = "hidden";
}

function search_by_id(id) {
	location.href = "ttboard.cgi?act=list" + QUERY_DB + "&s_mode=def&s_id=1&s_key=" + id;
	hide_user_menu();
}

function search_by_name(name) {
	location.href = "ttboard.cgi?act=list" + QUERY_DB + "&s_mode=def&s_name=1&s_key=" + name;
	hide_user_menu();
}

function send_mail(email) {
	if(email == "") return;
	location.href = "mailto:" + email;
}

function ttmailer(email) {
	if(email == "") return;
	window.open("ttmailer.cgi?act=write&to="+email, "", "width=320, height=350, resizable=1, scrollbars=1");
}

function open_url(url) {
	if(url == "") return;
	window.open(url, "", "");
}

function user_info(id) {
	profile(id, 1, "");
}

/*******************************************************************************
	SEARCH script
*******************************************************************************/
function set_search(field) {
	var obj_field = document.all["s_"+field];

	if(obj_field.value == 1) {
		document.all["s_"+field+"_chk"].src = PATH_SKIN + "images/search_" + field + ".gif";
		obj_field.value = 0;
	} else {
		document.all["s_"+field+"_chk"].src = PATH_SKIN + "images/search_" + field + "-1.gif";
		obj_field.value = 1;
	}
}

function set_search_num() {
	var total_num = SEARCH_TOTAL_COUNT;
	var search_num = search_form.s_num.value;

	if(search_num != '') {
		if(search_num > total_num) {
			search_num = total_num;
			search_form.s_num.value = total_num;
		}

		// show search field
		for(var i = 1; i <= total_num; i++) {
			if(i <= search_num)
				document.all["id_search" + i].style.display = "block";
			else
				document.all["id_search" + i].style.display = "none";
		}
	}
}

function show_adv_search() {
	document.all["id_default_search"].style.display = "none";
	document.all["id_adv_search"].style.display = "block";
}

function show_default_search() {
	document.all["id_default_search"].style.display = "block";
	document.all["id_adv_search"].style.display = "none";
}

function search(mode) {
	if(mode == "default") {
		if(search_form.s_id.value == 0 && search_form.s_name.value == 0
			&& search_form.s_title.value == 0 && search_form.s_content.value == 0) {
			alert("°Ë»öÇÒ ÇÊµå¸¦ ¼±ÅÃÇØ ÁÖ½Ê½Ã¿À.");
			return;
		} else if(search_form.s_key.value == "")  {
			alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			search_form.s_key.focus();
			return;
		}

		search_form.action = "ttboard.cgi?act=list" + QUERY_DB + "&s_mode=def";
	} else if(mode == "advanced") {
		// check search key
		for(var i = 1; i <= search_form.s_num.value; i++) {
			var obj = document.all["s_key" + i];

			if(obj.value == "") {
				alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
				obj.focus();
				return;
			}
		}

		search_form.action = "ttboard.cgi?act=list" + QUERY_DB + "&s_mode=adv";
	}

	search_form.submit();
}

/*******************************************************************************
	COMMENT script
*******************************************************************************/
function add_comment(idx) {
	if(document.all["cmt"+idx+"_name"].value == "") {
		alert("ÀÌ¸§À» ½á ÁÖ¼¼¿ä");
		document.all["cmt"+idx+"_name"].focus();
		return;
	}

	if(MEMBER_IDX == 0) {
		// ·Î±×ÀÎÇÑ °æ¿ì´Â ºñ¹Ð¹øÈ£¸¦ ¹ÞÁö¾ÊÀ½.
		if(document.all["cmt"+idx+"_pwd"].value == "") {
			alert("ºñ¹Ð¹øÈ£À» ½á ÁÖ¼¼¿ä");
			document.all["cmt"+idx+"_pwd"].focus();
			return;
		}
	}

	if(document.all["cmt"+idx+"_content"].value == "") {
		alert("³»¿ëÀ» ½á ÁÖ¼¼¿ä");
		document.all["cmt"+idx+"_content"].focus();
		return;
	}

	// set value
	comment_form.comment_name.value = document.all["cmt"+idx+"_name"].value;
	if(MEMBER_IDX == 0) {
		comment_form.comment_pwd.value = document.all["cmt"+idx+"_pwd"].value;
	}
	comment_form.comment_content.value = document.all["cmt"+idx+"_content"].value;

	comment_form.action = "ttboard.cgi?act=add_comment" + QUERY_DB + "&idx=" + idx;
	comment_form.submit();
}

function show_comment_pwd(article_idx, comment_idx) {
	if(MEMBER_IDX == 0) {
		// before login
		var obj = document.all["id_comment_pwd"];

		if(article_idx != 0 && comment_idx != 0) {
			comment_form.del_pwd.value = "";
			comment_form.article_idx.value = article_idx;
			comment_form.comment_idx.value = comment_idx;

			obj.style.posLeft = event.x - 170 + document.body.scrollLeft;
			obj.style.posTop = event.y + document.body.scrollTop;
		}

		obj.style.visibility = "visible";
		comment_form.del_pwd.focus();
	} else {
		// after login
		comment_form.del_pwd.value = "";
		comment_form.article_idx.value = article_idx;
		comment_form.comment_idx.value = comment_idx;

		del_comment();
		event.returnValue = false;
	}
}

function hide_comment_pwd() {
	document.all["id_comment_pwd"].style.visibility = "hidden";
}

function del_comment() {
	var pwd = comment_form.del_pwd.value;

	hide_comment_pwd();
	comment_form.action = "ttboard.cgi?act=del_comment" + QUERY_DB + "&pwd=" + pwd;
	comment_form.submit();
}

// comment resize
function resize_comment(idx, height) {
	obj = document.all["cmt" + idx + "_content"];
	if(obj) {
		var obj_height = parseInt(obj.rows);
		if(obj_height + height >= 3)
			obj.rows = obj_height + height;
	}
}

function cmt_mdel(aidx) {
	var obj = document.all["cmt"+aidx+"_idx"];
	if(!obj) return;

	// article index
	comment_form.article_idx.value = aidx;

	// comment index
	var cmt_idx = comment_form.comment_idx;
	cmt_idx.value = "";

	if(obj.length) {
		// more than two objects
		for(var i = 0; i < obj.length; i++) {
			if(obj[i].checked == true) {
				if(cmt_idx.value != "") cmt_idx.value += ",";
				cmt_idx.value += obj[i].value;
			}
		}
	} else {
		// only one object
		cmt_idx.value = obj.value;
	}

	comment_form.action = "ttboard.cgi?act=del_comment" + QUERY_DB;
	comment_form.submit();
}
/*******************************************************************************
	WRITE script
*******************************************************************************/
function verify_data() {
	// check name
	if(write_form.name.value == "") {
		alert("ÀÌ¸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		write_form.name.focus();
		return;
	}


	// check email
//	if(write_form.email.value != "") {
//		if(!check_email(write_form.email.value)) {
//			alert("ÀÌ¸ÞÀÏ Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
//			write_form.email.focus();
//			return;
//		}
//	}



	// check password
	if(WRITE_MODE != "modify" && MEMBER_IDX == 0) {
		if(write_form.pwd && write_form.pwd.value == "") {
			alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
			write_form.pwd.focus();
			return;
		}
	}
	// check title
	if(write_form.title.value == "") {
		alert("Á¦¸ñÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		write_form.title.focus();
		return;
	}
	// check content
	if(write_form.content.value == "") {
		alert("³»¿ë °Ë»ö½Ã Å°¿öµåÀ» 1°³ ÀÌ»ó ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		write_form.content.focus();
		return;
	}
	// check category
	if(write_form.cate_idx) {
		// use categoy
		if(CATEGORY_WRITE_METHOD == 0) {
			// essential field
			if(write_form.cate_idx.value == "") {
				alert("Ä«Å×°í¸®¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä.");
				return;
			}
		} else if(CATEGORY_WRITE_METHOD == 1) {
			// alert message
			if(write_form.cate_idx.value == 0) {
				var bYes = confirm("Ä«Å×°í¸®¸¦ ¼±ÅÃÇÏÁö ¾ÊÀ¸¼Ì½À´Ï´Ù.\nÀúÀåÇÏ½Ã°Ú½À´Ï±î?");
				if(!bYes) return;
			}
		} else if(CATEGORY_WRITE_METHOD == 2) {
			// no action
		}
	}

	// set content info
	if(write_form.content_width)
		write_form.content_width.value = parseInt(document.all['content'].style.width);
	if(write_form.content_height)
		write_form.content_height.value = parseInt(document.all['content'].style.height);

	write_form.submit();
}

// resize
function resize_content_width(width) {
	var obj, total_count;

	// url
	resize_object_width("url", width, CONTENT_WIDTH);

	// title
	resize_object_width("title", width, CONTENT_WIDTH);

	// content
	resize_object_width("content", width, CONTENT_WIDTH);

	// extension field
	oTable	= document.getElementById("tbl_ext");
	idx = oTable.rows.length;
	if(oTable) {
		for(var i = 1; i <= idx; i++) {
			resize_object_width("STITLE_"+i, width, CONTENT_WIDTH);
			resize_object_width("EXT_"+i, width, CONTENT_WIDTH);
		}
	}

	// file
	obj = document.all['file_num'];
	if(obj) {
		total_count = obj.options[obj.length-1].value;
		for(var i = 1; i <= total_count; i++) {
			resize_object_width("file"+i, width, FILE_WIDTH);
		}
	}

	// link
	resize_object_width("link1", width, FILE_WIDTH);
}

function resize_object_width(obj, width, min_width) {
	if(document.all[obj]) {
		var obj_width = parseInt(document.all[obj].style.width);
		if(obj_width + width >= min_width)
			document.all[obj].style.width = obj_width + width;
	}
}

function resize_content_height(height) {
	if(document.all["content"]) {
		var obj_height = parseInt(document.all['content'].style.height);
		if(obj_height + height >= CONTENT_HEIGHT)
			document.all['content'].style.height = obj_height + height;
	}
}

// file & link
function show_file() {
	var obj = write_form.file_num;
	var file_num = obj.options[obj.selectedIndex].value;
	var total_file = obj.options[obj.length-1].value;

	for(var i = 1; i <= total_file; i++) {
		var obj_file = document.all["id_file" + i];
		var obj_info = document.all["id_file" + i + "_info"];

		if(i <= file_num) {
			obj_file.style.display = 'block';
			if(obj_info) obj_info.style.display = 'block';
		} else {
			obj_file.style.display = 'none';
			if(obj_info) obj_info.style.display = 'none';
		}
	}
}

function show_link() {
	var obj = write_form.link_num;
	var link_num = obj.options[obj.selectedIndex].value;
	var total_link = obj.options[obj.length-1].value;

	for(var i = 1; i <= total_link; i++) {
		if(i <= link_num)
			document.all["id_link" + i].style.display = 'block';
		else
			document.all["id_link" + i].style.display = 'none';
	}
}

function add_var(id, idx) {
	if(id == 'link') {
		write_form.all["content"].value += "{LINK:" + idx + "}";
	} else if(id == 'file') {
		write_form.all["content"].value += "{FILE:" + idx + "}";;
	}
}

/*******************************************************************************
	ACTION script
*******************************************************************************/
// rollover bgcolor.
function rollover(obj, color) {
	if(!obj) return false;
	obj.style.backgroundColor = color;
}

function check_enter(id) {
	if(event.keyCode == 13) {
		if(id == "search") search('default');
		else if(id == "jump_page") jump_to();
		else if(id == "del_comment") del_comment();

		event.returnValue = false;
	}
}

function read_article(idx) {
	if(LIST_TITLE_ON_CLICK == 0) {
		location.href = "ttboard.cgi?act=read" + QUERY + "&page=" + PAGE_CUR_PAGE + "&idx=" + idx;
	} else if(LIST_TITLE_ON_CLICK == 1) {
		window.open("ttboard.cgi?act=popup" + QUERY + "&page=" + PAGE_CUR_PAGE + "&idx=" + idx,
			"", "width="+LIST_POPUP_WIDTH+", height="+LIST_POPUP_HEIGHT+", scrollbars=1, resizable=1");
	} else if(LIST_TITLE_ON_CLICK == 2) {
		window.open("ttboard.cgi?act=read" + QUERY + "&page=" + PAGE_CUR_PAGE + "&idx=" + idx,
			"", "width="+LIST_POPUP_WIDTH+", height="+LIST_POPUP_HEIGHT+", scrollbars=1, resizable=1");
	}
}

function read_page(idx,page) {
	location.href = "ttboard.cgi?act=read" + QUERY + "&page=" + PAGE_CUR_PAGE + "&idx=" + idx + "&pg=" + page;
}


function multi_read() {
	var idx = "";

	// make index.
	for(var i = 1; i <= ARTICLE_ROWS; i++) {
		var obj = document.all["check" + i];
		if(obj && obj.value != 0) {
			// check secret article
			if(document.all["article" + i + "_secret"].value == 1) {
				alert("ºñ¹Ð °Ô½Ã¹°Àº ´ÙÁßÀÐ±â¸¦ ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
				return;
			}

			if(idx != "") idx += ",";
			idx += obj.value;
		}
	}

	if(idx == "") {
		alert("ÀÐÀ» °Ô½Ã¹°À» ¼±ÅÃÇØÁÖ½Ê½Ã¿À.");
		return;
	}

	location.href = "ttboard.cgi?act=multi_read&idx=" + idx + QUERY;
}

function article_manage() {
	var idx = "";

	// make index.
	for(var i = 1; i <= ARTICLE_ROWS; i++) {
		var obj = document.all["check" + i];
		if(obj && obj.value != 0) {
			if(idx != "") idx += ",";
			idx += obj.value;
		}
	}
	if(idx == "") {
		alert("°Ô½Ã¹°À» ¼±ÅÃÇØÁÖ¼¼¿ä.");
		return;
	}

	var url = "ttadmin.cgi?act=article_manage_list&bid="+DB+"&idx="+idx;
	window.open(url, "", "width=450, height=160, resizable=1");
}

function reply_article(idx) {
	hform.action = "ttboard.cgi?act=reply" + QUERY + "&idx=" + idx;
	hform.submit();
}

function modify_article(idx) {
	hform.action = "ttboard.cgi?act=modify" + QUERY + "&idx=" + idx;
	hform.submit();
}

function delete_article(idx) {
	if(confirm("°Ô½Ã¹°À» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) {
		hform.action = "ttboard.cgi?act=delete" + QUERY + "&idx=" + idx;
		hform.submit();
	}
}

function recommend(idx) {
	location.href = "ttboard.cgi?act=recommend" + QUERY_DB + "&idx="+idx;
}

function jump_to() {
	var obj = document.all["jump_page"];
	var page = obj.value;
	var last_page = document.all["last_page"].value;

	if(!check_number(page)) {
		alert("page¿¡´Â ¼ýÀÚ¸¸ ¾²½Ç ¼ö ÀÖ½À´Ï´Ù.");
		obj.value = "";
		obj.focus();
		return;
	}

	if(page != "") {
		if(parseInt(page) < 1) {
			alert("ÆäÀÌÁö´Â 1º¸´Ù Ä¿¾ßÇÕ´Ï´Ù.");
			obj.value = "";
			obj.focus();
			return;
		} else if(parseInt(page) > parseInt(last_page)) {
			alert(page + " ÆäÀÌÁö´Â Á¸ÀçÇÏÁö ¾Ê´Â ÆäÀÌÁöÀÔ´Ï´Ù.");
			obj.value = "";
			obj.focus();
			return;
		} else {
			location.href = "ttboard.cgi?act=list" + QUERY + "&page="+page;
		}
	}
}

function whois(ip) {
	// check ip.
	if(ip == "") return;

	var left = (screen.width - 520) / 2;
	var top	= (screen.height - 500) / 3;

	window.open("ttadmin.cgi?act=whois&ip="+ip, "",
		"width=520, height=500, left="+left+", top="+top+", scrollbars=1, resizable=1");
}

function view_image(idx,imgpath) {
	url = "ttboard.cgi?act=popup" + QUERY_DB + "&object=popupimage&idx=" + idx + "&imgpath=" + imgpath;
	viewWin = window.open(url,'', 'width=500, height=400, scrollbars=yes, resizable=yes');
}

