/*
 * Url preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 * modified by pjj: info about path to the image moved from rel to title
 * (since slashes aren't allowed in rel)
 */
 
this.screenshotPreview = function(){
  /* CONFIG */
    xOffset = 10;
    yOffset = 30;
  /* END CONFIG */

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

// starting the script on page load
$(document).ready(function(){
  screenshotPreview();
});
