/*
**·ç´Ï¸ÖÆ¼º¸µå °ü·Ã ÀÚ¹Ù½ºÅ©¸³Æ® Æã¼Ç**
Writer -- Jeong Yun Kang --
modify date 2003-04-22
function chk_write(frm01)		- °Ô½ÃÆÇ ±Û¾²±âÃ¼Å© Æã¼Ç
function chk_delete(frm01)		- °Ô½ÃÆÇ ±ÛÁö¿ì±â Ã¼Å© Æã¼Ç
function chk_search(frm01)		- °Ô½ÃÆÇ °Ë»ö Ã¼Å© Æã¼Ç
function chk_comment()			- °Ô½ÃÆÇ ´ä±Û´Þ±â Ã¼Å© Æã¼Ç
function prohibit(name, op)		- °Ô½ÃÆÇ ·¹º§Ã¼Å©,À¯Àú·¹º§Ã¼Å© Æã¼Ç
function show_mailForm(obj)		- °Ô½ÃÆÇ Åä±Û¸ÞÀÏ show Æã¼Ç
function toggle_mailsend(ok)	- °Ô½ÃÆÇ Åä±Û¸ÞÀÏ º¸³»±â Ã¼Å© Æã¼Ç
*/

function StatusText() {
	window.status = "Looney Board ^^*";
	setTimeout("StatusText()",0);
}
//StatusText();

function img_resize(imgId) {
	var imgId = eval(imgId);
		if (imgId.width >=550){
//			var width = imgId.width*0.7;
//			var height = imgId.height*0.7;
			
			var width = 550;
			var height = imgId.height;

		/*	if (width >=550){
				
				width = imgId.width*0.7;
				height = imgId.height*0.7;
			}
			*/

		}
		else {
			height = imgId.height;
			width  = imgId.width;
		}

	imgId.height	= height;
	imgId.width		= width;
}

function ShowProgress()
{
	strAppVersion = navigator.appVersion;
	if (document.write_form.files(0).value != "" || document.write_form.files(1).value != "" || document.write_form.files(2).value != "") {
		if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) {
			winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes";
			window.showModelessDialog("config/Progress/show_progress.asp?nav=ie", null, winstyle);
		}
		else {
			winpos = "left=" + ((window.screen.width-380)/2) + ",top=" + ((window.screen.height-110)/2);
			winstyle="width=380,height=110,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos;
			window.open("config/Progress/show_progress.asp?nav=ns",null,winstyle);
		}
	}
	
	return true;
}


