$(function() {
	cloud_3('#cloud_1');
	cloud_3('#cloud_2');
	cloud_3('#cloud_3');
	cloud_3('#cloud_4');
	cloud_3('#cloud_5');
});

function randomFromTo(from, to){
   return Math.floor(Math.random() * (to - from + 1) + from);
}
	
function cloud(ID) {
	Rand_top = 170 + (Math.random()*50);
	To_width = $('body').width() - 234;
	links = randomFromTo(1, To_width);
	tijd = (1 - (links/To_width)) * 30000;
	$(ID).css({top: Rand_top, left:links});
	$(ID).animate({left:To_width},tijd, 'linear', function() { cloud_2(ID); });
}
function cloud_2(ID) {
	Rand_top = 170 + (Math.random()*50);
	To_width = $('body').width() - 234;
	links = randomFromTo(0, To_width);
	$(ID).css({top: Rand_top, left:'-234px'});
	$(ID).animate({left:To_width},30000, 'linear', function() { cloud_2(ID); });
}
function cloud_3(ID) {
	Rand_top = 170 + (Math.random()*50);
	To_width = $('body').width() - 234;
	links = randomFromTo(1, To_width);
	tijd = (1 - (links/To_width)) * 30000;
	$(ID).css({top: Rand_top, left:links});
}
