var Slideanimation = function (cnt)
{
  this.currentscroll = 0;
  this.scroll = null;
  this.scrollmax = 0;
  this.cardata = new Array();
  this.doSlide = false;
  this.items = new Array();
  this.cntid = cnt;

	this.doSlideThread = function()
	{
		if(this.doSlide)
  		{
      			this.moveAll();
			this.currentscroll += 1;
  			if(this.currentscroll > this.scrollmax-150)
	  		{
		  		this.currentscroll = 600;
  			}
	  	}
  		this.doSlideThread.delay(20);
  	}.bind(this);

  this.start_slide = function() { this.doSlide= true; this.doSlideThread(); }.bind(this);
  this.stop_slide = function() { this.doSlide = false; }.bind(this);
  
  this.moveAll = function()
  {
  	this.items.each(
		function(item,index)
		{
			var old_y = parseInt(item.style.top);
			/*
			var ref_y = old_y - 15;
			if(ref_y < 200 && ref_y > 0)
			{
				if(ref_y > 100) // size up
				{
					var newwidth = 270-ref_y;
					if(newwidth > 100) newwidth = 100;
					var newheight = newwidth/100*60
					item.setStyles({height: newheight, zIndex: newwidth });
				}
				else // size down
				{
					var newwidth = 70+ref_y;
					if(newwidth > 100) newwidth = 100;
					var newheight = newwidth/100*60

					item.setStyles({height: newheight, zIndex: newwidth});
				}
			}*/
			if(old_y-1 < -100) old_y+= this.items.length*110;
			item.setStyle('top',old_y-1);
	      	}.bind(this)
    );
  }.bind(this);

  this.init = function()
  {
  	if(!document.getElementById(this.cntid)) return;
  	this.items.each(
	      function(item,index)
	      {
		var pos = index*110+300;
		item.setStyles({position:'absolute', left: 5, top: pos});
		//var imgname = item.getAttribute('longdesc').toLowerCase();
		//var hname = "fileadmin/templates/sponsoren/farbig/"+imgname+"_farbig.gif";
		//eval('item.addEvent(\'mouseover\', function () {this.src = \''+hname+'\';}.bind(item))');
		//eval('item.addEvent(\'mouseout\', function () {this.src = \''+item.src+'\';}.bind(item))');
	      }
    	);
    
	this.start_slide.delay(100);

	$(this.cntid).addEvent('mouseover', function ()
		{
			this.doSlide = false;
		}.bind(this)
	);

	$(this.cntid).addEvent('mouseout', function ()
		{
			this.doSlide = true;
		}.bind(this)
	);
      
  }
}