/*
|| START  INFO ||

|| VSS HISTORY ||
$Revision: 1 $
$Author: Freelance $
$Modtime: 11/11/04 14:55 $ 
$Date: 11/11/04 16:15 $

|| PROPERTIES ||
Created By: Tom Peer	
Created On: 11/11/2004

|| FUNCTION ||
For use with multiple select objects (select list with size > 1 or checkboxes)

By adding a single checkBox for "all", and applying the following onClick method,
this function will deselect all options.

	deselect(this.form.{fieldname},this.checked);

Adding the following to the select box will uncheck the "all" field.

	uncheck(this.form.{fieldname});

E.g.

<input <cfif NOT ListLen(session.search.disciplines)>checked</cfif> onClick="deselect(this.form.disciplines,this.checked);"  type="Checkbox" name="all_disciplines" value="void">All disciplines<br>
<select onClick="uncheck(this.form.all_disciplines);" name="disciplines" size="5" multiple>
<CFOUTPUT query="application.obj.siteObj.Disciplines">
<option value="#disciplineid#"<cfif ListFind(session.search.disciplines,disciplineid)> selected</cfif>>#discipline_desc#
</CFOUTPUT>
</select>

|| END INFO ||
*/

function deselect(field, checked) {
	if (checked) {
		for (i = 0; i < field.options.length; i = i + 1) {
			field.options[i].selected = 0;
		}
	}
}

function uncheck(field) {
	field.checked = 0;
}

function uncheckall(field, checked) {
	if (checked) {
		for (i = 0; i < field.length; i = i + 1) {
			field[i].checked = 0;
		}
	}
}

