var LYS_STATEMENT_ITEM_CONTAINER = ".series";
var LYS_SUMMARY_CONTAINER = ".statement";
var LYS_FULL_CONTENT_CONTAINER = ".full_content";
var LYS_READ_MORE_CLASS = ".more";
var LYS_HIDE_LINK_TEXT = "<br />hide";

var LysNewsItem = Class.create({
  initialize: function(element) {
    this.element = element;
	this.summary = element.down(LYS_SUMMARY_CONTAINER);
    this.full_content = element.down(LYS_FULL_CONTENT_CONTAINER);
	
    var show_link;
    if (this.summary && (show_link = this.summary.down(LYS_READ_MORE_CLASS)))
    {
      show_link.observe("click", this.show_full_content.bindAsEventListener(this));
    }

    if (this.full_content)
    {
      var hide_link = new Element("a", { href: '#', 'class': 'hide' }).update(LYS_HIDE_LINK_TEXT);
      hide_link.observe("click", this.hide_full_content.bindAsEventListener(this));
      this.full_content.appendChild(hide_link);
      this.full_content.hide();
    }
  },
  
  show_full_content: function(event) {
    this.summary.hide();
    this.full_content.show();
    event.stop();
  },
  
  hide_full_content: function(event) {
    this.full_content.hide();
    this.summary.show();
    event.stop();
  }
});

function lys_statement_init(container)
{
  var elements = null;
  if (container)
  {
    elements = $(container).select(LYS_STATEMENT_ITEM_CONTAINER);
  }
  else
  {
    elements = $$(LYS_STATEMENT_ITEM_CONTAINER);
  }
  
  if (elements)
  {
    elements.each(function(el) { new LysNewsItem(el); });
  }
}