// 리스트로 이동
function fnList(cpage, pgroup) {
	document.formGoto.cpage.value = cpage;
	document.formGoto.pgroup.value = pgroup;
	document.formGoto.boardSeq.value = "0";
	document.formGoto.action = "list.do";
	document.formGoto.submit();
}

// 상세보기로 이동
function fnView(seqNo) {
	document.formGoto.boardSeq.value = seqNo;
	document.formGoto.action = "viewArticle.do";
	document.formGoto.submit();
}

// 수정폼으로 이동
function fnModify() {
	document.formGoto.action = "formModify.do";
	document.formGoto.submit();
}

// 삭제 패스워드 입력폼으로 이동
function fnDelete() {
	document.formGoto.action = "formRemove.do";
	document.formGoto.submit();
}

// 등록시 데이터 Validation
function fnCheck() {
	var cForm = document.formWrite; // Current Form
	if (isEmpty(cForm.userName)) {
		alert("이름을 입력하세요.");
		cForm.userName.focus();
		return false;
	}

	if (isEmpty(cForm.password)) {
		alert("패스워드을 입력하세요.");
		cForm.password.focus();
		return false;
	}

	if (isEmpty(cForm.contentTitle)) {
		alert("제목을 입력하세요.");
		cForm.contentTitle.focus();
		return false;
	}

	return true;
}

// 댓글 데이터 Validation
function fnWriteComment() {
	var cForm = document.formComment; // Current Form

	if (isEmpty(cForm.userName)) {
		alert("이름을 입력하세요.");
		cForm.userName.focus();
		return false;
	}

	if (isEmpty(cForm.password)) {
		alert("패스워드을 입력하세요.");
		cForm.password.focus();
		return false;
	}

	if (isEmpty(cForm.contents)) {
		alert("내용을 입력하세요.");
		cForm.contents.focus();
		return false;
	}

	return true;
}

// 댓글삭제
function fnDeleteComment(commentSeq) {

	if (isEmpty($('commentPassword' + commentSeq))) {
		alert("패스워드을 입력하세요.");
		$('commentPassword' + commentSeq).focus();
		return;
	}
	var cForm = document.formComment;
	cForm.commentSeq.value = commentSeq;
	cForm.commentPassword.value = $('commentPassword' + commentSeq).value;
	cForm.action = "/spring/board/removeComment.do";
	cForm.onSubmit = null;
	cForm.submit();
}

// 엔터불가능(댓글 삭제시 자동폼 submit을 막기위해) 
function fnEnterDisable() {
	if (event.keyCode == 13) {
		event.keyCode = 0;
	}
}

// 댓글삭제 패스워드 입력폼 열기 
function fnShowCommentPassword(commentSeq) {
	new Effect.BlindDown($('commentDelete' + commentSeq), {
		duration :0.6
	});
}