
/*
* KimsBoard Main Script
*/

//¿äÃ»µÈ Url(Äõ¸®½ºÆ®¸µ Á¦¿Ü)
function getThisFile()
{
	//var QuerySplit = location.href.split('?');
	//return QuerySplit[0];
	return './bbs.php';
}

//¿äÃ»µÈ ÆÄ¶ó¹ÌÅÍÀÇ Value
function getUriString(param)
{
	return eval("document.DataForm." + param).value;
}

//°øÅë URL (Á¦¾îÆÄ¶ó¹ÌÅÍ query,uid,p Á¦¿Ü ; ÆÄ¶ó¹ÌÅÍ°ªÀº getUriString('ÆÄ¸®¹ÌÅÍ') )
function getThisUrl()
{
	var d			=	document.DataForm;
	var table		=	d.table.value;
	var query		=	d.query.value;
	var p			=	d.p.value;
	var uid			=	d.uid.value;
	var where		=	d.where.value;
	var keyword		=	d.keyword.value;
	var search_step	=	d.search_step.value;
	var search_type =   d.search_type.value;
	var category	=	d.category.value;
	var sort		=	d.sort.value;
	var orderby		=	d.orderby.value;
	var grecnum     =   d.grecnum.value;

	var cqurl  = getThisFile();
	cqurl += table		? '?table='			+ table			: '';
	cqurl += where		? '&where='			+ where			: '';
	cqurl += keyword	? '&keyword='		+ keyword		: '';
	cqurl += search_step? '&search_step='	+ search_step	: '';
	cqurl += search_type? '&search_type='   + search_type   : '';
	cqurl += category	? '&category='		+ category		: '';
	cqurl += sort		? '&sort='			+ sort			: '';
	cqurl += orderby	? '&orderby='		+ orderby		: '';
	cqurl += grecnum	? '&grecnum='		+ grecnum		: '';
	if (where && keyword)
	{
		cqurl += '&search_sql=' + getSearchSql(where , keyword);
	}

	return cqurl;
}

//Á¤·ÄUrl (ÇÊµå¸í ASC,DESCÁöÁ¤)
function getSort(field)
{
	var d =	document.DataForm;

	if (d.sort.value == field)
	{
		if (d.orderby.value == "DESC")
		{
			d.orderby.value = "";
		}
		else {
			d.orderby.value = "DESC";
		}
	}
	else {
		d.sort.value = field;
		d.orderby.value = "DESC";
	}
	
	location.href = getThisUrl() + '&p=' + getUriString('p');
}

//¸¶Áö¸·ÆäÀÌÁö¼ö
function LastPage(p)
{
	return document.getElementById('LastPage').value;
}

//±Ûº¸±â
function ViewArticle(uid,secret,dbid,tbl,win,e)
{
	var url   = getThisUrl();
	var table = tbl != '' ? tbl : getUriString('table');
	if(secret != '')
	{
		var CookieSecret = document.getElementById('CookieSecret').value;
		var isRoot       = document.getElementById('isRoot').value;
		var isAdmin      = document.getElementById('isAdmin').value;
		var mbid         = document.getElementById('mbid').value;

		if(CookieSecret.indexOf(table + '_' + uid + '_' ) == -1)
		{
			if (mbid == '' || (mbid != '' && mbid != dbid))
			{
				if (isRoot == '0' && isAdmin == '0')
				{
					if (tbl != '') document.DataForm.table.value = tbl;
					getPassLayer('secret',isRoot,isAdmin,mbid,dbid,uid,0,e);
					return false;
				}
			}
		}
	}
	if (win != '_win')
	{
		location.href = url + '&query=view&uid=' + uid + '&p=' + getUriString('p');
	}
	else {
		var win = './bbs.php?table='+table+'&action=newwin&uid=' + uid;
		window.open(win , 'output_win','width=650,height=600,scrollbars=yes');
	}
}


//¸ñ·ÏÀ¸·Î
function getListPage()
{
	location.href = getThisUrl() + '&p=' + getUriString('p');
}

//ÀÏ¹Ý±Û¾²±â
function getWritePage()
{
	location.href = getThisUrl() + '&query=write';
}

//´äº¯¾²±â
function getReplyPage(uid)
{
	location.href = getThisUrl() + '&query=write&write_type=reply&uid=' + uid + '&p=' + getUriString('p');
}

