var pop;
function popupImage(url,width,height,titel) {
	
	// Breite und Höhe setzen
	var w = width || 110;
	var h = height || 110;
	
	// Breite und Höhe erweitern
	w += 40;
	h += 40;
	
	// Check, ob bereits ein Fenster offen ist. Falls ja, schliessen, um korrekte Größe zu erhalten.
	if(pop && !pop.closed) pop.close();
	
	// Fenster öffnen
	pop = window.open(url, 'ImagePopup', 'width='+w+',height='+h);
	
	// Inhalt
	var html = '';
	html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
	html += '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>'+titel+'</title>';
	html += '<script type="text/javascript">';
	html += 'function resizePopup() {';
	
	//  Nur, wenn keine Größe übergeben wurde
	if(width == undefined)
	{
		html += 'var x = parseInt(document.images["pImage"].width) + 40;';
		html += 'var y = parseInt(document.images["pImage"].height) + 90;';
		html += 'window.resizeTo(x,y);';
	}
	html += '}';
	html += '</script>';
	html += '<style type="text/css">html, body {background:#FFF;width:100%; height:100%; margin:0; padding:0;}img{border:2px solid #CCC;display:block;margin:0 auto;}</style>';
	html += '</head><body onload="resizePopup()" onblur="window.close()"><table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%"><tr><td align="center" valign="middle"><a href="#" onclick="window.close();" title="Klicken, um das Fenster zu schliessen">';
	html += '<img name="pImage" src="'+url+'" alt="'+titel+'" border="0" />';
	html += '</a></td></tr></table></body></html>';
	
	pop.document.open();
	pop.document.write(html);
	pop.document.close();
	pop.focus();
}

/**
 * @param string sId Element ID
 * @param string onOff Aktion 'on' oder 'off'
 */
function switchDisplay(sId, onOff) {
	var el = document.getElementById(sId);
	if(!el) return false;
	
	if(onOff == 'on') el.style.display = 'block';
	else el.style.display = 'none';
}


function popupBooking(url) {
	pBooking = window.open(url, 'BookingPopup', 'width=650,height=600,scrollbars=yes');
	pBooking.focus();
}