var winPopup;

function divErweitern (oID) {
	if (document.getElementById) {
		var first = true;
		var oDiv = document.getElementById(oID);
		oDiv = oDiv.firstChild;
		if (oDiv.nodeType == 1) first = false;
		while (oDiv.nextSibling != null) { // alle restlichen Knoten durchgehen
			oDiv = oDiv.nextSibling;
			if (oDiv.nodeType == 1 && ! first) { // nur Elementknoten (p, div, ul, ...)
				// style-Attribut hinzufügen, wenn noch nicht vorhanden
				var aStyle = document.createAttribute("style");
				if (! oDiv.style.height) {
					oDiv.style.height = " 0px";
				}
				var sStyle = new String(oDiv.style.height);
				if (sStyle.search( "100%") > -1 ) {
					sStyle = sStyle.replace( "100%", "0px");
				} else if (sStyle.search( "0px") > -1) {
					sStyle = sStyle.replace( "0px", "100%");
				}
				aStyle.nodeValue = sStyle;
				oDiv.style.height = sStyle;
			} else if (oDiv.nodeType == 1) {
				first = false;
			}
		}
	}
}

function showLargeImage (thumbnail) {
	// Bildöffner für popup mit Bild erwartete Übergabe: Objekt des thumbnails
	// Im Normalfall ist das Objekt der Link, nicht die Grafik des Links
	var imgLarge = new Image();
	var src = new String(thumbnail.src);
	src = src.replace(/t_/, "");
	imgLarge.src = src;

	w = imgLarge.width + 10;
	h = imgLarge.height + 50;
	x = (screen.availWidth / 2) - (w / 2);
	y = (screen.availHeight / 2) - (h / 2);
	winPopup = window.open(
            '','Bildbetrachtung',
		'width=550,height=550,left='+x+',top='+y+',screenX='+x+',screenY='+y+',status=yes,resizable=yes');
	with (winPopup)
	{
	focus();
	document.open();
	document.write('<html><head><title>Kochen am Markt ' + thumbnail.name + '</title>');
	document.write('<meta http-equiv=\"imagetoolbar\" content=\"no\">');
	document.write('</head>');
	document.write('<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" scroll=\"no\" onload=\"opener.showLargeImage_Resize(document.images[0].width,document.images[0].height)\">')
	document.write('<a href=\"javascript:self.close()\">');
	document.write('<img src=\"' + src + '\" border=\"0\" alt=\"' + thumbnail.name + '\"></a><br>')
	document.write('</body></html>')
	document.close();
	}
}

function showLargeImage_Resize(x,y) {
	if (navigator.appName == 'Microsoft Internet Explorer')
	{winPopup.resizeTo(x+10,y+29+22);}
	else
	{
	   if(navigator.appVersion.substring(0,1) < "5")
      	{winPopup.resizeTo(x,y+22);}
	   else
      	{winPopup.resizeTo(x+8-8,y+28+22);}
	}
	bildpopx=(screen.availWidth/2)-(x/2);
	bildpopy=(screen.availHeight/2)-(y/2);
	winPopup.moveTo(bildpopx,bildpopy);
}

