/* Image preview script, powered by jQuery (http://www.jquery.com)
 * Written by Alen Grakalic (http://cssglobe.com)
 * See: http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 */

this.imagePreview = function() {
  xOffset = 10;
  yOffset = 30;

  $("a.preview").hover(
      function(e) {
      this.t = this.title;
      this.title = "";
      $("body").append(
        "<p id='preview' class='cardimg'><img src='" + this.rel + "' /></p>");
      $("#preview")
        .css("top", (e.pageY - xOffset) + "px")
        .css("left", (e.pageX + yOffset) + "px")
        .fadeIn("fast");
      },
      function() {
      this.title = this.t;
      $("#preview").remove();
      });
  $("a.preview").mousemove(function(e){
      $("#preview")
      .css("top",(e.pageY - xOffset) + "px")
      .css("left",(e.pageX + yOffset) + "px");
      });
};
