function SetComment()
{
	this.commentformElem;
	this.checkboxElem;
	this.checkboxDivElem;
	this.formDivElem;
}


SetComment.prototype.init = function()
{
	var checkboxDivElemHTML = '';
	checkboxDivElemHTML += '<input type="checkbox" id="agreement" />';
	checkboxDivElemHTML += '上記に同意して投稿する';
	this.checkboxDivElem = document.createElement("div");
	this.checkboxDivElem.innerHTML = checkboxDivElemHTML;
	
	var formDivElemHTML = '';
	formDivElemHTML += '<div id="comments-open-data">';
	formDivElemHTML += '<div id="name-email">';
	formDivElemHTML += '<dl class="pkg" style="margin-bottom:0;">';
	formDivElemHTML += '<dt style="margin-bottom:0; width:110px; text-align:left;"><label for="comment-author">ニックネーム<br />（ハンドルネーム）:</label></dt>';
	formDivElemHTML += '<dd style="margin-bottom:0; width:340px;"><input id="comment-author" name="author" /></dd>';
	formDivElemHTML += '</dl>';
	formDivElemHTML += '<p style="margin-top:0;">本人のお名前が特定できる名称は受付けできません。</p>';
	formDivElemHTML += '<dl class="pkg">';
	formDivElemHTML += '<dt style="width:110px;"><label for="comment-email">メールアドレス:</label></dt>';
	formDivElemHTML += '<dd style="width:340px;"><input id="comment-email" name="email" /></dd>';
	formDivElemHTML += '<dd class="notice" style="margin-left: 130px;"><label for="comment-bake-cookie"><input type="checkbox" id="comment-bake-cookie" name="bakecookie" onclick="if (!this.checked) forgetMe(document.comments_form)" value="1" />この情報を登録しますか?</label></dd>';
	formDivElemHTML += '</dl>';
	formDivElemHTML += '</div>';
	formDivElemHTML += '<dl id="comments-open-text">';
	formDivElemHTML += '<dt><label for="comment-text">コメント: <span>(スタイル用のHTMLタグが使えます)</span></label></dt>';
	formDivElemHTML += '<dd><textarea id="comment-text" name="text" rows="15" cols="50"></textarea></dd>';
	formDivElemHTML += '</dl>';
	formDivElemHTML += '<div id="comments-open-footer" class="comments-open-footer">';
	formDivElemHTML += '<input type="submit" accesskey="v" name="preview" id="comment-preview" value="確認" class="button" />';
	formDivElemHTML += '<input type="submit" accesskey="s" name="post" id="comment-post" value="投稿" class="button" />';
	formDivElemHTML += '</div>';
	formDivElemHTML += '</div>';
	this.formDivElem = document.createElement("div");
	this.formDivElem.innerHTML = formDivElemHTML;
	
	this.commentformElem = document.getElementById("comments-form");
	if(!this.commentformElem) return;
	this.commentformElem.style.display = "block";
	this.commentformElem.innerHTML = '';
	this.commentformElem.appendChild(this.checkboxDivElem);
	this.setCheckBox();
}


SetComment.prototype.setCheckBox = function(scope)
{
	this.checkboxElem = document.getElementById("agreement");
	this.checkboxElem.onclick = (function(scope)
	{
		var func = function()
		{
			scope.setForm(scope);
		}
		return func;
	})(this);
}


SetComment.prototype.setForm = function(scope)
{
	if(scope.checkboxElem.checked)
	{
		scope.commentformElem.appendChild(scope.formDivElem);
	}
	else
	{
		scope.commentformElem.removeChild(scope.formDivElem);
	}
}


function initComment()
{
	var comment = new SetComment();
	comment.init();
}




window.addOnload(initComment);




var commentsFormStyle = '';
commentsFormStyle += '<style type="text/css">';
commentsFormStyle += '#comments-form{';
commentsFormStyle += 'display:none;';
commentsFormStyle += '}';
commentsFormStyle += '</style>';
document.write(commentsFormStyle)
