	var speed = 70;
	var pic, numImgs, arrLeft, i, totalHeight, n, myInterval; 

$(window).load(function(){
	pic = $("#slider").children("p");
	numImgs = pic.length;
	arrLeft = new Array(numImgs);
	
	for (i=0;i<numImgs;i++){
		
		totalHeight=0;
		for(n=0;n<i;n++){
			totalHeight += $(pic[n]).height();
		}
		
		arrLeft[i] = totalHeight;
		$(pic[i]).css("top",totalHeight);
	}
	
	myInterval = setInterval("flexiScroll()",speed);
	$(pic).show();	
});

function flexiScroll(){

	for (i=0;i<numImgs;i++){
		arrLeft[i] -= 1;		

		if (arrLeft[i] == -($(pic[i]).height())){	
			totalHeight = 0;	
			for (n=0;n<numImgs;n++){
				if (n!=i){	
					totalHeight += $(pic[n]).height();
				}			
			}	
			arrLeft[i] =  totalHeight;	
		}					
		$(pic[i]).css("top",arrLeft[i]);
	}
}