this.imagePreview = function() {
    /* CONFIG */

    xOffset = 20;
    yOffset = 50;

    // these 2 variable determine popup's distance from the cursor
    // you might want to adjust to get the right result

    /* END CONFIG */
    $("a.preview").hover(function(e) {
        var divX = $("#hoverPopup").offset().left;
        var divY = $("#hoverPopup").offset().top;
        this.t = this.title;
        this.title = "";
        var c = (this.t != "") ? "<br/>" + this.t : "";
        $("#hoverPopup").append("<p id='preview'><img id='popupImage' src='" + this.href + "' alt='Image preview' />" + c + "</p>");
        $(this).animate({ width: $(this).width() }, 500, function() {
        });
        var height = $("#popupImage").height();
        $("#preview")
			.css("top", (e.pageY - divY - yOffset - height) + "px")
			.css("left", (e.pageX - divX - 10) + "px")
			.fadeIn("slow");
    },
	function() {
	    this.title = this.t;
	    $("#preview").remove();
	});
    $("a.preview").mousemove(function(e) {
        var divX = $("#hoverPopup").offset().left;
        var divY = $("#hoverPopup").offset().top;
        var height = $("#popupImage").height();
        $(this).animate({ width: $(this).width() }, 500, function() {
        });
        $("#preview")
			.css("top", (e.pageY - divY - yOffset - height) + "px")
			.css("left", (e.pageX - divX - 10) + "px");
    });
};
