(function() {
	'use strict';
	
	$('#collapseProjects').on('show.bs.collapse', function(event) {
		if ($('#collapseProjects').html().trim() == '') {

			$('#collapseProjects').append('<div class="card-block projects" id="projects_popup">\
											<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i><span>&ensp;Загружаем...</span>\
	        								</div>');

			var popup_url = '/mainpage/projects/';
			$.get(popup_url, function(data) {
				$('#projects_popup').html(data);
			});
		}
	})
})();