
/*
      //create onDomReady Event
      window.onDomReady = initReady;
      // Initialize event depending on browser
      function initReady(fn)
      {
        //W3C-compliant browser
        if(document.addEventListener) {
          document.addEventListener("DOMContentLoaded", fn, false);
        }
        //IE
        else {
          document.onreadystatechange = function(){readyState(fn)}
        }
      }
      //IE execute function
      function readyState(func)
      {
        // DOM is ready
        if(document.readyState == "interactive" || document.readyState == "complete")
        {
                func();
        }
      }


	window.onDomReady(onReady);
	 
	function onReady()
	{
	        //alert("The DOM is ready!");

	
	}
*/


/*********************************************************** 
/* Zum ermitteln der Höhe des Browsers
/*
/***********************************************************/

	// prüfe on IE oder andere Browser
	function JSBrowser(){
		this.browser = function(){
			if(navigator.appName =="Microsoft Internet Explorer"){
				return 1;
			} else {
				return 0;
			}
		}
	}
	
	function JSSettings(objid,prop){
		
		this.objid = objid;
		this.prop = prop;
		
		this.prepStringForIE = function(){
			var split = this.prop.split("-");
			split[1] = split[1].substr(0,1).toUpperCase() + split[1].substr(1,split[1].length);
			return split[0] + split[1];
		}
		
		this.getStyleValuesIE = function(){
			var obj, propval;
            var prop = this.prepStringForIE();
            obj=document.getElementById(this.objid);
            propval=obj.currentStyle[prop];
            return propval.replace("px","");
		
		}
	
		this.getStyleValueNotIE = function(){
		 	var obj, propval;
          	obj=document.getElementById(this.objid);
	        propval=document.defaultView.getComputedStyle(obj,"").getPropertyValue(this.prop);
    	    return propval.replace("px","");
		}
	
	
		this.get = function(){
			if(this.browser()){
				return this.getStyleValuesIE();
			} else {
				return this.getStyleValueNotIE();
			}
		}
	}


	function SliderBoxen(element,top){
		this.element = element;
		this.top = top;
		//JSSettings.prototype = new JSBrowser;
		//var settings = new JSSettings("right","padding-bottom");
		
/*		
		if(settings.browser()){
			// IE
			this.element.style.bottom = window.document.body.scrollHeight - this.top;
		} else {
			this.element.style.bottom = window.document.body.scrollHeight - this.top - settings.get();
		}
*/
	}



	function setFooterForIE(){
		JSSettings.prototype = new JSBrowser;
		var settings = new JSSettings("zapp_centrecontent","padding-bottom");
//		alert(settings.get());
		if(settings.browser()){
			document.getElementById("zapp_centrecontent").style.height = parseInt(settings.get()) + parseInt(window.document.body.scrollHeight);
		} 
	}

	function setHeight(){
		if(window.document.body.scrollHeight < window.document.body.clientHeight){
			document.getElementById("wrapper").style.height = window.document.body.clientHeight;
			document.getElementById("zapp_innerwrap").style.height = window.document.body.clientHeight;
		} else {
			document.getElementById("wrapper").style.height = window.document.body.scrollHeight;
			document.getElementById("zapp_innerwrap").style.height = window.document.body.scrollHeight;
		}
	}


/*********************************************************** 
/* Zum ermitteln der Höhe der Newsschlagzeilen
/*
/***********************************************************/

	function getNewsschlagzeilenheight(){
		var height = document.getElementById("zapp_newsschlazeilen").offsetHeight - document.getElementById("zapp_ns_list_header").offsetHeight;
		document.getElementById("zapp_newslist").style.height = height;
	}
	

	function getSliderpraesentation(){
		for(var i = 0; i < document.getElementById('countSlider').value; i++){
			document.getElementById('zapp_praesentation_' + i).style.left = document.sliderpraesentation["elementSlider"][i].value + "px";
		}		
	}
	// Bei IE braucht es dies function um die effektive höhe zu ermitteln

	function findPosTop(obj){
		var curtop = 0;
		if(obj.value == null){
			return obj.offsetTop;
		}

		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop;
				obj = obj.offsetParent;
			}
		}

/*
		else if (obj.x)
			curleft += obj.x;
*/
//		alert(curtop);
		return curtop;
	}
	
	
	
	window.onload = function() {
		//setFooterForIE();
		//setHeight();
		BrowserDetect.init();
		if(document.getElementById('zapp_praesentation_0')){
			getSliderpraesentation();
		}
		if(typeof(window.getBoxRegionen) == "function") {
			document.getElementById("zapp_region").innerHTML = getBoxRegionen();
		}
		
		var brows = new JSBrowser();
		if(brows.browser()){
			marginBottom = 35;
		} else {
			marginBottom = 27;
		}
		
		//helpBox();
	}


	function helpBox(){

		var brows, marginBottom, topNavi, naviHeight, naviBottom, top, height, distanz;
		brows = new JSBrowser();
		if(brows.browser()){
			marginBottom = 35;
		} else {
			marginBottom = 27;
		}
		
        topNavi = findPosTop(document.getElementById("zapp_navi_main"));
        naviHeight = document.getElementById("zapp_navi_main").offsetHeight;
        naviBottom =  topNavi + naviHeight;


        top = findPosTop(document.getElementById("footer"));
        height = parseInt(document.getElementById("zapp_navi_help").offsetHeight);
        distanz;
        if((top - naviBottom) < (height + marginBottom + 20)){

                document.getElementById("zapp_navi_help").style.position='relative';
                //distanz = naviBottom + height + marginBottom + 20;
                document.getElementById("zapp_navi_help").style.top = "10px";
                distanz = naviBottom + 20 + height + marginBottom;
                document.getElementById("left").style.height = (distanz - document.getElementById("header").offsetHeight) + "px";

        } else {
                document.getElementById("zapp_navi_help").style.position='absolute';
                distanz = parseInt(top) - parseInt(height) - parseInt(marginBottom);
                document.getElementById("zapp_navi_help").style.top = distanz + "px";
        }

        //distanz = parseInt(top) - parseInt(height) - parseInt(marginBottom);
        //document.getElementById("zapp_navi_help").style.top = distanz + "px";


	}


