$('document').ready(function () {
	$('#swap-blog-comment-posts').click(function () {
		$('#blog-comments-posts').toggleClass('hidden');

		if ($('#blog-comments-posts').attr('class').lastIndexOf('hidden') > 0) {
			$(this).attr('value', 'Show comments');
		} else {
			$(this).attr('value', 'Hide comments');
		}
	});

	$('#swap-blog-comment-add').click(function() {
		$('#addCommentForm').toggleClass('hidden');

		if ($('#addCommentForm').attr('class').lastIndexOf('hidden') > 0) {
			$(this).html('Add comment');
		} else {
			$(this).html('Hide form');

			// Hack to make editor editable in gecko...
			if (! document.all) {
				var oEditor = FCKeditorAPI.GetInstance('comment');
				if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG) {
					oEditor.MakeEditable();
				}
			}
		}
	});

	/* Toggle Comments */
	$('#toggle_blogcomments a').click(function () {
		if (getCookie('blogcomments_cookie') == 1) {
			$('#content_blogcomments').show();
			$(this).removeClass('down');
			$(this).addClass('up');
			setCookie('blogcomments_cookie', 0);
		} else {
			$('#content_blogcomments').hide();
			$(this).removeClass('up');
			$(this).addClass('down');
			setCookie('blogcomments_cookie', 1);
		}
	});
});
