$(function() {
    $('.page-container').scrollbar().addClass('scrollbar-macosx');
	$.fn.selectListTrigger = function(eventName) {
        return this.each(function() {
            var el = $(this).get(0);
            triggerNativeEvent(el, eventName);
        });
    };

    function triggerNativeEvent(el, eventName){
		if (el.fireEvent) { // < IE9
			(el.fireEvent('on' + eventName));
		} else {
			var evt = document.createEvent('Events');
			evt.initEvent(eventName, true, false);
			el.dispatchEvent(evt);
		}
	}
	
	$('[data-init-plugin="select2"]').on('select2:select', function (e) {
		$(this).selectListTrigger('change');
	});

    $('body').on('click', '.requestModal', function () {
        let type = $(this).attr('data-type');
        if(type){ $(this).parents('.parentContainer').find('.modalContainer[data-type="'+type+'"]').modal('show'); }
    });

    VANTA.BIRDS({
        el: "#maintenanceContainer",
        backgroundColor: 0xf9f9f9,
        wingSpan: 40.00,
        separation: 100.00,
        alignment: 100.00,
        cohesion: 100.00,
        quantity: 2.00
    })
});