'remmah.widget'.namespace();

remmah.widget.Scroller = function(element, leftScroller, rightScroller, scrollAmount)
{
	this.element = (typeof element == 'string') ? document.getElementById(element) : element;
	this.leftScroller = (typeof element == 'string') ? document.getElementById(leftScroller) : element;
	this.rightScroller = (typeof element == 'string') ? document.getElementById(rightScroller) : element;
	this.left = 0;
	this.scrollAmount = scrollAmount;
	if (this.element)
	{
    if (this.leftScroller)
    {
      this.leftScroller.onclick = this.scrollLeft_onClick.bind(this);
    }
    if (this.rightScroller)
    {
      this.rightScroller.onclick = this.scrollRight_onClick.bind(this);
    }
	}
	return this;
}
remmah.widget.Scroller.testedIn = [
	'Firefox v.3.6.18'
];
var proto = remmah.widget.Scroller.prototype;
proto.toString = function()
{
	return 'remmah.widget.Scroller';
};
proto.scrollLeft_onClick = function(e)
{
  this.left += this.scrollAmount;
  this.scroll()
};
proto.scrollRight_onClick = function(e)
{
  this.left -= this.scrollAmount;
  this.scroll()
};
proto.scroll = function()
{
  var morph = new remmah.Morph('scroller');
  var morphObject;
      
  morphObject = new remmah.Morph.Object(this.element, 'left:'+this.left+';', 600, remmah.EffectTransitions.linear)
    morphObject.onEnd = function(){
    morph.remove(this);
  }
      
  morph.add(morphObject);
  morph.start();
};
