jQuery.fn.pbTableImage = function(options){
    return this.each(function(){
        var defaults = {
                clName:'tip',
                followMouse:true,
                left:10,
                vertical:'top',
                base:$('.imagegallery a[href$=drawing.jpg]').attr('href'),
                content:false
            },
            $tip = $('<div>'),
            html;

        options = $.extend(defaults,options);

        if(!options.content){
            if(!options.base){
                return false;
            }else{
                html = '<img src="'+options.base.replace(/\/full\//,'/prev/')+'"/>';
            }
        }else{
            html = options.content;
        }

        $tip.addClass(options.clName).html(html).appendTo('body');

        $(this).hover(function(e){
            $tip.show();
            setTip(e.pageX,e.pageY);
        },
        function(){
            $tip.hide();
        });

        if(options.followMouse){
            $(this).bind('mousemove',function(e){
                setTip(e.pageX,e.pageY);
            });
        }

        function setTip(x,y){
            var t,
                l = options.left;

            if(options.vertical === 'top'){
                t = 0 - $tip.outerHeight();
            }else{
                t = 0;
            }
            $tip.css({top:y + t +'px',left:x + options.left +'px'});
        }
    });
};
