/* Index----------------------------

   1. comment_clear
   2. showConformWindow

--------------------------------- */


/* ---------------------------------
	1. comment_clear
--------------------------------- */
function CB_clearText(name){
	try{
		document.getElementsByName(name).item(0).value = "";
	} catch(error){
	}
}
function clearBtn_Click(){
	CB_clearText('summary');
	CB_clearText('title');
	CB_clearText('content');
}

/* ---------------------------------
	2. showConformWindow
--------------------------------- */
function CB_showConformWindow(nm) {

	var dispName;
	var dispTitle;
	var dispComment;
	// 確認ダイアログを表示
	if (document.forms[nm].elements['summary'].value != null) {
		dispName = document.forms[nm].elements['summary'].value.replace(/(\n|\r)+/g, " ").substring(0, 20);
	} else {
		dispName = "";
	}
	if (document.forms[nm].elements['title'].value != null) {
		dispTitle = document.forms[nm].elements['title'].value.replace(/(\n|\r)+/g, " ").substring(0, 20);
	} else {
		dispTitle = "";
	}
	if (document.forms[nm].elements['content'] != null) {
		dispComment = document.forms[nm].elements['content'].value.replace(/(\n|\r)+/g, " ").substring(0, 20);
	} else {
		dispComment = "";
	}
	var disy = "以下の内容でコメントを投稿します。\nよろしければ送信ボタンを押してください。\n\n" +
		"　　　　タイトル　　 　" + dispTitle +
		"\n　　　　ニックネーム　" + dispName +
		"\n　　　　投稿内容　　" + dispComment + "\n\n" +
		"　　※投稿内容の表示は先頭２０文字までです。　　\n" +
		"　　※送信終了後、元の画面に戻ります。　　\n\n";

	var res = confirm(disy);
	// 選択結果で分岐
	if( res == true ) {
		document.forms[nm].action="/CB_commentResist.jsp";
		document.forms[nm].method="post";
		document.forms[nm].submit();
	}
}


/* ---------------------------------
	3. CommentJump
--------------------------------- */
function CB_CommentJump() {

	var errFlg = document.f_blog.errFlg.value;
	if (errFlg == "1") {
		// エラーの場合は入力欄にジャンプする
		location.href="#comment";
	}
}
