/**
 * @author Naomi Suzuki
 */
/*
document.observe("dom:loaded", function(){
  var page = new Page();
});*/

  $(document).ready(function() {
    initNews();
  });
 
 
  function initNews(){
    $.ajax({
      url: contextPath+ "/ajax/twitter-feed.php",
      success: onSuccess,
      dataType: 'json'
    });
  };

  function onSuccess(news){

    var html = "";
    var count = 2;
    $.each(news,function(){
      if(count==0)return false;
      html+="<span>"+this.created_at.split(" +")[0]+"</span><h5>"+this.text+"</h5>";
      if(count-1!=0)html+="<br />";
      count--;
    });

    $("#loading-news").html("NEWS");
    $("<p style='display:none' />").html(html).appendTo($("#news")).show('slide');

 }
