if( !General ) var General = {};

General.subscript = {
	init: function(){
		this.preparePng();
		this.prepareCloud();
	},
	preparePng: function(){
		if( typeof( ddpngfix ) !== 'undefined' ){
			$( 'img[src$=.png]:not(.opaque), #mask, #cloud1, #cloud2, #cloud3' ).each( function(){
				ddpngfix.fixPng( this );					
			} );
		}
	},
	current: 0, list: [],
	prepareCloud: function(){
		$.get( 	'data.php', '', function( data, status ){	
			General.subscript.current = 0;
			General.subscript.list = data.split( ';' );
			General.subscript.populateCloud();
		}, 'text' );
	},
	populateCloud: function(){
		if( this.current < this.list.length ){
			var top = Math.floor( Math.random()*50+210 );
			var left =  Math.floor( Math.random()*550 );
			var span = $( '<span class="name" style="top:' + top + 'px;left:' + left + 'px;">' + this.list[this.current++] + '</span>' );

			$( '#clouds' ).append( span );
			$( span ).hide();
			$( span ).fadeIn( 200, function(){
				$( span ).animate( { top:'-50px' }, top*1.5+6400, 'linear', function(){
					$( span ).remove();
				} );											
			} );

			setTimeout( 'General.subscript.populateCloud()', 1200 );
		}else{
			this.prepareCloud();			
		}
	}
}
$( 'document' ).ready( function(){
	General.subscript.init();
} );
