// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


// Ajax pagination - Batch added for enabling ajax pagination with will_paginate
// Reference link: http://wiki.github.com/mislav/will_paginate/ajax-pagination
// Non-Ajax version - <%= will_paginate @posts %>
// Ajax version - <%= will_paginate @posts, :class => 'pagination ajax' %>

document.observe("dom:loaded", function() {
  // the element in which we will observe all clicks and capture
  // ones originating from pagination links
  var container = $(document.body)

  if (container) {

    container.observe('click', function(e) {
      var el = e.element()
      if (el.match('.pagination.ajax a')) {
        new Ajax.Request(el.href, { method: 'get' })
        e.stop()
      }
    })
  }
})