jQuery Combine two functions to be used on change
<p>I have 2 functions I wrote (mostly modified) that I need to combine into one function. The first function is called when a user chooses a department, it does a callback to find days and adds them to an array. The second function blocks off days in a jQuery datepicker. I've gotten the blocked off days to work properly, I just can't figure out how to combine the two functions. I've tried a lot of different ways, but nothing seems to be working.</p>

<pre><code>// load calendar buttons
$(document).ready(function(){
$("#Return_Date").datepicker( { beforeShowDay: nonWorkingDates, showOn: "both",    numberOfMonths: 2, minDate: 0, maxDate: "364D", gotoCurrent: true, buttonImageOnly: true }   );
$("#Depart_Date").datepicker( { beforeShowDay: nonWorkingDates, showOn: "both", numberOfMonths: 2, minDate: 0, maxDate: "364D", gotoCurrent: true, buttonImageOnly: true    }   );
});

// load blocked days - this loads properly into the date pickers above
function nonWorkingDates(date){
// create an array for closedDates
var closedDates = [[3,22,2012], [3,25,2012], [4,15,2012], [4,24,2012], [4,25,2012]];

//loop through the list of closed Dates
for (i = 0; i &lt; closedDates.length; i++) {      
    // if the date is found set it as disabled. January is 0, February 1, etc so a -1 is needed on the month value
    if (date.getMonth() == closedDates[i][0] - 1 &amp;&amp; date.getDate() == closedDates[i][1] &amp;&amp;  date.getFullYear() == closedDates[i][2]) {
        return [false];
    }
}
return [true];
};

//load in closed dates i need the BlockedTravelDays array to pull into the date pickers. the array here loads fine
$(document).ready(function NoTravelDays() {
$("#TripApprovalDepartment").change(function() {
    var value = $.trim($("#TripApprovalDepartment").val());
    if (value.length &gt; 0) {
        $.getJSON("../approval.cfc?method=getBlockedDays&amp;returnFormat=json", {DeptID:value}, function(res,code) {
            // create an Array
            var BlockedTravelDays = [];
            for (var i = 0; i &lt; res.DATA.length; i++) { 
                // store the travel days in the array
                BlockedTravelDays.push(res.DATA[i][2]);
            }; // end for loop
        }); // end JSON
    } // end if
});
});
</code></pre>
