/** list article */
(function ($, LOGA) {

$(document).on('click', '.ad', function() {
	var ad_id = $(this).attr('ad_id'),
		to = $(this).attr('to'),
		t = $(this).text(),
		items = getCheckboxItem();
	$("[name='article_id']").val(items);
	$.FEA.dialog({
		content: document.getElementById(ad_id),
		id: 'ab_d',
		title: t,
		okValue: LOGA.L('OK'),
		ok: function () {
			$(to).submit();
			return false;
		},
		cancelValue: LOGA.L('CANCEL'),
		cancel: function () {}
	}).showModal();
});

/* get checked article item */
function getCheckboxItem() {
	var allSel = '',
		items = $(":checkbox[name='article_id[]']");
	for(i=0; i < items.length; i++) {
		if(items[i].checked) {
			if('' == allSel) {
				allSel = items[i].value;
			}
			else {
				allSel = allSel + ',' +items[i].value;
			}
		}
	}
	return allSel;
}

})(jQuery, LOGA);
