	function CheckAll(e) {
		var inputs = $$("td#moduleslist input");
		var allmod = $('mod_tous'); // $(Event.element(e));
		
		for (i=0; i<inputs.length; i++) {
			if( (inputs[i].type == 'checkbox') && (inputs[i].name != 'mod_tous') ) {
				inputs[i].checked = true;
				inputs[i].disabled = allmod.checked;
			}
		}		
	}

	function CheckAllPub(e) {
		var inputs = $$("td#moduleslist input");
		var allpubmod = $('mod_pub'); // $(Event.element(e));
		
		for (i=0; i<inputs.length; i++) {
			if( (inputs[i].type == 'checkbox') && (inputs[i].name.startsWith('mod_pub')) && (inputs[i].name != 'mod_pub') ) {
				inputs[i].checked = true;
				inputs[i].disabled = allpubmod.checked;
			}
		}		
	}
function initObserver(e) {
	Event.observe('mod_tous','click', CheckAll);
	Event.observe('mod_pub','click', CheckAllPub);
	//Event.observe('mod_tous','click', CheckAll);

	if ($('mod_tous').checked)
		CheckAll();

	if ($('mod_pub').checked)
		CheckAllPub();

}

Event.observe(window, 'load', initObserver);