jquery datepicker
<p>I have a datepicker that is already set up, how can I access the datepicker instance for use in another part of my javascript. I plan to use the click event of an element, get the date of the datepicke and initiate a query via a url.</p>

<p>Thanks guys,</p>

<pre><code> $(document).ready(function(){
        $('#datepicker').hide();


&lt;?php echo "$('#eventlist').load('events/findevent/" . $date . "');"; ?&gt;
        $("#datepicker").datepicker({
            dateFormat: 'yy-mm-dd',
            onSelect: function(selecteddate){
                $('#eventlist').load('events/findevent/'+selecteddate);
            },
            beforeShowDay: function(date,inst){
                var found = false;
                var i = 0;
                while(!found &amp;&amp; (i&lt;valid.length)){
                    found = (!(date&gt;valid[i] || date&lt;valid[i]));
                    i++;
                }
                return [found,'',''];
            },
            onChangeMonthYear: function(year,month,inst){
                $('#eventlist').load('events/findbymonth/'+"0"+month);
            }
        });
    });
</code></pre>

<p>In the Html I simply have a div tag with the id as datepicker. In addition to the date picker, I have 4 buttons next and prev for the month and date. when a user clicks the next for either of the fields the the date will shift to the next available date. I have all the dates in a javascript array so the I am trying to use the date picker instance in the click function of a given button, get the date and set the new date. That way the actions will be called to update other fields with respect to the presently selected date. Any suggestions will greately appreaciated.
thanks.</p>
