/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  JS Library.
  by DesignSlicer.com _ info@designslicer.com _
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
jQuery(document).ready(function() {
  jQuery('#comments_wrap .reply').click(function(event){
    event.preventDefault();
    var string = '<a class="reply-to" href="#' + jQuery(this).parents('li').attr('id') + '">@' + jQuery(this).parents('li').find('.fn').text() + ':</a>';
    var currentValue = jQuery('#comment').val();
    jQuery('#comment').val(currentValue + '\n' + string + '\n').focus();
  });
  var exp = /^@/;
  var exphref = /^#comment-/;
  jQuery('#comments_wrap .col-right p a').each(function(){
      if (jQuery(this).text().match(exp) && jQuery(this).attr('href').match(exphref)) {
        jQuery(this).addClass('reply-to');
      }
  });
  var offset = jQuery('#comments_wrap').offset();
  jQuery('.reply-to').hover(
    function(){
      jQuery(jQuery(this).attr('href')).clone().hide().attr('id','').insertAfter(jQuery(this).parents('li')).addClass('comment-tip').fadeIn('medium');
    },
    function(){
      jQuery('.comment-tip').fadeOut('fast',function(){
        jQuery(this).remove();
      });
    }
  ).mousemove(function(e){
    jQuery('.comment-tip').css({'left' : (e.pageX - offset.left + 10) , 'top' : (e.pageY - offset.top + 5)});
  });
});