function Gallery() {
  var images, i, clone, anzahl, rel;
  /// Funktionen
  
  
  this.getPicRoot = function() {
    var list, i;
    list = document.getElementsByTagName("div");
    for(i=0; i<list.length; i++) {
      if (list[i].getAttribute("class")=="picRoot" && !list[i].obj) { return list[i]; }  
    }
    return false;
  }
  this.hideAll = function(){
    var i;
    for(i=0; i<this.images.length; i++) {
      this.images[i].style.display = "none";
    }
  }
  /// Initalisierung
  
  if(this.getPicRoot()) {
    this.root = this.getPicRoot();
    this.root.obj = this;
  
    this.detail = document.createElement("div");
    this.detail.setAttribute("class", "picDetail");
    this.root.appendChild(this.detail);
  
    this.preview = document.createElement("div");
    this.preview.setAttribute("class", "picPreview");
    this.root.appendChild(this.preview);
    
    images = this.root.getElementsByTagName("img");
    anzahl = images.length;
    this.images = new Array();
    for(i=0; i<anzahl; i++) {
      this.images.push(images[0]);
    
      clone = images[0].cloneNode(false);
      clone.link = images[0];
      clone.mainObj = this;
      clone.setAttribute("onclick", "this.mainObj.hideAll(); this.link.style.display = 'inline-block';")
    
      rel = parseFloat(clone.getAttribute("height"))/50;
      clone.setAttribute("width", parseInt(clone.getAttribute("width")/rel));
      clone.setAttribute("height", 50);
    
    
    
      if(i!=0) { images[0].style.display = "none"; }
    
      this.preview.appendChild(clone);
    
    
      this.detail.appendChild(images[0]);
    }
  } else {
    //Galerie konnte nicht erstellt werden!
    return false;
  }
  // Galerie erstellt...
  //return true;
  
}

function galeryOnLoad() {
  var i=0, ww=true;
  i=document.getElementsByTagName("div").length;
  while(i>=0&&ww){
    galerie = new Gallery();
    i--;
  }
}
//  */
  
  //alert("OK");
setTimeout("galeryOnLoad();", 10);
