
window.addEvent('domready', function() {
		

		var imagewidth;

		var scrolled = "left";
		var speed=0;
		var scroll;

		startmoving();
		
		
		
		function startmoving(){
			
			imagewidth=$("backgroundjs").getWidth();
			divWidth=$("bigImg").getWidth();
			if(imagewidth<divWidth){
				imagewidth=divWidth
			}
			speed = imagewidth/0.05;
			
			scroll = new Fx.Scroll('bigImg', {
					wait: 1000,
					duration: speed,
					//offset: {'x': -200, 'y': -50},
					transition:Fx.Transitions.linear
			});
			
			$('botFade').style.width = imagewidth+"px";
			$('topShado').style.width = imagewidth+"px";
			if(scrolled=="left"){
				scroll.toRight().chain(function(){
						scrolled = "right";
						startmoving();
				});
			}
			else if(scrolled=="right"){
				scroll.toLeft().chain(function(){
						scrolled = "left";
						startmoving();
				});
			}
			
		}
		
		
		
		
		
});
