var clouds = Class.create({cloudContainerHeight: 389,cloudInfo: {},cloudMinSpeed: 100,cloudMaxSpeed: 300,cloudDelayRandomNess: 50,cloudRandomDelay: false,cloudContainerWidth: 0,cloudAnimation: false,cloudRandomization: true,initialize: function (cloudAnimation, minSpeed, maxSpeed){this.cloudAnimation = cloudAnimation;this.cloudMinSpeed = minSpeed;this.cloudMaxSpeed = maxSpeed;this.cloudInfo = $$('div.cloud');this.cloudContainerWidth = document.body.getWidth();if(this.cloudRandomization == true){this.randomize();}if(this.cloudAnimation == true){this.animate();}},moveClouds: function(cloud){this.cloudInfo.each(function(e, index){var randomSpeed = (Math.floor(Math.random() * (this.cloudMaxSpeed - this.cloudMinSpeed))) + this.cloudMinSpeed;e.setStyle({zIndex: 500-(randomSpeed)});e.speed = randomSpeed;e.delay = Math.floor(Math.random() * this.cloudDelayRandomNess);this.moveCloudAction(e, index);}.bind(this));},moveCloudAction: function(cloud, index){if(this.cloudRandomDelay == true){var cloudDelay = this.cloudInfo[index].delay;} else{var cloudDelay = 0;}this.moveOptions = {x: (0 - (cloud.getWidth() * 2)),y: cloud.getStyle('top').replace('px', ''),mode: 'absolute',transition: Effect.Transitions.linear,duration: this.cloudInfo[index].speed,afterFinish: this.resetClouds.bind(this, cloud, index),delay: cloudDelay};new Effect.Move(cloud, this.moveOptions);},resetClouds: function(cloud, index){cloud.setStyle({ left : (this.cloudContainerWidth+cloud.getWidth()+50)+'px', top: Math.floor(Math.random() * this.cloudContainerHeight)+'px'});this.cloudInfo[index].delay = 0;this.moveCloudAction(cloud, index);},animate: function(){this.moveClouds();},randomize: function(){this.cloudInfo.each(function(e){e.setStyle({left:((Math.floor(Math.random() * ((this.cloudContainerWidth * 2) + -500))) - 500)+'px'});e.appear({duration: 2, delay: Math.floor(Math.random() * 3)});}.bind(this));}});
