/**
 * init.js
 * 
 * Attach a jquery plugin flexselect to our select boxes on DOM (select elements with a class of flexselect)
 */

jQuery(document).ready(function() {
    for (var i = 0; i < $("select.flexselect").length; i++) {
        // the allowMismatchBlank property will be set according to the 'allowMismatchBlank' class of the select element whether it exists or not
        // the showDisabledOptions property will be true to show disabled options in the combo
        if ($("select.flexselect")[i].classList.contains('allowMismatchBlank')) {
            $('#' + $("select.flexselect")[i].getAttribute("id")).flexselect({
                allowMismatchBlank: true,
                showDisabledOptions: true,
            });
        }
        else {
            $('#' + $("select.flexselect")[i].getAttribute("id")).flexselect({
                allowMismatchBlank: false,
                showDisabledOptions: true,
            });
        }
    }
});