var isIE6 = false;

/* prototype / scriptaculous */
	function showOverlay(url, width, height) {

		//var arrayPageSize = getPageSize();
		//$('overlay').style.height = (arrayPageSize[1] + 'px');

		if (document.all) {
			//this.overlay.style.width = document.body.offsetWidth;
			$('overlay_background').style.width = "102%";
		} else {
			$('overlay_background').style.width = "100%";
		}
		
		if (width && height) { 			
			document.getElementById('overlay_width').style.width = width;
			
			//var height2 = height.replace(/px/g, "");
			//document.getElementById('overlay_width').style.height = (parseInt(height2) + 45) + "px";

			var border_height = parseInt(height.slice(0, -2)) + 45;
			
			document.getElementById('overlay_width').style.height = border_height + "px";

			document.getElementById('overlay_iframe').style.width = width;
			document.getElementById('overlay_iframe').style.height = height;
		} else {
			document.getElementById('overlay_width').style.width = "958px";
			document.getElementById('overlay_width').style.height = "563px";
			document.getElementById('overlay_iframe').style.width = "958px";
			document.getElementById('overlay_iframe').style.height = "518px";
		}
		
		//window.overlay.document.location.href=url;
		
		new Effect.Appear('overlay_background', { duration: 0.5,  to: 0.7, afterSetup: function() {
			new Effect.Appear('overlay_box', { delay: 0.5, duration: 0.2,  to: 1, afterSetup: function() {
				//$('overlay_wait').style.display = "none";
				//$('loading').hide();
				new Effect.BlindDown('overlay_content', { delay: 0.3, duration: 0.5, scaleContent: false, scaleX:false, scaleY:true, restoreAfterFinish: false, afterFinishInternal: function() { //afterFinishInternal
					//$('loading').hide();
					window.overlay.document.location.href = url;
					//$('loading').show();
					//$('overlay_iframe').hide();
					//$('overlay_iframe').show();
				}
				} );

			} } );
			// new Effect.BlindDown('overlay_box', { delay: 0.3, duration: 0.8, scaleContent: false, scaleX:false, scaleY:true, restoreAfterFinish: false } );
		} });
		
		if(isIE6) {
			//var scrollHeight = document.documentElement.scrollTop
			//alert("IE 6 scroll:"+document.documentElement.scrollHeight);
			
			document.getElementById('overlay_box').style.top = document.documentElement.scrollTop; //getPageScroll();
			document.getElementById('overlay_background').style.top = 0;
			document.getElementById('overlay_background').style.height = document.documentElement.scrollHeight;

			//alert("soo:"+scrollHeight);
		}

		Event.observe($('overlay_background'), 'click', hideOverlay.bindAsEventListener(this));
		Event.observe($('overlay_box'), 'click', hideOverlay.bindAsEventListener(this));
		Event.observe($('overlay_content'), 'click',  function(event) { Event.stop(event) });

		return false;
	}

	function ready() {
		$('loading').hide();
		$('overlay_iframe').show();
	}

	function hideOverlay() {
		$('overlay_box').hide();
		$('overlay_background').hide();
		$('overlay_content').hide();
		window.overlay.document.location.href = "/blank.php";
		return false; // this
	}
	
	
	
	
	// overlay2 for showing frames without the usual overlay border e.g. for images
	function showOverlay2(url, width, height) {

		if (document.all) {
			$('overlay_background2').style.width = "102%";
		} else {
			$('overlay_background2').style.width = "100%";
		}
		
		if (width && height) { 			
			document.getElementById('overlay_width2').style.width = width;		
			document.getElementById('overlay_width2').style.height = height;
			document.getElementById('overlay_iframe2').style.width = width;
			document.getElementById('overlay_iframe2').style.height = height;
		} else {
			document.getElementById('overlay_width2').style.width = "958px";
			document.getElementById('overlay_width2').style.height = "563px";
			document.getElementById('overlay_iframe2').style.width = "958px";
			document.getElementById('overlay_iframe2').style.height = "518px";
		}
		
		new Effect.Appear('overlay_background2', { duration: 0.5,  to: 0.7, afterSetup: function() {
			new Effect.Appear('overlay_box2', { delay: 0.5, duration: 0.2,  to: 1, afterSetup: function() {

				new Effect.BlindDown('overlay_content2', { delay: 0.3, duration: 0.5, scaleContent: false, scaleX:false, scaleY:true, restoreAfterFinish: false, afterFinishInternal: function() { //afterFinishInternal
					window.overlay2.document.location.href = url;
				}
				} );

			} } );
		} });

		Event.observe($('overlay_background2'), 'click', hideOverlay2.bindAsEventListener(this));
		Event.observe($('overlay_box2'), 'click', hideOverlay2.bindAsEventListener(this));
		Event.observe($('overlay_content2'), 'click',  function(event) { Event.stop(event) });

		return false;
	}	
	
	function hideOverlay2() {
		$('overlay_box2').hide();
		$('overlay_background2').hide();
		$('overlay_content2').hide();
		window.overlay2.document.location.href = "/blank.php";
		return false;
	}






	
	
	
	
	
	


