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

var mytemp="joij";

$(document).ready(function(){

mytemp="joij";

	$("#einzel").css("display", "none");
	$("div .arrow").css("display", "none");	
	$("#info_button").css("display", "none");
	$("#uebersicht_button").css("display", "none");	
	

	//$("#overlay").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 lastthumb = $("#thumbs img:last").attr("ref");
		var firstthumb = $("#thumbs img:first").attr("ref");
	    
	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;
		//$("#sammlung").height(height);
		/*sammlunghoch = $("#sammlung").height() + 90;		
		sammlunghoch = parseInt(sammlunghoch);
		sammlunghoch = sammlunghoch/2;
		sammlunghoch = "-" + sammlunghoch.toString() + 'px';*/
		$("#sammlung").css("margin-top", "-300px"); 
			
		$("#bigbild").height(height);
		
		$(window).resize(function(){
		var height  = $(window).height() - 140;
		$("#bigbild").height(height);
		
		
		$("#bigbild").css("width", "auto");
		
		var tmp_bildbreite = $("#bigbild").width();
		var tmp_fensterbreite  = $(window).width();
		
		if (tmp_bildbreite > tmp_fensterbreite) {
		var tmp_bildhoehe = $("#bigbild").height();
		tmp_bildbreite = parseInt(tmp_bildbreite);
		tmp_bildhoehe = parseInt(tmp_bildhoehe);
		var tmp_ratio = tmp_bildbreite/tmp_bildhoehe;
		tmp_fensterbreite  = $(window).width() - 100;
		tmp_fensterbreite = parseInt(tmp_fensterbreite);
		var tmp_neuhoch = tmp_fensterbreite/tmp_ratio;
		$("#bigbild").width(tmp_fensterbreite);
		$("#bigbild").height(tmp_neuhoch);
		}
		
		
		});
		
		
	
	  
	$('#info_button').mouseover(function() {
	
	
	var bildoverlay = $("#bigbild").attr("rel");
	bildoverlay = "#info_" + bildoverlay;
	
	var breitbild = $("#bigbild").width() - 16;
	$(bildoverlay).width(breitbild);
	breitbild = parseInt(breitbild);
	breitbild = breitbild/2 +8;
	breitbild = '-' + breitbild.toString() + 'px';
	$(bildoverlay).css({left: "50%", 'margin-left': breitbild});
	
			$(bildoverlay).fadeIn();
			});
	
	$('#info_button').mouseout(function() {
			$('.overlay').fadeOut();
			});
			  
	$("#overlay").click(function (){
        $(".overlay").fadeOut();
	});
	
	
	$("#thumbs img").click(function (){ // von klein zu groß
		
clearInterval(myint);
        $(".overlay").hide();
		
		
		var fakebild = "images/transparent.png";
		$("#bildfake").attr("src", fakebild ); 
		mytemp = $(this).parent().attr("href");
		myid = $(this).attr("ref");
			
		var nextref = $(this).parent().parent().next("li").children("a").children("img").attr("ref");
		var backref = $(this).parent().parent().prev("li").children("a").children("img").attr("ref");
		
		
		if (typeof(backref) == 'undefined') {backref = lastthumb;}
		if (typeof(nextref) == 'undefined') {nextref = firstthumb;}
		
		nextref = "#thumbid_" + nextref.toString();
		backref = "#thumbid_" + backref.toString();
		
		nextbild = $(nextref).parent().attr("href");
		backbild = $(backref).parent().attr("href");
		
		backbutton = "#thumbid_" + lastthumb.toString();
		vorbutton = "#thumbid_" + firstthumb.toString();
		
		if($.browser.msie && $.browser.version < 7) {
			
		} else {
		if (backref == backbutton) {
		$("#bildback").css("display", "none");
			} else {
		$("#bildback").css("display", "inherit");
		}
		if (nextref == vorbutton) {
		//$("#bildvor").css("display", "none");
		var uebersicht = $("#uebersicht_button").children("a").attr("href");
		nextbild = uebersicht;
			} else {
		$("#bildvor").css("display", "inherit");
		}
		}
						
	 	$("#austausch img").fadeOut("fast",function(){
		});
		$("#bigbild").attr("rel", myid );
		$("#bildvor").attr("rel", nextbild );
		$("#bildvor").attr("ref", nextref );
		$("#bildback").attr("rel", backbild );
		$("#bildback").attr("ref", backref );
				
		$("#bildfake").attr("src", mytemp );
		myint = setInterval("something()", 600 );
		

		return false;
		
		
		});
	
	
	 
	$("#bildvor").click(function (){ // von Groß zu Groß weiter
		
		clearInterval(myint);
		
		$(".overlay").hide();
		var fakebild = "images/transparent.png";
		$("#bildfake").attr("src", fakebild ); 
		
		var uebersicht = $("#uebersicht_button").children("a").attr("href");
				   	 	
		mytemp = $("#bildvor").attr("ref");
		nextref = mytemp;
		mytemp = $("#bildvor").attr("rel");
		
		if (mytemp == uebersicht) {
			window.location.href = uebersicht;			
			} else {
				
		nextref = $(nextref).parent().parent().next("li").children("a").children("img").attr("ref");
		if (typeof(nextref) == 'undefined') {nextref = firstthumb;}
		
		
		
		nextref = "#thumbid_" + nextref.toString();
		nextbild = $(nextref).parent().attr("href");
		
		var aktuell = $(nextref).parent().parent().prev("li").children("a").children("img").attr("ref");
		if (typeof(aktuell) == 'undefined') {aktuell = lastthumb;}
		
		var myid = $("#bigbild").attr("rel"); // alte ID 
		backref = "#thumbid_" + myid.toString();
		backbild = $(backref).parent().attr("href");
		
		backbutton = "#thumbid_" + lastthumb.toString();
		vorbutton = "#thumbid_" + firstthumb.toString();
		if (backref == backbutton) {
		$("#bildback").css("display", "none");
			} else {
		$("#bildback").css("display", "inherit");
		}
		if (nextref == vorbutton) {
		//$("#bildvor").css("display", "none");
		
		nextbild = uebersicht;
		
  		//$("#uebersicht_button").children("a").trigger("click");


			} else {
		$("#bildvor").css("display", "inherit");
		}
		
	    $("#bigbild").fadeOut("fast",function(){
		});
		$("#bigbild").attr("rel", aktuell );
	   	$("#bildvor").attr("rel", nextbild );
	   	$("#bildvor").attr("ref", nextref );
	  	$("#bildback").attr("rel", backbild );
	   	$("#bildback").attr("ref", backref );
		
		$("#bildfake").attr("src", mytemp );
		myint = setInterval("something()", 600 );
		return false;
		
		} // mytemp=uebersicht
		
	 });
	 
	$("#bildback").click(function (){ // von Groß zu Groß zurück
		clearInterval(myint);
        $(".overlay").hide();
		var fakebild = "images/transparent.png";
		$("#bildfake").attr("src", fakebild );
		
   	 	mytemp = $("#bildback").attr("ref");
		nextref = mytemp;
		mytemp = $("#bildback").attr("rel");
		
		nextref = $(nextref).parent().parent().next("li").children("a").children("img").attr("ref");
		if (typeof(nextref) == 'undefined') {nextref = firstthumb;}
		
		nextref = "#thumbid_" + nextref.toString();
		nextbild = $(nextref).parent().attr("href");
		
		var aktuell = $(nextref).parent().parent().prev("li").children("a").children("img").attr("ref");
		if (typeof(aktuell) == 'undefined') {aktuell = lastthumb;}
				
		var backref = $(nextref).parent().parent().prev("li").prev("li").children("a").children("img").attr("ref");
		
		if (aktuell == lastthumb) {
			nextref = "#thumbid_" + lastthumb;
			backref = $(nextref).parent().parent().prev("li").children("a").children("img").attr("ref")
			}
			
		if (typeof(backref) == 'undefined') {backref = lastthumb;}
		
		
		var myid = $("#bigbild").attr("rel"); // alte ID 
		backref = "#thumbid_" + backref.toString();
		backbild = $(backref).parent().attr("href");
		
		backbutton = "#thumbid_" + lastthumb.toString();
		vorbutton = "#thumbid_" + firstthumb.toString();
		if (backref == backbutton) {
		$("#bildback").css("display", "none");
			} else {
		$("#bildback").css("display", "inherit");
		}
		if (nextref == vorbutton) {
		$("#bildvor").css("display", "none");
			} else {
		$("#bildvor").css("display", "inherit");
		}
		
	   	$("#bigbild").fadeOut("fast",function(){
		});
		$("#bigbild").attr("rel", aktuell );
	   	$("#bildvor").attr("rel", nextbild );
	   	$("#bildvor").attr("ref", nextref );
	  	$("#bildback").attr("rel", backbild );
	   	$("#bildback").attr("ref", backref );
		
		$("#bildfake").attr("src", mytemp );
		myint = setInterval("something()", 600 );
	    return false;
	 });
	

var elementCount = $("#thumbs img").length;
if (elementCount <= 8) {
	$('#pfeilrechts').css("display", "none");
	$('#pfeillinks').css("display", "none");
	}
		
})