function listSelectAll(idForm) {
	var chk =  $("#" + idForm + " input[type=checkbox].selectAll")
		.is(':checked');

	$("#" + idForm + " input[type=checkbox]").each(
			function() {
			if(chk) 
				$("#" + idForm + " input[type=checkbox]").attr('checked', 'checked');
			else
				$("#" + idForm + " input[type=checkbox]").removeAttr('checked');
			});
}

function showDebug(str) {
	$('body').append(str);
}

function deleteRecords(formId) {
	var count = $("#" + formId + " input[type=checkbox]:checked").length;
	count -= $("#" + formId + " input[type=checkbox].selectAll:checked").length;

	if(count == 0) {
		alert("Non è stato selezionato alcun record.");
		return;
	}

	var answer = confirm("Vuoi cancellare " + count + " record?");
	if (answer){
		$('#fld_command').val('delete');
		$('#' + formId).submit();
	}
}

