Problem with inline AJAX datepicker (jQuery UI 1.7 - Chapter 7)

Problem with inline AJAX datepicker (jQuery UI 1.7 - Chapter 7)

I'm not a very experienced JavaScript programmer and strugling with a problem using the datepicker. I'm trying to implement the AJAX datepicker from Dan Wellman's jQuery 1.7 book (chapter 7). The sample code works fine. However, when attaching the datepicker to a <div> to display the datepicker inline, the sample code no longer works as expected.

Can anybody out there help me with this?