/**************************************************************************/
/************************** functions.js **********************************/
/**************************************************************************/



/**************************************************************/
// Set Content Height wenn Content zu klein

	function setContentHeight( iAbstand ){
				
		//var iAbstand = 290;
		if (iAbstand == null) { var iAbstand = 290;  }
		
		var oContent = document.getElementById('idContentElement');
					
		// Höhe auf Auto setzen
		oContent.style.height = "auto";
		
		
		var iBrowserHeight = GetBrowserInnerHeight() - iAbstand;		
		var iContentHeight = oContent.offsetHeight;
		
		// Wenn Content < wie verfügbare Browser höhe dan höhe von Content Setzen
		if ( iContentHeight <= iBrowserHeight ) {			
			// Höhe des Contents Anpassen			
			var iContentHeight = iBrowserHeight+"px";		
			oContent.style.height = iContentHeight;		
		}
	}



/**************************************************************/
// Browser Width & Height


	function GetBrowserInnerHeight() {		
	   if (window.innerHeight) {
			return window.innerHeight;								   
	   } else if (document.body && document.body.offsetHeight) {
			return document.body.offsetHeight;
	   } else {
			return 0;
	   }
	}

	function GetBrowserInnerWidth()
	{
	   if (window.innerWidth) {
			return window.innerWidth;
	   } else if (document.body && document.body.offsetWidth) {
			return document.body.offsetWidth;
	   } else {
			return 0;
	   }
	}


/**************************************************************/
// Resize und OnLoad Event Händler

// Onload und Onresize Eventhandler erg?nzen
	function addOnLoadEventHandler(oEventHandler) {
		if(typeof window.onload != 'undefined' && window.onload != null) {
			var oOnLoad = window.onload;
			window.onload = function(){oOnLoad(); oEventHandler()};
		} else {
			window.onload = function(){oEventHandler()};
		}
	}
	
	function addOnResizeEventHandler(oEventHandler) {
		if(typeof window.onresize != 'undefined' && window.onresize != null) {
			var oOnResize = window.onresize;
			window.onresize = function(){oOnResize(); oEventHandler()};
		} else {
			window.onresize = function(){oEventHandler()};
		}
	}
