/*
 * <mju><mnu>
 * author: mju@bauer-partner.de,mnu@bauer-partner.de
 * Copyright (c) 2001 Bauer & Partner AG. All Rights Reserved.
 */
var IE4 = false;
var W3C = false;
var NN4 = false;
var load = false;
var OPERA = false;

/*
 * constructor for dom objects
 * author: mju@bauer-partner.de
 */
function newObject(id, parentId){

  parentId = (parentId == null)  ? "" : parentId;

  if (W3C){ this.obj = document.getElementById(id); }
  else if (IE4){ this.obj = document.id; }
  else if (NN4){
    this.obj = (parentId == "") ? document.layers[id] : document.layers[parentId].document.layers[id];
  }

  this.css = (NN4) ? this.obj : this.obj.style;
  this.top = (NN4) ? this.css.top : this.css.pixelTop;
  this.name = id;
  this.isVisible = false;
  this.keepOpen = false;

  // method assigment
  this.show = f_Show;
  this.hide = f_Hide;
  this.setKeepOpen = f_setKeepOpen;
  this.setVisible = f_SetVisible;
  // Getter/Setter
  this.setLeft = f_setLeft;
  this.setTop = f_setTop;

}

function f_setTop(y){
  this.css.top = y;
}

function f_setLeft(x){
  this.css.left = x;
}

function f_setKeepOpen(bool){
  this.keepOpen = bool;
}

function f_SetVisible(bool){
  if (bool == true){
    if (NN4){ this.css.visibility = "show"; }
    else { this.css.visibility = "visible"; }
    this.isVisible = true;
  }
  else {
    if (NN4){ this.css.visibility = "hide"; }
    else { this.css.visibility = "hidden"; }
    this.isVisible = false;
  }
}

function f_Show(){

  if (!this.isVisible && load == true){
    this.setVisible(true);
  }
}

function f_Hide(){
    this.setVisible(false);
}

/**
 * This function determines and remembers the client browser.
 */
function setClient(){
  
  // IE 5.x, NN 6.x/Mozilla, Opera 5
  if (document.getElementById){
    W3C = true;
    /**/
    if ((navigator.userAgent.toLowerCase()).indexOf("opera") != -1) {
      OPERA = true;
	}
  }
  // IE 4
  else if (document.all){ IE4 = true; }
  // Netscape Navigator 4.xx
  else if (document.layers){ NN4 = true; }
}


/**
 * This function writes more external references into the document.
 * Of course, only those useful with JavaScript turned on.
 */
function includeFiles() {
  
  setClient();

  var theRefs = "";
  if (NN4) {
    theRefs += "<link rel='stylesheet' href='styles/nn_styles.css' type='text/css'>\n";
  }
  if (OPERA) {
    //theRefs += "<link rel='stylesheet' href='styles/opera.css' type='text/css'>";
    theRefs += "<script language='JavaScript' src='scripts/opera.js' type='text/javascript'><\/script>\n";
  }
  theRefs += 
    "<script language='JavaScript' src='scripts/menuTree.js' type='text/javascript'><\/script>\n" +
   

  
  document.writeln(theRefs);
 //alert(theRefs);
}


/**
 * This is the constructor of layer objects
 */


function Obj(id, parentId){
	
  parentId = (parentId == null)  ? "" : parentId;
  //alert("id: " +id);

  if (W3C || OPERA){ this.obj = document.getElementById(id); }
  else if (IE4){ this.obj = document.id; }
  else if (NN4){
    //alert("isNN"); 
    this.obj = (parentId == "") ? document.layers[id] : document.layers[parentId].document.layers[id];
  }
  this.name = id;
}


// only Netscape 4.x: fix resize-bug 
function resizeFix() {
  //alert("function");
  if (widthCheck != window.innerWidth || heightCheck != window.innerHeight) {
	window.history.go(0);
	
  }
}

// only Opera: fix resize-bug  
function operadetectresize() {
  if(window.innerHeight != available_height || window.innerWidth !=
available_width) {
    location.reload();
  }
}

function onloading()    {

if(OPERA)       {
available_width=innerWidth; 
available_height=innerHeight;
setInterval('operadetectresize()', 500);
} 
}


/*
 * constructor for images - need own one for browser incompatibilities
 * author: mnu@bauer-partner.de
 */
function Img(imgName,parentId){
  parentId = (parentId == null)  ? "" : parentId;

  if (W3C){
    this.obj = document.images[imgName];
  }
  else if (IE4){
   this.obj = document.images[imgName];
  }
  else if (NN4){
  this.obj = (parentId == "") ? document.images[imgName]:document.layers[parentId].document.images[imgName];
    this.keepOpen=false;
  }

  // method assigment
  this.setSource = f_setSource;
  this.setSourcel = f_setSourcel;
  this.setKeepOpen= f_setKeepOpen;
  }



  function f_setSource(source,nr){
// wenn keine bildnummer nr angegeben, dann einfach tauschen, sonst überprüfen ob Nummer getauscht werden muß!!!!

  if(nr==null){
  if (load==true && this.keepOpen == true) this.obj.src=source;
}

  else{ //überprüft ob Nummer getauscht werden muß!!! Anwendung: welche Bilder der dynamisch erzeugten Listen müssen getauscht werden, damit es mit der Anzahl der Einträe übereinstimmt

    for (i=0; i<colNumber; i++){
      if (nr > i*4 && nr < i*4+5){
        for(j=1; j<5; j++){
          if(nr==i*4+j &&  pictNumber[i]>4-j){
            if (load==true && this.keepOpen == true) this.obj.src=source;
          }
        }
      }
    }
  }
}


function f_setSourcel(source){
    if (load==true) this.obj.src=source;
}
