// JavaScript Document
function autoSave(){
   ColdFusion.Ajax.submitForm("proposal_builder", "proposal_builder_draft.cfm",setSaveTime);
   autoSaveEvery(120000);
}
function autoSaveEvery(ms) {
   var timeout=setTimeout("autoSave()",ms);
}
function setSaveTime(res) {
   if (res) {
      document.getElementById('savedAt').innerHTML = 'Autosaved at ' + nowFormated();
   }
}
function nowFormated(){
   var now = new Date();
   var ampm = "AM";
   var hour = new Number(now.getHours());
   if (hour > 12) {
      ampm = "PM";
      hour = hour - 12;
   } else if (hour == 0) {
      hour = 12;
   }
   var minutes = new Number(now.getMinutes());
   if (minutes <= 9) {
      minutes = "0" + minutes;
   }
   return hour + ":" + minutes + " " + ampm;
}

