function scroller(object_name) {
var interval = null;

function configuration() {
this.parent_node = null;
this.content = new Object();
this.content.html = null;
this.content.width = null;
this.scroller = new Object();
this.scroller.id = 'scroller';
this.scroller.height = '160px';
this.scroller.width = '700px';
}

this.options = new configuration();

this.init = function() {
if(this.options.parent_node) {
this.options.parent_node.innerHTML = '<div id="' + this.options.scroller.id + '" style="position: relative; top: 0px; left: 0px; overflow: hidden; height: ' + this.options.scroller.height + '; width: ' + this.options.scroller.width + '; margin: auto;"><div style="border: none; margin: 0px; padding: 0px; position: relative; top: 0px; left: 0px;"></div></div>';
var scroller = document.getElementById(this.options.scroller.id);
}

if(this.options.content.html && this.options.content.width) {
scroller.childNodes[0].innerHTML = this.options.content.html;
} else {
scroller.childNodes[0].innerHTML = 'Content Definition Error';
}
}

this.right = function(pixels, timeout) {
var scroller = document.getElementById(this.options.scroller.id);

if(timeout && pixels) {
interval = window.setInterval(object_name + '.right(' + pixels + ');', timeout);
} else if(pixels) {
if(Math.abs(parseInt(scroller.childNodes[0].style.left)) < parseInt(this.options.content.width) - parseInt(this.options.scroller.width)) {
if(Math.abs(parseInt(scroller.childNodes[0].style.left) - pixels) > parseInt(this.options.content.width) - parseInt(this.options.scroller.width)) {
scroller.childNodes[0].style.left = '-' + (parseInt(this.options.content.width) - parseInt(this.options.scroller.width)) + 'px';
} else {
scroller.childNodes[0].style.left = (parseInt(scroller.childNodes[0].style.left) - pixels) + 'px';
}
} else {
this.right(null);
}
} else {
if(interval) {
window.clearInterval(interval);
interval = null;
}
}
}

this.left = function(pixels, timeout) {
var scroller = document.getElementById(this.options.scroller.id);

if(timeout && pixels) {
interval = window.setInterval(object_name + '.left(' + pixels + ');', timeout);
} else if(pixels) {
if(parseInt(scroller.childNodes[0].style.left) < 0) {
if(parseInt(scroller.childNodes[0].style.left) + pixels >= 0) {
scroller.childNodes[0].style.left = '0px';
} else {
scroller.childNodes[0].style.left = (parseInt(scroller.childNodes[0].style.left) + pixels) + 'px';
}
} else {
this.right(null);
}
} else {
if(interval) {
window.clearInterval(interval);
interval = null;
}
}
}
}
