﻿var pageHeightObj;
var windowObj;
var onLoadFunctions=new Array();
function addOnload(newFunction) {
    try {
        onLoadFunctions[onLoadFunctions.length]=newFunction;
    }catch(e){}
}
/* wird erst ausgefuehrt nachdem die Seite vollstaendig geladen ist*/
function initAfterImages(){
    try {
        /* waiting for images to load */
        for (i = 0; i < document.images.length; ++i) {
            if (!document.images[i].complete && !isPrint(document.images[i]) && document.images[i].src!="") {
                window.setTimeout(function(){
                    initAfterImages();
                }, 25);
                return false;
            }
        }
        /* calling onload Functions */
        for (i = 0; i < onLoadFunctions.length; i++) {
            if (typeof onLoadFunctions[i] == "function") {
                window.setTimeout(onLoadFunctions[i],0);
            }
        }
    } catch(e){}
}
window.setTimeout(function(){
try {
    var oldOnload = window.onload;
    if (typeof oldOnload == "function") {
        window.onload = function(){
            if (oldOnload) {
                oldOnload();
            }
            window.setTimeout(initAfterImages,100);
        }
    }
    else {
        window.onload = window.setTimeout(initAfterImages,100);
    }
}catch(e){}
},500);

function elemWidth(Obj){
try{
    if (Obj.clip && Obj.clip.width){
        return Obj.clip.width;
    } else if (Obj.offsetWidth) {
        return Obj.offsetWidth;
    } else if (Obj.style.pixelWidth) {
        return Obj.style.pixelWidth;
    } else {
        return false;
    }
}catch(e){}
}
/* ermittelt die weite in Pixel eines HTML-Elements*/
function elemHeight(Obj){
try{
    if (Obj.clip && e.clip.height)
        return Obj.clip.height;
    else if (Obj.offsetHeight)
        return Obj.offsetHeight;
    else if (Obj.style.pixelHeight)
        return Obj.style.pixelHeight;
    return false;
}catch(e){}
}
function isPrint(obj){
    try {
        if (obj.className && obj.className.indexOf("print_only") != -1) {
            return true;
        }
        if (obj.parentNode) 
            return isPrint(obj.parentNode);
        return false;
    }catch(e){}
    return false;
}
function submitForm(elem){
    try{
        if(elem.options[elem.selectedIndex].value){
            location.href=elem.options[elem.selectedIndex].value;
        }
    }catch(e){}
}
var cnt = 0;
var faqObj=[];
var faqElem=[];
var faqObjHeight=[];
var moving = false;
function faqFX(){
    try {
        var timeout=500;
        var sumHeight=0;
        var tmp = document.getElementsByTagName("div");
        for (i = 0; i < tmp.length; i++) {
            if (tmp[i].className == "faq_list") {
                var entries = tmp[i].getElementsByTagName("div");
                for (j = 0; j < entries.length; j++) {
                    if (entries[j].className == "entry") {
                        if (navigator.userAgent.toLowerCase().indexOf("msie 6.") != -1) {
                            var elem = entries[j].getElementsByTagName("ul");
                            for (var k = 0; k < elem.length; k++) elem[k].style.visibility = "hidden";
                        }
                        for (k = 0; k < entries[j].childNodes.length; k++) {
                            if (entries[j].childNodes[k].className && entries[j].childNodes[k].className.indexOf("title") != -1) {
                                entries[j].childNodes[k].className = entries[j].childNodes[k].className + " closed";
                                entries[j].childNodes[k].id = "faq_antwort_opener_"+cnt;
                                entries[j].childNodes[k].onclick = function(){
                                    try {
                                        if (!moving) {
                                            moving=true;
                                            
                                            if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1){
                                                var elem = this.parentNode.getElementsByTagName("ul");
                                                for (var j = 0; j < elem.length; j++)  elem[j].style.visibility = "hidden";
                                            }
                                                
                                            var id = this.id.split("faq_antwort_opener_").join("");
                                            if (this.className.indexOf("open") != -1) {
                                                try { pageHeightObj.fadeHeight(faqObjHeight[id] * -1); } catch (e) {}
                                            } else {
                                                try { pageHeightObj.fadeHeight(faqObjHeight[id]); } catch (e) {}
                                            }
                                            faqObj[id].toggle();
                                            var _slf=this;
                                            
                                            if (_slf.className.indexOf("open") != -1) {
                                                window.setTimeout(function(){
                                                    _slf.className = _slf.className.split(" open").join(" closed");
                                                }, timeout);
                                            } else {
                                                _slf.className = _slf.className.split(" closed").join(" open");
                                            }
                                            
                                            var _self = this;
                                            window.setTimeout(function(){
                                                if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1){
                                                    if (_self.className.indexOf("open")>-1) {
                                                        var elem = _self.parentNode.getElementsByTagName("ul");
                                                        for (var j = 0; j < elem.length; j++) elem[j].style.visibility = "visible";
                                                    } else {
                                                        var elem = _self.parentNode.getElementsByTagName("ul");
                                                        for (var j = 0; j < elem.length; j++) elem[j].style.visibility = "hidden";
                                                    }
                                                }
                                                moving=false;
                                            },timeout+1);
                                        }
                                    } catch (e) {}
                                };
                            } else if(entries[j].childNodes[k].className && entries[j].childNodes[k].className.indexOf("text") != -1){
                                entries[j].childNodes[k].id = "faq_antwort_"+cnt;
                                faqObj[cnt] = new fx.Height("faq_antwort_"+cnt, {duration: timeout});
                                try{
                                    faqObjHeight[cnt]=elemHeight(entries[j].childNodes[k]);
                                    sumHeight += elemHeight(entries[j].childNodes[k]);
                                }catch(e){}
                                faqObj[cnt].hide();
                            }
                        }
                        cnt++;
                    }
                }
            }
        }
    }catch(e){}
}
var cnt2 = 0;
var tabObj=new Array();
var tabObjHeight=new Array();
var tabLinkObj=new Array();
var execCount=0;
function tabFX(){
    try {
    if (document.getElementById("footer") && execCount < 100) {
        var sumHeight = 0;
        var tmp = document.getElementsByTagName("div");
        for (i = 0; i < tmp.length; i++) {
            if (tmp[i].className == "tabs") {
                var entries = tmp[i].getElementsByTagName("div");
                for (j = 0; j < entries.length; j++) {
                    if (entries[j].className == "panel_entry") {
                        var pos = tabObj.length;
                        tabObj[pos] = entries[j];
                        tabObj[pos].style.overflow = "hidden";
                        tabObjHeight[pos] = elemHeight(entries[j]);
                        if (pos == 0) {
                            entries[j].style.display = "block";
                        }
                        else {
                            entries[j].style.display = "none";
                            sumHeight += tabObjHeight[pos];
                        }
                    }
                    else 
                        if (entries[j].className == "tabs_header") {
                            var links = entries[j].getElementsByTagName("a");
                            for (k = 0; k < links.length; k++) {
                                tabLinkObj[tabLinkObj.length] = links[k];
                                if (k == 0) {
                                    links[k].className = links[k].className + " active";
                                }
                                links[k].id = "tab_opener_" + cnt2;
                                links[k].onclick = function(){
                                    var sumHeight = 0;
                                    try {
                                        var id = this.id.split("tab_opener_").join("");
                                        for (i = 0; i < tabObj.length; i++) {
                                            if (tabObj[i].style.display != "none") {
                                                tabObj[i].style.display = "none";
                                            }
                                        }
                                        for (i = 0; i < tabLinkObj.length; i++) {
                                            tabLinkObj[i].className = tabLinkObj[i].className.split(" active").join("");
                                            if (tabLinkObj[i].className == "active") 
                                                tabLinkObj[i].className = "";
                                        }
                                        this.className = this.className + " active";
                                        tabObj[id].style.display = "block";
                                    } 
                                    catch (e) {
                                    }
                                }
                                cnt2++;
                            }
                        }
                }
            }
        }
    }
    }catch(e){}
    if(!document.getElementById("footer") && execCount < 100){
        execCount++;
        window.setTimeout(function(){
            tabFX();
        }, 50);
    }
}

