function loadYears() {
    $(".contestyear").empty();
    $(".contestname").empty();
    $(".contestdates").empty();
    $(".additionalinfo").attr("hidden", true);
    $.ajax({
        url: base_url+'index.php/cabrillo/getYears',
        type: 'post',
        data: {'station_id': $("#station_id").val()},
        success: function (data) {
            if (data.length > 0) {
                $(".contestyear").append('
' + lang_export_cabrillo_select_year + '
' +
                '' +
                '  '); 
                $.each(data, function(key, value) {
                    $('#year')
                        .append($("")
                        .attr("value",value.year)
                        .text(value.year));
                });
            } else {
                $(".contestyear").append(lang_export_cabrillo_no_contests_for_stationlocation);
            }
        }
    });
}
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('' + lang_export_cabrillo_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('' + lang_export_cabrillo_select_date_range + '
' +
                '' +
                '' +
                '  '); 
                $.each(data, function(key, value) {
                    $('#contestdatesfrom')
                        .append($("")
                        .attr("value", value.date)
                        .text(value.date));
                });
                
                $.each(data, function(key, value) {
                    $('#contestdatesto')
                        .append($("")
                        .attr("value", value.date)
                        .text(value.date));
                });
        }
    });
}
function addAdditionalInfo() {
    $(".additionalinfo").removeAttr("hidden");
}