var commenting = 0;
var cmsComment = new Class({
	submit: function(){
		if ($('content').value == "") { alert("Please enter a comment."); return false; }
		commenting++;
		$('posting').setHTML('<span class="comloading">Posting...</span>');
		new Ajax('add.php',{ data: $('newComment').toQueryString(), onComplete: function(responseText){
			$('comments').setHTML('<div id="comment'+commenting+'"></div>' + $('comments').innerHTML);
			$('comment'+commenting).setOpacity(0).setHTML(responseText);
			new Fx.Style('comment'+commenting, 'opacity').start(0,1);
			$('posting').setHTML();
		} }).request();
		$('newComment').reset();
	},
	delete: function(id){
		new Ajax('delete.php',{ data: 'id='+id }).request();
		new Fx.Style('comment_'+id, 'opacity',{ onComplete: function(){
			$('comment_'+id).setStyle('display', 'none');
		} }).start(1,0);
	}
});
var Comment = new cmsComment();