var protoReflector = Class.create({
  initialize: function(element,options) {
	this.element = $(element);	
	this.options = Object.extend({
		opacity : 1/3,
		amount : 1/3,
		background:'#cccccc'
	}, options || {});
	this.reflect();
  },
  reflect: function() {
	  
    var div = new Element('div',{'id':'parentof'+this.element.id});
    this.element.wrap(div);
	var p = this.element.parentNode, n = this.element.nextSibling;
    var d = 1.0/(this.element.height*(this.options.amount));
    var l=0;
    (this.element.height*this.options.amount).times( function(line) {
      l++;
	//new Insertion.Bottom(p,'<div style="height:1px;overflow:hidden;background:'+this.options.background+';" id="refl'+l+'_'+this.element.id+'" ><img src="'+this.element.src+'" style="margin-top:-'+(this.element.height-line-1)+'px;"></div>');
	new Insertion.Bottom(p,'<div style="height:1px;overflow:hidden;background:'+this.options.background+';width:90px;" id="refl'+l+'_'+this.element.id+'" ><img src="'+this.element.src+'" style="width:90px;margin-top:-'+(this.element.height-line-1)+'px;"></div>');


            $('refl'+l+'_'+this.element.id+'').setOpacity((1-d*line)*(this.options.opacity));
    }.bind(this));
    
    $('parentof'+this.element.id).onmouseover=function(){$('parentof'+this.element.id).setOpacity(1);}.bind(this);
    $('parentof'+this.element.id).onmouseout=function(){new Effect.Opacity(('parentof'+this.element.id), { from: 1.0, to: 0.5, duration: 0.2 });}.bind(this);
    $('parentof'+this.element.id).setOpacity(0.5);
  }
 });
