// containerdiv: this is the div to scroll
// contentdiv: this contains the feed
// uri: uri of the rss-feed
// direction: "left", "right", "up" or "down"
// speed: 1 = slow, 2 = no so slow, ...
function insertFeed(containerdiv, contentdiv, uri, direction, speed) {
    jQuery.getFeed({
        url: '/parse_rss.php?url=' + encodeURI(uri),
        success: function(feed) {
            var html = '';
            for(var i = 0; i < feed.items.length; i++) {
              var item = feed.items[i];
	      if ((direction == 'up') || (direction == 'down')) {
	        html += '<div class="feed_entry">';
	      }
	      html += ''
                + '<a href="'
                + item.link
                + '" target="_blank">'
                + item.title
                + '</a>';
	      if ((direction == 'up') || (direction == 'down')) {
                html += '<div class="feed_description">'
                + item.description
                + '</div>';
	        html += '</div>';
	      }
	      else {
		 html += ' +++ ';
	      }
            }
            $('#'+contentdiv).append(html);
        }
    });
    $(document).ready(function(){
      if ((direction == 'left') || (direction == 'right')) {
        $('#'+contentdiv).css('white-space', 'nowrap');
      }
      $jScroller.add('#'+containerdiv, '#'+contentdiv, direction, speed, true);
      $jScroller.start();
    });
}


