	
	Event.observe(window, 'load', function() {
		$('thumbs').select('img').each(function(item) {
			setBilderClass(item);
		});
		//setBilderClass();
	});
	
	function setBilderClass(image) {
		if(image.width > image.height) {
			image.up().up().className = 'thumb quer';
		}
		if(image.width < image.height) {
			image.up().up().className = 'thumb hoch';
		}		
	}
	
function PlayVideo(usernr,ObjektNr,filename_video,titel_video,bild){
	
	// <![CDATA[
				var so = new SWFObject("/include/flv_player/gddflvplay-v35.swf", "einzelansichtbildgross", "280", "210", "9", "#000000"); 
					so.addParam("scale", "noscale");
					so.addParam("quality", "best");
					so.addParam("allowScriptAccess", "always");
					so.addParam("allowFullScreen", 'true');
					//VIDEO PARAMS
					so.addVariable("vdo", escape('/userdaten/'+usernr+'/'+ObjektNr+'/video/'+filename_video+'')); //video file
					so.addVariable("desc", escape(''+titel_video+'')); //  movie title
					so.addVariable("autoplay", 'false'); // autoplay: true or false  | default: false
					so.addVariable("sound", '70'); // sound volume 0-100	
					// YOUR CUSTOM LOGO, remove the next line if none
					//so.addVariable("mylogo", escape('customlogo.png')); // PNG, JPG, GIF,SWF, we recommend PNG for transparency
					
					//BUFFER SIZE (preloads x seconds of the movie before play)
					so.addVariable("buffer", 2); // buffer time in seconds; default 2sec if missing
					// START 
				  so.write("einzelansichtbildgross");
					// ]]>
				document.getElementById("bildlink").style.display  = "block";
		return(true);
	
	}
	
	//////////////////////////////////////////////////////////////////////////////////////////////////////
	function switch2picture(bild){
		var innerHTML = '<img class="img_gross"  src="'+bild+'"/>';
		document.getElementById("einzelansichtbildgross").innerHTML  = innerHTML;
		document.getElementById("bildlink").style.display  = "none";
		
	}	 
	
	//////////////////////////////////////////////////////////////////////////////////////////////////////
	
	function maximizePicture(Ereignis, Img){
		if (Ereignis){
			with(scrollPos()){
				var innerHTML = '<img style="border: solid 1px black; padding: 1px;" height="400" src="' + Img.src.replace(/thumbs\//, '') + '" />';
				document.getElementById("maxpicture").style.left = Ereignis.clientX + left + 10   + "px";
    			document.getElementById("maxpicture").style.top  = Ereignis.clientY + top  - 200 + "px";
				document.getElementById("maxpicture").innerHTML  = innerHTML;
			}
		} // end if	 
	} // end function maximizePicture
	
	//////////////////////////////////////////////////////////////////////////////////////////////////////
	
	function minimizePicture(){
	
		document.getElementById("maxpicture").innerHTML  = "";
	
	}
	
	function movePicture(Ereignis) {
		with(scrollPos()) {
			document.getElementById("maxpicture").style.left = Ereignis.clientX + left + 10   + "px";
    		document.getElementById("maxpicture").style.top  = Ereignis.clientY + top  - 200  + "px";
		}
	}
	
	/////////////////////////////////////////////////////////////////////////////////////////////////
	function showLageplan(src) {
		if(src=='-1') {
			return false;
		}
		PlanWindow = window.open(src, "Planwindow", "resizeable=yes,width=805,height=605");
  		PlanWindow.focus();
	}
	
	function tellAFriend(objektuid,host,lang) {
		tafWindow = window.open('/php/index/index.handler.tellafriend.php?nr='+objektuid+'&host='+host+'&lang='+lang, "Planwindow", "resizeable=yes,width=350,height=400");
  		tafWindow.focus();
	}
	
	function switchBigImage(width,height,newsrc) {
		hoehe = height+18;//+48;
		breite = width+18;
		//FotoWindow = window.open(newsrc, 'Fotowindow', 'resizeable=yes,width='+breite+',height='+hoehe);
		FotoWindow = window.open('', 'Fotowindow', 'resizeable=yes,width='+breite+',height='+hoehe);
		
		FotoWindow.document.open();
		FotoWindow.document.write('<html><head><title>'+newsrc+'</title></head><body>');
		FotoWindow.document.write('<img src="'+newsrc+'">');
		//FotoWindow.document.write('<center><table>');
		//FotoWindow.document.write('<tr>');
		//FotoWindow.document.write('<td><a href=""><img src="/img/zurueck_pfeil.gif"></a></td>');
		//FotoWindow.document.write('<td><a href=""><img src="/img/vorwaerts_pfeil.gif"></a></td>');
		//FotoWindow.document.write('</tr>');
		//FotoWindow.document.write('</table></center>');
		FotoWindow.document.write('</body></html>');
		FotoWindow.document.close();
		
		FotoWindow.focus();
		//$('einzelansichtbildgross').src = newsrc;
		//alert(newsrc);
	}
	
	//////////////////////////////// Freymann neu ab 09.09.09 //////////////////////////////////////
	function imagePopup(url, i, mouse) {
		
		
		var mousepos 	= new mslib().getMousePos(mouse);
		var scrollpos	= new mslib().getScrollPos();
	
		var bigPicture 	= document.getElementById("bigpicture");
		var last 		= document.getElementById("last");
		var next 		= document.getElementById("next");
		var container 	= document.getElementById("images_hauptcontainer");

			with(container){
				style.display 	= 	"block";
				
				if(imagePopup.prototype.move){
					style.top		= 	(mousepos.y-100)	+	"px";
					style.left		=	(mousepos.x+10)		+ 	"px";
				}//end if
				
			}//end with
			
			with(bigPicture){
				src=url;
			}//end with
			
			with(last) { // Zurückblättern
				
				onclick 	= document.getElementsByName("thumb")[Math.max(i-1, 0)].onclick;
			
				if(i==0){
					style.visibility = "hidden";
				}//end if
				else{
					style.visibility = "visible";
				}
			
			}//end with
			
			with(next) { // Vorwärtsblättern
				onclick = document.getElementsByName("thumb")[Math.min(i+1, document.getElementsByName("thumb").length-1)].onclick;
			
				if(i==document.getElementsByName("thumb").length-1){
					style.visibility = "hidden";
				}//end if
				else{
					style.visibility = "visible";
				}
				
			}//end with
		
	}//end function
	
	function imageClose() {
		with(document.getElementById("images_hauptcontainer")) {
				style.display = "none";
		}//end with
	}//end function