// JavaScript Document
function RollAlpha(class_max, class_min, escalier)
{
	this.class_max		= $$('.'+class_max);
	this.class_min	= $$('.'+class_min);
	this.actif = null;
	this.escalier = escalier;
	
	this.over = function() 
	{
		this.class_max.each(function(el)
		{
			if (!this.escalier)
			{
				if (el.rang != this.actif.rang)
				{
					el.morph({'opacity':'0.3'});
				}
			}
			else
			{
				if (el.rang != this.actif.rang)
				{
					if (Math.abs(this.actif.rang - el.rang) == 1)
					{
						el.morph({'opacity':'0.6'});
						
					}
					else if (Math.abs(this.actif.rang - el.rang) == 2)
					{
						el.morph({'opacity':'0.4'});
						
					}
					else 
					{
						el.morph({'opacity':'0.2'});
					}		
				}
				else
				{
					el.morph({'opacity':'1'});
				}
			}
		}, this);
		this.class_min.each(function(el)
		{
			if (el.rang != this.actif.rang)
			{
				el.morph({'opacity':'0.3'});
			}
		}, this);
	}
	
	this.out = function()
	{
		this.class_max.each(function(el)
		{
			el.morph({'opacity':'1'});
		});
		this.class_min.each(function(el)
		{
			el.morph({'opacity':'1'});
		});
	}
	
	
	this.active = function(indice)
	{
		this.class_max.each(function(el)
		{
			if (el.rang == indice)
			{
				this.actif = el;
				this.over();
			}
				
		}, this);
	}
	
	i = 0;
	this.class_max.each(function(el)
	{
		el.rang = i;
		i++;
		el.roll = this;
		el.addEvents(
		{
			mouseenter: function()
			{
				this.roll.actif = this;
				this.roll.over();
			},
			mouseleave: function()
			{
				this.roll.actif = null;
				this.roll.out();
			}
		});
	}, this);
	i = 0;
	this.class_min.each(function(el)
	{
		el.rang = i;
		i++;
		el.roll = this;
		el.addEvents(
		{
			mouseenter: function()
			{
				this.roll.actif = this;
				this.roll.over();
			},
			mouseleave: function()
			{
				this.roll.actif = null;
				this.roll.out();
			}
		});
	}, this);
	
	
}