//ÆÐ½º¿öµåÃ¼Å© ·¹ÀÌ¾î, ¼öÁ¤/»èÁ¦
function getPassLayer(que,isRoot,isAdmin,mbid,dbid,uid,ruid,e)
{
	if (isRoot != '0' || isAdmin != '0' || (mbid != '' && mbid == dbid))
	{
		if (que == 'modify')
		{
				location.href = getThisUrl() + '&query=write&write_type=modify&uid=' + uid + '&p=' + getUriString('p');
		}
		if (que == 'delete')
		{
			if(confirm('Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?         '))
			{
				location.href = getThisUrl() + '&action=delete&uid=' + uid + '&p=' + getUriString('p');
			}
		}	
		return false;
	}
	if(!x) var x = e.pageX ? e.pageX : document.body.scrollLeft+event.clientX;
	if(!y) var y = e.pageY ? e.pageY : document.body.scrollTop+event.clientY;
	var l = document.getElementById('PassCheckLayer');
	var f = document.pass_check_form;
	var t = document.getElementById('PwLayTitle');
	
	l.style.display = 'block';
	l.style.left = x - 80;
	l.style.top  = y + 20;

	f.table.value  = getUriString('table');
	f.action.value = que;
	f.uid.value    = uid;
	f.ruid.value   = ruid;
	f.p.value      = getUriString('p');
	
	if (que == 'delete')
	{
		t.innerHTML = "<b>°Ô½Ã¹°À» »èÁ¦ÇÕ´Ï´Ù..</b>";
		f.Nparam.value = getThisUrl() + '&p=' + getUriString('p');
	}
	if (que == 'modify')
	{
		t.innerHTML = "<b>°Ô½Ã¹°À» ¼öÁ¤ÇÕ´Ï´Ù..</b>";
		f.Nparam.value = getThisUrl() + '&query=write&write_type=modify&p=' + getUriString('p') + '&uid=' + uid;
	}
	if (que == 'secret')
	{
		t.innerHTML = "<b>ºñ°ø°³ °Ô½Ã¹°ÀÔ´Ï´Ù..</b>";
		f.Nparam.value = getThisUrl() + '&query=view&p=' + getUriString('p') + '&uid=' + uid;
	}
	if (que == 'cdelete')
	{
		t.innerHTML = "<b>ÄÚ¸àÆ®¸¦ »èÁ¦ÇÕ´Ï´Ù..</b>";
		f.Nparam.value = getThisUrl() + '&query=view&p=' + getUriString('p') + '&uid=' + uid;
	}
	f.COMP_PASS.focus();
}

//°Ë»öSQL
function getSearchSql(where , keyword)
{
	var i;
	var SQL = "";
	var search_type = document.DataForm.search_type.value;
		search_type = search_type == 'and' ? 'AND' : 'OR';

	if (keyword.indexOf(' ') == -1 && keyword.indexOf(',') == -1)
	{
		if (where == "ALL") return "BB_NAME LIKE '%"+keyword+"%' "+search_type+" BB_SUBJECT LIKE '%"+keyword+"%' "+search_type+" BB_CONTENT LIKE '%"+keyword+"%'";
		else				return where + " LIKE '%"+keyword+"%'";
	}
	else {
		keyword = keyword.replace(',' , ' ')
		var key_exp = keyword.split(' ');
		if (where == "ALL")
		{
			for(i = 0; i < key_exp.length - 1; i++)
			{
				SQL += "(BB_NAME LIKE '%"+key_exp[i]+"%' "+search_type+" BB_SUBJECT LIKE '%"+key_exp[i]+"%' "+search_type+" BB_CONTENT LIKE '%"+key_exp[i]+"%') "+search_type+" ";
			}
			SQL += "(BB_NAME LIKE '%"+key_exp[i]+"%' "+search_type+" BB_SUBJECT LIKE '%"+key_exp[i]+"%' "+search_type+" BB_CONTENT LIKE '%"+key_exp[i]+"%')";
		}
		else {
			for(i = 0; i < key_exp.length - 1; i++)
			{
				SQL += where + " LIKE '%"+key_exp[i]+"%' "+search_type+" ";
			}
			SQL += where + " LIKE '%"+key_exp[i]+"%'";
		}
		return SQL;
	}
}

//°Ë»ö¾îÃ¼Å©
function getSearchStart()
{
	if(getUriString('where') && getUriString('keyword'))
	{
		getKeywordHighLight();
	}
}

