var msgLoading = 'loading...';

function atkLblEditObjectLabels(obj_id, url)
{
	document.getElementById('atkLabel_' + obj_id).innerHTML = msgLoading;
	ajax_loadContent('atkLabel_' + obj_id, url);
}

function atkLblEditAddLabels(obj_id, url)
{
	document.getElementById('atkLabelAdd_' + obj_id).innerHTML = msgLoading;
	ajax_loadContent('atkLabelAdd_' + obj_id, url);
}

function atkLblEditRemoveLabels(obj_id, url)
{
	document.getElementById('atkLabelRemove_' + obj_id).innerHTML = msgLoading;
	ajax_loadContent('atkLabelRemove_' + obj_id, url);
}

function atkLblSubmitObjectLabels(div_id, url)
{
	var labels = document.getElementsByName(div_id + '_cb');
	var checked = new Array();
	
	for(var i = 0; i < labels.length; i++)
		if (labels[i].checked)
			checked.push(document.getElementById(div_id + '_a' + labels[i].value).innerHTML);
	
	var checkedLabels = checked.join();
	checkedLabels = checkedLabels.replace(/&amp;/g, '&');
	
	document.getElementById(div_id).innerHTML = msgLoading;

	ajax_loadContent(div_id, url + '&submit=1&checkedLabels=' + encodeURIComponent(checkedLabels));
}

function atkLblCheckAll(div_id, check_all)
{
	var labels = document.getElementsByName(div_id + '_cb');
	for(var i = 0; i < labels.length; i++)
		labels[i].checked = check_all;
}
