// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
var dirty = false;
function init() {
  document.body.onchange = function() {
    // This doesn't work in IE
    dirty = true;
  }
  document.body.onclick = function( e ) {
    if( dirty &&
        ( e.target.nodeName=='A' || e.target.parentNode.nodeName == 'A' ))
    {
      if( ! confirm(
          "You've made changes on this page.  Are you sure you\n" +
          "want to leave without saving and lose these changes?" ) )
      {
        return false;
      }
    }
  }
}
