/*
 * WNCOutdoors.info Comments

 * This script is free and unencumbered software released into the
 * public domain. It comes without any restrictions on what you may
 * do with it, and with no warranty whatsoever. Assume nothing works,
 * and you may be pleasantly surprised; and when it breaks, you get
 * to keep both pieces.
 * @requires: prototype.js
*/
( function( WNCO, $, undefined ) {
  WNCO.Comments = {
    
    params: {}, // This gets filled by calling page.
    
    addComment: function( event ){
      $('comment-button').disabled = true;
      var url = [ 'http:/', WNCO.cfg.hostname, 'data', WNCO.Comments.params.type, WNCO.Comments.params.id, 'comments' ].join( '/' );
      new Ajax.Request( url, {
        method: 'post',
        parameters: $('comment-form').serialize()
      });
      $('comment-status').update('Comment submitted. Please allow a few moments to process ' +
                                 'for comment to appear (refresh page).');
      $('comment-form').remove();
      Event.stop( event );
    }
  }; // Public
}( window.WNCO = window.WNCO || {}, $ ) );

