var News = Class ({

  iterator: null,
  data: null,
  active: null,
  
  initialize: function() {
    this.iterator = 0;
    this.data = new Array();
    this.active = 0;
  },
  
  addData: function(title, summary, photo, url) {
    this.data[this.iterator] = new Array();
    this.data[this.iterator]['title'] = title;
    this.data[this.iterator]['summary'] = summary;
    this.data[this.iterator]['photo'] = photo;
    this.data[this.iterator]['url'] = url;
    
    this.iterator++;
  },
  
  change: function(id) {
    var mySummary = $('news-summary'); 
    if (this.data[id]) {
	    mySummary.href = $('news-url').href = this.data[id]['url'];
	    $('news-img').src = this.data[id]['photo'];
	    mySummary.set('text', this.data[id]['summary']);
	    this.active = id;
    }
  },
  
  render: function() {
    this.active++;
    if (this.active > 2) {
      this.active = 0;
    }
    this.change(this.active);
    setTimeout("objNews.render()", 10000); 
  }

});

var objNews = new News();