
this.imagePreview = function () 
{
    ixOffset = 120;
    iyOffset = -120;

    $("img.zoom").hover(function (e) 
    {
        this.t = this.title;
        this.title = "";
        var c = (this.t != "") ? "<br/>" + this.t : "";
        $("body").append("<p id='preview'><img src='" + this.src + "' alt='Voucher preview' />" + c + "</p>");
        $("#preview")
			.css("top", (e.pageY - ixOffset) + "px")
			.css("left", (e.pageX + iyOffset) + "px")
			.fadeIn("fast");
    },
	function () 
    {
	    this.title = this.t;
	    $("#preview").remove();
	});
	$("img.zoom").mousemove(function (e) 
    {
        $("#preview")
			.css("top", (e.pageY - ixOffset) + "px")
			.css("left", (e.pageX + iyOffset) + "px");
    });
};

this.imagePreviewCategory = function () 
{
    xOffset = 20;
    yOffset = -120;

    $("img.zoomCategory").hover(function (e) {
        this.t = this.title;
        this.title = "";
        var c = (this.t != "") ? "<br/>" + this.t : "";
        $("body").append("<p id='preview'><img src='" + this.attributes['reflex'].value + "' alt='Voucher preview' />" + c + "</p>");
        $("#preview")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function () {
	    this.title = this.t;
	    $("#preview").remove();
	});
	$("img.zoomCategory").mousemove(function (e) {
        $("#preview")
			.css("top", (e.pageY - xOffset - 110) + "px")
			.css("left", (e.pageX + yOffset) + "px");
    });
};



// starting the script on page load
$(document).ready(function ()
{
    imagePreview();
    imagePreviewCategory();
    $(".lightboxLink").colorbox({ width: "700px", height: "600px", iframe: true });
});