//°Ë»ö°á°ú ÇÏÀÌ¶óÀÌÆ®
function getKeywordHighLight() 
{
	var where   = getUriString('where');
	var keyword = getUriString('keyword');
	var r,i,s=document.selection.createRange().text;

	if(!where || !keyword) 
	{ 
		return false;
	}
	
	keyword = keyword.replace(',' , ' ');
	var keyexp = keyword.split(' ');

	for ( var j = 0; j < keyexp.length; j++)
	{
		r = document.body.createTextRange();
		for(i = 0; r.findText(keyexp[j]); i++)
		{
			r.execCommand('ForeColor','','#FF0000');
			r.execCommand('BackColor','','#FFFF00');
			r.collapse(false);
		}
	}
}

//Ä«Å×°í¸®¼¿·ºÆ®
function getCategoryForm(use , sbj , opt , cat , event)
{
	if (use)
	{
		var select = "";
		var option = opt.split(',');
		
		select += "<SELECT NAME='BB_CATEGORY' ID='BB_CATEGORY'";
		select += event ? " onchange='getCategoryEvent(this);' CLASS='Wfield'>" : " CLASS='Wfield'>";
		select += "<OPTION VALUE=''>"+ sbj +"</OPTION>";
		for (var i = 0; i < option.length; i++)
		{
			if (option[i]) 
			{
				if (cat == option[i])
				{
					select += "<OPTION VALUE='"+ option[i] +"' selected>"+ option[i] +"</OPTION>";
				}
				else {
					select += "<OPTION VALUE='"+ option[i] +"'>"+ option[i] +"</OPTION>";
				}
			}
		}
		select += "</SELECT>";
		select += "<INPUT TYPE=HIDDEN NAME='is_category' VALUE='1'>";
		
		document.write(select);
	}
	else {
		document.write("<INPUT TYPE=HIDDEN NAME='is_category' VALUE=''>");
	}
}

//Ä«Å×°í¸®ÀÌº¥Æ®
function getCategoryEvent(obj)
{
	location.href = getThisUrl().replace('category=' + getUriString('category') + '&' , '') + '&category=' + obj.value;
}

//ºñ°ø°³Ã¼Å©¹Ú½º
function getSecretCheck(use , que)
{
	if(use == 'checked')
	{
		document.write("<INPUT TYPE=CHECKBOX NAME=BB_SECRET VALUE='checked' "+que+">°ü¸®ÀÚ¿¡°Ô¸¸ °ø°³ÇÕ´Ï´Ù");
	}
	else {
		document.write("<INPUT TYPE=CHECKBOX NAME=BB_SECRET VALUE='checked' "+que+" STYLE='display:none;'>");
	}
}

//´äº¯¸ÞÀÏ¹ß¼ÛÃ¼Å©¹Ú½º
function getRemailCheck(use,email,type)
{
	if (use && email && type == 'reply')
	{
		document.write("<INPUT TYPE=hidden NAME=writeer_remail VALUE='"+email+"'>");
		document.write("<INPUT TYPE=CHECKBOX NAME=remail VALUE='checked'>ÀÌ¸ÞÀÏ·Î ´äº¯¹ß¼Û");
	}
}

//µî·ÏÀÎ¼±ÅÃ¼¿·ºÆ®
function getIsRootSelect(isRoot,v_LogId)
{
	if (isRoot != '0' && v_LogId != '')
	{
		document.write("<SELECT NAME='writer_select' ID='writer_select' CLASS='Wfield'>");
		document.write("<OPTION VALUE='member'>±Û¾´ÀÌ: »ç¿ëÀÚ·Î µî·Ï</OPTION>");
		document.write("<OPTION VALUE='root'>±Û¾´ÀÌ: °ü¸®ÀÚ·Î µî·Ï</OPTION>");
		document.write("</SELECT>");
        if(navigator.userAgent.indexOf('Opera') == -1 && navigator.userAgent.indexOf('MSIE') != -1)
		{
			getSelectToLayer(document.getElementById('writer_select'),150,'');
		}
	}
}

