var PreLoader = new Class( {
    'Implements' : [ Options ],

    'options' : {
        'position' : 'bottom',
        'related_el' : null,
        'element' : null,
        'src' : '/img/ajax-loader/small.gif',
        'size' : null
    },

    'initialize' : function ( item, options ) {
        this.setOptions( options );

        var self = this;
        this.options.element = new Element( 'img' )
            .setProperties( {
                'src'   : self.options.src
            } );
        
        if ( this.options.size ) {
        	this.options.element.setProperty( 'width', this.options.size );
        }
            
        this.hide();

        if ( item ) {
            this.options.related_el = item;
            this.options.element.inject(
                this.options.related_el,
                this.options.position
            );
        }
    },

    'show' : function () {
        this.options.element.setStyle( 'display', '' );
    },

    'hide' : function () {
        this.options.element.setStyle( 'display', 'none' );
    }
} );