Datepicker does not open instantly after click

Datepicker does not open instantly after click

I'm trying to figure out why the datepicker opens only after other functions are executed in my "click" event handler.

Here's what I'm doing...
  1. var datepicker_text_input_event_handler = function (evnt) {
  2.   if (evnt.type == 'click') {
  3.     $(evnt.target).datepicker('show');
  4.     if (!lightbox_visible) { lightbox_visible = true; show_lightbox(); }
  5.     open_new_popup();
  6.   }
  7. };
The datepicker only "shows" after LINE 4 and LINE 5 have finished. Can anyone shed some light on this?

My goal is to have the datepicker open instantly when the user clicks on the text input field.

Thanks,
- Glen