﻿function hideLastdayOfMonth() {

    var monthValue = document.getElementById('ctl00_cp_comboMonth').value;
    if (monthValue == 9 || monthValue == 4 || monthValue == 6 || monthValue == 11) {
        //hide the 31st if it exists in the dropdown
        try {
            document.getElementById('ctl00_cp_comboDay').options.remove(31);
            var new_option = new Option('29', '29', false, false);
            document.getElementById('ctl00_cp_comboDay').options[29] = new_option;
            var new_option1 = new Option('30', '30', false, false);
            document.getElementById('ctl00_cp_comboDay').options[30] = new_option1;
        }
        catch (err) { }
    }
    else if (monthValue == 2) {
        try {
            document.getElementById('ctl00_cp_comboDay').options.remove(31);
            document.getElementById('ctl00_cp_comboDay').options.remove(30);
            document.getElementById('ctl00_cp_comboDay').options.remove(29);
        }
        catch (err) { }
    }
    else {
        var new_option = new Option('29', '29', false, false);
        document.getElementById('ctl00_cp_comboDay').options[29] = new_option;
        var new_option1 = new Option('30', '30', false, false);
        document.getElementById('ctl00_cp_comboDay').options[30] = new_option1;
        var new_option2 = new Option('31', '31', false, false);
        document.getElementById('ctl00_cp_comboDay').options[31] = new_option2;
    }
}
