window.onload = init;

function init() {
	
//	$('body').style.height = '0px';

	new Effect.Morph( 'body' , {
		style: {
			height: (typeof window.innerHeight != 'undefined' ? window.innerHeight : document.body.offsetHeight) - 20 + 'px'
		}
	} );
	
	setTimeout("loop()", 1000);
}

function loop() {
	
	var first = true;
	
	var d = document.getElementsByClassName('bar');
	
	for( var x = 0; x<d.length; x++ ) {
		new Effect.Morph( d[x].id , {
			style: {
				width: Math.random()*800 + $(d[x].id.replace("bar_", "text_")).offsetWidth + 'px'
			},
			duration: 1
		} );
		
		if( first == true ) {
			$(d[x].id).style.display = 'none';
			$(d[x].id).style.height = '0px';
			$(d[x].id).style.width = '0px';
			$(d[x].id).className = '';
			var first = false;
		}
	}
	
	setTimeout("loop()", 1000);
}