<!-- //

var layer = {

	initialize:function()
		{
			// LINK WIRD IN DEN LISTEN MODUS GESETZT
			$$('.layer.open').invoke('observe', 'click', layer.open);
		},
		open:function(event)
		{
			// DAS EVENT ERHÄLT EINEN NAMEN
			
			var element = Event.element(event);
			
			// WIR TAUSCHEN MAL DAS HREF AUS
			var target = element.longDesc;

			element.longDesc = "";
			

			// ALLE SELECTS AUSBLENDEN
			$$('select').each(function(selects){ selects.style.visibility = "hidden"; });
			

			// WIR BAUEN UNS DEN LAYER ZUSAMMEN
			var objBody = $$('body')[0];
			var arrayWindowSize = layer.getWindowSize();
			objBody.appendChild(Builder.node('div',{id:'dbnOverlay'}));
		
			objBody.appendChild(
				Builder.node('div',{id:'dbnLayer'}, [
					Builder.node('a',{className:'layer close', id:'closeButton', style:'display: none;', href: 'javascript:void(0);' },'Fenster schlie&szlig;en'),
					Builder.node('div', {id:'dbnLayerContent', style: 'display: none;'})
				])
			);
			

			// HIER BEKOMMT DAS LAYERSEINE GRÖSSE UND DIE POSITION
			
			var widthLayer = 802;
			var heightLayer = 402;
			var topPosition = 145;
			
			$('dbnOverlay').setStyle({ width: arrayWindowSize[0] + 'px', height: arrayWindowSize[1] + 'px' });
			
			$('dbnLayer').style.width = widthLayer + "px";
			$('dbnLayer').style.height = heightLayer + "px";
			if (topPosition) {
				$('dbnLayer').style.top = topPosition + "px";
			}
			$('dbnLayer').style.marginLeft = "-" + (widthLayer / 2) + "px";
			new Effect.Grow('dbnLayerContent', {delay: 0.75, duration: 0.3, beforeStart: function() {
															
															$('linkSection').style.visibility = "hidden";
														}, afterFinish: function() {
															$('closeButton').show();
															new Ajax.Updater('dbnLayerContent', target, {
																asynchronous: true,
																evalScripts: true,
																method: 'get'
															});
														}
			});		
			// WIR LADEN DAS ZIEL IN DEN CONTENT BEREICH UND GEBEN DIESES ANSCHLIESSEND WIEDER AN DAS LINKELEMENT ZURÜCK
			//new Ajax.Updater('dbnLayerContent', target, {asynchronous:true, evalScripts:true, method: 'get'});			
					
			element.longDesc = target;
			event.stop();
			
			
			// CLOSE BUTTON WIRD IN DEN LISTEN MODUS GESETZT
			$$('.layer.close').invoke('observe', 'click', layer.close);
			

			return false;
		},
		close:function(id)
		{
			// LAYER WIRD AUS DEM DOM ENTFERNT
			$('dbnOverlay').remove();
			$('dbnLayer').remove();
			
			if($('dbnTooltip')) {
				$('dbnTooltip').remove();
			}

			// ALLE SELECTS SIND WIEDER DA
			$$('select').each(function(selects){ selects.style.visibility = "visible"; });
			$('linkSection').style.visibility = "visible";
		},
		getWindowSize: function() {
	        
		    var xScroll, yScroll;
			
			if (window.innerHeight && window.scrollMaxY) {	
				xScroll = window.innerWidth + window.scrollMaxX;
				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
				if(document.documentElement.clientWidth){
					windowWidth = document.documentElement.clientWidth; 
				} else {
					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 = xScroll;		
			} else {
				pageWidth = windowWidth;
			}

			return [pageWidth,pageHeight];
		}
}

Event.observe(window, 'load', layer.initialize);

// -->