var Ticker = new Class({initialize:function(a, b) {
  if(this.a = $(a)) {
    this.a.getElement("ul").empty();
    (new Request.JSON({url:b, method:"get", onComplete:this.hi.bind(this)})).send()
  }
}, hi:function(a) {
  if(!($type(a) === false || a.length === 0)) {
    this.a.removeClass("loading");
    $A(a).each(function(b) {
      (new Asset.image(b.image));
      var c = new Element("li");
      (new Element("a", {href:b.link, title:b.title, html:b.title})).inject(c);
      c.data = b;
      c.inject(this.a.getElement("ul"));
      c.addEvent("mouseenter", function() {
        this.si(c, true)
      }.bind(this)).addEvent("mouseleave", function() {
        this.dsi(c)
      }.bind(this))
    }, this);
    this.ni();
    this.rp()
  }
}, ni:function() {
  if($type(this.c) === false || this.c < 0 || this.c >= this.a.getElements("li").length)this.c = 0;
  this.si(this.a.getElements("li")[this.c]);
  this.c += 1
}, si:function(a, b) {
  $type(b) !== false && this.pp();
  this.a.getElement("div.teaser").empty();
  (new Element("a", {html:a.data.title, "class":"title " + a.data.section, title:a.data.title, href:a.data.link})).inject(this.a.getElement("div.teaser"));
  (new Element("img", {src:a.data.image.replace("demo.", "")})).inject(this.a.getElement("div.teaser"));
  var c = new Element("div", {text:a.data.teaser, "class":"body"});
  (new Element('hr')).inject(c);
  (new Element('a', {href:a.data.link, text: (a.data.comments > 0 ? a.data.comments + ' ' + (a.data.comments == 1 ? a.data.text.comment : a.data.text.comments) + ' | ' : '') + a.data.text.more, 'class': 'comments'})).inject(c);
  c.inject(this.a.getElement("div.teaser"));
  this.a.getElements("li").each(function(e) {
    e.set('class', '');
  });
  a.addClass("active").addClass(a.data.section);
}, dsi:function() {
  this.c -= 1;
  this.ni();
  this.rp()
}, pp:function() {
  $clear(this.b)
}, rp:function() {
  this.b = this.ni.periodical(5E3, this)
}});
