jQuery(document).ready(function(){

	setupImageRotator();

});

/* =========================================================================================== */



  function setupImageRotator(){

		animSpeedIn  =   200;
		animSpeedOut =   200;
		animTimeout  =  5000;
		durationVal  = jQuery('#rotatorImages img').length * (animSpeedIn + animSpeedOut + animTimeout);

		jQuery('#rotatorImages').cycle({ 
			fx:      'scrollLeft',
			speedIn:  animSpeedIn,
			speedOut: animSpeedOut,
			timeout:    animTimeout,
			nowrap: 0,
			sync: 0
			// Array is randomized by PHP as random and nowrap as Cycle parameters seem incompatible
		});

		// animateWords(durationVal);

	}
	

	function animateWords(durationVal){
		animateSun(durationVal);
		animateWind(durationVal);
		animateRain(durationVal);
	}

	function animateSun(durationVal){
		jQuery('#sun').animate({
			left: '+262'
		}, durationVal, function() {
			// Animation complete.
		});
	}

	function animateWind(durationVal){
		jQuery('#wind').animate({
			left: '+=150'
		}, durationVal, function() {
			// Animation complete.
		});
	}
	
	function animateRain(durationVal){
		jQuery('#rain').animate({
			left: '-=386'
		}, durationVal, function() {
			// Animation complete.
		});
	}
	

