/**
 * Forces a checkbox to be selected before a form can be submitted.
 * Add a class of "mustBeChecked" to the checkbox which you want
 * to be required before form submission.
 */
agree = {
	'input.mustBeChecked': function(el) {
		var context = el;
		while(context.nodeType == 1) {
			context = context.parentNode;
			if (context.tagName == 'FORM') break;
		}
		if (context.tagName == 'FORM') {
			// Found an ancestral form
			var form = context;
			for (var x=0; x<form.elements.length; x++) {
				if (form.elements[x].type == 'submit') form.elements[x].disabled = !el.checked;
			}
			assignEvent(el, 'click', function() {
				// Check the state and react
				for (var x=0; x<form.elements.length; x++) {
					if (form.elements[x].type == 'submit') 
					{	
					form.elements[x].disabled = !el.checked;
					show('true','checkBoxError');
					}
				}	
			});
		}
	}
};
Behaviour.register(agree);

function show(sw,obj) {
	var ns4 = (document.layers) ? true : false;
	var ie4 = (document.all && !document.getElementById) ? true : false;
	var ie5 = (document.all && document.getElementById) ? true : false;
	var ns6 = (!document.all && document.getElementById) ? true : false;
	
	// show/hide the divisions
	if (sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'visible';
	if (!sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'hidden';
	if (sw && ns4) document.layers[obj].visibility = 'visible';
	if (!sw && ns4) document.layers[obj].visibility = 'hidden';
}