function PostComment () {
	var form = $('CommentForm');
	
	var name = form['comment[name]'];
	var body = form['comment[copy]'];
	var link = form['comment[link]'];
	
	if (body.empty()) alert('You can not post an empty comment');
	else if (name.empty()) alert('You must enter a name to post as.');
	else {
		var co = new Cookie('comments');
		if (!name.empty()) co.name = name.value;
		if (!link.empty()) co.link = link.value;
		co.store(365);
		
		new Effect.Opacity('CommentEntryBox', { from: 1.0, to: 0.7, duration: 0.5 });
		form.request({
			parameters: { validpost:true },
			onComplete: function(r){
				new Effect.Opacity('CommentEntryBox', { from: .7, to: 1, duration: 0.5 });
				body.clear();
				
				if (r.headerJSON) alert(r.headerJSON.message);
				else {
					var e = new Element('div');
						e.setOpacity(0);
						e.update(r.responseText);
					$('CommentsList').appendChild(e);
					new Effect.Opacity(e, { from: 0, to: 1, duration: 0.5 });
				}
			}
		});
	}
}


function DeleteComment (id) {
	new Ajax.Request('/comment/delete', {
		method: 'post',
		evalJSON: true,
		parameters: { ajax:true, id:id },
		onSuccess: function(r) {
			if (r.headerJSON && r.headerJSON.deleted) {
				var e = $('Comment_'+id);
				new Effect.Opacity(e, { from: 1, to: 0, duration: 0.5, afterFinish: function () {
					if (e) e.parentNode.removeChild(e);
				}});
			}
		}
	});
}