/* Parallax 0.1 by WebTek.cz */

	//		» html syntax:
	//
	//			<div class="parallax"></div>

  //settings

window.addEvent('domready',function(){

  var duration = 100000;
  var length = 2000;
  var count = 0;
  var image = $$('.parallax');
  var imageSrc = "../_gfx/clouds_001.jpg";

	image.each(function parallax(){

		image.setStyles({
			'background-image': 'url("'+imageSrc+'")',
			'background-size': 'auto 100%',
			'position': 'fixed',
			'top': '0px',
			'right': '0px',
			'bottom': '0px',
			'left': '0px',
			'display': 'block',
			'z-index': '-500',
			'opacity': 0
		});


	  // Executes the standard tween on the background position
	  var run = function() {
	    tweener.tween("background-position","-" + (++count * length) + "px 0px");
	  };

	  // Defines the tween
	  var tweener = image.setStyle("background-position","0px 0px").set("tween",{
	    duration: duration,
	    transition: Fx.Transitions.linear,
	    onComplete: run,
	  });


	  function show(){
	  	image.set('morph', {duration: 5000});
			image.morph({'opacity': '1'});
		};

		addEvent('load', show);

	  // Starts the initial run of the transition
	  run();

	});

});