/* fremder code von lightbox: http://www.huddletogether.com/projects/lightbox/lightbox.js */
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}



function toUrl(myUrl) {
	window.location.href = myUrl;
	return false;
}











/**************************************************************

	Script		: Overlay
	Version		: 1.2
	Authors		: Samuel birch
	Desc		: Covers the window with a semi-transparent layer.
	Licence		: Open Source MIT Licence

**************************************************************/

/*
var Overlay = new Class({
	
	getOptions: function(){
		return {
			colour: '#000',
			opacity: 0.7,
			zIndex: 1,
			container: document.body,
			onClick: Class.empty
		};
	},

	initialize: function(options){
		this.setOptions(this.getOptions(), options);
		
		this.options.container = $(this.options.container);
		
		this.container = new Element('div').setProperty('id', 'OverlayContainer').setStyles({
			position: 'absolute',
			left: '0px',
			top: '0px',
			width: '100%',
			zIndex: this.options.zIndex
		}).injectInside(this.options.container);
		
		this.iframe = new Element('iframe').setProperties({
			'id': 'OverlayIframe',
			'name': 'OverlayIframe',
			'src': 'javascript:void(0);',
			'frameborder': 1,
			'scrolling': 'no'
		}).setStyles({
			'position': 'absolute',
			'top': 0,
			'left': 0,
			'width': '100%',
			'height': '100%',
			'filter': 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)',
			'opacity': 0,
			'zIndex': 1
		}).injectInside(this.container);
		
		this.overlay = new Element('div').setProperty('id', 'Overlay').setStyles({
			position: 'absolute',
			left: '0px',
			top: '0px',
			width: '100%',
			height: '100%',
			zIndex: 2,
			backgroundColor: this.options.colour
		}).injectInside(this.container);
		
		this.container.addEvent('click', function(){
			this.options.onClick();
		}.bind(this));
		
		this.fade = new Fx.Style(this.container, 'opacity').set(0);
		this.position();
		
		window.addEvent('resize', this.position.bind(this));
	},
	
	position: function(){ 
		if(this.options.container == document.body){ 
			var h = window.getScrollHeight()+'px'; 
			this.container.setStyles({top: '0px', height: h}); 
		}else{ 
			var myCoords = this.options.container.getCoordinates(); 
			this.container.setStyles({
				top: myCoords.top+'px', 
				height: myCoords.height+'px', 
				left: myCoords.left+'px', 
				width: myCoords.width+'px'
			}); 
		} 
	},
	
	show: function(){
		this.fade.start(0,this.options.opacity);
	},
	
	hide: function(){
		this.fade.start(this.options.opacity,0);
	}
	
});
Overlay.implement(new Options);
*/
/*************************************************************/




