var $el, $tempDiv, $tempButton, divHeight = 0;

$.fn.middleBoxButton = function(text, url, target) {
    
    return this.hover(function() {
    
        $el = $(this).css("border-color", "white");
        divHeight = $el.height() + parseInt($el.css("padding-top")) + parseInt($el.css("padding-bottom"));
              
        $tempDiv = $("<div />");
        $tempDiv.addClass("overlay");

        $tempButton = $("<a />");
        $tempButton.attr({ href: url, target: target});
        $tempButton.addClass("widget-button");
        $tempButton.css("top", (divHeight / 2) - 7 + "px");
        $tempButton.text(text).appendTo($tempDiv);
        $tempDiv.appendTo($el);
        
    }, function() {
    		$el = $(this).css("border-color", "#999");
    		$(".overlay").fadeOut("fast", function() {
    			$(this).remove();
    		})
    });
}
