/*********************************************************
* Variablen
*********************************************************/

// var xyz = 'xyz';


/*********************************************************
* Scrolllinks
*********************************************************/

function scrollinterna()
{
	$('a[href*=#]').click(function() {
		if( location.pathname.replace( /^\//,'' ) == this.pathname.replace( /^\//,'' ) && location.hostname == this.hostname && $(this).attr('href').replace( /#/,'' ) != '' )
		{
			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			if ($target.length)
			{
				var targetOffset = $target.offset().top;
				$('html,body').animate({scrollTop: targetOffset}, 800, 'swing');
				return false;
			}
		}
	});
};


/*********************************************************
* Linkliste
*********************************************************/

function linklist()
{
	$('ul.links li ul').hide();
	$('ul.links li a:not(ul.links li ul li a)').click(function(){
		$(this).next().slideToggle();
		return false;
	});
	$('ul.links li:not(ul.links li ul li)').each(function(){
		if( !$(this).children('ul').length )
		{
			$(this).addClass('empty');
			$(this).children('a').attr('title', 'Keine Links vorhanden.').append('<span>x</span>');
		}
	});
	$('ul.links li.empty a').mouseenter(function(){
		$(this).children('span').css('display', 'block');
	}).mouseout(function(){
		$(this).children('span').css('display', 'none');
	});
}


/*********************************************************
* Document-Ready
*********************************************************/

$(document).ready(function() { // Wenn DOM geladen, dann ...
	scrollinterna(); // Scrollinks
	linklist(); // Linkliste
});