  clear_totals();
                        }
                }

		function select_all_attachments(all){
			attachments = all.value.split('_');

			var elements = document.forms[0].elements;
			for(var i=0; i < elements.length; i++){
				var checkbox = elements[i];
				if(checkbox.name.match('document_' + attachments[0] + '_' + attachments[1] + '_')){
					if (checkbox.type == "checkbox") {
						if(checkbox.checked != all.checked){
							checkbox.checked = all.checked;
							update_sizes(checkbox);
						}