var ns = document.layers ? true : false;
var ie = document.all ? true : false;

function createObjects()
{
  DHTMLLib.prototype.show          = methodShow;
  DHTMLLib.prototype.hide          = methodHide;
  DHTMLLib.prototype.write         = methodWrite;
  DHTMLLib.prototype.load          = methodLoad;
  DHTMLLib.prototype.clip          = methodClip;
  DHTMLLib.prototype.setBgColor    = methodsetBgColor;
  DHTMLLib.prototype.setBackground = methodsetBackground;
  DHTMLLib.prototype.setZIndex     = methodsetZIndex;
  DHTMLLib.prototype.setLeft       = methodsetLeft;
  DHTMLLib.prototype.setTop        = methodsetTop;
  DHTMLLib.prototype.setWidth      = methodsetWidth;
  DHTMLLib.prototype.setHeight     = methodsetHeight;
  DHTMLLib.prototype.moveBy        = methodmoveBy;
  DHTMLLib.prototype.moveTo        = methodmoveTo;
  DHTMLLib.prototype.resizeBy      = methodresizeBy;
  DHTMLLib.prototype.resizeTo      = methodresizeTo;

  DHTMLLib.prototype.getLeft       = methodgetLeft;
  DHTMLLib.prototype.getTop        = methodgetTop;
  DHTMLLib.prototype.getWidth      = methodgetWidth;
  DHTMLLib.prototype.getHeight     = methodgetHeight;
  DHTMLLib.prototype.getVisibility = methodgetVisibility;

  var obj = 'window';
  var aktobj = '';
  var ebene = 0;
  zaehler = new Array();
  for (var i=0; i < 100; i++)
    zaehler[i] = 0;

  if (ns) {

    while (zaehler[0] < document.layers.length || ebene) {

      aktobj = obj + '.document.layers['+zaehler[ebene]+']';

      window[eval(aktobj + '.name')] = new DHTMLLib(eval(aktobj));

      for (var i=0; i < eval(aktobj+'.document.images.length'); i++)

        document.images[eval(aktobj+'.document.images['+i+'].name')] = eval(aktobj+'.document.images['+i+']');

      zaehler[ebene]++;

      if (eval(aktobj + '.document.layers.length') > zaehler[ebene+1]) {

        obj = aktobj;
        ebene++;

      }

      else {

        while (ebene > 0 && eval(aktobj.substring(0, aktobj.lastIndexOf('.document')) + '.document.layers.length') <= zaehler[ebene]) {
          zaehler[ebene+1] = 0;
          ebene--;
          aktobj = aktobj.substring(0, aktobj.lastIndexOf('.document'));
        }
        obj = aktobj.substring(0, aktobj.lastIndexOf('.document'));
        zaehler[ebene+1] = 0;
      }

    }

  }
  else if (ie) {
    for (var i=0; i < document.all.length; i++) {
      if (document.all[i].id)
        window[document.all[i].id] = new DHTMLLib(document.all[i].id);
    }
  }

}
function DHTMLLib(LayerName)
{
  this.style = ns ? LayerName : document.all[LayerName].style;
  this.layer = ns ? LayerName : document.all[LayerName];

  this.left = ns ? this.layer.pageX : (!this.style.left ? this.layer.offsetLeft : parseInt(this.style.left));
  this.top = ns ? this.layer.pageY : (!this.style.top ? this.layer.offsetTop : parseInt(this.style.top));
  this.width = ns ? this.layer.document.width : (!this.style.width ? this.layer.offsetWidth : parseInt(this.style.width));
  this.height = ns ? this.layer.document.height : (!this.style.height ? this.layer.offsetHeight : parseInt(this.style.height));
}

function methodShow()
{
  this.style.visibility = "visible";
}
function methodHide()
{
  this.style.visibility = "hidden";
}
function methodWrite(HTML_Code)
{
  if (ie)
    this.layer.innerHTML = HTML_Code;
  else if (ns) {
    with (this.layer.document) {
      open();
      write(HTML_Code);
      close();
    }
  }
}
function methodLoad(Dateiname)
{
  if (ie)
    this.write('<iframe name="IFrame'+this.layer.id+'" src="'+Dateiname+'" width='+this.getWidth()+' height='+this.getHeight()+'></iframe>');
  else
    this.layer.load(Dateiname,this.getWidth());
}
function methodClip(links,oben,rechts,unten)
{
  if (ie)
    this.style.clip = 'rect(' + oben + ' ' + rechts + ' ' + unten + ' ' + links + ')';
  else if (ns) {
    with (this.style.clip) {
      left = links;
      top = oben;
      right = rechts;
      bottom = unten;
    }
  }
}
function methodsetBgColor(Farbe)
{
  if (ns)
    this.style.bgColor = Farbe;
  else if (ie)
    this.style.backgroundColor = Farbe;
}
function methodsetBackground(ImageURL)
{
  if (ns)
    this.style.background.src = ImageURL;
  else if (ie)
    this.style.backgroundImage = 'url('+ImageURL+')';
}
function methodsetZIndex(schicht)
{
  this.style.zIndex = schicht;
}
function methodsetLeft(Wert)
{
  this.style.left = Wert;
  this.left = Wert;
}
function methodsetTop(Wert)
{
  this.style.top = Wert;
  this.top = Wert;
}
function methodsetWidth(Wert)
{
  if (ns) this.clip(0,0,this.getWidth(),this.getHeight());
  else if (ie) this.clip('auto','auto','auto','auto');
  if (ie)
    this.style.width = Wert;
  else if (ns)
    this.style.resizeTo(Wert,this.height);
  this.width = Wert;
}
function methodsetHeight(Wert)
{
  if (ns) this.clip(0,0,this.getWidth(),this.getHeight());
  else if (ie) this.clip('auto','auto','auto','auto');
  if (ie)
    this.style.height = Wert;
  else if (ns)
    this.style.resizeTo(this.width,Wert);
  this.height = Wert;
}
function methodmoveBy(xWert,yWert)
{
  this.style.left = this.getLeft() + xWert;
  this.style.top = this.getTop() + yWert;
  this.left = this.style.left;
  this.top = this.style.top;
}
function methodmoveTo(xWert,yWert)
{
  this.style.left = xWert;
  this.style.top = yWert;
  this.left = xWert;
  this.top = yWert;
}
function methodresizeBy(xWert,yWert)
{
  if (ns) this.clip(0,0,this.getWidth(),this.getHeight());
  else if (ie) this.clip('auto','auto','auto','auto');
  if (ie) {
    this.style.width = xWert + this.width;
    this.style.height = yWert + this.height;
  }
  else if (ns)
    this.style.resizeTo(xWert+this.width,yWert+this.height);
  this.width = xWert + this.width;
  this.height = yWert + this.height;
}
function methodresizeTo(xWert,yWert)
{
  if (ns) this.clip(0,0,this.getWidth(),this.getHeight());
  else if (ie) this.clip('auto','auto','auto','auto');
  if (ie) {
    this.style.width = xWert;
    this.style.height = yWert;
  }
  else if (ns)
    this.style.resizeTo(xWert,yWert);
  this.width = xWert;
  this.height = yWert;
}

function methodgetLeft()
{
  return (this.left);
}
function methodgetTop()
{
  return (this.top);
}
function methodgetWidth()
{
  return (this.width);
}
function methodgetHeight()
{
  return (this.height);
}
function methodgetVisibility()
{
  return (this.style.visibility);
}
