Datepicker does not load on asp.net page referencing a MasterPage

Datepicker does not load on asp.net page referencing a MasterPage

Below on Block 2 is a simple Asp.net page and the code works. But when i use the code on a page referencing a MasterPage with ContentPlaceHolder it does not work. The Only way it will work is by using the Live (Click) method, see BLOCK 1.
 
The only problem with BLOCK 1 's code is that the calendar ONLY displays after you first click on the text field, and I want it to display when the page the load, thats the problem im having. Any help?
--------------------------------------------------------------------------------------------------
--BLOCK 1:
--------------------------------------------------------------------------------------------------
< script type ="text/javascript"> (document).ready( function () {$( '#datepicker' ).live( 'click' , function () {

$(

this).datepicker({

showOn:

'both',

buttonImage: "imagesZ/calendar.gif",

buttonImageOnly:

true

}).focus();

});

});

 
--------------------------------------------------------------------------------------------------
--BLOCK 2:
--------------------------------------------------------------------------------------------------
<
html xmlns ="http://www.w3.org/1999/xhtml">

<

head runat ="server">

< title > Calendar </ title >

< script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></ script >

< script type ="text/javascript" src ="http://jquery-ui.googlecode.com/svn/tags/1.8rc1/ui/jquery.ui.core.js"></ script >

< script type ="text/javascript" src ="http://jquery-ui.googlecode.com/svn/tags/1.8rc1/ui/jquery.ui.datepicker.js"></ script >

< script type ="text/javascript" src ="http://jquery-ui.googlecode.com/svn/trunk/ui/i18n/jquery.ui.datepicker-en-GB.js"></ script >

< script type ="text/javascript"> $( function () { $( '#datepicker' ).datepicker(); }); </ script >

</ head >

<

body >

< form id ="form1" runat ="server">

< div >

      < input runat ="server" id ="datepicker" />

</ div >

</ form >

</

body >

</

html >