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

Event.addBehavior.reassignAfterAjax = true;

Event.addBehavior({
   'div.pagination a' : Remote.Link
   })

var confirm_destroy = function(event, options) {
  if (confirm("Are you sure that you want to delete this item?")) {

    var newHash = new Hash();
    newHash.set("_method", "delete");
    newHash.set(options.token_name, options.token_value);
    newHash.set('page', options.page); 

    var post_content = { 
      method : "post",
      parameters : newHash
    };
    new Ajax.Request(options.action, post_content);
 }

 Event.stop(event);
 return false;

}; 


var confirm_destroy_all_completed = function(event, options) {
  if (confirm("Are you sure that you want to delete all completed snipes?  This will clear all snipes which have ended from your history.")) {

    var newHash = new Hash();
    newHash.set(options.token_name, options.token_value);
    newHash.set('page', options.page); 

    var post_content = { 
      method : "post",
      parameters : newHash
    };
    new Ajax.Request(options.action, post_content);
 }

 Event.stop(event);
 return false;

}; 
