$(document).ready(function() 
{
	var url = top.document.location.href;
	
	if ( url.lastIndexOf("#") != -1 )
	{
		id = ( url.substr(url.lastIndexOf("#")) == "#" ) ? "1" : url.substr(url.lastIndexOf("#")+ 1);
		
		$(".content_box:visible").hide();
		$("#content" + id).show();
		$("#reiter-ul li span").removeClass("aktiv-reiter");
		$("#content_link" + id).addClass("aktiv-reiter");
	}
		
	$("#reiter-ul li span").click(function () 
	{
		var id = this.id.substr(12);
		
		if ($("#content" + id).is(":visible") === false) 
		{
			$(".content_box:visible").fadeOut(0, function ()
			{
				$(".button-div").hide();
				$("#reiter-ul li span").removeClass("aktiv-reiter");
				$("#content" + id).fadeIn();
				$(".button-div").show();
				$("#content_link" + id).addClass("aktiv-reiter");
				
				// DEEPLINKING
				
				if ( url.lastIndexOf("#") == -1 )
					top.document.location.replace( url + "#" + id );
				else
					top.document.location.replace(url.substr(0, url.lastIndexOf("#")) + "#" + id );
			});
		}
	});
});