
// JavaScript Document

SCROLL = function(obj, attr) {
var interval;
var offset = {
'top': obj.offsetTop || 0,
'height': obj.offsetHeight || 0
};

this.start = function(amount) {
/* Default setzen */
attr.top = attr.top || 0;
attr.width = attr.width || "auto";
attr.height = attr.height || "auto";

/* Intervall starten */
interval = setInterval(
function() {
move(amount);
},
attr.time
);
};



this.stop = function() {
if (interval) {
clearInterval(interval);
}
}

function move(amount) {
/* Werte refreshen */
attr.top += amount;
attr.height += amount;
offset.top -= amount;

/* Grenze überschritten? */
if (attr.top < 0 || attr.height > offset.height) {
attr.top -= amount;
attr.height -= amount;
offset.top += amount;
return;
}

/* Object bewegen */
obj.style.clip = "rect(" + attr.top + "px " + attr.width + "px " + attr.height + "px 0)";
obj.style.top = offset.top + "px";
}
}
