/** admin */
(function ($, LOGA) {

/* select all */
$(document).on('click', '.select_all', function() {
	var flag = $(this).prop('checked');
	$('input[name^="' + $(this).attr('to') + '"]').prop('checked', flag);
}).on('click', '.select_sub', function() {
	var flag = $(this).prop('checked');
	$(this).siblings().find('input[type="checkbox"]').prop('checked', flag);
});

/* add refresh botton */
if(top != self) {
	$('body').prepend('<div id="loga_totop"></div>');
	$('body').append('<div id="totop_button"><a href="#loga_totop" class="icon-arrow-up" data-smooth-scroll></a></div><div id="refresh_button"><i class="icon-refresh pointer" onclick="location.reload();"></i></div><div id="tobottom_button"><a href="#loga_tobottom" class="icon-arrow-down" data-smooth-scroll></a></div>');
	$('body').append('<div id="loga_tobottom"></div>');
}

/* show dialog */
$(document).on('click', '.dialog', function() {
	var to = $(this).attr('to'),
		t = $(this).text();
	$.FEA.dialog({
		content: document.getElementById(to),
		id: 'ab_d',
		title: t
	}).showModal();
});

})(jQuery, LOGA);
