
function hangulCheck(str) 
{
	for(i=0; i<str.length; i++) 
	{
		var a = str.charCodeAt(i);
		if (a > 128) 
		{
			alert('Ã·ºÎÇÏ½Ç ÀÌ¹ÌÁö´Â ÇÑ±Û¸íÀ» »ç¿ëÇÏ½Ç¼ö ¾ø½À´Ï´Ù. ¿µ¹®À¸·Î »ç¿ëÇØÁÖ¼¼¿ä.');
			return false;
		}	
	}
	return true;
}

function trim (strSource) 
{
	re = /^\s+|\s+$/g;
	return strSource.replace(re, '');
}

function ltrim (strSource) 
{
	re = /^\s+/g;
	return strSource.replace(re, '');
}

function rtrim (strSource) 
{
	re = /\s+$/g;
	return strSource.replace(re, '');
}

function loadmedia()
{
	var arrMediaList = document.all.tags("object");
	var i;

	for (i=0; i<arrMediaList.length; i++) 
	{
		if (arrMediaList[i].classid.toUpperCase() == "CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" && arrMediaList[i].rsr.length > 40) {
			arrMediaList[i].ShowStatusBar = "-1";
			if (arrMediaList[i].rau == "0") {
				arrMediaList[i].autostart = "0"
			} else {
				arrMediaList[i].autostart = "-1"
			}
			arrMediaList[i].filename = arrMediaList[i].rsr;
		}
	}
}

function EDT_ViewImage() 
{
	if (event.srcElement.tagName == "IMG") 
	{
		window.open(event.srcElement.src, "", "directories=no,location=no,menubar=no,resizable=yes,status=no,toolbar=no,scrollbars=yes");
	}
}

// ¿¡µðÅÍ
function ToggleEditorSize(bDirection) 
{
	if (!bDirection) 
	{
		document.all.editBox.height = document.all.editBox.height <= 400?document.all.editBox.height:parseInt(document.all.editBox.height)-200;
	}
	else 
	{
			document.all.editBox.height = document.all.editBox.height>=2000?document.all.editBox.height:parseInt(document.all.editBox.height) + 200;
	}
}

// ÅØ½ºÆ®¿¡¾î¸®¾î
function ToggleTextAreaSize(bDirection) 
{
	if (!bDirection) 
	{
		document.all.content.rows = document.all.content.rows-2;
	}
	else 
	{
		document.all.content.rows = document.all.content.rows+2;
	}
}

// Ã·ºÎÆÄÀÏ »èÁ¦ ¹× Á¤¸®
function removeAttach()
{
	var attachlist = document.getElementById("attachfilelist");
    if (attachlist.selectedIndex <= 0) { return; } // ¼±ÅÃµÈ°Ô ¾øÀ¸¸é
	attachlist.remove(attachlist.selectedIndex);   // ¼±ÅÃÇÑ ÆÄÀÏ ¸®½ºÆ®¿¡¼­ »èÁ¦
	putAttachFile();
}

function putAttachFile()
{
	var attachlist = document.getElementById("attachfilelist");
	var total = attachlist.options.length;			
	if (total > 1)
	{
		var oriFileNameArr = "";
		var newFileNameArr = "";

		for(i=0; i<total; i++)
		{
			if (attachlist.options[i].value != "") 
			{
				oriFileNameArr = oriFileNameArr + attachlist.options[i].text + "?";				// ¿À¸®Áö³¯ ÆÄÀÏ¸í
				newFileNameArr = newFileNameArr + attachlist.options[i].value + "?";		// »õ·Î¿î ÆÄÀÏ¸í
			}			
		}
	}
	else
	{
		oriFileNameArr = ""; 
		newFileNameArr = ""; 
	}
	
	document.form1.attachOriFileNameList.value = oriFileNameArr.substr(0,oriFileNameArr.length-1);			// ¿À¸®Áö³¯ ÆÄÀÏ¸í
	document.form1.attachFileNameList.value = newFileNameArr.substr(0,newFileNameArr.length-1);			// »õ·Î¿î ÆÄÀÏ¸í

}
// Ã·ºÎÆÄÀÏ »èÁ¦ ¹× Á¤¸®

// ÆÄÀÏÃ·ºÎÃ¢ ¶ç¿ì±â
function fileUploadFnc(frmObj)
{
	var bbsID = frmObj.bbsID.value;
	var bbsClass = frmObj.bbsClassCheck.value;
	var nFileTotal = frmObj.attachfilelist.length;
	var bbsPdsTotal = frmObj.bbsPdsTotal.value;
	if(parseInt(nFileTotal-1) >= parseInt(bbsPdsTotal)) { alert(bbsPdsTotal + "°³ ÀÌ»ó Ã·ºÎÇÏ½Ç¼ö ¾ø½À´Ï´Ù."); return; }

	newOpen('bbsFileUpload.asp?bbsID=' + bbsID,'fileUpload','420','140','0','0','0','0','0','CENTER','');

/*
	if(retVal)	 // ÆÄÀÏÀ» Ã·ºÎÇÑ°Ô ÀÖ´Ù¸é
	{
		if(retVal[0] != null && retVal[0] != "" && retVal[1] != null && retVal[1] != "" && retVal[2] != null && retVal[2] != "")
		{
			var attachFileNameList = frmObj.attachFileNameList.value;						// ºÎ¸ðÆûÀÇ È÷µçÇÊµå
			attachFileNameList = attachFileNameList + "?" + retVal[1];						// ÆÄÀÏ¸í ´õÇÏ±â
			frmObj.attachFileNameList.value = attachFileNameList;							// ´õÇÑ ÆÄÀÏ¸í ºÎ¸ðÃ¢ÀÇ È÷µçÇÊµå¿¡ ³Ö±â

			// ºÎ¸ðÆûÀÇ ÆÄÀÏÃ·ºÎ ¹Ú½º¿¡ Ãß°¡
			var total = frmObj.attachfilelist.options.length;
			var position = parseInt(total) + 1
			frmObj.attachfilelist.length = position;		
			frmObj.attachfilelist.options[total].text = retVal[0];
			frmObj.attachfilelist.options[total].value = retVal[1];	
		}
	}
*/

}
// ÆÄÀÏÃ·ºÎÃ¢ ¶ç¿ì±â

function HandleLoad() 
{
	blnBodyLoaded = true;
	init();
}

function HTMLDecode(strHtml)
{
	var strRetVal = "";
	strRetVal = strHtml.replace(/&gt;/gi, ">");
	strRetVal = strRetVal.replace(/&lt;/gi, "<");
	strRetVal = strRetVal.replace(/&quot;/gi, "\"");
	strRetVal = strRetVal.replace(/&amp;/gi, "&");
	return strRetVal;
}

function setEditMode(sMode) { document.all.editBox.editmode = sMode; }

function HandleKeyDown(e)
{
	if (event.srcElement.name == "title") 
	{
		if (event.keyCode == 9 || event.keyCode == 13) 
		{
			document.all.editBox.focus();
			document.all.editBox.setFocus();
			return false;
		}
	}
	else if (event.keyCode == 13) 	{ event.keyCode = 9; }
	return true;
}

function init() 
{
	for (var i = 0; i < document.form1.elements.length; i++) 
	{
		if (document.form1.elements[i].type == "text" || document.form1.elements[i].type == "password") 
		{
			document.form1.elements[i].onkeydown = HandleKeyDown;
		}
	}
	document.all.editBox.displaybpl(GetBPL(), GetBPLWidth(), GetBPLHeight(), GetBPLTop(), GetBPLLeft());
	setTimeout("document.form1.title.focus()", 0);
}