function Gallery() {
  this.id = '';
  this.o = {};
  this.items = [];
  this.active = {};
  this.active_description = '';
  this.description = {};
  this.body = false;
  this.ready = false;
  return this;
}
Gallery.prototype.init = function(id) {
  this.id = id;
  this.o = d.getElementById(id);
  if (!this.o) return;
  this.description = d.getElementById(id+'-description');
  this.body = d.getElementById(id+'-body');
  this.active_description = this.description.innerHTML;
  if (this.body) {
    this.active_body = this.body.innerHTML;
  }
  var cn = this.o.childNodes;
  for (var i=0;i<cn.length;i++) {
    var item = cn[i];
    if (item.nodeType !=1 ) continue;
    this.items.push(item);
  }
  this.ready = true;
}
Gallery.prototype.over = function(o) {
  if (!this.ready) return;
  if (o.className == 'image-active') {
    this.active = o;
    return;
  }
  o.className = 'image-active';
  img = o.getElementsByTagName('img')[0];
  // date hack
  var content = img.alt.split(', Datum:');
  this.description.innerHTML = content[0];
  if (this.body) {
    if (content.length > 1) this.body.innerHTML = content[1]
    else this.body.style.visibility = 'hidden';
  }
}
Gallery.prototype.out = function(o) {
  if (!this.ready || o == this.active) return;
  o.className = 'image';
  this.description.innerHTML = this.active_description;
  if (this.body) {
    this.body.style.visibility = 'visible';
    this.body.innerHTML = this.active_body;
  }
}
galerie = new Gallery()
