/*
 * jQuery Pimg (Preview image) 
 * Written by Dave Earley ( http://dave-earley.com )
 */

function pimg()
{
    this.xOffset = 20;
    this.yOffset = 20;
    $("img.pimg").hover(function (e)
    {
/*    if(e.pageX > 600){
    xOffset = 20;
    yOffset = -500;
//  alert(e.pageY)
    }
        if(e.pageX < 600){
            xOffset = 20;
    yOffset = 20;
    }
	*/
//alert(e.pageX);
        this.img_title = this.title;
        this.title = "";
        var img_src = $(this).attr('img_src');
        var desc = (this.img_title != "") ? "<h3>" + this.img_title + "</h3>" : "";
		 var desc = "";
        var image = (img_src) ? img_src : this.src;
        $("body").append("<div align='center' id='pimg'><img width='230px' height='230px'  style='padding: 15px 15px 15px 15px;position: relative;top: 0px; left: 0px;'  src='" + image + "' alt='Image preview' />" + desc + "</div>");
        $("#pimg").css("top", (e.pageY - xOffset) + "px").css("left", (e.pageX + yOffset) + "px");
        $("#pimg").fadeIn(700);
    }, function ()
    {
        this.title = this.img_title;
        $("#pimg").remove();

    });
    $("img.pimg").mousemove(function (e)
    {
        $("#pimg").css("top", (e.pageY - xOffset) + "px").css("left", (e.pageX + yOffset) + "px");
    });
};


function pimgtoo()
{
    this.xOffset = 200;
    this.yOffset = 4;
    $("img.pimg").hover(function (e)
    {

        this.img_title = this.title;
        this.title = "";
        var img_src = $(this).attr('img_src');
        var desc = (this.img_title != "") ? "<h3>" + this.img_title + "</h3>" : "";
        var image = (img_src) ? img_src : this.src;
        $("body").append("<div id='pimg'><img width='0px' height='0px' style='position: relative;top: 15px; left: 60px;'  src='" + image + "' alt='Image preview' />" + desc + "</div>");
        $("#pimg").css("top", (e.pageY - xOffset) + "px").css("left", (e.pageX + yOffset) + "px");
        $("#pimg").fadeIn(700);
    }, function ()
    {
        this.title = this.img_title;
        $("#pimg").remove();

    });
    $("img.pimg").mousemove(function (e)
    {
        $("#pimg").css("top", (e.pageY - xOffset) + "px").css("left", (e.pageX + yOffset) + "px");
    });
};



function pimgtoocontacto()
{
    this.xOffset = 100;
    this.yOffset = 4;
    $("img.pimg").hover(function (e)
    {

        this.img_title = this.title;
        this.title = "";
        var img_src = $(this).attr('img_src');
        var desc = (this.img_title != "") ? "<h3>" + this.img_title + "</h3>" : "";
        var image = (img_src) ? img_src : this.src;
        $("body").append("<div id='pimg'><img width='0px' height='0px' style='position: relative;top: 15px; left: 60px;'  src='" + image + "' alt='Image preview' />" + desc + "</div>");
        $("#pimg").css("top", (e.pageY - xOffset) + "px").css("left", (e.pageX + yOffset) + "px");
        $("#pimg").fadeIn(700);
    }, function ()
    {
        this.title = this.img_title;
        $("#pimg").remove();

    });
    $("img.pimg").mousemove(function (e)
    {
        $("#pimg").css("top", (e.pageY - xOffset) + "px").css("left", (e.pageX + yOffset) + "px");
    });
};

function pimgimg()
{
    this.xOffset = 100;
    this.yOffset = 5;
    $("img.pimg").hover(function (e)
    {


        this.img_title = this.title;
        this.title = "";
        var img_src = $(this).attr('img_src');
        var desc = (this.img_title != "") ? "<h3>" + this.img_title + "</h3>" : "";
        var image = (img_src) ? img_src : this.src;
        $("body").append("<div id='pimg'><img width='0px' height='0px' style='position: relative;top: 15px; left: 60px;'  src='" + image + "' alt='Image preview' />" + desc + "</div>");
        $("#pimg").css("top", (e.pageY - xOffset) + "px").css("left", (e.pageX + yOffset) + "px");
        $("#pimg").fadeIn(700);
    }, function ()
    {
        this.title = this.img_title;
        $("#pimg").remove();

    });
    $("img.pimg").mousemove(function (e)
    {
        $("#pimg").css("top", (e.pageY - xOffset) + "px").css("left", (e.pageX + yOffset) + "px");
    });
};
