function loadYears() {
    $(".contestyear").empty();
    $(".contestname").empty();
    $(".contestdates").empty();
    $.ajax({
        url: base_url+'index.php/cabrillo/getYears',
        type: 'post',
        data: {'station_id': $("#station_id").val()},
        success: function (data) {
                $(".contestyear").append('
Select year: 
' +
                '' +
                '  '); 
                $.each(data, function(key, value) {
                    $('#year')
                        .append($("")
                        .attr("value",value.year)
                        .text(value.year));
                });
        }
    });
}
function loadContests() {
    $(".contestname").empty();
    $(".contestdates").empty();
    $.ajax({
        url: base_url+'index.php/cabrillo/getContests',
        type: 'post',
        data: {'year': $("#year").val(),
                'station_id': $("#station_id").val()
        },
        success: function (data) {
                $(".contestname").append('Select contest: 
' +
                '' +
                '  '); 
                $.each(data, function(key, value) {
                    $('#contestid')
                        .append($("")
                        .attr("value",value.col_contest_id)
                        .text(value.col_contest_id));
                });
        }
    });
}
function loadContestDates() {
    $(".contestdates").empty();
    $.ajax({
        url: base_url+'index.php/cabrillo/getContestDates',
        type: 'post',
        data: {'year': $("#year").val(),
                'contestid': $("#contestid").val(),
                'station_id': $("#station_id").val()},
        success: function (data) {
                $(".contestdates").append('Select daterange: 
' +
                '' +
                '  '); 
                $.each(data, function(key, value) {
                    $('#contestdates')
                        .append($("")
                        .attr("value", value.mindate + ',' + value.maxdate)
                        .text(value.mindate + ' - ' + value.maxdate));
                });
        }
    });
}