//<!--

var wlcp=wlcp||{};

wlcp.Comments = {
  init:function()
  {
    $('commentForm').hide();
    $('addCommentForm').onsubmit = wlcp.Comments.onsubmit;
    $$('a[name=commentControl]').each(wlcp.Comments.attachOnclick);
  },
  attachOnclick:function(o, i)
  {
    o.onclick = wlcp.Comments.onclick;
  },
  onclick:function()
  {
    Effect.toggle('commentForm', 'slide');
    return false;
  },
  onsubmit:function()
  {
    new Ajax.Updater(
      $$('.CommentControl')[0],
      '/comment/save',
      {
        asynchronous: true,
	parameters: Form.serialize(this)
      }
    );
    return false;
  }
}


wlcp.Guestbook = {
  init:function()
  {
    $('guestbookForm').hide();
    $('addGuestbookForm').onsubmit = wlcp.Guestbook.onsubmit;
    $$('a[name=guestbookControl]').each(wlcp.Guestbook.attachOnclick);
  },
  attachOnclick:function(o, i)
  {
    o.onclick = wlcp.Guestbook.onclick;
  },
  onclick:function()
  {
    Effect.toggle('guestbookForm', 'slide');
    return false;
  },
  onsubmit:function()
  {
    new Ajax.Updater(
      $$('.GuestbookControl')[0],
      '/guestbook/save',
      {
        asynchronous: true,
	parameters: Form.serialize(this)
      }
    );
    return false;
  }
}

//-->
