function sel() {
    with(document.form1) {
	for(i=0;i<elements.length;i++) {
	    thiselm = elements[i];
	    if(thiselm.name.substring(0,3) == 'msg')
		thiselm.checked = !thiselm.checked
	}
    }
}