function openModal(title, route, params)
{
	var params = (typeof(params) == 'undefined') ? [] : params;
	var message = (typeof(params['preload']) == 'undefined') ? '<p><i class="fa fa-spin fa-spinner"></i> Loading...</p>' : params['preload'];
	var callback_apply = (typeof(params['onApply']) == 'undefined') ? false : params['onApply'];
	var callback_open = (typeof(params['onOpen']) == 'undefined') ? false : params['onOpen'];

	var dialog = bootbox.dialog({
		title: title,
		message: message,
		buttons: getModalButtons(callback_apply),
		callback: function() {
			if (callback_open) {
				callback_open();
			} 
		}
	});
						
	dialog.init(function(){
		dialog.find('.bootbox-body').load(route);
	});

}

function getModalButtons(callback) {
	return {
		ok: {
			label: "Apply",
			className: 'btn-info',
			callback: function() {
				if (typeof(callback) !== 'undefined') {
					callback();
				}
			}
		}
	}
}
