var news = function (target) {
  var that = {
    list: [],
    target: target,
    get: function (json) {
           if (json.result === 'okay') {
             that.list = json.news;
             that.setList();
           }
         },
    setList: function () {
               var contents = '';
               that.list.each(function (row) {
                 contents += '<p><span class="date">' + row.news_date + '</span>&nbsp;&nbsp;';
                 if (row.link) {
                   if (row.is_popup - 0 === 1) {
                     contents += '<a href="' + row.link + '" '
                              +  'onclick="window.open(\'' + row.link + '\', \'\', \'menubar=1,toolbar=1,width=760,height=500,scrollbars=1,location=1,resizable=1\');'
                              +  ' return false;">'
                              ;

                   }
                   else {
                     contents += '<a href="' + row.link + '">';
                   }
                 }
                 contents += row.news_text;
                 if (row.link) {
                   contents += '</a>';
                 }
                 contents += '</p>';

               });
               $(that.target).update(contents);
             }
  };
  return that;
};
var newsObj = new news('news');
function callback(json) {
  newsObj.get(json);
}
document.observe('dom:loaded', function(){
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.src = 'http://www2.murakami-kinen.or.jp/news_data/news.php';
  document.body.appendChild(script);
});
