Dialog Issue

Dialog Issue

I'm new to using JQuery and JQuery UI. I've implemented a dialog form
that allows for a time block selection once a date is clicked on a php
calendar that i created. The issue I'm having is if I click on a date
and then click on the cancel button in the dialog, then click on
another date, the dialog will not open again after the first instance
is closed. Below is my code. Help!!
function selectTime()
{
        var startTime = "",
             endTime = "",
             myvars = "";
        $("#dlg_time").dialog(
        {
            bgiframe: true,
            height: 250,
            width: 400,
            modal: true,
            buttons: {
                'Select Time': function()
                {
                    mytime = $("input[@name=time]:checked").val(),
                    myvars = mytime.split("-");
                    $("#start_time").val(myvars[0]);
                    $("#end_time").val(myvars[1]);
                    $(this).dialog('close');
                },
                Cancel: function()
                {
                    $(this).dialog('close');
                }
            },
        });
}
--