JQuery DatePicker

Hello list, I am relatively new at JS and also JQuery and am having some problems with configuring the stock datepicker object.

Here is my class structure:

var accounting = 
    init: function()
        var invDate = $("#invDate");
        for(var i = 0, ii = invDate.length; i < ii; i++){
            // an existing date in an input element, format like 'mm-dd-yy'
            idte = document.getElementById('invDate').value;
                minDate: -20, 
                maxDate: "+1M +10D",
                showAnim: "fadeIn",
                altField: "#actualDate",
                changeMonth: true,
                numberOfMonths: 3,
                showButtonPanel: true
            [B]$(invDate).DatePicker("setDate", idte);[/B] // fails here
            $(invDate).bind("change", accounting.doInvDate);
     doInvDate: function(event){
        // never gets here
        var dte = $(this).DatePicker("getDate");
        alert('INV Date has changed, returned value is: '+ dte);

This will create the date picker object so that when the input cell is selected, the datepicker object opens, but I cannot set the date. Also, I would like to get the 3 months showing when the cell is selected, but that never happens either.

Any suggestions?

Since there are several things about the page that can interfere with the proper working of the script, can you please provide a test web page that demonstrates the problem so that we can then investigate the cause of that problem.

The solution was to remove the invDate.datepicker(); invocation. In essence, I was instantiating the object twice and the second set of instructions were being ignored.