addLoadEvent(initShowHide);

function initShowHide() {
	var comments = document.getElementsByTagName('a');
	var commentBox = document.getElementById('commentForm');
	for (var i=0; i<comments.length; i++) {
		if (comments[i].className.indexOf('addComment') != -1) {
			
			/* if there is an error message */
			if (commentBox) {
				var ps = commentBox.getElementsByTagName('p');
				for (var j = 0; j < ps.length; j++) {		
					if (ps[j].className.indexOf('error-on') != -1) {
						if (!commentBox.className.indexOf('show') != -1) {
							addClass(commentBox,'show');
						}
					}
				}
			}
			/* on click */
			comments[i].onclick = function(){
				if (commentBox.className.indexOf('show') != -1) {
					remClass(commentBox,'show');
				}
				else{
					addClass(commentBox,'show'); 							
				}
			}
		}
	}
}	



