$(document).ready(function() {
  
  //$('.fp-news li').click(function() {
  $('.fp-news li a').mouseover(function() {
    var item = $(this).parent().parent();
    var content = item.html();
    var breaking = item.is('.breaking');
    var popup = $('#fp-news');
    var popupContent = $('.popup-content', popup);
    var timer = null;
    var settings = {
      anchor: ['tl', 'tl'],
      offset: [-26, -10]
    };
    if (!popup.is(':visible')) {
	  if($(this).parent().attr('class') != 'count-comments') {
		   popupContent.empty().removeClass('breaking').append(content);
		  if (breaking) popupContent.addClass('breaking');
		  popup.position(item, settings);
		  $(window).bind('resize', function() {
			if (timer) clearTimeout(timer);
			timer = setTimeout(function() {
			  popup.position(item, settings);
			}, 100);
		  });
	  }
    };
    return false;
  });
  $('#fp-news').mouseout(function() {
    if ($('#fp-news').is(':visible')) {
	    $('#fp-news').fadeOut('fast');
	    $(window).unbind('resize');
	    if ($.browser.msie && $.browser.version.substr(0,1) == 6) $('select').css('visibility', 'visible')
    };
    return false;
  });
});

