function $gebID (id) {
    if (!id) return null;
    var o = document.getElementById(id);
    if (o) {
        if (typeof o.extend != 'function') { 
            o.extend = function (n) {
                for (var e in n) {
                    this[e] = n[e];
                }
            }
        }
        return o;
    }
    return null;
}
function initScroller () {
    
	var animations = {};
	animations.a = false;
	animations.fw = function () {
		
		var th = this,
			f = this.getElementsByTagName('img')[0];
			
		function animate () {
			animations.a = true;
			th.insertBefore(f.cloneNode(true), null);
			new Animation({obj:th, type:'move', startLeft:0, targetLeft:-235, transition: TRANSITION.Quart.easeOut, duration:600, callback:finished}).start();
		}
		
		function finished () {
			th.removeChild(f);
			th.style.left='0px';
			animations.a = false;
		}

		if (!animations.a) animate();
	}
	
	animations.rw = function () {
		
		var th = this,
			f = this.getElementsByTagName('img')[this.getElementsByTagName('img').length-1];
		
		function animate () {
			animations.a = true;
			th.style.left = '-235px';
			th.insertBefore(f.cloneNode(true), th.getElementsByTagName('img')[0]);
			new Animation({obj:th, type:'move', startLeft:-235, targetLeft:0, transition: TRANSITION.Quart.easeOut, duration:600, callback:finished}).start();
		}
		
		function finished () {
			th.removeChild(f);
			animations.a = false;
		}
		
		if (!animations.a) animate();
	}
	
	$gebID('viewport').extend(animations);
	
}
