/**
 * Blit Enter Submit plugin 1.0
 *
 * Copyright (c) 2008 Blit, Inc (http://blit.com/)
 * MIT license (blit.com/licenses/mit.html)
 */

/*
var BlitEnterSubmit = {
  queue: [],
  process_queue: function() {
    var element_info = this.queue.pop();
    if (!element_info) return;
    $element = $(element_info.element);
    if ($element.val()==element_info.value) $element.parents('form:first')[0].submit();
  }
}
*/

jQuery.fn.enter_submit = function() {
  this.each(function(){
    $this = $(this);
    if ($this.is('form')) {
      $this.find('input').keyup(function(e){
        if (e.keyCode == 13) {
            //BlitEnterSubmit.queue.push({element:this,value:$(this).val()});
            //setTimeout('BlitEnterSubmit.process_queue();',1000);
            $(this).parents('form:first')[0].submit();
            return false;
        }
      });
    }
  });
  return this;
}
    