function pageHeight(){
    try{
    this.minHeight=-1;
    this.maxHeight=-1;
    this.currentHeight=false;
    this.navBoxObj=false;
    this.contBoxObj=false;
    this.navBoxFadeObj=false;
    this.contBoxFadeObj=false;
    this.innerContentObj=false;
    this.duration=500;
    
    this.initObj=function(){
        try {
            if (document.getElementById("nav_box")) 
                this.navBoxObj = document.getElementById("nav_box");
            
            if (document.getElementById("content_box")) {
                this.contBoxObj = document.getElementById("content_box");
                this.innerContentObj = this.contBoxObj.getElementsByTagName("div")[0];
            }
                
        }catch(e){}
    };
    
    this.initHeight=function(){
        try{
            var max=this.minHeight;
            
            if(document.getElementById("col1_content") && document.getElementById("col2_content")){
                var menuH = this.elemHeight(document.getElementById("col1_content"));
                var contH = this.elemHeight(document.getElementById("col2_content"));
                if(menuH < contH) this.minHeight=menuH;
                else this.minHeight=contH;
            }
            
            if (document.getElementById("col1_content") && this.elemHeight(document.getElementById("col1_content")) > max) {
                max = this.elemHeight(document.getElementById("col1_content"));
            }
                
            if(document.getElementById("col2_content") && this.elemHeight(document.getElementById("col2_content")) > max)
                max = this.elemHeight(document.getElementById("col2_content"));
                
            if(document.getElementById("col3_content") && this.elemHeight(document.getElementById("col3_content")) > max)
                max = this.elemHeight(document.getElementById("col3_content"));
                
            if(max != 0){
                this.maxHeight = max;
                if(this.navBoxObj) this.navBoxObj.style.height = max+"px";
                if(this.contBoxObj) this.contBoxObj.style.height = max+"px";
                this.currentHeight=max;
            }
            
            if(this.navBoxObj) 
                this.navBoxFadeObj = new fx.Height("nav_box", {duration: this.duration});
            
            if(this.contBoxObj) 
                this.contBoxFadeObj = new fx.Height("content_box", {duration: this.duration});        
        } catch (e) {}
    };
    
    this.setHeight=function(newHeight){
        try{
        var newPageHeight = newHeight;
        if(newHeight<0 && (this.currentHeight+newHeight) >= this.minHeight){
            newPageHeight=(this.currentHeight+newHeight);    
        } else if((this.currentHeight+newHeight) >= this.minHeight){
            if (this.innerContentObj) {
                if(this.elemHeight(this.innerContentObj)+newHeight <= this.minHeight){
                    newPageHeight = this.minHeight;
                } else {
                    if(this.elemHeight(this.innerContentObj)+newHeight <= this.currentHeight){
                        newPageHeight = this.currentHeight;
                    } else {
                        if (this.elemHeight(this.innerContentObj) > this.minHeight) {
                            newPageHeight = this.elemHeight(this.innerContentObj);
                        } else {
                            newPageHeight = this.minHeight;
                        }
                    }
                }
            } else {
                newPageHeight = (this.currentHeight + newHeight);
            }
        } else {
            newPageHeight = this.minHeight;
        }
        
        if(this.navBoxObj) this.navBoxObj.style.height = newPageHeight+"px";
        if(this.contBoxObj) this.contBoxObj.style.height = newPageHeight+"px";        
        this.currentHeight = newPageHeight;
        } catch (e) {}
    };
    
    this.fadeHeight=function(newHeight){
        try{
        if (!this.navBoxFadeObj && !this.contBoxFadeObj) {
            this.setHeight(newHeight);
        } else {
            var newPageHeight = newHeight;
            if (newHeight < 0 && (this.currentHeight + newHeight) >= this.minHeight) {
                newPageHeight = (this.currentHeight+newHeight);
            } else if ((this.currentHeight+newHeight) >= this.minHeight) {
                if (this.innerContentObj) {
                    if(this.elemHeight(this.innerContentObj)+newHeight <= this.minHeight){
                        newPageHeight = this.minHeight;
                    } else {
                        newPageHeight = this.currentHeight+(newHeight-(this.currentHeight-this.elemHeight(this.innerContentObj)));
                    }
                } else {
                    newPageHeight = (this.currentHeight + newHeight);
                }
            } else {
                newPageHeight = this.minHeight;
            }
            
            if (this.navBoxFadeObj) this.navBoxFadeObj.custom(this.currentHeight, newPageHeight);
            if (this.contBoxFadeObj) this.contBoxFadeObj.custom(this.currentHeight, newPageHeight);
            this.currentHeight = newPageHeight;
        }
        } catch (e) {}
    };
    
    this.elemHeight=function(Obj){
        try{
            if (Obj.clip && e.clip.height)
                return Obj.clip.height;
            else if (Obj.offsetHeight)
                return Obj.offsetHeight;
            else if (Obj.style.pixelHeight)
                return Obj.style.pixelHeight;
            return -1;
        }catch(e){}
        return -1;
    };
    
    this.initObj();
    } catch(e){}
}
function openForward(src_,width_,height_) {
    try{
    var _width = (width_)?width_:478;
    var _height = (height_)?height_:310;
    windowObj = new Window(
    {
        resizable:false,
        closable:true,
        minimizable:false,
        maximizable:false,
        draggable:false,
        width:_width,
        height:_height,
        url: src_, 
        className: "forward" 
    });
    Windows.closeAllModalWindows();
    Windows.addModalWindow(windowObj);
    windowObj.setCloseCallback(function(){Windows.removeModalWindow();windowObj.destroy();});
    windowObj.setOpacity(0.9);
    windowObj.setZIndex(999);
    windowObj.showCenter();
    } catch(e){}
}
function closeForward(){
    try {
    if(window.top != this.window && window.top.Windows != null){
        try {window.top.windowObj.removeModalWindow();}catch(e){}
        try {window.top.windowObj.destroy();}catch(e){}
        window.top.Windows.closeAll();
        if(window.top.windowObj!=null)window.top.windowObj=null;
    } else if(Windows != null){
        try {Windows.removeModalWindow();}catch(e){}
        try {windowObj.destroy();}catch(e){}
        Windows.closeAll();
        if(windowObj!=null)windowObj=null;
    }
    } catch(e){}
}
function setForwardHeight(){
    try {
        if (window.top.windowObj != null && document.getElementById("mail-form")) {
                var curSize = window.top.windowObj.getSize();
                var newHeight = elemHeight(document.getElementById("mail-form"));
                newHeight += 32;
                if(navigator.appVersion.indexOf('MSIE')<0) newHeight += 15;
                window.top.windowObj.setSize(curSize["width"], newHeight);
                window.top.windowObj.showCenter();
                window.focus();
        }
    } catch(e){}
}
function createBookMarkLink(text,_bookmarkUrl,_bookmarkTitle){
    var TEXT = "Bookmark This Page";
    var URL = "http://"+document.domain;
    var TITLE = document.domain;
    var id = "bookmark_"+(new Date().getTime());
    if(text) TEXT = text;
    if(_bookmarkUrl) URL = _bookmarkUrl;
    if(_bookmarkTitle) TITLE = _bookmarkTitle;
    document.writeln('<a href="" id="'+id+'">'+TEXT+'</a>');
    var elem = document.getElementById(id);
    if (window.sidebar) {
        // Firefox
        elem.href="javascript:voids(0);";
        elem.title=TITLE;
        elem.onclick=function(){
            window.sidebar.addPanel(TITLE,URL,'');
            return false;
        }
    } else if(window.external){
        elem.onclick=function(){
            window.external.AddFavorite(URL, TITLE);
            return false;
        };
    } else if(window.opera && window.print){
        elem.rel = "sidebar";
        elem.href = URL;
        elem.title=TITLE;
        var curLocation = document.location.href;
        elem.onclick=function(){
            window.onclose=function(){
                document.location.href=curLocation;
            };
        }
    } else {
        elem.parentNode.removeChild(elem);
    }
}
var sExecCount=0;
function startBoxesEquelHeight(){
    try {
        if (document.getElementById("footer") && document.getElementById("col3_content") && document.getElementById("col3_content").getElementsByTagName("div")) {
        window.setTimeout(function(){
                var layes = document.getElementById("col3_content").getElementsByTagName("div");
                var startboxes = new Array();
                var max = 0;
                for (var i = 0; i < layes.length; i++) {
                    if (layes[i].className.indexOf("startpage_big_box") > -1) {
                        startboxes.push(layes[i]);
                    }
                }
                for (var i = 0; i < startboxes.length; i++) {
                    var h = elemHeight(startboxes[i]);
                    if (max < h) 
                        max = h;
                }
                for (var i = 0; i < startboxes.length; i++) {
                    startboxes[i].style.height = max + "px";
                }
            });
        } else if(sExecCount < 500){
            sExecCount++;
            window.setTimeout(function(){
                startBoxesEquelHeight();
            }, 50);
        }
    } catch(e) {
        if(!document.getElementById("footer") && sExecCount < 500){
            sExecCount++;
            window.setTimeout(function(){
                startBoxesEquelHeight();
            }, 50);
        }
    }
}

try {
    /* Iframe DHTML Layer*/
    if(window.top != this.window) addOnload(window.setTimeout(function(){setForwardHeight()}, 50));
    /* Normal Contentpage */
    /* sets text FX 4 FAQ*/
    addOnload(faqFX);
    /* set Tab Navigation */
    tabFX();
    /* equal height Startpage */
    startBoxesEquelHeight();
}catch(e){}