function something(){
		
		if($("#bildfake").width()>20){
		$("#bigbild").attr("src", bighref ).css("display", "none");		
		$("#einzel").fadeIn("fast");
		$("#bigbild").fadeIn("fast");
		
		clearInterval(myint);
		
		return false;
		}
		}

var mytemp="joij";

$(document).ready(function(){
mytemp="joij";


	var width  = $(window).width();
	var height  = $(window).height();
	$("#background").width(width);
	$("#background").height(height);
	
	$(window).resize(function(){
		width  = $(window).width();
		height  = $(window).height();
		$("#background").width(width);
		$("#background").height(height);
		
		var height  = $(window).height() - 140;
		$("#bigbild").height(height);
		$("#bigbild").css("width", "auto");
		$("#bildvor").css({height: "100%"});
		$("#bildback").css({height: "100%"});
		
			var tmp_bildbreite = $("#bigbild").width();
				var tmp_fensterbreite  = $(window).width();
				
					if (tmp_bildbreite > tmp_fensterbreite) {
						
					//var height  = $(window).height() - 240;
					//$("#bigbild").height(height);
					
					var width  = $(window).width() - 60;
					$("#bigbild").width(width);
					$("#bigbild").css("height", "auto");
					
					}
		
		
	});
		
	$("#info_button").css("display", "none");
	$("#uebersicht_button").css("display", "none");	
	$("#einzel").css("display", "none");
	$("div .arrow").css("display", "none");	
	$("#wrap_bigbild_info").css("display", "none");	
	
			$('#scrollthumb').hoverscroll()	;
			$('#pfeilrechts').mouseover(function() {
				$('#scrollthumb').startMoving(1,8);
			});
			$('#pfeilrechts').mouseout(function() {
				$('#scrollthumb').stopMoving();
			});
			$('#pfeillinks').mouseover(function() {
				$('#scrollthumb').startMoving(-1,8);
			});
			$('#pfeillinks').mouseout(function() {
				$('#scrollthumb').stopMoving();
			});
			
	var firstthumbid = $("#thumbs img:first").parent().attr("id");
   	var lastthumbid = $("#thumbs img:last").parent().attr("id");
			
	$("#thumbs a").click(function (){
		clearInterval(myint);
		
		
		var fakebild = "images/transparent.png";
		$("#bildfake").attr("src", fakebild ); 
		bighref = $(this).attr("href");
		bigid = $(this).attr("id");
		bigalt = $(this).children().attr("alt");
		bigtitle = $(this).children().attr("title");
		var nextbild = $(this).parent().next("li").children().attr("id");
		var backbild = $(this).parent().prev("li").children().attr("id");
		if (typeof(backbild) == 'undefined') {backbild = lastthumbid;}
		if (typeof(nextbild) == 'undefined') {nextbild = firstthumbid;}
		
			if (backbild == lastthumbid) {
			$("#bildback").hide();
				} else {
			$("#bildback").show("fast");
			}
			if (nextbild == firstthumbid) {
			nextbild = "zur_uebersicht";
				} else {
			$("#bildvor").show("fast");
		}
		
		$("#austausch img").fadeOut("fast",function(){
		});
		$("#bigbild").attr("rel", bigid );
		$("#bigbild").attr("alt", bigalt );
		$("#bigbild").attr("title", bigtitle );
		var info_alt = $("#bigbild").attr("alt");
		$('#bigbild_beschreibung').html(info_alt);
		var info_title = $("#bigbild").attr("title");
		$('#bigbild_titel').html(bigtitle);
		$("#bildvor").attr("rel", nextbild );
		$("#bildback").attr("rel", backbild );
		$("#bildfake").attr("src", bighref );
		myint = setInterval("something()", 600 );
		
		return false;
	});
	
	$("#bildvor").click(function (){
		clearInterval(myint);
		var fakebild = "images/transparent.png";
		$("#bildfake").attr("src", fakebild );
		var uebersicht = $("#uebersicht_button").children("a").attr("href");
		bigid = $("#bildvor").attr("rel");
		bighrefid = "#" + bigid.toString();
		bighref = $(bighrefid).attr("href");
		bigalt = $(bighrefid).children().attr("alt");
		bigtitle = $(bighrefid).children().attr("title");
		if (bigid == "zur_uebersicht") {
			var uebersicht = $("#uebersicht_button").children("a").attr("href");
			window.location.href = uebersicht;			
			} else {
				var nextbild = $(bighrefid).parent().next("li").children().attr("id");
				var backbild = $(bighrefid).parent().prev("li").children().attr("id");
				if (typeof(backbild) == 'undefined') {backbild = lastthumbid;}
				if (typeof(nextbild) == 'undefined') {nextbild = firstthumbid;}

				if (backbild == lastthumbid) {
					$("#bildback").hide();
				} else {
				$("#bildback").show("fast");
				}
				if (nextbild == firstthumbid) {
				nextbild = "zur_uebersicht";
					} else {
				$("#bildvor").show("fast");
			}
				
		$("#austausch img").fadeOut("fast",function(){
		});
		$("#bigbild").attr("rel", bigid );
		$("#bigbild").attr("alt", bigalt );
		$("#bigbild").attr("title", bigtitle );
		var info_alt = $("#bigbild").attr("alt");
		$('#bigbild_beschreibung').html(info_alt);
		var info_title = $("#bigbild").attr("title");
		$('#bigbild_titel').html(info_title);
		$("#bildvor").attr("rel", nextbild );
		$("#bildback").attr("rel", backbild );
		$("#bildfake").attr("src", bighref );
		myint = setInterval("something()", 600 );
		return false;
		}
		
	});

$("#bildback").click(function (){
		clearInterval(myint);
		var fakebild = "images/transparent.png";
		$("#bildfake").attr("src", fakebild );
		var uebersicht = $("#uebersicht_button").children("a").attr("href");
		bigid = $("#bildback").attr("rel");
		bighrefid = "#" + bigid.toString();
		bighref = $(bighrefid).attr("href");
		bigalt = $(bighrefid).children().attr("alt");
		bigtitle = $(bighrefid).children().attr("title");
		if (bigid == "zur_uebersicht") {
			var uebersicht = $("#uebersicht_button").children("a").attr("href");
			window.location.href = uebersicht;			
			} else {
				var nextbild = $(bighrefid).parent().next("li").children().attr("id");
				var backbild = $(bighrefid).parent().prev("li").children().attr("id");
				if (typeof(backbild) == 'undefined') {backbild = lastthumbid;}
				if (typeof(nextbild) == 'undefined') {nextbild = firstthumbid;}
				
				
					if (backbild == lastthumbid) {
					$("#bildback").hide();
						} else {
					$("#bildback").show("fast");
					}
					if (nextbild == firstthumbid) {
					nextbild = "zur_uebersicht";
						} else {
					$("#bildvor").show("fast");
					}
				
		$("#austausch img").fadeOut("fast",function(){
		});
		$("#bigbild").attr("rel", bigid );
		$("#bildvor").attr("rel", nextbild );
		$("#bigbild").attr("alt", bigalt );
		$("#bigbild").attr("title", bigtitle );
		var info_alt = $("#bigbild").attr("alt");
		$('#bigbild_beschreibung').html(info_alt);
		var info_title = $("#bigbild").attr("title");
		$('#bigbild_titel').html(info_title);
		$("#bildback").attr("rel", backbild );
		$("#bildfake").attr("src", bighref );
		myint = setInterval("something()", 600 );
		return false;
		}
	});

$('#info_button').mouseover(function() {
	
		var tmpbreit = $("#bigbild").width();
		var tmp_mittig = tmpbreit/2;
		
		if($.browser.safari){tmp_mittig=tmp_mittig-1;};
		if ((tmp_mittig%2) != 0){tmp_mittig = tmp_mittig + 1;};
		
		
		tmp_mittig = "-" + tmp_mittig.toString() + "px";
		$("#wrap_bigbild_info").css({width: tmpbreit, "margin-left": tmp_mittig});
		
			$("#wrap_bigbild_info").fadeIn();
			
			});
	
	$('#info_button').mouseout(function() {
			$("#wrap_bigbild_info").fadeOut();
			});
			  
	

})

