function sliderTeaser(id, width) {
  this.aktTeaserNum = 0;
  this.width = width;
  this.arrTeaser = $(id).getElements('.bild');
  this.arrTweens = new Array();
  this.arrTeaser.each(function(el,i){
    this.arrTweens[i] = new Fx.Tween(this.arrTeaser[i],{duration:800,wait:true,transition:Fx.Transitions.Cubic.easeOut});
    if (i!=0) {
      this.arrTeaser[i].setStyle('left',width+'px');
    }
  },this); 
  this.slide = function(direction) {
    if (this.arrTeaser[this.aktTeaserNum].getStyle('left').toInt()==0) {
      if (direction=='right') {
        this.nextTeaserNum = (this.aktTeaserNum<this.arrTweens.length-1) ? this.aktTeaserNum+1:0; 
        this.arrTweens[this.aktTeaserNum].start('left','0','-'+this.width);
        this.arrTweens[this.nextTeaserNum].start('left',this.width,'0');
      } else {
        this.nextTeaserNum = (this.aktTeaserNum>0) ? this.aktTeaserNum-1:this.arrTweens.length-1;
        this.arrTweens[this.aktTeaserNum].start('left','0',this.width);
        this.arrTweens[this.nextTeaserNum].start('left','-'+this.width,'0');
      }
      this.aktTeaserNum = this.nextTeaserNum;
    }
  }  
}
function marken(id) {
  this.speed = 15;
  this.id = id;
  this.paneMarken = $(id);
  this.width = $(id).getStyle('width').toInt(); 
  this.arrLogos = $$('#' + id + ' img');
  this.logoWidth = this.arrLogos[0].getStyle('width').toInt();
  this.logoMarginRight = this.arrLogos[0].getStyle('margin-right').toInt();
  this.logosAnzahl = this.arrLogos.length;
  this.marquee = $$('#' + id + ' .marquee')[0];
  this.marqueeWidth = this.logosAnzahl * (this.logoWidth + this.logoMarginRight); 
  this.marquee.setStyle('width', this.marqueeWidth);
  
  this.moveLogos = function(direction) {
    this.posLeftMarquee = this.marquee.getStyle('left').toInt();
    if (direction=="left") {
      if (this.posLeftMarquee<24-this.speed) {
        this.marquee.setStyle('left',this.posLeftMarquee + this.speed); 
        $$('#' + this.id + ' .navRechts').setStyle('display','block');
      } else {
        this.marquee.setStyle('left',24); 
        $$('#' + this.id + ' .navLinks').setStyle('display','none');
      }
    }
    if (direction=="right") {
      if (this.posLeftMarquee>this.width+this.speed-this.marqueeWidth) {
        this.marquee.setStyle('left',this.posLeftMarquee - this.speed); 
        $$('#' + this.id + ' .navLinks').setStyle('display','block');          
      } else {
        this.marquee.setStyle('left',(this.width)-this.marqueeWidth); 
        $$('#' + this.id + ' .navRechts').setStyle('display','none');
      }
    }
  }
}
function startMarquee(id,direction) {   
  driveMarquee = setInterval(id+'.moveLogos("'+direction+'")',50);
}
function stopMarquee() {    
  clearInterval(driveMarquee);
}
function openInfo(id) {
  if (id!=aktInfo) {
    $(id).addClass('aktiv');
    $(aktInfo).removeClass('aktiv');
    aktInfo = id;
  }
}
function showFull(id) {
  obj=$(id);
  $('katalogLayer').empty();
  var myNewElement = new Element('div.katalog');
  myNewElement.set('html',obj.innerHTML);
  myNewElement.inject($('katalogLayer'));
  $('katalogLayer').setPosition(obj.getPosition());
  $('katalogLayer').setStyle('left', $('katalogLayer').getStyle('left').toInt()-2);
  $('katalogLayer').setStyle('top',$('katalogLayer').getStyle('top').toInt()-2);
  $('katalogLayer').setStyle('display','block');
}
function openFull() {
  if (popupTimerHandle != null) {
    clearTimeout(popupTimerHandle);
    popupTimerHandle = null;
  }
}
function hideFull(obj) {
  $('katalogLayer').setStyle('display','none');
}
function closeFull() {
  popupTimerHandle = setTimeout("hideFull();", 1);
}
function showAllKataloge() {
  $('boxKataloge').setStyle('height','auto');
  $$('div.linkAll').setStyle('display','none');
}
