//ÀÎÁõ °ü·Ã ÀÚ¹Ù ½ºÅ©¸³Æ® ½ÃÀÛ//////////////////////////////////////////////////////////////////////////
var click_x,click_y;

if (document.layers){ document.captureEvents(Event.MOUSEDOWN) }

document.onmousedown = FindXY;

function FindXY(loc) {
	var theEvent = loc ? loc : window.event;
	click_x = (document.layers) ? theEvent.pageX : theEvent.clientX - 130;
	click_y = (document.layers) ? theEvent.pageY : theEvent.clientY - 60;
}

function showDeleteForm(action, bcfg_idx, board_idx, cmdProc)
{
	document.getElementById("passwdHidden").style.left = click_x - 50;
	document.getElementById("passwdHidden").style.top = document.body.scrollTop + click_y - 30;
	document.getElementById("passwdHidden").style.display = '';

	document.hidden.action = action;
	document.hidden.bcfg_idx.value = bcfg_idx;
	document.hidden.board_idx.value = board_idx;
	document.hidden.cmdProc.value = cmdProc;
	document.hidden.passwd.focus();
}

function showDeleteForm2(action, bcfg_idx, blue_id, cmdProc)
{
	document.getElementById("passwdHidden").style.left = click_x - 50;
	document.getElementById("passwdHidden").style.top = document.body.scrollTop + click_y - 30;
	document.getElementById("passwdHidden").style.display = '';

	document.hidden.action = action;
	document.hidden.bcfg_idx.value = bcfg_idx;
	document.hidden.blue_id.value = blue_id;
	document.hidden.cmdProc.value = cmdProc;
	document.hidden.passwd.focus();
}
function showCommentForm(action, bcfg_idx, board_idx, comment_idx, cmdProc)
{
	document.getElementById("passwdHidden").style.left = click_x - 50;
	document.getElementById("passwdHidden").style.top = document.body.scrollTop + click_y - 30;
	document.getElementById("passwdHidden").style.display = '';

	document.hidden.action = action;
	document.hidden.bcfg_idx.value = bcfg_idx;
	document.hidden.board_idx.value = board_idx;
	document.hidden.comment_idx.value = comment_idx;
	document.hidden.cmdProc.value = cmdProc;
	document.hidden.passwd.focus();
}

function setPasswd(form)
{
	if(!form.passwd.value)
	{
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
		return false;
	} else 
	{
		hideHidden();
		form.submit();
	}
}

function hideHidden()
{
	document.getElementById("passwdHidden").style.display = 'none';
}

function deleteConfirm(action, bcfg_idx, board_idx, cmdProc)
{
	if(confirm('ÇØ´ç±ÛÀ» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?'))
	{
		//location = action + '?bcfg_idx=' + bcfg_idx + '&board_idx=' + board_idx + '&cmdProc=' + cmdProc;

		document.hiddenDelete.submit();
	}
}


function deleteCommentConfirm(comment_idx)
{
	if(confirm('ÇØ´ç±ÛÀ» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?'))
	{
		//location = action + '?bcfg_idx=' + bcfg_idx + '&board_idx=' + board_idx + '&cmdProc=' + cmdProc;

		document.hiddenCommentDelete.comment_idx.value = comment_idx;

		document.hiddenCommentDelete.submit();
	}
}
//ÀÎÁõ °ü·Ã ÀÚ¹Ù ½ºÅ©¸³Æ® ³¡//////////////////////////////////////////////////////////////////////////









//±Û¾²±â 
function checkForm() {

	if(document.board.board_writer_name.value.length < 1)
	{
		alert('ÀÛ¼ºÀÚ¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		document.board.board_writer_name.focus();
		return false;
	}
	if(document.board.board_writer_passwd.value.length < 1)
	{
		alert('ºñ¹Ð¹øÈ£ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		document.board.board_writer_passwd.focus();
		return false;
	}
	if(document.board.board_title.value.length < 1)
	{
		alert('Á¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		document.board.board_title.focus();
		return false;
	}
	if(document.board.board_main.value.length < 1)
	{
		alert('º»¹®À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		document.board.board_main.focus();
		return false;
	}

	return true;
}

function cancel(form)
{
	form.reset();
}

function save()
{
	if(checkForm())
		document.board.submit();
}
function reset()
{
	document.board.reset();
}











//ÄÚ¸àÆ®
function checkCommentForm() {
	if(document.comment.comment_writer_name.value.length < 1)
	{
		alert('ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		document.comment.comment_writer_name.focus();
		return false;
	}
	
  if(document.comment.comment_writer_passwd.value.length < 1)
	{
		alert('ºñ¹Ð¹øÈ£ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		document.comment.comment_writer_passwd.focus();
		return false;
	}

	if(document.comment.comment_main.value.length < 1)
	{
		alert('³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		document.comment.comment_main.focus();
		return false;
	}
	
	return true;
}

function saveComment()
{
	if(checkCommentForm())
	{
		document.comment.submit();
	}
}








//ÃßÃµ
function recommend(bcfg_idx, board_idx)
{
	document.recommend.submit();
}

