var Marquoo = new Class({

 //implements
 Implements: [Options, Events],

 //options
 options: {
 speed: 60,
 distance: 2
 },

 // global vars
 container: false,
 timer: 0,

 /**
 * initialize
 * -----------
 * Initialize all class vars, set threshold
 * values and add rollover events to container
 */
 initialize: function(container, options) {
 this.setOptions(options);
 this.container = container;

 // find widths of container and content element
 this.c_width = container.getSize().x;
 this.e_width = this.container.getFirst().getSize().x;

 // set threshold values to determine when to destroy or clone the scrolling element
 this.new_threshold = (this.e_width - this.c_width) - ((this.e_width - this.c_width) * 2);
 this.del_threshold = this.e_width - (this.e_width * 2);

 // add rollover event to our container
/* this.container.addEvents({
 'mouseenter' : function(){this.stopScroll();}.bind(this),
 'mouseleave' : function(){this.startScroll();}.bind(this)
 });*/
 // BANG and the dirty is gone!
 if(this.e_width > this.c_width){
 this.startScroll();
 }
 },

 /**
 * startScroll
 * -----------
 * Run the calculatePositions function
 * repetitively to handle the element animation
 */
 startScroll: function(){
 this.timer = this.calculatePositions.periodical(this.options.speed, this);
 },

 /**
 * stopScroll
 * ----------
 * Clear the timer to stop the animation
 */
 stopScroll: function(){
 clearInterval(this.timer);
 },

 /**
 * calculatePositions
 * ------------------
 * Handles all element animation, cloning and
 * destruction based on element positions and
 * threshold vars set in initialize function
 */
 calculatePositions: function(){
 var elems = this.container.getChildren();
 Array.each(elems, function(elem, index){
 // reposition our element
 var new_pos = parseInt(elem.getStyle('left'))-this.options.distance;
 elem.setStyle('left', new_pos);

 // add a clone to the end if needed
 if((new_pos < this.new_threshold) && elem.retrieve('cloned')==null){
 var clone = elem.clone();
 clone.setStyle('left', new_pos + this.e_width + 10);
 clone.inject(this.container, 'bottom');
 elem.store('cloned', 1);  // stop us getting loads of unwanted clones
 }

 // destroy the element if it's outside the container
 if(new_pos < this.del_threshold){
 elem.destroy();
 }
 }, this);
 }
});
