//== BROWSERCHEK =============================================================
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
      && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
      && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav6up = (is_nav && (is_major >= 5));
var is_kingkong = (agt.indexOf("konqueror") != -1);

var dt = 15;  // Zeitverzögerung f. Roll...
var lw = 60; // Layer-Breite
var ld = 10;  // Layer-Abstand
var o;              // Offset für Position, = (Fenster - Inhalt)/2
var menus;      // Zähler für Menues
var allT;           // timeout alle

//== CREATE OBJ AND METHODS ==================================================
// © by Robert Rohm, D33 InterNet Services GmbH, D-90439 Nuernberg
// Feel free to use this script as long as you include this copyright notice.

function createDivObj(obj){
    if (is_nav6up || is_kingkong){
        this.css = document.getElementById(obj).style;
        this.css.height = this.css.height;
        this.css.width  = this.css.width;
    }
    else {
        this.css = eval('document.all.'+obj+'.style');
        this.css.height =  eval('document.all.'+obj+'.offsetHeight;');
        this.css.width  =  eval('document.all.'+obj+'.offsetWidth;');
    }

    this.rollOut=rollOutObj;
    this.rollIn=rollInObj;
    this.roll=rollObj;
    this.rolls=0;
    this.movUp=movUpObj;
    this.mov=movObj;
    this.tickt=0;
    this.steps=0;
    this.schalt=schaltObj;
    this.ein=einObj;
    this.aus=ausObj;
    this.obj=obj+"Object"; eval(this.obj+"=this");
}

function rollOutObj(){
    this.rolls = 1;
    //alert('this rolls h=!'+h);
    t = parseInt(this.css.top);
    h = parseInt(this.css.height)-1;
    if (this.steps < 9){
        this.css.top = t - Math.round(h/10);
        this.steps++;
        clearTimeout(this.tickt);
        this.tickt = setTimeout(this.obj+".rollOut()", dt);
    } else if (this.steps == 9) this.css.top = 129 - h;
}

function rollInObj(){
    this.rolls = 0;
    t = parseInt(this.css.top);
    h = parseInt(this.css.height)-1;
    if (this.steps > 0){
        this.css.top = t + Math.round(h/10);
        this.steps--;
        clearTimeout(this.tickt);
        this.tickt = setTimeout(this.obj+".rollIn()", dt);
    } else if (this.steps == 0) this.css.top = 129;
}

function rollObj(){
    if (this.rolls == 0) this.rollOut()
    else this.rollIn();
}

function movUpObj(x){  // unfertig
    s = parseInt(this.css.top);
}

function movObj(x,y){//OK
    this.css.top = x;
    this.css.left = y;
}

function schaltObj(){// OK
    if (this.css.visibility =="visible"){
      this.css.visibility ="hidden";
      }else{
      this.css.visibility ="visible";
      }
    }

function einObj(){ //OK
        this.css.visibility ="visible";
}

function ausObj(){ //OK
        this.css.visibility ="hidden";
}
//== INIT OBJ ================================================================
// must be invoked after doc is loaded completely
function initDivObj(n){
    oDiv = new Array();
  for(i=0; i<=n; i++){
    oDiv[i]=new createDivObj('Layer'+i);
    oDiv[i].ein();
    }
    menus = n;
    setPos(n);
}

//== PUBLICS  ========================================================
function EinAus(a){oDiv[a].schalt()};
//function Ein(a){oDiv[a].ein()};  // alte Fassung, jetziges Ein(a) ist eigentl. Ein1(a);
function Ein(a){clearTimeout(oDiv[a].tickt); oDiv[a].ein()};
function Aus(a){oDiv[a].aus()};
function Aus2(a){s = 'Aus('+a+');';oDiv[a].tickt = window.setTimeout(s,500);};

// rr-menu f's
function testmov(a){
    if (oDiv[a]){
        clearTimeout(allT);
        oDiv[a].rollOut();
        allIn(a);
    }
};

function allIn(a){
    for(i=1; i<= menus; i++){
        if ((i != a) && (oDiv[i].rolls == 1)) oDiv[i].rollIn();
    }
}

function clrAll(){
    allT = setTimeout("allIn(0)", 500);
}

// Offset für Menü-Verteilung
//  ... muß je nach Browser individuell angegeben werden!
// Status: OK
function setOffset(){
        if (parseInt(oDiv[0].css.width) > 750){
            return (10 + (parseInt(oDiv[0].css.width) -750)/2)
        } else {
            return 10;
        }//*/

}

// Menü-Verteilung
// Status: OK
function setPos(n){
    o = setOffset();
    for (i=1; i<=n; i++){
        //oDiv[i].css.left = o + (i-1) * parseInt(630/menus);
        oDiv[i].css.left = o + parseInt(oDiv[i].css.left);
    }
}
//===========================================================================