function addReadMoreEvents(e) {
	$$('.readMore').each(function (teaser) {
		teaser = $(teaser);
		teaser.observe('click', function(e) {
			e.stop();
			$(teaser.id.replace('more', 'articleBody')).toggle();
			$(teaser.id.replace('more', 'articleTeaser')).toggle();
		;});
	});
	/*
	$$('.articleBody').each(function (abody) {
		abody = $(abody);
		abody.observe('click', function(e) {
			$(abody.id.replace('Body', 'Teaser')).toggle();
			abody.toggle();
		;});
	});
	*/
}
document.observe('dom:loaded', addReadMoreEvents);

function initEditors(e) {
	$$('.editor').each (function (elt) {
		$(elt).observe('click', editArticle);
	});
}
function editArticle(e) {
	e = Event.extend(e);
	elt = e.element();
	var articleId = elt.id.replace('edit_', '');
	e.stop();
	var xhrOptions = {
		onComplete: function(xhr, json) {
			var response = xhr.responseXML.getElementsByTagName('ajax-response');
			if (response == null || response.length != 1)
				return;
			processAjaxResponse( response[0].childNodes );
		}
	}
	new Ajax.Request('_articleForm.php?articleId=' + articleId, xhrOptions);
}
document.observe('dom:loaded', initEditors);
function showAllArticleEditorIcons(show) {
	$$('.editor').each (function (elt) {
		if (show) $(elt).show();
		else $(elt).hide();
	});
}