this.imagePreview = function(){
    /* CONFIG */
        
        xOffset = 20;
        yOffset = 120;
        
        // 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){

        if(e.pageX > 500 ){ xOffset = -360; } else { xOffset = 20; }


        this.t = this.title;
        this.title = "";
        this.image = "http://www.ssl-improve.jp/w3e/data/" + this.href.substr(this.href.indexOf("GRP"), 19) + "_320.jpg";

        var c = (this.t != "") ? this.t : "";
        $("body").append("<div id='preview'><div class='preview_image'><img src='"+ this.image +"' alt='"+ this.t +"' /></div><div class='preview_name'>"+ c.replace(", ","<br />") +"</div></div>");
        $("#preview")
            .css("top",(e.pageY - yOffset) + "px")
            .css("left",(e.pageX + xOffset) + "px")
            .fadeIn(0);
    },
    function(){
        this.title = this.t;
        $("#preview").remove();
    });    
    $("a.preview").mousemove(function(e){
        if(e.pageX > 500 ){ xOffset = -360; } else { xOffset = 20; }
        $("#preview")
            .css("top",(e.pageY - yOffset) + "px")
            .css("left",(e.pageX + xOffset) + "px");
    });
};


// starting the script on page load
$(document).ready(function(){
    imagePreview();
});
