function createScrolling(name) {
	this.name = name;
    this.rollerHeight = 0;
    this.sumItemHeight = 0;
    this.itemList = new Array();
    this.fadeoutRef = new Array();
    this.fadeinRef = new Array();
    this.moveRef = new Array();
    this.uid = 0;
    this.timer = 5000; // microsecond, 1000 = 1 second

	this.compileItems =
    function(id){
        var parent = document.getElementById(id);
        this.rollerHeight = parent.offsetHeight;

        for(var i=0; i<parent.childNodes.length; i++){
            if(parent.childNodes[i].tagName)
            if(parent.childNodes[i].tagName == "DIV"){
                var itemInfo = new Array;
                itemInfo["reference"] = parent.childNodes[i];
                itemInfo["height"] = parent.childNodes[i].offsetHeight;
                itemInfo["visible"] = true;
                this.itemList.push(itemInfo);
            }
        }
    };

	this.setupList =
    function(){
        var bottom = 0;
        for(var i in this.itemList){
            this.itemList[i]["reference"].style.position = "absolute";
            if(!this.itemList[i]["reference"].style.top){
                this.itemList[i]["reference"].style.top = bottom+"px";
            }

            bottom += this.itemList[i]["height"];
            if(bottom > this.rollerHeight){
                this.itemList[i]["reference"].style.top = (bottom-this.itemList[i]["height"])+"px";
                this.itemList[i]["reference"].style.display = "none";
                changeOpac1(this.itemList[i]["reference"],0);
                this.itemList[i]["visible"] = false;
            }else{
                this.itemList[i]["reference"].style.display = "";
                if(this.itemList[i]["visible"] == false) this.fadein(this.itemList[i]["reference"]);
                if(this.itemList[i]["reference"].style.top != (bottom-this.itemList[i]["height"])+"px"){
					this.moveUp(this.itemList[i]["reference"],this.itemList[i]["reference"].offsetTop,(bottom-this.itemList[i]["height"]));
                }
                this.itemList[i]["visible"] = true;
            }
        }
    };

	this.rotate =
    function(){
        this.fadeout(this.itemList[0]["reference"]);
		setTimeout(this.name + ".fncpush();",500);
		setTimeout(this.name + ".fncsplice();",500);
		setTimeout(this.name + ".setupList();",500);
    };
	
	this.fncpush =
	function(){
		this.itemList.push(this.itemList[0]);
	};
	
	this.fncsplice =
	function(){
		this.itemList.splice(0,1);
	};

	this.fadeout =
    function(ref){
        this.fadeoutRef[++this.uid] = ref;
        var t = 10;
        for(var i=100; i>= 0; i-=10){
			setTimeout(this.name + ".fncFadeOut(" + i + ");",t+=35);
		}
    };
	
	this.fncFadeOut = 
	function(i){
		changeOpac1(this.fadeoutRef[this.uid],i);
	};

	this.fadein =
    function(ref){
        this.fadeinRef[++this.uid] = ref;
        var t = 10;
        for(var i=0; i<= 100; i+=10){
			this.fncFadeIn(i);
			//setTimeout(this.name + ".fncFadeIn(" + i + ");",t+=35);
		}
    };

	this.fncFadeIn = 
	function(i){
		changeOpac1(this.fadeinRef[this.uid],i);
	};

	this.moveUp =
    function(ref, start, end){
        this.moveRef[++this.uid] = [ref, start, end];
        var t = 10;
        for(var i=start; i>=end; i-=(0.02*(i-end))){
			this.fncMove(i);
			//setTimeout(this.name + ".fncMove(" + i + ");",t+=3);
            if(i-end <= 1) break;
        }
    };

	this.fncMove =
	function(i){
		move(this.moveRef[this.uid][0], i);
	};
	
	this.startScrolling =
	function(){
		this.compileItems(this.name);
		this.setupList();
		for(var i in this.itemList){
			this.sumItemHeight += this.itemList[i]["height"];
		}
		if(this.sumItemHeight > this.rollerHeight){
			setInterval(this.name+".rotate();",this.timer);
		}
	}
}

function move(ref, t){
	ref.style.top = t + "px";
}

function changeOpac1(object, opacity){
	object = object.style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

