var Wall = Class.create();
Wall.extend({
	top:0,
	init:function(id,cla){
		var coord = $(id).getCoordinates();
		var width = coord.width-240;
		var height = coord.height-240;
		var messages = $$('.'+cla);
		var td = this;
		messages.each(function(v,i){
			var id = $(v).id.replace('script','');
			td.top = Math.max(td.top,id)
			$(v).setStyles({
				left:Math.ceil(Math.random()*width),
				top:Math.ceil(Math.random()*height+50)
			});
			$(v).setStyle('z-index',id);
			$(v).addClass('style'+Math.ceil(Math.random()*5));
			$(v).addEvent('click',td.mClick(id));
			$(v).makeDraggable({onStart:function(){
				$('script'+id).setStyle('z-index',td.top);
				td.top ++;
			}});
		})
	},
	mClick:function(i){
		td = this;
		return function(){
			$('script'+i).setStyle('z-index',td.top);
			td.top ++;
		}
	}
})

