/**
  *
  * @param <type> $fnUserId
  * @param <type> $wmCalendarName
  * @param <type> $wmEventContainer
  * @param <type> $updateDate
  * @param <type> $accountOffset
  * @return <type> 
  */
 private function ConvertWMToFunambolEventContainer($fnUserId, $wmCalendarName, &$wmEventContainer, $updateDate = FALSE, $accountOffset = 0)
 {
     $fnEventContainer = new FunambolEventContainer();
     $fnEventContainer->SetValue('id', $wmEventContainer->GetValue('FunambolEventId'));
     $fnEventContainer->SetValue('userid', $fnUserId);
     if ($updateDate) {
         $wmDateModified = $wmEventContainer->GetValue('eventLastModified');
         // as 2000-12-31 23:59:59 -pseudo-GMT
         $wmTimestampModified = strtotime($wmDateModified);
         $fnTimestampModified = $wmTimestampModified + date('Z');
         // as seconds from Epoch in localtime
         $fnEventContainer->SetValue('last_update', "" . $fnTimestampModified . "111");
     } else {
         $fnEventContainer->SetValue('last_update', "" . time() . "222");
     }
     if ($wmEventContainer->GetValue('eventIsDeleted')) {
         $fnEventContainer->SetValue('status', FUNAMBOL_STATUS_DELETED);
     } else {
         $fnEventContainer->SetValue('status', FUNAMBOL_STATUS_UPDATED);
     }
     //		$fnEventContainer->SetValue('type'] = 1)
     $fnEventContainer->SetValue('all_day', $wmEventContainer->GetValue('eventAllDay'));
     $fnEventContainer->SetValue('body', $wmEventContainer->GetValue('eventText'));
     //		$fnEventContainer->SetValue('busy_status'] = 2;
     //		$fnEventContainer->SetValue('categories'] = '';
     //		$fnEventContainer->SetValue('companies'] = '';
     //		$this->_container['birthday'] = null;
     //		$fnEventContainer->SetValue('duration'] = 0;
     $fnEventContainer->SetValue('dstart', date("Y-m-d H:i:s", strtotime($wmEventContainer->GetValue('eventTimeFrom')) + $accountOffset * 60));
     $fnEventContainer->SetValue('dend', date("Y-m-d H:i:s", strtotime($wmEventContainer->GetValue('eventTimeTill')) + $accountOffset * 60));
     $fnEventContainer->SetValue('folder', "DEFAULT_FOLDER");
     //\\" . $wmCalendarName);
     //		$fnEventContainer->SetValue('importance'] = 5;
     //		$fnEventContainer->SetValue('location'] = null;
     //		$fnEventContainer->SetValue('meeting_status'] = 0;
     //		$this->_container['mileage'] = 0;
     //		$this->_container['reminder_time'] = null;
     //		$fnEventContainer->SetValue('reminder'] = 0;
     //		$this->_container['reminder_sound_file'] = null;
     //		$fnEventContainer->SetValue('reminder_options'] = 0;
     //		$fnEventContainer->SetValue('reminder_repeat_count'] = 0;
     //		$fnEventContainer->SetValue('sensitivity'] = 0;
     $fnEventContainer->SetValue('subject', $wmEventContainer->getValue('eventName'));
     if ($wmEventContainer->IsEventRepeat()) {
         $internalRepeatForm = $wmEventContainer->GetInternalRepeatForm();
         if (!is_null($internalRepeatForm)) {
             $fnEventContainer->SetValue('rec_interval', $internalRepeatForm->GetValue('repeatOrder'));
             // convert RepeatPeriod into rec_type
             switch ($internalRepeatForm->GetValue('repeatPeriod')) {
                 case 0:
                     // daily
                     $fnEventContainer->SetValue('rec_type', 0);
                     break;
                 case 1:
                     // weekly
                     $fnEventContainer->SetValue('rec_type', 1);
                     $mask = $this->GetMaskFromInternalRepeatForm($internalRepeatForm);
                     $fnEventContainer->SetValue('rec_day_of_week_mask', $mask);
                     break;
                 case 2:
                     // monthly
                     //		$fnEventContainer->SetValue('rec_month_of_year'] = 0;
                     //		$fnEventContainer->SetValue('rec_day_of_month'] = 0;
                     //
                     // each 4-th monday - here is 4-th
                     $fnEventContainer->SetValue('rec_instance', $internalRepeatForm->GetValue('repeatWeekNumber', 'int') + 1);
                     $mask = $this->GetMaskFromInternalRepeatForm($internalRepeatForm);
                     $fnEventContainer->SetValue('rec_day_of_week_mask', $mask);
                     if ($mask > 0) {
                         $fnEventContainer->SetValue('rec_type', 3);
                     } else {
                         $fnEventContainer->SetValue('rec_type', 2);
                     }
                     break;
                 case 3:
                     // yearly
                     //		$fnEventContainer->SetValue('rec_month_of_year'] = 0;
                     //		$fnEventContainer->SetValue('rec_day_of_month'] = 0;
                     //					echo "<br/>&nbsp;&nbsp;repeatWeekNumber=".$internalRepeatForm->GetValue('repeatWeekNumber');
                     // each 4-th monday - here is 4-th
                     $fnEventContainer->SetValue('rec_instance', $internalRepeatForm->GetValue('repeatWeekNumber', 'int') + 1);
                     $mask = $this->GetMaskFromInternalRepeatForm($internalRepeatForm);
                     $fnEventContainer->SetValue('rec_day_of_week_mask', $mask);
                     if ($mask > 0) {
                         $fnEventContainer->SetValue('rec_interval', 12);
                         $fnEventContainer->SetValue('rec_month_of_year', date("m", strtotime($wmEventContainer->GetValue('eventTimeFrom'))));
                         $fnEventContainer->SetValue('rec_type', 6);
                     } else {
                         $fnEventContainer->SetValue('rec_type', 5);
                     }
                     break;
             }
             // switch( repeatPeriod )
             //					echo "<br/>&nbsp;&nbsp;excluded=".$internalRepeatForm->GetValue('excluded');
             $fnEventContainer->SetValue('rec_start_date_pattern', date("Ymd\\THis", strtotime($wmEventContainer->GetValue('eventTimeFrom'))));
             $this->log("<br/>&nbsp;&nbsp;repeatEnd=" . $internalRepeatForm->GetValue('repeatEnd'));
             switch ($internalRepeatForm->GetValue('repeatEnd')) {
                 case 0:
                     // no end date
                     $fnEventContainer->SetValue('rec_no_end_date', 1);
                     break;
                 case 1:
                     // end after N occurences
                     $fnEventContainer->SetValue('rec_occurrences', $internalRepeatForm->GetValue('repeatNum'));
                     break;
                 case 2:
                     // end by DATE
                     //							echo "<br/>&nbsp;&nbsp;repeatUntil=".;
                     $fnEventContainer->SetValue('rec_end_date_pattern', date("Ymd\\THis", strtotime($internalRepeatForm->GetValue('repeatUntil'))));
                     break;
             }
             // switch( repeatEnd )
         }
         // if( event repeat )
     }
     // if( repeat event );
     return $fnEventContainer;
 }