Event.observe(window, 'load', init);
var feed  = LikeJsonFeed["news"];

function init(){
  feed.entry.each(function(item){
    item.body = item.body.gsub(/\n/, '<br />');
    item.body = auto_link(item.body);
    item.image = item.image == '' ? '' : '<img src="'+ item.image +'" alt="" />'
    new Insertion.Bottom('news', templ.evaluate(item));
  })
}

function auto_link(text) {
  return text.gsub(/(https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/, function(match) { 
    return '<a href="'+match[0]+'">'+match[0]+'</a>'
  });
}

