<?php
function sitemodule_form_alter($form_id, &$form) {
  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) { 
    //set this to the type of content you want to publish on
    switch($form['type']['#value']){
      case 'content-session':
        $form['field_start_date'][0]['value']['#attributes'] = array('class' => 'jscalendar');
        $form['#jscalendar_ifFormat'] = '%Y-%m-%d';
        $form['#jscalendar_showsTime'] = 'false';
        break;
      case 'content-agenda':
        $form['field_start_date'][0]['value']['#attributes'] = array('class' => 'jscalendar');
        $form['field_end_date'][0]['value']['#attributes'] = array('class' => 'jscalendar');
        $form['#jscalendar_ifFormat'] = '%Y-%m-%d';
        $form['#jscalendar_showsTime'] = 'false';
        break;
    }
  }
}
  
function sitemodule_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if ($node->type == 'content-session') {
    switch ($op) {
      case 'validate':
        break;
      case 'submit':
        $hh = ($node->field_start_time_hour[0]['value'] == '12') ? 0 : (int)$node->field_start_time_hour[0]['value'];
        $hh = ($node->field_start_time_ampm[0]['value'] == 'pm') ? $hh + 12 : $hh;
        $hh = ($hh < 10) ? "0$hh" : "$hh";
        $mm = $node->field_start_time_minutes[0]['value'];
        $node->field_start_time[0]['value'] = $node->field_start_date[0]['value'] 
            . 'T' . $hh . ':' . $mm . ':00';
            
        $hh = ($node->field_end_time_hour[0]['value'] == '12') ? 0 : (int)$node->field_end_time_hour[0]['value'];
        $hh = ($node->field_end_time_ampm[0]['value'] == 'pm') ? $hh + 12 : $hh;
        $hh = ($hh < 10) ? "0$hh" : "$hh";
        $mm = $node->field_end_time_minutes[0]['value'];
        $node->field_end_time[0]['value'] = $node->field_start_date[0]['value'] 
            . 'T' . $hh . ':' . $mm . ':00';
            
        drupal_set_message('Start time updated to: '.$node->field_start_time[0]['value']);
        drupal_set_message('End time updated to: '.$node->field_end_time[0]['value']);
        break;
    }
  }
}
?>