Datepicker - cant set minDate on second datepicker after choosing first date

Datepicker - cant set minDate on second datepicker after choosing first date

I know this has been brought up before, but I have been unable to get
the solution previously offered to work. Here is what I need to do.
I have two datepickers on my page, in a "arrive" and "depart" type of
scenario. What I need to happen is to set the minDate of the "depart"
datepicker to be no sooner than date chosen by the "arrive"
datepicker.
For example, someone chooses to arrive on January 1, 2010. The depart
datepicker should not allow a date earlier than January 1, 2010 to be
chosen.
The code previously offered is below. I have played with this for a
couple of hours now and am getting nowhere. For some reason, it
breaks the "depart" datepicker and won't bring up the calendar at
all. Any help is greatly appreciated.
<script type="text/javascript">
$(document).ready(function() {
$("#arrive").datepicker({
minDate: new Date(2009, 11 - 1, 6),
onSelect: function(dateText, inst){
var day =
$("#arrive").datepicker("getDate");
day.setDate(day.getDate()+1);
$("#depart").datepicker
("option","minDate",
day);
}
});
$('#calendar-trigger-arrive').click(function() {
$('#arrive').datepicker('show');
});
});
</script>
--