$("#fontSizeSwitch").css("left","0");

if($.cookie("fontSize")) {
	$("body").css("font-size",$.cookie("fontSize"));
}

$(document).ready(function(){
	$('a[href^="http"]').attr('target','_blank');

	$("#fontSizeSwitch li a").click(function() {
		var fontSize = $(this).attr("href");
		fontSize = fontSize.substring(1);

		$("body").css("font-size",fontSize);
		$.cookie("fontSize",fontSize, {expires: 365, path: '/'});

		return false;
	});

	$(function() {
	    var autoTime = 3000;
	    $("#tickerContent").jCarouselLite({
			visible: 3,
	        btnNext: "#tickerButtonDown",
	        btnPrev: "#tickerButtonUp",
	        vertical: true
	    });
	    //simulate autoscroll by simulating "click" on next link
	    var x = setInterval("$('#tickerButtonDown').trigger('click');", autoTime);
	    //if stopAuto is clicked the autoscroll is suspended for autoTime
	    //no matter how far along the timer already was
	    $("#tickerButtonUp").click(function() {
	        clearInterval(x);
	//        x = setInterval("$('#tickerButtonUp').trigger('click');", autoTime);
	    });
	    $("#tickerButtonDown").click(function() {
	        clearInterval(x);
	        x = setInterval("$('#tickerButtonDown').trigger('click');", autoTime);
	    });
	});

	$('h3.toggleContent').addClass('toggleContentInactive');

	$('h3.toggleContent + ul').hide();

	$('h3.toggleContent').css('cursor','pointer');

	$('h3.toggleContent').click(function() {
		$(this).next().slideToggle();
		$(this).toggleClass('toggleContentInactive');
		$(this).toggleClass('toggleContentActive');
	});

	$('h3.toggleContent:first').click();

	$("#publicationSubNav li:first").addClass("current");
	$("#pubContentBox div:first").show();

	$("#publicationSubNav li").click(function(event){
		$("#publicationSubNav li").removeClass("current");
		$("#pubContentBox div").hide();
		$(this).addClass("current");
	});

	$("#inhalt").click(function(event){
		$("#inhaltBox").show();
	});

	$("#inhaltsverzeichnis").click(function(event){
		$("#inhaltsverzeichnisBox").show();
	});

	$("#geleitwort").click(function(event){
		$("#geleitwortBox").show();
	});

	$("#rezension").click(function(event){
		$("#rezensionBox").show();
	});

	$("#leseprobe").click(function(event){
		$("#leseprobeBox").show();
	});

	$("#themenbereiche").click(function(event){
		$("#themenbereicheBox").show();
	});
});

