$('ul.pressoffice').each(function() {
	$(this).hide();
	$(this).find('img').fullsize({shadow: false});

	$('h3#' + $(this).attr('id') + '-header').click(function() {
		var helper = '#' + $(this).attr('id').substr(0, $(this).attr('id').indexOf('-header'));
		
		$('ul.pressoffice:not("'+helper+'")').hide();
		
		$('h3.pressoffice:not("#'+$(this).attr('id')+'")').addClass('expanded');
		$('h3.pressoffice:not("#'+$(this).attr('id')+'")').removeClass('collapsed');
		
		$('ul#' + $(this).attr('id').substr(0, $(this).attr('id').indexOf('-header')))
			.toggle();
		
		$(this).toggleClass('collapsed');
		$(this).toggleClass('expanded');
	})
		.css('cursor', 'pointer')
		.addClass('expanded');
});

$(document).ready(
	function() {
	     $("a.pressofficeres").click(function(){
	     	var idres=$(this).attr("id");
			$.ajax({
				url: "/ajax.php",
				type: "POST",
				data: "resid=" + idres + "&plugin_name=pressoffice",
				dataType: "html",
				beforeSend: function() {
				},
				success: function(html) {
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
				},
				complete: function() {
				}
			});
		});
});