function planner_drag_birthdays(){
  var $list = $('#planner_items'),
  $mail_icon = $('.button-compose');

  $("li.drag_birthday", $list).draggable({
    cancel: "a.ui-icon",
    revert: "invalid",
    containment: "window",
    scroll: false,
    helper: "clone",
    cursor: "move",
    appendTo: '#planner_drag_list',
    zIndex: 999999
  });
  
  $mail_icon.droppable({
    accept: "#planner_items_list > li.drag_birthday",
    activeClass: "ui-state-highlight",
    tolerance: "touch",
    drop: function(event,ui){
      var bd = new Date(ui.draggable.find('.time').next().val()).getTime() + 3600000 * 7;
      bd = Math.round(bd / 1000);
      if(new Date(bd * 1000) < new Date()){
        bd = new Date(bd * 1000);
        bd = new Date((bd.getMonth() + 1) + '/' + bd.getDate() + '/' + (bd.getFullYear() + 1) + ' 08:00:00').getTime();
        bd = Math.round(bd / 1000);
      }
      var append = '&_date=' + bd;
      var email = ui.draggable.find('.drag_email').val();
      var oldtask = rcmail.env.task;
      rcmail.env.task='mail';
      if(rcmail.env.compose_newwindow){
        composenewwindowcommandcaller('compose', email + '?subject=' + rcmail.gettext('planner.happybirthday') + append, this);
      }
      else{
        rcmail.command('compose', email + '?subject=' + rcmail.gettext('planner.happybirthday') + append, this);
      }
      $('#planner_help').hide();
      rcmail.env.task = oldtask;
    }
  });
}