//ºñ¹Ð¹øÈ£ ÀÔ·ÂÆû(±Û¾²±â)
function getPasswdInput(wType,secret,pass,name)
{
	var passinput = "";

	if (wType)
	{
		if (wType == 'reply')
		{
			//´äº¯
			if (secret == 'checked')
			{
				passinput = "<INPUT TYPE=PASSWORD NAME='"+name+"' VALUE='"+pass+"' SIZE=15 CLASS='Wfield' readonly STYLE='background:#DFDFDF;'>";
			}
			else {
				passinput = "<INPUT TYPE=PASSWORD NAME='"+name+"' SIZE=15 CLASS='Wfield'>";
			}
		}
		else {
			//¼öÁ¤
			passinput = "<INPUT TYPE=PASSWORD NAME='"+name+"' VALUE='"+pass+"' SIZE=15 CLASS='Wfield' readonly STYLE='background:#DFDFDF;'>";	
		}
	}
	else {
		//ÀÏ¹Ý±Û
		passinput = "<INPUT TYPE=PASSWORD NAME='"+name+"' SIZE=15 CLASS='Wfield'>";			
	}

	document.write(passinput);
}

//ÀÌ¸§,ÆÐ½º¿öµå ÀÔ·ÂÆû(ÄÚ¸àÆ®)
function getNameInputCmt(mbid,isroot)
{
	var f = document.CommentForm;
	var wperm   = f.write_perm.value;

	var yNull   = "<INPUT TYPE='HIDDEN' NAME='RP_NAME' VALUE=''><INPUT TYPE='HIDDEN' NAME='isPass' VALUE=''>";
	var nNull   = "<INPUT TYPE='HIDDEN' NAME='RP_NAME' VALUE='1'><INPUT TYPE='HIDDEN' NAME='isPass' VALUE='1'>";

	if (mbid != '' || isroot != '0')
	{
		if (wperm != '0')
		{
			document.write(nNull);
		}
		else {
			document.write(yNull);
		}
	}
	else {
		if (wperm != '0')
		{
			document.write("<INPUT TYPE='TEXT' NAME='RP_NAME' SIZE='15' VALUE='ÀÌ¸§' CLASS='Wfield' onfocus=\"this.value='';\">&nbsp;");
			document.write("<INPUT TYPE='TEXT' NAME='RP_PASS' SIZE='15' VALUE='ºñ¹Ð¹øÈ£' CLASS='Wfield' onfocus=\"this.value='';\"><INPUT TYPE='HIDDEN' NAME='isPass' VALUE=''>&nbsp;");
		}
		else {
			document.write(yNull);
		}
	}
}

//ÄÚ¸àÆ®°¹¼ö
function getCommentNum(num)
{
	if (num)
	{
		document.write("("+num+"°³)");
	}	
}

//ÄÚ¸àÆ®»èÁ¦ ±ÇÇÑ
function getCommentDeletePerm(isRoot,isAdmin,v_LogId,skin,uid,rp_id,ruid)
{
	var pass = (isRoot != '0'  || isAdmin != '0' || (v_LogId != '' && v_LogId == rp_id)) ? 1 : 0;
	document.write("<IMG SRC='./bbs/skin/"+skin+"/image/ico_delete.gif' ALIGN=absmiddle STYLE='cursor:hand;' onclick=\"doCommentDelete("+uid+","+ruid+","+pass+",event);\">");
}

//ÄÚ¸àÆ®»èÁ¦
function doCommentDelete(uid,ruid,pass,e)
{
	if (pass == 1)
	{
		if (!confirm('\nÁ¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?        \n'))
		{
			return false;
		}

		var f = document.pass_check_form;
		f.table.value  = getUriString('table');
		f.action.value = 'cdelete';
		f.uid.value    = uid;
		f.ruid.value   = ruid;
		f.p.value      = getUriString('p');

		f.Nparam.value = getThisUrl() + '&query=view&p=' + getUriString('p') + '&uid=' + uid;
		f.submit();
	}
	else {
		getPassLayer('cdelete',0,0,'','',uid,ruid,e);
		return false;
	}
}

//ÀÌ¸ð¼Ç¾ÆÀÌÄÜ
function getEmotionIcon(color)
{
	var icon = "";
	
	icon += "<TABLE CELLSPACING=0 CELLPADDING=1>";
	icon += "<TR BGCOLOR='"+color+"'>";

	for(var i = 1; i < 19; i++)
	{
		icon += "<TD ID='emotion_td_"+i+"' STYLE='border:1 solid "+color+";' onclick=\"getSelectEm("+i+",'"+color+"')\"><IMG ID='emotion_img_"+i+"' SRC='./bbs/image/em/"+i+".gif' STYLE='cursor:hand;filter:gray();' HSPACE=2 VSPACE=2></TD>";
	}
	
	icon += "</TR>";
	icon += "</TABLE>";

	document.write(icon);
}

