(function( $ ){

    var methods = {
    
        setup : function(self, p_image, p_side) {
            // create the div for the image
            var parent_id = self.parent().attr('id');
            var div_id = parent_id + '_slideImg';
            
            var divCode = '<div id="' + div_id + '" class="slideImg"></div>';
            $(divCode).insertAfter(self);
            
            // select the right div, and then style the div
            var div_obj = self.next('#' + div_id);
            
            $(div_obj).css('position', 'absolute');
            $(div_obj).css('bottom', '40px');
            
            if(p_side == 'right') {
                $(div_obj).css('right', '0');
            } else {
                $(div_obj).css('left', '0');
            }
            
            $(div_obj).css('z-index', '1');
            $(div_obj).css('margin', '0');
            
            $(div_obj).css('width', '118px');
            $(div_obj).css('height', '0');
        
            // add the image to the div
            $(div_obj).css('background', 'url("' + p_image + '") no-repeat');
            
            // return the created div for manipulation
            return div_obj;
            
        }
        
    }
    
    $.fn.SlideLink = function(p_image, p_side) {

        // create, style, and add the image
        var div_obj = methods.setup(this, p_image, p_side);

        // rollover event
        this.mouseenter(function() {
            $(div_obj).stop(true, true).animate({
                height: '70px'
            }, 500);
//            $(div_obj).slideToggle(500);
        });
        
        // rollout event
        this.mouseleave(function() {
            $(div_obj).stop(true, true).animate({
                height: '0'
            }, 500);
        });
    
    };
})( jQuery );