function chk_write(frm01,catpdscnt){

	if ((frm01.writer.value.length < 2) || (frm01.writer.value.length > 10)){
		alert("[ÀÌ¸§]À» ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä.");
		frm01.writer.focus();
		return ;
	}
	//Email Ã¼Å© Æã¼Ç ºÎºÐ-ÇöÀç °Ô½ÃÆÇ¿¡¼­ ÇÊ¿ä°¡ ¾øÀ½À¸·Î ÁÖ¼®Ã³¸®
	/*var ck = 0;
	if (frm01.email.value =="") {
		alert("[ÀÌ¸ÞÀÏ]ÀÌ ºñ¾ú½À´Ï´Ù. ");
		frm01.email.focus();
		return ;
	}
	else
	{
		for (var j=0; j < frm01.email.value.length ; j++ ) {
			var ch= frm01.email.value.substring(j,j+1)
			if (ch == "@" | ch== "." ) {
				ck = ck + 1;
			}
		}
		if (ck < 2 ) {
			alert("(À¯È¿ÇÑ)[Email]ÀÌ ¾Æ´Õ´Ï´Ù. ");
			frm01.email.focus();
			return ;
		}
	}*/

	if ((frm01.subject.value.length < 4) || (frm01.subject.value.length > 60)){
		alert("[Á¦¸ñ]À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		frm01.subject.focus();
		return ;
	}
/*
	if (frm01.content.value.length < 4){
		alert("[³»¿ë]À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		frm01.content.focus();
		return ;
	}
*/

	for (index = 0; index < frm01.istag.length; index++) {
		if (frm01.istag[index].checked == true) {
			break;
		}
	}
	var temp,temp1
	
	if (frm01.istag[index].value == "2") {
		
		if(frm01.srcedit.value == "2"){
	    	alert("HTMLÀÛ¼º »óÅÂ¿¡¼­ ÀúÀåÇÏ¼¼¿ä");
	    	return;
		}
		else{

//			alert("¤»¤»¤»");

			temp = document.getElementById("EditCtrl").contentWindow.document.body.innerHTML.replace(/</g, "&lt;");
			temp = document.getElementById("EditCtrl").contentWindow.document.body.innerHTML.replace(/>/g, "&gt;");
			temp = document.getElementById("EditCtrl").contentWindow.document.body.innerHTML.replace(/\"/g, "\"");


			frm01.htmlcontent.value=temp;
//			alert(temp);
//              document.getElementById("EditCtrl").contentWindow.document.body.innerText.replace(/(<IMG |<IFRAME )/g,"\n$1");
		}
		
		if (frm01.htmlcontent.value == "") {
			alert("º»¹® ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
			return;
		}
	} else {
		if (frm01.content.value == "") {
			alert("º»¹® ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
			frm01.content.focus();
			return;
		}
	}


	if ((frm01.passwd.value.length < 4) || (frm01.passwd.value.length > 10)){
		alert("[ÆÐ½º¿öµå]´Â 4ÀÚÀÌ»ó 10ÀÚ ÀÌÇÏÀÔ´Ï´Ù. ");
		frm01.passwd.focus();
		return ;
	}
	
	strAppVersion = navigator.appVersion;
	
	if (catpdscnt!='0'){
	if (document.frm01.file(0).value != "") {
		if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) {
			winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes";
			window.showModelessDialog("/board/webboard/config/Progress/show_progress.asp?nav=ie", null, winstyle);
		}
		else {
			winpos = "left=" + ((window.screen.width-380)/2) + ",top=" + ((window.screen.height-110)/2);
			winstyle="width=380,height=110,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos;
			window.open("/board/webboard/config/Progress/show_progress.asp?nav=ns",null,winstyle);
		}
	}
	}
	
	frm01.submit();
	return true ;
}


//°Ô½Ã¹° º¸±â Æã¼Ç
function view_contents(BulletinNo,npage,BulletinCode,isSecret){

		location.href = 'view.asp?BulletinNo='+BulletinNo+'&npage='+npage+'&bulletinCode='+BulletinCode+'&isSecret='+isSecret;
}

// °Ô½Ã¹°Áß¿¡¼­ º»ÀÎÀÇ ±ÛÀÌ°Å³ª °ü¸®ÀÚ°¡ Áö¿ï¶§ ÄÄÆßÇÏ´Â Æã¼Ç
function chk_deluser(npage,bulletinCode,bulletinNo,user_id,refNo)
{


	var msg = '°Ô»ç¹°ÀÌ »èÁ¦ µË´Ï´Ù.'+'\r\n'+'Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î ?';
	if(confirm(msg)==1) {
		location.href = 'delete.asp?npage='+npage+'&bulletinCode='+bulletinCode+'&bulletinNo='+bulletinNo+'&user_Id='+user_id+'&refNo='+refNo;
	}

}

function chk_delete(frm01){

	if ((frm01.passwd.value.length < 4) || (frm01.passwd.value.length > 10)){
		alert("[ÆÐ½º¿öµå]´Â 4ÀÚÀÌ»ó 10ÀÚ ÀÌÇÏÀÔ´Ï´Ù. ");
		frm01.passwd.focus();
		return ;
	}

	frm01.submit();
	return true ;
}

function chk_writeNotice(frm01){

	if ((writeNotice.subject.value.length < 4) || (writeNotice.subject.value.length > 60)){
		alert("[Á¦¸ñ]À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		writeNotice.subject.focus();
		return ;
	}

	if (writeNotice.content.value.length < 4){
		alert("[³»¿ë]À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		writeNotice.content.focus();
		return ;
	}

	
	strAppVersion = navigator.appVersion;
	
	
	/* -- °øÁö»çÇ×¿¡ ¾÷·Îµå°¡ÀÖÀ»°æ¿ì¿¡»ç¿ë --ÇöÀç´Â °øÁö»çÇ×¿¡ ¾÷·Îµå´Â ¾ø°Ô Ã³¸®!!
		if (document.writeNotice.file.value != "") {
		if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) {
			winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes";
			window.showModelessDialog("/board/webboard/config/Progress/show_progress.asp?nav=ie", null, winstyle);
		}
		else {
			winpos = "left=" + ((window.screen.width-380)/2) + ",top=" + ((window.screen.height-110)/2);
			winstyle="width=380,height=110,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos;
			window.open("/board/webboard/config/Progress/show_progress.asp?nav=ns",null,winstyle);
		}
	}
	*/
	

	writeNotice.submit();
	return true ;
}



function chk_pwd(frm01){

	if ((frm01.passwd.value.length < 4) || (frm01.passwd.value.length > 10)){
		alert("[ÆÐ½º¿öµå]´Â 4ÀÚÀÌ»ó 10ÀÚ ÀÌÇÏÀÔ´Ï´Ù. ");
		frm01.passwd.focus();
		return ;
	}

	frm01.submit();
	return true ;
}

function chk_search(frm01){

	if ((frm01.searchword.value.length < 1)){
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä. ");
		frm01.searchword.focus();
		return ;
	}

	frm01.submit();
	return true ;
}

function chk_comment()
	{
				
		if (document.comment.comment_writer.value == "") {
				alert("ÀÛ¼ºÀÚ¸¦ ÀÔ·ÂÇØ ÁÖ½Ê¼¼¿ä!");
				document.comment.comment_writer.focus();
				return;
		}

		if (document.comment.replyContent.value == "") {
				alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä!");
				document.comment.replyContent.focus();
				return;
		}
		
		if (document.comment.comment_pwd.value == "" || document.comment.comment_pwd.value.length<4) {
				alert("ÆÐ½º¿öµå¸¦ 4ÀÚÀÌ»óÀ¸·Î \n\n ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä!");
				document.comment.comment_pwd.focus();
				return;
		}

		if (document.comment.replyContent.value.length>300)
		{
				alert("ÀÔ·Â±ÛÀÚ´Â 200ÀÚÀÌÇÏ·Î ÇØÁÖ¼¼¿ä^^");
				document.comment.replyContent.focus();
				return;
				
		}

	document.comment.action="/board/webboard/process.asp"
	document.comment.submit();
	return true ;
}


//°Ô½ÃÆÇ ÀÐ±â ¾²±â ±ÇÇÑ ¸Þ¼¼Áö Function--Modify by Jeong Yun Kang
function prohibit(name, op)
{
	if(op == "r"){
		var str = name+"ÀÌ»ó¸¸ÀÌ ±ÛÀ» ÀÐÀ» ¼ö ÀÖ½À´Ï´Ù"
		alert(str);
		return;
	}else if(op == "w"){
		var str = name+"ÀÌ»ó¸¸ÀÌ ±ÛÀ» µî·ÏÇÒ ¼ö ÀÖ½À´Ï´Ù"
		alert(str);
		return;
	}else if(op == "e"){
		var str = name+"ÀÌ»ó¸¸ ´äº¯ÇÒ ¼ö ÀÖ½À´Ï´Ù"
		alert(str);
		return;
	}else{
		var str="·Î±×ÀÎ ÇÏ¼Å¾ßÇÕ´Ï´Ù."
		alert(str);
		return;
	}
}


function DeleteDeny()
{
	alert("»èÁ¦ÇÏ½Ã·Á´Â ÀÌ ±ÛÀº °ü·ÃµÈ ±ÛÀÌ ÀÖ½À´Ï´Ù.\n°ü·ÃµÈ ±ÛÀÌ ÀÖÀ¸¸é »èÁ¦ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
}


function Reply()
{
				
	var	T_NAME = document.ViewReply.replyName.value;
	var	T_CONTENT = document.ViewReply.replyContent.value;
	//ÀÌ¸§
	if (document.ViewReply.replyName.value == "")
	{
		alert("ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.. please.");
		return false;
	}
	//Á¦¸ñ
	if (document.ViewReply.replyContent.value == "")
	{
		alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.., please.");
		return false;
	}
	
	document.ViewReply.submit();
	
}

function chkKey(frm)
{
	if (frm.searchStr.value.length < 2)

	{
		alert('°Ë»ö¾î´Â 2ÀÚÀÌ»ó ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		frm.searchStr.focus();
		return false;
	}
	
	else
	
	frm.submit();

}


//°Ô½Ã¹° ÆùÆ® »çÀÌÁî º¯È¯ Æã¼Ç
var CurrentFontSize = 10
var CurrentLineHeight = 16
function SetFontSize(SizeFlag) {
	obj = document.getElementById("ContentSummary")
	
	if (SizeFlag == 'B') {
		if(CurrentFontSize<30){
		CurrentFontSize = CurrentFontSize + 1
		CurrentLineHeight = parseInt(CurrentFontSize*1.6)
		obj.style.fontSize = CurrentFontSize + "pt"
		obj.style.lineHeight = CurrentLineHeight + "pt"
		}
	} else {
		if (CurrentFontSize>5) {
			CurrentFontSize = CurrentFontSize - 1
			CurrentLineHeight = parseInt(CurrentFontSize*1.6)
		}
		obj.style.fontSize = CurrentFontSize + "pt"
		obj.style.lineHeight = CurrentLineHeight + "pt"
	}
}

function new_win(url)
{
	window.open(url,"popup","width=300,height=400,scrollbars=yes,status=yes,toolbar=yes,left='100',top='100'");
}

function new_win2(url)
{
	window.open(url,"popup","width=0,height=0,scrollbars=auto,status=yes,toolbar=no,left='100',top='100'");
}

function winOpen(URL, winName,features)
{
	wmap = window.open(URL,winName,features);
	wmap.focus();
}


var flag = false;
function select_all() {
	var frm = document.BrdList;
		if(flag == false) {
			for( var i=0; i < frm.elements.length; i++) {
				frm.elements[i].checked = true
			}
			flag = true;
		} else {
			for( var i=0; i < frm.elements.length; i++) {
				frm.elements[i].checked = false
			}
			flag = false;
		}
	return; 
}

function chk_view() {
	var frm = document.BrdList;
	var Count = 0;
	for(i=0;i < frm.elements.length;i++) {
		if(frm.elements[i].name == "bulletinNo") {
			if(frm.elements[i].checked == true) {
				Count++;
				if(confirm('¼±ÅÃÇÑ Ç×¸ñÀ» º¸½Ã°Ú½À´Ï±î?')) {
					document.BrdList.submit();
					return;
				} else {
					return;
				}
			}
		}
	} // end for
	if (Count == 0) {
		alert("ÇÔ²²º¼ Ç×¸ñÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä!!")
		return;
	}
}

function ItemWasChecked(obj)
{
	if (obj.checkeditem == "N"){
		obj.checkeditem = "Y";
		obj.src = "/board/webboard/img/checkbox_o.gif";
		eval("document.frmlist.chk" + obj.id + ".value='on'");
	}else{
		obj.checkeditem = "N";
		obj.src = "/board/webboard/img/checkbox_n.gif";
		eval("document.frmlist.chk" + obj.id + ".value='off'");
	}
}

function LookingChecked()
{
	CheckedItems = "";
	var oCK = document.frmlist.chk;
	var bdCode = document.frmlist.bulletinCode.value;
	var cPage = document.frmlist.nPage.value;
	for(var i =0; i < oCK.length; i++){
		if(oCK[i].value == "on"){
			CheckedItems = CheckedItems + oCK[i].seq + ","
		}
	}
	CheckedItems = CheckedItems.substr(0,CheckedItems.length-1);
	
	for(i =0; i < oCK.length; i++){
		if(oCK[i].value == "on"){
			oCK[i].value = ""
		}
	}
	

	if (CheckedItems != "")
		location.href = "view_all.asp?bulletinCode=" + bdCode + "&nPage=" + cPage + "&seqs=" + CheckedItems;
	else
		alert("ÇÑ¹ø¿¡ º¸½Ç ±Û(µ¿½Ãº¸±âÇÒ ±Û)À» ¼±ÅÃÇØ ÁÖ½Ê½Ã¿ä.");
}


function changeSearchPart(o)
{
	var oSearchImg = document.all.searchImg;
	for(var i=0; i < oSearchImg.length; i++)
	{
		oSearchImg[i].src = "img/s_" + oSearchImg[i].key + "_off.gif";
	}
	
	o.src = "img/s_" + o.key + "_on.gif";
	document.frmSearch.searchPart.value= o.key;
}	

function initSearchPart()
{
	var oSearchImg = document.all.searchImg;
	for(var i=0; i < oSearchImg.length; i++)
	{
		if(oSearchImg[i].key == "<%=SearchPart_o%>")
			oSearchImg[i].src = "img/s_" + oSearchImg[i].key + "_on.gif";
		else
			oSearchImg[i].src = "img/s_" + oSearchImg[i].key + "_off.gif";
	}
	
	document.frmSearch.searchPart.value= "<%=SearchPart_o%>";
}



var imgObj = new Image();
function showImgWin(imgName) {
	imgObj.src = escape(imgName);
	setTimeout("createImgWin(imgObj)", 100);
}
function createImgWin(imgObj) {
	if (! imgObj.complete) {
		setTimeout("createImgWin(imgObj)", 100);
	return;
}
	imageWin = window.open("", "imageWin", "width=" + imgObj.width + ",height=" + imgObj.height);
	imageWin.document.write("<html><body style='margin:0'>");
	imageWin.document.write("<img src='" + imgObj.src + "' onclick=window.close();>");
	imageWin.document.write("</body><html>");
	imageWin.document.title = imgObj.src;

}