//ÀÌ¸ð¼Ç¼±ÅÃ
function getSelectEm(g,color)
{

	for(var i = 1; i < 19; i++)
	{
		if(i == g)
		{
			document.getElementById('emotion_td_' + i).style.border = '1 solid gray';
			document.getElementById('emotion_td_' + i).style.background = '#ffffff';
			document.getElementById('emotion_img_' + i).style.filter = 'none';
			document.CommentForm.RP_EMOTION.value = i;
		}
		else {
			document.getElementById('emotion_td_' + i).style.border = '1 solid '+color;
			document.getElementById('emotion_td_' + i).style.background = color;
			document.getElementById('emotion_img_' + i).style.filter = 'gray()';
		}
	}
}

//ÄÚ¸àÆ®ÇÊµå ¸®»çÀÌÁî
function CommentLayResize(que)
{
	var area = document.getElementById('CommentTextAreaLay');
	var heit = parseInt(area.style.height.replace('px',''));
	if (que == '-')
	{
		if (heit - 100 >= 60) area.style.height = heit - 100;
	}
	else if (que == '+')
	{
		if (heit + 100 <= 600) area.style.height = heit + 100;
	}
	else {
		area.style.height = 60;
	}
}

//Ã·ºÎÆÄÀÏ
function LayerUpfile(enable,files,table,uid,where,colnum,type)
{
	if(enable)
	{
		var Layer_Tag = "";
		var Tmp_FileNum = files.split(';');
		
		if (Tmp_FileNum.length > 1)
		{
			Layer_Tag += "<IFRAME NAME='TmpFrameForDownload' WIDTH=0 HEIGHT=0 FRAMEBORDER=0 SCROLLING=0></IFRAME>";
			Layer_Tag += "<TABLE ID='upFile_Tmp_Layer' CELLSPACING=0 CELLPADDING=3 STYLE='border:1 solid dfdfdf;'><TR><TD>";
			Layer_Tag += "<TABLE CELLSPACING=1 CELLPADDING=1 STYLE='color:#404040;'>";
			Layer_Tag += "<TR>";
			
			for (var i = 0; i < Tmp_FileNum.length; i++)
			{
				if (Tmp_FileNum[i] == "") continue;

				var fname_arr = getFileName(Tmp_FileNum[i]).split('=');
				
				if(fname_arr[1])
				{
					Layer_Tag += "<TD>";
					Layer_Tag += "<IMG SRC='./bbs/image/file/small/" + getFileExt(fname_arr[0]) + ".gif' VSPACE=2 ALIGN=absmiddle> ";
					Layer_Tag += "<A TARGET='TmpFrameForDownload' HREF=\"./bbs.php?table="+table+"&action=down&where="+where+"&dtype=up&uid="+uid+"&file="+fname_arr[0]+"\">" + fname_arr[0];
					Layer_Tag += " (" + getFileSize(fname_arr[1],'K') + ")</A>";
					Layer_Tag += "</TD>";
				}
				else {
					Layer_Tag += "<TD>";
					Layer_Tag += "<IMG SRC='./bbs/image/file/small/" + getFileExt(fname_arr[0]) + ".gif' VSPACE=2 ALIGN=absmiddle> ";
					Layer_Tag += "<A TARGET='TmpFrameForDownload' HREF=\"./bbs.php?table="+table+"&action=down&where="+where+"&dtype=link&uid="+uid+"&file="+Tmp_FileNum[i]+"\">" + fname_arr[0];
					Layer_Tag += " (Link)";
					Layer_Tag += "</TD>";
				}

				if (((i+1)%colnum) == 0)
				{
					Layer_Tag += "</TR><TR>";
				}
			}

			Layer_Tag += "</TR>";
			Layer_Tag += "</TABLE>";
			Layer_Tag += "</TD></TR></TABLE>";
		}
		if (type == 'write')
		{
			document.write(Layer_Tag);
		}
		else {
			return Layer_Tag;
		}
	}
}

