
function initFeed(feedId) {
    
    var feedBlock = $('#' +feedId);
    var itemBlocks = $('.rss-item-block', feedBlock);
    
    itemBlocks
    .mouseover(
	function(e) {
	    var rssItemContent = $('.rss-item-content', this);

	    var position = $(this).position();
	    var top = position.top + $(this).height();
	    rssItemContent.show();
	    
	    rssItemContent.css('top', top);
	    var rssItemHeight = rssItemContent.height()
	    var windowHeight = $(window).height()
	    
	    if(windowHeight - e.clientY < rssItemHeight + 30) {

		top = position.top - rssItemHeight-5;
		rssItemContent.css('top', top);
	    }

	    $('.rss-item-title', this).addClass('rss-item-title-active');
	}
    )
    .mouseout(
    	function() {
	   $('.rss-item-content', this).hide();
	   $('.rss-item-title', this).removeClass('rss-item-title-active');

	}
    );

    var feedNavigation = $('.feed-navigation', feedBlock);
    
    $('.page', feedNavigation).each(function() {
	$(this).click(function() {
	
	    $.get($(this).attr('href'), function(response) {
		
		feedBlock.html(response);
	    });
	    return false;
	});
    });

    var vote = $('.vote', feedBlock);

    $('a', vote).each(function() {
	$(this).click(function() {

	    var loginLink = $('#loginLink');
	    if(loginLink.size()) {
		loginLink.click();
		return false;
	    }
	    var a  = $(this);

	    $.get(a.attr('href'), function(response) {
		
		if(response) {
		    var voteCont = a.parents('.vote');
		    $('.num', voteCont).html(response);
		}
		
	    });
	    return false;
	});
    });
    
}
