/*
funktioniert nur auf uebersichtsseiten
*/


$(document).ready(function() {
	
var viewshort = $.cookie('viewshort');

/*
short an/aus
*/
function shortonoff() {
    if (viewshort == 'off') {
		shorton();
    } 
    else if (viewshort == 'on') {
		shortoff();
    }

	return false;
}

function shortoff() {
	$.cookie('viewshort', 'off', {path: "/", expires: 14});
	viewshort = 'off';
	$('.article-intro').show(50, function() {});
	$('.post-image').show(50, function() {});
	$('.post-image-caption').show(50, function() {});
	$('#nachricht').hide(50, function() {});
};

function shorton() {
	$.cookie('viewshort', 'on', {path: "/", expires: 14});
	viewshort = 'on';
	$('.article-intro').hide(50, function() {});
//	$('.trunc').eTruncate();
	$('.post-image').hide(50, function() {});
	$('.post-image-caption').hide(50, function() {});
	$('#nachricht').text('hinweis: „x“ drücken, um alle artikel-texte anzuzeigen');;
	$('#nachricht').show(50, function() {});
};

function hashit(item) {
	var $item = $(item);
	window.location.hash = $item.parent().attr('id');
}



$("#topbanner").live("click", function(){
    if (viewshort == 'off') {
		shorton();
    } 
    else if (viewshort == 'on') {
		shortoff();
    }

	return false;
});

$('#toc').toc({exclude: 'h1, h2, h3'});

// init shorts
	if (viewshort == 'off') {

	}
	else if (viewshort == null) {
		viewshort = 'off';
	}
	else if (viewshort == 'on') {
		shorton();
	}

	$.jknav.DEBUG = false;
	$('h3').jknav(hashit);
	$.jknav.init({
	  up: 'k',
	  down: 'j',
	  easing: 'swing',
	  circular: false,
	  reevaluate: true,
	});


});


