var comment_tmout;
var comment_open = false;
jQuery('#comments_list').live('mouseover', function() 
{
    clearTimeout(comment_tmout);
    var torrentId = jQuery(this).attr('rel');      
    
    if (torrentId == '')
      return;
    if (comment_open.length > 0 && comment_open!=torrentId)
    {
        jQuery('#comment_tooltip').css('display', 'none');
    }
    if (comment_open.length > 0 && comment_open==torrentId)
        return;
        
    var oContainer = jQuery('#comment_tooltip');
   
    
    var pos = jQuery(this).offset();
    iLeft = pos.left-8;
    iTop = pos.top; 
    oContainer.css({
      left: iLeft + 'px',
      top: iTop + 'px'
    });

    jQuery('#comment_tooltip div.body').html('&nbsp;');

    jQuery.ajax({
      type: 'GET',
      url: "/system/ajax_response/get_comments.php",
      cache: true,
      data: {torrentId: torrentId },
      beforeSend: function() {
            jQuery('#comment_tooltip div.body').html('<center style="margin:auto 0;width:300px;"><img src="/system/site_templates/torrentland/images/tooltips/ww_loader.gif"></center>');
        },
      success: function(data) {                
            var oData = eval('(' +data  + ')')
            
            if (oData.iTorrentId == torrentId) { 
                jQuery('#comment_tooltip div.body').html(oData.sContent);
            }else{
                jQuery('#comment_tooltip div.body').html('No comments');
            }
        }
    });
    comment_open = torrentId;
    oContainer.css('display', 'block');
});


jQuery('#comments_list').live('mouseout', function() 
{
    HideComment();
});


function HideComment()
{   
    comment_tmout = setTimeout(function(){
        jQuery('#comment_tooltip').css('display', 'none');
        comment_open = false;
    }, 100);
}
function CommentHover()
{
    clearTimeout(comment_tmout);       
}
function CommentOut()
{
    HideComment();      
}



