// JavaScript Document
Effect.Reflector = Class.create();
Object.extend(Object.extend(Effect.Reflector.prototype,
  Effect.Base.prototype), {
	initialize: function(element){
		this.element = $(element);
		element = $(element);
		if (!element) throw(Effect._elementDoesNotExistError);
		var options = Object.extend({
			height: 0.5,
			opacity: element.getOpacity() || 0.5,
			fps: 100
		}, arguments[1] || { });
		var p = element.parentNode, n = element.nextSibling;
	    var d = 1.0/(element.height*options.height);
		(element.height*options.height).times( function(line) {
			var h = Builder.node('div',{style:'height:1px;overflow:hidden'},
						[Builder.node('img',{src:element.src, 
						style:'margin-top:-'+(element.height-line-1)+'px'
					})]);
			p.insertBefore(h,n);
			$(h).setOpacity((1-d*line)*options.opacity);
		});
		this.start(options);
	}
});

