function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 0;
	for(z=0; z<theForm.length; z++) {
		if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
			theForm[z].checked = theElement.checked;
		}
	}
}

function resetCheckAll(theElement) {
	var checkAllStatus = true;
	var theForm = theElement.form, z = 0;
	
	for(z=0; z<theForm.length; z++) {
		if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
			checkAllStatus = checkAllStatus && theForm[z].checked;
		}
	}
	
	if(theForm.checkall) {
		theForm.checkall.checked = checkAllStatus;
	}
}

function checkSelected(theElement) {
	var checkAnyStatus = false;
	var count = 0;
	
	var theForm = theElement.form, z = 0;
	
	for(z=0; z<theForm.length; z++) {
		if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
			if(theForm[z].checked) {
				count++;
			}
			checkAnyStatus = checkAnyStatus || theForm[z].checked;
		}
	}
	if(checkAnyStatus) {
		return confirm('Delete ' +count +' record' +(count > 1 ? 's':'')+'?');
	} else {
		alert('Please select at least one record');
		return false;
	}
}