$(document).ready(function() {
	// make the faq accordion style
	$('dl.faq dt').click(function(){
		$(this).siblings('dd:visible').hide();
		return !$(this).next('dd:hidden').toggle();
	});
	
	// add some mouseover magic and clickable rows
	$('ul.galleries li,ul.pictures li').mouseover(function(){
		$(this).addClass('over');
	}).mouseout(function(){
		$(this).removeClass('over');
	}).click(function(){
		location.href = $('a',this).attr('href');
	}).filter(':even').addClass('even');
	
	$('.searchresults li:even').addClass('even');
	
	$('.emotes img').click(function(){
		$('#message').val($('#message').val()+$(this).attr('alt'));
	});
	
	$('legend').remove();
	
	$('.errors ul li a').click(function(){
		return !$($(this).attr('href')).focus();
	});

	$("div#content").bind("ajaxSend", function(){
		$('div#ajaxloader').remove();
		$(this).prepend('<div id="ajaxloader">Laden...</div>');
	}).bind("ajaxComplete", function(){
		$('div#ajaxloader').remove();
	});

	var dotheheadersorting = function(){
		$(this).parents('.morenews').load($(this).attr('href'),function(){
			$('.morenews .pagenav a').click(dotheheadersorting);	
		});
		return false;
	};

	$('.morenews .pagenav a').click(dotheheadersorting);
	
});
