Form Observer help

Form Observer help

I found this code on google.  I want to  watch a form for changes.  If changes are made and user navigates away from the form, I want to popup a warning.  If user clicks submit I want to process the form as usual.  Currently the former is working find, but I also get a warning on submit.  Here is a demo site...   https://q3ait.org/js/testobserver.html

Here is the js code...
  1. /**
  2.  *  jquery.popupt
  3.  *  (c) 2008 Semooh (http://semooh.jp/)
  4.  *
  5.  *  Dual licensed under the MIT (MIT-LICENSE.txt)
  6.  *  and GPL (GPL-LICENSE.txt) licenses.
  7.  *
  8.  **/
  9. (function($){
  10.   $.fn.extend({
  11.     FormObserve: function(opt){
  12.       opt = $.extend({
  13.         changeClass: "changed",
  14.         filterExp: "",
  15.         msg: "Unsaved changes will be lost.\nReally continue?"
  16.       }, opt || {});

  17.       var fs = $(this);
  18.       fs.each(function(){
  19.         this.reset();
  20.         var f = $(this);
  21.         var is = f.find(':input');
  22.         f.FormObserve_save();
  23.         setInterval(function(){
  24.           is.each(function(){
  25.             var node = $(this);
  26.             var def = $.data(node.get(0), 'FormObserve_Def');
  27.             if(node.FormObserve_ifVal() == def){
  28.               if(opt.changeClass) node.removeClass(opt.changeClass);
  29.             }else{
  30.               if(opt.changeClass) node.addClass(opt.changeClass);
  31.             }
  32.           });
  33.         }, 1);
  34.       });

  35.       function beforeunload(e){
  36.         var changed = false;
  37.         fs.each(function(){
  38.           if($(this).find(':input').FormObserve_isChanged()){
  39.             changed = true;
  40.             return false;
  41.           }
  42.         });
  43.         if(changed){
  44.           e = e || window.event;
  45.           e.returnValue = opt.msg;
  46.  return opt.msg;
  47.         }
  48.       }
  49.       if(window.attachEvent){
  50.           window.attachEvent('onbeforeunload', beforeunload);
  51.       }else if(window.addEventListener){
  52.           window.addEventListener('beforeunload', beforeunload, true);
  53.       }
  54.     },
  55.     FormObserve_save: function(){
  56.       var node = $(this);
  57.       if(node.is('form')){
  58.         node.find(':input').each(function(){
  59.           $(this).FormObserve_save();
  60.         });
  61.       } else if(node.is(':input')){
  62.         $.data(node.get(0), 'FormObserve_Def', node.FormObserve_ifVal());
  63.       }
  64.     },
  65.     FormObserve_isChanged: function(){
  66.       var changed = false;
  67.       this.each(function() {
  68.         var node = $(this);
  69.         if(node.eq(':input')){
  70.           var def = $.data(node.get(0), 'FormObserve_Def');
  71.           if(typeof def != 'undefined' && def != node.FormObserve_ifVal()){
  72.             changed = true;
  73.             return false;
  74.           }
  75.         }
  76.       });
  77.       return changed;
  78.     },
  79.     FormObserve_ifVal: function(){
  80.       var node = $(this.get(0));
  81.       if(node.is(':radio,:checkbox')){
  82.         var r = node.attr('checked');
  83.       }else if(node.is(':input')){
  84.         var r = node.val();
  85.       }
  86.       return r;
  87.     }
  88.   });
  89. })(jQuery);