jQuery date picker does not firing in ajax page

jQuery date picker does not firing in ajax page

Hi

Here I have using datepicker from jQuery UI
in my public/javascript folder as effects,prototype,control,dragdrop js files.
in my public folder contains jqueryui development buddle. (css,js,development-bundle)

in layout/application.rhtml

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2.   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.   <head>
  5.     <title><%= h(yield(:title) || "Untitled") %></title>
  6.     <%= stylesheet_link_tag 'application' %>
  7.     <%=javascript_include_tag :defaults%>
  8.     <%= stylesheet_link_tag '/jquery-ui/css/custom-theme/jquery-ui-1.8.1.custom.css' %>
  9. <%=javascript_include_tag "/jquery-ui/js/jquery-1.4.2.min.js"%>
  10. <%=javascript_include_tag "/jquery-ui/js/jquery-ui-1.8.1.custom.min.js"%>
  11. <script>
  12.        $(document).ready(function(){
  13.             var $j=jQuery.noConflict();
  14.             $j( '#date' ).datepicker({ dateFormat: 'dd-mm-yy' });
  15.              });
  16.     </script>
  17.    
  18.     <%= yield(:head) %>
  19.   </head>
  20.   <body>
  21.     <div id="container">
  22.       <%- flash.each do |name, msg| -%>
  23.         <%= content_tag :div, msg, :id => "flash_#{name}" %>
  24.       <%- end -%>
  25.      
  26.       <%- if show_title? -%>
  27.         <h1><%=h yield(:title) %></h1>
  28.       <%- end -%>
  29.      
  30.       <%= yield %>
  31.     </div>
  32.   </body>
  33. </html>

in home/index.rhtml

  1. <%title "Home"%>
  2. <%=link_to "Add Details" ,:action=>"add"%>
  3. <%=link_to_remote "Ajax Add Details", :update=>"add" , :url=>{ :action=>"add" }%>
  4. <div id='add' />

in  home/add.rhtml

  1. <%title "Add details"%>
  2. <%form_tag :action=>"create" do%>
  3.     Name : <%=text_field_tag "name" ,"",:size=>15%>
  4.     DOB  : <%=text_field_tag "dob","",:id=>"date"%>
  5.     <%=submit_tag "Save"%>
  6. <%end%>

the datepicker works when I run http://localhost:3000/home/add.rhtml directly but
the datepicker not work when i run ajax page http://localhost:3000/home/index.rhtml

Any solutions for that,????