/*
* Image 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
*
*/

this.imagePreview = function() {
    /* CONFIG */

    xOffset = 10;
    yOffset = 30;

    // 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) {
        this.t = this.title;
        this.title = "";
        var c = (this.t != "") ? this.t : "";
        var k = (this.t != "") ? "" : "";
 
            $("body").append("<center><p id='preview'  >  " + c + "<br/><img  style='padding:10px;' src='" + this.hreflang + "' alt='' width='350px' height='500px'/</p></center>");
            $("#preview")
			.css("top", document.documentElement.scrollTop)
			.css("left", (e.pageX + yOffset < 735) ? e.pageX + yOffset + "px" : (e.pageX + yOffset - 460 > 460) ? e.pageX + yOffset - 460 + "px" : (e.pageX - 490) + "px")
			.fadeIn("fast");
         
     
      
    },
	function() {
	    this.title = this.t;
	    $("#preview").remove();
	});
    $("a.preview").mousemove(function(e) {
      
 
     $("#preview")
			.css("left", (e.pageX + yOffset < 735) ? e.pageX + yOffset + "px" : (e.pageX + yOffset - 460 > 460) ? e.pageX + yOffset - 460 + "px" : (e.pageX - 490) + "px")
 
    });
};


// starting the script on page load
$(document).ready(function() {
    imagePreview();
});