//¸µÅ©ÆÄÀÏ
function LayerLinkfile(enable,files,table,uid,where,colnum,type)
{
	if(enable)
	{
		var fname;
		var Layer_Tag = "";
		var Tmp_FileNum = files.split(';');
		
		if (Tmp_FileNum.length > 1)
		{
			Layer_Tag += "<IFRAME NAME='TmpFrameForDownload' WIDTH=0 HEIGHT=0 FRAMEBORDER=0 SCROLLING=0></IFRAME>";
			Layer_Tag += "<TABLE ID='linkFile_Tmp_Layer' CELLSPACING=0 CELLPADDING=3 STYLE='border:1 solid dfdfdf;'><TR><TD>";
			Layer_Tag += "<TABLE CELLSPACING=1 CELLPADDING=1 STYLE='color:#404040;'>";
			Layer_Tag += "<TR>";
			
			for (var i = 0; i < Tmp_FileNum.length; i++)
			{
				if (Tmp_FileNum[i] == "") continue;

				fname = Tmp_FileNum[i];

				Layer_Tag += "<TD>";
				Layer_Tag += "<IMG SRC='./bbs/image/file/small/" + getFileExt(getFileName(fname)) + ".gif' VSPACE=2 ALIGN=absmiddle> ";
				Layer_Tag += "<A TARGET='TmpFrameForDownload' HREF=\"./bbs.php?table="+table+"&action=down&where="+where+"&dtype=link&uid="+uid+"&file="+fname+"\">" + getFileName(fname);
				Layer_Tag += " (¸µÅ©)";
				Layer_Tag += "</TD>";

				if (((i+1)%colnum) == 0)
				{
					Layer_Tag += "</TR><TR>";
				}
			}

			Layer_Tag += "</TR>";
			Layer_Tag += "</TABLE>";
			Layer_Tag += "</TD></TR></TABLE>";
		}
		if (type == 'write')
		{
			document.write(Layer_Tag);
		}
		else {
			return Layer_Tag;
		}
	}
}

//----------------------------------------------------------------------------------------------
// ÆÄÀÏÃ³¸® °ü·Ã
//----------------------------------------------------------------------------------------------

//ÆÄÀÏ¸í
function getFileName(name)
{
	var FileFullStr = name.split('?');
	var FileUrliArr = FileFullStr[0].split('/');
	return FileUrliArr[FileUrliArr.length - 1];
}

//ÆÄÀÏÈ®ÀåÀÚ->¾ÆÀÌÄÜ
function getFileExt(name)
{
	var ExtSet  = "gif,jpg,jpeg,bmp,png,swf,fla,pds,ai,tif,pcx,ppj,"; //ÀÌ¹ÌÁö,ÇÃ·¡½¬
		ExtSet += "mid,wav,mp3,"; //»ç¿îµå
		ExtSet += "asf,asx,avi,mpg,mpeg,wmv,wma,ra,ram,mov,"; //µ¿¿µ»ó
		ExtSet += "doc,xls,ppt,hwp,hlp,eml,"; //¿ÀÇÇ½º
		ExtSet += "zip,tar,trz,gz,rar,alz,"; //¾ÐÃà
		ExtSet += "exe,dll,reg,ini,"; //½ÇÇà
		ExtSet += "php,php3,class,java,htm,html,txt,cgi,pl,jsp,asp,xml,";//web ÃÑ53°³

	var FileNameArr = name.split('.');
	var ext = FileNameArr[FileNameArr.length - 1].toLowerCase()
	
	if (ExtSet.indexOf(ext) != -1)
	{
		return ext;
	}
	else {
		return "unknown";
	}
}

//ÆÄÀÏ»çÀÌÁî
function getFileSize(bt , type)
{
	if (type == "M")
	{
		var btn = parseInt(bt)/(1024*1024);
		var bt_split = btn.toString().split('.');
		var subnum = bt_split[1] ? '.' + bt_split[1].substring(0,2) : '';
		var bt_num   = commaSplit(bt_split[0]) + '.' + subnum;
		return  bt_num + "M";
	}
	if (type == "K")
	{
		var btn = parseInt(bt)/1024;
		var bt_split = btn.toString().split('.');
		var subnum = bt_split[1] ? '.' + bt_split[1].substring(0,2) : '';
		var bt_num   = commaSplit(bt_split[0]) + subnum;
		return  bt_num + "K";
	}
	if (type == "B")
	{
		return commaSplit(bt) + "B";
	}
}

//½ºÅ©·¦
function Scrab(table,uid,id)
{
	if (id == '')
	{
		alert('\nÈ¸¿øÀ¸·Î ·Î±×ÀÎÇØ¾ß ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.       \n');
		return false;
	}

	alert('½ºÅ©·¦ÇÏ¿´½À´Ï´Ù.       ');

	frames.logiframe.location.href = './bbs.php?table=' + table + '&action=scrab&uid='+uid;
}

//¸ÞÀÏ
function SendMail(table,uid)
{
	window.open('./bbs.php?action=mailwin&table='+table+'&uid='+uid , 'mwin' , 'left=0,top=0,width=500,height=500');
}
