﻿$(document).ready(function() 
    {
        $('.ImageHoverText').mouseover(over);
        $('.ImageHoverText').mouseout(out);
        
         $('.ImageHoverText').toggle
         (
            function (e)
            {
                $(this).unbind('mouseover').unbind('mouseout');
            },
            function (e)
            {
                $('.ImageHoverText').mouseover(over);
                $('.ImageHoverText').mouseout(out);
            }
         );
    }
);

function over ()
{
    var offset = getPosition(this);
    $('.Image', this).css({top: offset.top, left: offset.left, zIndex : 10000}).show();
}

function out ()
{
    $('.Image', this).hide();
}

function getPosition (obj)
{
    var offset = $(obj).position();
    var imgWidth = $('.Image', obj).width();
    var imgHeight = $('.Image', obj).height();
    var linkWidth = $(obj).width();
    
    offset.left = (offset.left + linkWidth + 15);
    offset.top = (offset.top - imgHeight);
    
    return offset;
}