Index: advpoll.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/advpoll.js,v
retrieving revision 1.4
diff -r1.4 advpoll.js
26a27,41
> 
>     function updateStartDate() {
>       if ($("#edit-settings-usestart").attr("checked")) {
>         $(".edit-settings-startdate").show();
>         $("#edit-settings-startdate-year").removeAttr("disabled");
>         $("#edit-settings-startdate-month").removeAttr("disabled");
>         $("#edit-settings-startdate-day").removeAttr("disabled");
>       }
>       else {
>         $(".edit-settings-startdate").hide();
>         $("#edit-settings-startdate-year").attr("disabled", "disabled");
>         $("#edit-settings-startdate-month").attr("disabled", "disabled");
>         $("#edit-settings-startdate-day").attr("disabled", "disabled");
>       }
>     }
54a70,73
> 
>     // Disable starting date if necessary
>     updateStartDate();
>     $("#edit-settings-usestart").click(updateStartDate);
59c78
<     
---
> 
Index: advpoll.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/advpoll.module,v
retrieving revision 1.42
diff -r1.42 advpoll.module
115c115,116
<   $result = db_query('SELECT d.nid FROM {advpoll} d INNER JOIN {node} n ON d.nid = n.nid WHERE (n.created + d.runtime) < '. time() .' AND d.active = 1 AND d.runtime != 0');
---
>   $sql = 'SELECT p.nid FROM {advpoll} p INNER JOIN {node} n ON p.nid = n.nid WHERE ((p.startdate IS NULL AND (n.created + p.runtime) < '. time() .') OR (p.startdate IS NOT NULL AND (p.startdate + p.runtime) < ' . time() . ')) AND p.active = 1 AND p.runtime != 0';
>   $result = db_query($sql);
272a274,311
>   $form['settings']['usestart'] = array(
>     '#type' => 'checkbox',
>     '#title' => t('Use start date'),
>     '#description' => t('Specify a date that the poll opens.'),
>     '#default_value' => (isset($node->startdate)? TRUE :
>       ($form_values['startdate']? $form_values['startdate'] : FALSE)),
>   );
> 
> /*
>   $form['settings']['startdate'] = array(
>     '#type' => 'textfield',
>     '#title' => t('Starting date'),
>     '#description' => t('Date that the poll opens'),
>     '#attributes' => array('class' => 'jscalendar'),
>     '#default_value' => format_date($node->startdate? $node->startdate : time()),
>   );
>   */
> 
>   $date = $form_values['startdate']? $form_values['startdate'] :
>     $node->startdate? $node->startdate : time();
> 
>   $form['settings']['startdate'] = array(
>     '#prefix' => '<div class="edit-settings-startdate">',
>     '#suffix' => '</div>',
>     '#type' => 'date',
>     '#title' => t('Starting date'),
>     '#description' => t('Date that the poll opens'),
>     '#default_value' => array('year' => date('Y', $date), 'month' => date('m', $date), 'day' => date('d', $date)),
>   );
> 
>   $form['settings']['startdatejs'] = array(
>     '#type' => 'hidden',
>     '#default_value' => $date,
>     '#attributes' => array('class' => 'jscalendar'),
>   );
> 
> 
> 
278c317
<     '#description' => t('After this period, the poll will be closed automatically.')
---
>     '#description' => t('After this period, the poll will be closed automatically. This is relative to the start date if it is specified, otherwise the date the poll was created.')
756c795,804
<   db_query("UPDATE {advpoll} SET active=%d, runtime=%d, maxchoices=%d, algorithm='%s', uselist=%d, showvotes=%d WHERE nid = %d", $node->settings['active'], $node->settings['runtime'], $node->settings['maxchoices'], $node->settings['algorithm'], $node->settings['uselist'], $node->settings['showvotes'], $node->nid);
---
>   db_query("UPDATE {advpoll} SET active=%d, runtime=%d, maxchoices=%d, algorithm='%s', uselist=%d, showvotes=%d, startdate=%s WHERE nid = %d",
>     $node->settings['active'],
>     $node->settings['runtime'],
>     $node->settings['maxchoices'],
>     $node->settings['algorithm'],
>     $node->settings['uselist'],
>     $node->settings['showvotes'],
>     $node->settings['usestart']? _advpoll_create_startdate($node): 'NULL',
>     $node->nid);
> 
760a809,816
> function _advpoll_create_startdate($node) {
>   list($hour, $min) = explode(':', date('h:m', time()));
>   return mktime($hour, $min, 0,
>       $node->settings['startdate']['month'],
>       $node->settings['startdate']['day'],
>       $node->settings['startdate']['year']);
> }
> 
791,792c847,853
<   db_query("INSERT INTO {advpoll} (nid, mode, uselist, active, runtime, maxchoices, algorithm, showvotes) VALUES (%d, '%s', %d, %d, %d, %d, '%s', %d)",
<     $node->nid, $mode, $node->settings['uselist'], $node->settings['active'], $node->settings['runtime'], $node->settings['maxchoices'], $node->settings['algorithm'], $node->settings['showvotes']);
---
>   db_query('INSERT INTO {advpoll} (nid, mode, uselist, active, runtime, '
>     . 'maxchoices, algorithm, showvotes, startdate)'
>     . ' VALUES (%d, "%s", %d, %d, %d, %d, "%s", %d, %s)',
>     $node->nid, $mode, $node->settings['uselist'], $node->settings['active'],
>     $node->settings['runtime'], $node->settings['maxchoices'],
>     $node->settings['algorithm'], $node->settings['showvotes'],
>     $node->settings['usestart']? _advpoll_create_startdate($node): 'NULL');
