    var noteid="";
    var dsNotes = new Spry.Data.XMLDataSet(spryhost+"FetchNotes","notes/note",{useCache:false});
    var ds1Note = new Spry.Data.XMLDataSet(spryhost+"Fetch1Note&noteid="+noteid,"notes/note",{useCache:false});
    
    function addNewNote(frm) {
      if (!CheckRequired(document.getElementById('note'), '', 'You must enter the note text')) return false;
      var formData = encodeURI(frm);
      var txtNote = document.getElementById('note').value;
      Spry.Utils.loadURL('POST', spryhost + "AddNote", true, null, {postData: "note=" + txtNote, headers: {"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}});
      if ((pageName == 'cp/notes') || (pageName == 'control_panel')) setTimeout("refreshNotes()", 500);
      document.getElementById('notepop').style.display = 'none';
      document.getElementById('note').value='';
      return false;
    }
    
    function setUpNoteBox(hideshow) 
    {
      if (hideshow == "show") 
      {
        document.getElementById('notepop').style.display = 'block';
        document.getElementById('note').focus();
      } 
      else 
      {
        document.getElementById('notepop').style.display = 'none';    
      }
    }
    
    function setUpEditNote(hideshow,noteid) {
      if (noteid == "") return false;
      if (hideshow == "show") 
      {
        ds1Note.setURL(spryhost + "Fetch1Note&noteid=" + noteid);
        ds1Note.loadData();
        setTimeout("show('editNote')", 250);
      } 
      else 
      {
        document.getElementById('editNote').style.display = 'none';    
      }
    }

    function refreshNotes() {
      dsNotes.setURL(spryhost + "FetchNotes");
      dsNotes.loadData();
    }
    
    function deleteNote() {
      Spry.Utils.loadURL('POST', spryhost + "DeleteNote", true, null, {postData: "noteid=" + noteid, headers: {"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}});
      setTimeout("refreshNotes()", 500);
    }

    function funcEditNote(frm) {
      var formData = encodeURI(frm);
      var txtNote = document.getElementById('editnotedesc').value;
      if (txtNote!=null && txtNote!="") 
      {
        var txtNote = document.getElementById('editnotedesc').value;
        var txtID = document.getElementById('editnoteid').value;
        Spry.Utils.loadURL('POST', spryhost + "EditNote", true, null, {postData: "noteid=" + txtID + "&note=" + txtNote, headers: {"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}});
        setTimeout("refreshNotes()", 500);
        document.getElementById('editNote').style.display = 'none';
        document.getElementById('editnotedesc').value='';
      }
      return false;
    }
