var whichopen = 0;
var whichgr = 0;
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var NN = navigator.appName == 'Netscape';

if (NN) {
    window.onresize = resizeHandler;
    wx = window.innerWidth;
    wy = window.innerHeight;
}

function resizeHandler() {
    if (window.innerHeight!=wy || window.innerWidth!=wx){
        /* muss man leider, weil sich Netscape sonst manchmal in einer
        * Endlosschleife verfaengt
        */
        top.document.location = top.document.location;
    }
}

function setmenu(img) {
    if (parent == self) {
        if (!(document.layers && self.innerHeight == 0 && self.innerWidth == 0)) { // the second conditions allows correct printing on Netscape 4
            if (document.images) {
                top.location.replace("/index.html?" + location.href);
            } else {
                top.location.href = "/index.html?" + location.href;
            }
        }
        return true;
    }
    loaded = true;
    parent.setmenu(img);
}

function setleftframe(name) {
    if (parent != self) {
        parent.setleftframe(name);
    }
}

function detailszeig(ident) {
    if (document.getElementById && document.getElementById(ident) != null) {
        document.getElementById(ident).style.visibility='visible';
        document.getElementById(ident).style.display='block';
    } else if (document.layers && document.layers[ident] != null) {
        document.layers[ident].visibility = 'visible';
    } else if (document.all) {
        document.all[ident].style.zIndex = 100;
        document.all[ident].style.visibility = 'visible';
    }
}

function detailsweg(ident) {
    if (whichopen != ident) {
        if (document.getElementById && document.getElementById(ident) != null) {
            document.getElementById(ident).style.visibility='hidden';
            document.getElementById(ident).style.display='none';
        } else if (document.layers && document.layers[ident] != null) {
            document.layers[ident].visibility = 'hidden';
        } else if (document.all) {
            document.all[ident].style.visibility = 'hidden';
        }
    }
}

function setdata(ident,gr) {
    var whichopen_temp = whichopen;
    var whichgr_temp = whichgr;
    if (whichopen == ident) {
        whichopen = 0;whichgr = 0;
    } else {
        whichopen = ident;whichgr = gr;
    }
    if (whichopen_temp) {
        detailsweg(whichopen_temp);gr_off(whichgr_temp);
    }
    if (whichopen) {
        detailszeig(ident);gr_on(gr);
    }
}

function gr_on(name) {
    if (typeof(parent.leftmiddle.loaded) != "undefined") {
        var grundrissObj = InternetExplorer ?  parent.leftmiddle.grundriss : parent.leftmiddle.document.grundriss;
        grundrissObj.TGotoLabel('/' + name,'on')
    }
}

function gr_off(name) {
    if (typeof(parent.leftmiddle.loaded) != "undefined") {
        var grundrissObj = InternetExplorer ? parent.leftmiddle.grundriss : parent.leftmiddle.document.grundriss;
        if (whichgr != name) {grundrissObj.TGotoLabel('/' + name,'off');}
    }
}

function popup(file,end,wide,high) {
    data = 'width=' + wide + ',height=' + high + ',resizable=yes,scrollbars=no';
    url = file + '.' + end;
    page = window.open(url,file,data);
    if (navigator.appName.indexOf('Netscape') != -1) {
        if (window.focus) page.focus();
    }
}