<?php

if (!defined('PARENT') || !isset($mswPick['time'])) { exit; }

/* DATE PICKER
------------------------------------------*/

?>
<script src="content/js/plugins/jquery.datepicker.js"></script>
<script src="content/js/plugins/i18n/datepicker.<?php echo $mswPick['lang']; ?>.js"></script>
<script>
//<![CDATA[
jQuery(function() {
  jQuery('.mswdatepicker').datepicker({
    autoClose  : true,
    <?php
    // Show selected month / year
    // Highlighting doesn't appear to work for selectDate. Bug maybe?
    if (isset($airCFG['y'], $airCFG['m'], $airCFG['d'])) {
    ?>
    selectDate : new Date(<?php echo $airCFG['y'] . ', ' . ($airCFG['m'] == '01' ? '0' : ltrim(($airCFG['m']-1), '0')) . ', ' . ltrim($airCFG['d'], '0'); ?>),
    startDate  : new Date(<?php echo $airCFG['y'] . ', ' . ($airCFG['m'] == '01' ? '0' : ltrim(($airCFG['m']-1), '0')) . ', ' . ltrim($airCFG['d'], '0'); ?>),
    <?php
    }
    if (isset($mswPick['skipolder'])) {
    ?>
    minDate    : new Date(<?php echo date('Y', $DT->ts()) . ', ' . (date('j', $DT->ts()) == '1' ? '0' : ltrim((date('m', $DT->ts())-1), '0')) . ', ' . ltrim(date('d', $DT->ts()), '0'); ?>),
    <?php
    }
    ?>
    dateFormat : '<?php echo $SETTINGS->calformat; ?>',
    firstDay   : <?php echo ($SETTINGS->weekstart == 'sun' ? 0 : 1); ?>,
    language   : '<?php echo $mswPick['lang']; ?>',
    timepicker : <?php echo $mswPick['time']; ?>,
    timeFormat : 'hh:ii'
  });
});
//]]>
</script>