title: How to launch the beforeShowDay of DatePicker from another function
body: <p>I have a Datepicker with the following code.  I have a dropdownbox and upon a change in the dropDown box I want to launch the datePicker beforeShowDay  function.  How can I do this?</p>
  
  <pre><code>var freeDate;
  </code></pre>
  
  <p>Part of my code is as follows:</p>
  
  <pre><code>$("#myDiv").datepicker({
      showOtherMonths: true,
      selectOtherMonths: true,
      dateFormat: "yy/mm/dd",
      onSelect: function(dateText, inst) {},
      onChangeMonthYear: function(year, month, inst) {
          $.ajax({
              contentType: "application/json; charset=utf-8",
              dataType: "json",
              url: '@Url.Action("ListDates", "Party")',
              data: {
                  date: new Date(year, month - 1, 1).toString("yyyy/MM/dd"),
                  userID: userID
              },
              success: function(data) {
                  freeDate = eval(data);
              },
              error: function(request, status, error) {}
          });
      },
      beforeShowDay: function(dateToShow) {
          var returnResult = new Array();
          returnResult.push(true);
          var itemMatched = false;
          $.each(freeDate, function(key, value) {
              if (new Date(parseInt(value.substr(6))).compareTo(dateToShow) == 0) {
                  itemMatched = true;
                  returnResult.push('timeNotFree');
                  return;
              }
          });
          if (!itemMatched) returnResult.push('');
          returnResult.push('');
          return returnResult;
      }
  });​
  </code></pre>
  
  <hr>
  
  <pre><code>$('#myList').change(function() {
      userID = $("#userList &gt; option:selected").attr("value");
      // myList is used to have freeDate and the DatePicker must be shown accordingly.
      $.ajax({
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          url: '@Url.Action("ListDates", "Party")',
          data: {
              date: new Date($("#myDiv").datepicker("getDate").toString("yyyy/MM/dd")),
              userID: userID
          },
          success: function(data) {
              freeDate = eval(data);
          },
          error: function(request, status, error) {}
      });
      $("#myDiv").datepicker("setDate", $("#myDiv").datepicker("getDate").toString("yyyy/MM/dd"));
  });​
  </code></pre>