﻿function SetDatePicker(controlToUse, prefillToday, allowPastDates, dateFormat, firstDayOfWeek)
{
    Date.firstDayOfWeek = firstDayOfWeek;
    Date.format = dateFormat;
    $(function()
    {
        startDate = null;
        if (allowPastDates == true)
        {
            startDate = '01/01/1990';
        }
        
        $('#' + controlToUse).datePicker({displayClose:true, startDate:startDate});
        
        if (prefillToday == true)
        {
            $('#' + controlToUse).datePicker().val(new Date().asString()).trigger('change');
        }
    });
}