$(document).ready(function(){
	$('#leinwand, #notiz,#fuss').hide();
//Quelltextmanipulation
	$('h1').html('<strong><img src="templates/pipo/bilder/menu.png" alt="Menu" width="130" height="21"></strong>')
	.append('<a href="#" class="tgl" title="Kommentare" id="info">Kommentare</a><a href="#" class="tgl" id="schliessen" title="schliessen">Schliessen</a>')
	.find('a:last')
	.hide();

	$('#fuss em').prepend('<a href="index.php">Start</a>').appendTo('h1 strong').hide();
         $('#fuss span:contains("0 Kommentare")').text('Thorsten Konigorski');
//Navi oben rechts
	$('h1 strong').hover(
		function () {
			$('h1 em').show();
			$('h1 img').hide();

		},
		function () {
			$('h1 em').hide();
			$('h1 img').show();
		}
	);
//Kommentar-Slider
	$('#aux').removeClass('nichtscript')
		.css("opacity", .85)
		.find('li:contains("Noch keine Kommentare.")')
		.css({'text-align':'center'});

	var winheight = $(window).height();
	$("#auxList").height(winheight-40);

	$('#info').click(function(){
			$('#aux').animate({left: '0px'}, 1000, function() {
				$('.tgl').toggle();
			});
			return false;
			});
	$('#schliessen').click(function(){
			$('#aux').animate({left: '-400px'}, 1000, function() {
				$('.tgl').toggle();
			});
			return false;
			});
//Thumbs
	$('.thumbnails').fadeTo("fast", 0.7)
	.hover(
		function () {
			$(this).stop().fadeTo('slow', 1);
		},
		function () {
			$(this).stop().fadeTo('slow', 0.7);
		}
	);
//erstes und letztes Bild
	var zurueckcheck = $('#zurueck a').attr('href');
	var vorcheck = $('#vor a').attr('href');
	var addr = location.href.replace(/.+\/photo\//, '');

	if (addr == zurueckcheck){
		$('#leinwand a').removeAttr('href')
			.find('img')
			.attr({title:'Dies ist das letzte Photo.'})
                         .addClass('letztes');
		$('#zurueck').html('&laquo;');
 	};
	if ((addr == vorcheck)||(addr == '')||(addr == 'index.php')){       // Letzteres zum Warten der Startseite
		$('#vor').html('&raquo;');
 	};

});
//Blendvorgaenge
$(window).load(function () {
	$('#leinwand,#notiz,#fuss').fadeIn(1200);


	$('#photo, #notiz a').not('.letztes').click(function () {
		$('#photo').fadeOut('400');
		$('#notiz, #aux').fadeOut('fast');
		}
  	);

});