var botSlider = Class.create();
botSlider.prototype = {
	initialize : function( elm ) {
		this.timeout = null;
		this.elem = elm;
		this.direction = 1;
		this.startHeight = 50; // this.elem.style.height.replace('px', '');
		// alert(this.elem.style.height);
		this.position = 0;
		this.max = 136;
		this.speed = 1;
		this.startmt = this.elem.style.marginTop.replace('px', '');

		Event.observe(elm,'mouseover',this.activate.bindAsEventListener(this),true);
		Event.observe(elm,'mouseout',this.deactivate.bindAsEventListener(this),true);
	},
	slide : function()
	{
		this.position += ((this.speed * (this.max + 1 - this.position) / 8) * this.direction);
		if(this.position >= this.max || this.position <= 0)
		{
			if(this.timeout != null)
			{
				this.timeout.stop();
				this.timeout = null;
			}
		}
		
		this.position = Math.min(Math.max(0, this.position), this.max);
		this.elem.style.marginTop = (this.startmt - this.position)+'px';
		this.elem.style.height = (this.startHeight + this.position)+'px';
	},
	activate : function( ev ) {
		this.direction = 1;
		if(this.position < this.max && this.timeout == null)
		{
			this.timeout = new PeriodicalExecuter( this.slide.bind(this), 0.01);
		}
	},
	deactivate : function( ev ) {
		this.direction = -1;
		if(this.position > 0 && this.timeout == null)
		{
			this.timeout = new PeriodicalExecuter( this.slide.bind(this), 0.01);			
		}
	}
}

var botSliders = Class.create();
botSliders.prototype = {
	initialize : function(element) {
		this.element = $(element);
		if(this.element)
		{
			this.sliders = {};
			this.menu = $A(this.element.getElementsByClassName('nitem'));
			if(this.menu.length > 0)
			{
				for(i=0; i<this.menu.length; i++)
				{
					this.sliders['slider'+i] = new botSlider( this.menu[i] );
				}
			}	
		}
	}
}

function loadSliders()
{		
	var botSls = new botSliders('news-items');
}

Event.observe(window,'load', loadSliders,false);