﻿var tip
$(document).ready(function() {
    
    var top, left;
    
    var findCordinate = function(e)
    {
        if(e.clientY + $("#tooltip").height() + 10 > $(window).height())
	    {
            top = e.pageY - $("#tooltip").height() - 10;
          
            top = ($("#tooltip").height() + 10) >  e.clientY ? e.pageY - e.clientY + 10 : top; 
        }
        else
        {
            top = e.pageY + 10;
        }
            
        left = e.pageX -400 - 10;
    };
    
    $('.show').mouseover(function(e) {
    
    
    findCordinate(e);
		
	tip = $(this).parent().parent('.ProductAll').children('.more').html();	
    		
    $(this).attr('title','');
    		
	$(this).parent().append('<div id="tooltip"><div class="tipBody">' + tip + '</div></div>');		
    $('#tooltip').css('top', top);
	$('#tooltip').css('left', left);
	$('#tooltip').show();
		
	}).mousemove(function(e) {
	
	findCordinate(e);
	
	
	$('#tooltip').css('top', top );
	$('#tooltip').css('left', left);
    		
	}).mouseout(function() {
        	
	$(this).parent().children('#tooltip').remove();
        		
	});
});

