$(document).ready(function () {
	$('div.training ul li a').click(function(){
		$('div.training ul li a').removeClass('active');
		$(this).addClass('active');
		var target = $(this).attr('href');
		var target = $(target).parent();
		$('#scrollDivs').stop().scrollTo(target,800);
		return false;
	});
	
	$('#navBar ul li a[href$="login.html"]').live('click',function(){
		var parent=$(this).parent();
		var href=$('#header p.h1 a').attr('href');
		$(this).remove();
		$(parent).html('<span class="active" title="login">Login</span>');
		$('#wrapper').append('<div id="logindiv"></div>');
		$('#logindiv').hide()
			.append('<form action="'+href+'aerobic/login.html" method="post"><label>Name</label><input type="text" name="name" value="" /> <label>PW</label><input type="text" name="pw" value="" /><button class="submit" type="submit" name="login">Login</button></form>')
			.append('<a class="close" href="#close" title="Fenster schließen"> Fenster schließen [x] </a>')
			.slideDown('slow');
		return false;
	});
	
	$('#logindiv a.close').live('click',function(){
		$('#logindiv').slideUp('slow',function(){
			$('#logindiv').remove();
			var parent=$('#navBar ul li span.active[title~=login]').parent();
			$('#navBar ul li span.active[title~=login]').remove();
			var href=$('#header p.h1 a').attr('href');
			$(parent).html('<a rel="nofollow" href="'+href+'aerobic/login.html">Login</a>');
		});
	});
});



