
var defaultCommentNm = 'お名前';
var defaultCommentText = 'コメントを入力してください。';

function addComment(){
	var commentNmValue = document.forms['pubBlogAddCommentForm'].commentNm.value;
	if(commentNmValue=='' || commentNmValue==defaultCommentNm){
		alert("コメント投稿者名を入力してください。");
		return false;
	}
	var commentTextValue = document.forms['pubBlogAddCommentForm'].text.value;
	if(commentTextValue=='' || commentTextValue==defaultCommentText){
		alert("コメントを入力してください。");
		return false;
	}
	// 確認
	if (window.confirm("コメントを書き込みます。\nよろしいですか？")) {
		document.getElementById("addCom").disabled = true;
		document.forms['pubBlogAddCommentForm'].submit();
	}
}

function clearForm(form){
	var commentNmObj = form.commentNm;
	if(commentNmObj.value==''){
		setValue(commentNmObj,defaultCommentNm);
	}
	var commentTextObj = form.text;
	if(commentTextObj.value==''){
		commentTextObj.value=defaultCommentText;
	}
}

function clearValue(obj){
	obj.value='';
}

function setValue(obj,str){
	obj.value=str;
}
