var prevSelIndexTrip = -1;

// Populates the date dropdown according to the dates array
function tripChanged(dropDown)
{
    var form = document.forms[0];
    var dateBox = form.date;
    var selIndexCountry = form.country.selectedIndex-1;
    var selIndexTrip = dropDown.selectedIndex-1;
    dateBox.disabled = (selIndexTrip == -1);
    dateBox.selectedIndex = 0;
    if(selIndexTrip >= 0)
    {
        var prevDates = dates[selIndexCountry][prevSelIndexTrip];
        var currDates = dates[selIndexCountry][selIndexTrip];
        if(prevDates != currDates) // Only change date dropdown options if the dates has changed
        {
            setDates(selIndexCountry,selIndexTrip);
        }
    }
    for(k=j+1; k<dateBox.length; k++)
    {
        dateBox.options[k] = null;
    }
    prevSelIndexTrip = selIndexTrip;
}