$(function() {
	var ieexc = jQuery.support.leadingWhitespace;
	if(ieexc) {
		$('#menu li')
			.find('a')
			.append('<span class="hover"></span>').each(function () {
			var hoverText =	$(this).find('span.menutext').text();
			$(this).find('span.hover').append(hoverText);
			  var $span = $('> span.hover', this).css('opacity', 0);
			  $(this).hover(function () {
				$span.stop().fadeTo(800, 1);
			  }, function () {
				$span.stop().fadeTo(450, 0);
			  });
			});
	}
	$('.ngg-galleryoverview').before('<a href="javascript:history.back()">Zur&uuml;ck</a>');
	$('#spenden').next().remove();
	$('#spenden').next().hide();
	$('#spenden').click(function(){
		$(this).next().toggle(600);
	});
	var anmeldepdf = $('#content.anmeldung h3').next().find('a');
	$('#content.anmeldung h3:last').before(anmeldepdf).remove();
	$('#content.anmeldung h3:last').before(anmeldepdf).remove();
	$('#content').accordion({
		autoHeight: false,
		header: 'h3',
		collapsible: true,
		active: false,
		navigation: true
	});
	$('#content.infos br+br').each(function(){
		if($(this).next().text() == 'Google Maps'){
			$(this).prev().remove();
			$(this).remove();
		}
		if($(this).prev().has('img')){
			$(this).remove();
		}
	});
	$('body').append('<div id="newsModalOverlay"></div><div id="newsModal"></div>');
	$('#newsModal').hide();
	$('#newsModalOverlay').hide();
	$('a.ajax').live('click',function(){
		var href = $(this).attr('href');
		title = $(this).text();
		$('#newsModal').load(href + ' #container div.content',function() {
			$('#newsModal div.content').prepend('<h3>' + title + '</h3>');
			$('#newsModalOverlay').show('fade',400);
			$(this).show('fade',600);
		});
		return false;
	});
	$('#newsModalOverlay').live('click',function(){
		$('#newsModal').hide('fade',500);
		$('#newsModalOverlay').hide('fade',500);
	});
	$('#newsModal').live('click',function(){
		$('#newsModal').hide('fade',500);
		$('#newsModalOverlay').hide('fade',500);
	});
	$('.text h4').live('click',function(){
		$(this).next().toggle('blind',500);
	}).next().hide();
});
