$(document).ready(function () {
	//window.setTimeout(function () { $('#wrapper_inner').css("height",$(document).height() + "px"); }, 100 );

	window.setTimeout(function () {
		$("#navigation ul").lavaLamp({
			fx: "backout",
			speed: 1000
		});
	}, 100);
	
	$('#navigation ul a').click(function () {
		$(this).blur();
	});
	
	window.setTimeout(function () { $('li#current').trigger("click"); }, 100 );
	
	initBookshopList();
	
	window.setTimeout(function () { initVertLogos(); }, 100);
});

function initBookshopList()
{
	$('.bookshoplist li div').not('.clearer').hide();
	$('.bookshoplist').not('.current').hide();
	
	$('.bookshoplist li a.more').toggle(function () {
		$(this).blur();
		$(this).next().next().slideDown();
		$(this).text('weniger');
	}, function () {
		$(this).blur();
		$(this).next().next().slideUp();
		$(this).text('mehr');
	});
	
	$('#bookshop_navi a').click(function () {
		$(this).blur();
		var newBS = $(this).attr("id");
		if ($('.bookshoplist.current').length > 0)
			$('.bookshoplist.current').removeClass("current").slideUp(function () { $('.'+newBS).slideDown(); });
		else
			$('.'+newBS).slideDown();
			
		$('.'+newBS).addClass("current");
	})
}

function initVertLogos()
{
	$('ul.logos li img').each(function () {
		var imgHeight = $(this).innerHeight();
		var spanHeight = $(this).parent().find('span').height();
				
		if (spanHeight > imgHeight)
			$(this).css("padding-top",((spanHeight - imgHeight) / 2)+'px');
	});
}
