	// site.js - (c) 2009 Ideenkreation.de
	
	var backgroundMorph = null;
	var styleProp		= null;
	var bgSize			= null;
	
/*	function Fensterweite () {
	  if (window.innerWidth) {
		return window.innerWidth;
	  } else if (document.body && document.body.offsetWidth) {
		return document.body.offsetWidth;
	  } else {
		return 0;
	  }
	}
	
	var shizzle = Fensterweite(); */

	function Fensterhoehe () {
	  if (window.innerHeight) {
		return window.innerHeight;
	  } else if (document.body && document.body.offsetHeight) {
		if(navigator.appName.indexOf("Explorer") != -1){
			return document.getElementById('IEhackInnerHeight').offsetTop;
		}else{
			return document.body.offsetHeight;	
		}
	  } else {
		return 0;
	  }
	}

	function setActiveBackground(){
		var thumbnailDiv = $('thumbnailList');
		var thumbnailList = thumbnailDiv.getChildren('ul')[0];
		listElements = thumbnailList.getChildren('li');
		num_ListElements = listElements.length;
		for(var i=0;i<num_ListElements;i++){
			listEntry = listElements[i];
			listEntry.className = '';
		}
		this.className = 'aktiv';
		anchor = this.getChildren('a')[0];
		$('backgroundPicture').src = anchor.href;
		return false;
	}

	// resizing window / image / flash
	window.addEvent('domready',function() 
	{
		$('wrapper').height = document.body.offsetHeight;
	
		// Fenster auf x0, y0 bewegen
		// window.moveTo(0, 0);
		if($('backgroundPicture')){

			$('backgroundPicture').setStyle('height', Fensterhoehe()+'px');
		
			var currentSize = screen.availHeight * 4/3;
		
		//	window.resizeTo(currentSize, screen.availHeight);
		//	window.resizeTo(Fensterhoehe() * 4/3, screen.availHeight);
		
			//backgroundMorph = new Fx.Morph('backgroundPicture', {duration: 3000, transition: Fx.Transitions.Sine.easeInOut});
		
		
			window.addEvent('resize',function() 
			{
				//backgroundMorph.cancel();
				$('backgroundPicture').setStyle('height', Fensterhoehe()+'px');
				$('backgroundPicture').setStyle('width', Fensterhoehe()*4/3+'px');
			});
		}
		if($('mainflash')){
			// Fenster auf x0, y0 bewegen, nur auf Startseite
			//window.moveTo(0, 0);
			var currentSize = screen.availHeight * 4/3;

			window.resizeTo(currentSize, screen.availHeight);
			window.resizeTo(Fensterhoehe() * 4/3, screen.availHeight);

			$('background').setStyle('height', Fensterhoehe()+'px');
			$('background').setStyle('width', Fensterhoehe()*4/3+'px');
			
			//backgroundMorph = new Fx.Morph('backgroundPicture', {duration: 3000, transition: Fx.Transitions.Sine.easeInOut});
		
		
			window.addEvent('resize',function() 
			{
				//backgroundMorph.cancel();
				$('background').setStyle('height', Fensterhoehe()+'px');
				$('background').setStyle('width', Fensterhoehe()*4/3+'px');
			});
		}
		if($('thumbnailList')){
			var thumbnailDiv = $('thumbnailList');
			var thumbnailList = thumbnailDiv.getChildren('ul')[0];
			if(thumbnailList){
				listElements = thumbnailList.getChildren('li');
				num_listElements = listElements.length;
				for(var i=0;i<num_listElements;i++){
					listEntry = listElements[i];
					listEntry.addEvent('click', setActiveBackground.bind(listEntry));
				}
			}
		}

	});
