  var dp_count = 0;
  function ajaxDayPlanner(action, type, id, sid, subtype, exbtnid, ob)
  {
   var tickbox = ob;
   var request_uri = '/siteapp/ajax/' + exbtnid + ';dayplanner?action=' + action + '&type=' + type + '&sid=' + sid + '&item_id=' + id + '&subtype=' + subtype;

   $('followmouse').show(); // Show the 'updating day planner' div that follows the mouse
   // Set the curosr style to the hourglass
   document.body.style.cursor = 'wait';
   $$('input').each(function(e){e.style.cursor='wait'});
   // Track how many times we have been called. Then we know when reset the hourglass and hide the 'update ay planner' div.
   dp_count++;

   new Ajax.Request(request_uri,
    {
     method:'get',
     onSuccess: function(transport){
      dp_count--;
      if( !dp_count ) reset_ajax_feedback();

      if( transport.responseText.match(/OK/) ) {
       // Nothing to do.. ?
      }
      else {
       var is_error = transport.responseText.substr(0,6);
       var err_mess = transport.responseText.substr(6);
       if( is_error == 'ERROR|' ){
        alert(err_mess);
       }
       else {
        alert('Day Planner update failed.');
       }
       undo_click(tickbox);
      }
     },
     onFailure: function(){
      //var row_id = listname+'_row';
      //var tablerows  = document.getElementById(row_id);
      //var cellstohide = tablerows.getElementsByTagName("td");
      //for (var i=0; i<cellstohide.length; i++){
      //  cellstohide[i].style.display = "none";
      //}
      alert('AJAX request failed');
      reset_ajax_feedback();
      undo_click(tickbox);
     }
    });
  }

  function reset_ajax_feedback()
  {
   document.body.style.cursor = 'auto';
   $$('input').each(function(e){e.style.cursor='auto'});
   $('followmouse').hide();
  }
  

 function undo_click(ob)
 {
  ob.checked = ob.checked ? false : true;
 }

 function dp( ob, type, sid, id, subtype, exbtnid )
 {
  //alert(ob + ':' + type + ':' + sid + ':' + id + ':' + subtype + ':' + exbtnid);
  var action = 'del';
  if( ob.checked )
   action = 'add';
  var dpaction = ajaxDayPlanner(action, type, id, sid, subtype, exbtnid, ob);
  return;
 }


