/**
 * @author Abdellah Boutmouzzar abdellah@3wkom.net
 */
var abHover = new Class({
	Implements: Options,
    options: {
		triggers: '.abHoverAble',
		pathPrefix: '/upload/miniature/'
    },
	initialize: function(options){
		this.setOptions(options);
		this.triggers = this.options.triggers;
		this.pathPrefix = this.options.pathPrefix;
		
		$$(this.triggers).each(function(el, i){
			var path = el.get('rev');
			if(path != null){
				path = this.pathPrefix + path;
				el.setStyle('position', 'relative');
				var abImg = new Element('img', {id: 'abImg' + i, style: 'position: absolute;top:0px;left:-72px;', src: path}).fade(0);
				(function(){ abImg.inject(el); }).delay(1000);

				el.addEvents({
					'mouseenter': function(e){
						abImg.fade(1);
					},
					'mouseleave': function(e){
						abImg.fade(0);
					}
				})
			}
		}.bind(this))
	}
});

