<script type="text/javascript">
	/* 
	 * This example is from the book _Ajax: The Definitive Guide_ by Anthony T. Holdener III.
	 * Written by Anthony T. Holdener III.  Copyright (C) 2008 O'Reilly Media, Inc.
	 * You may study, use, modify, and distribute this example for any purpose.
	 * This example is provided WITHOUT WARRANTY either expressed or implied.
	 */
	//<![CDATA[
	/**
	 * This function, checkboxesToString, takes the passed /p_formId/ and gets
	 * all <input> elements within the form as an /Array/. It then finds the
	 * /checkbox/ types with a /p_className/ value and adds any checked element
	 * to the string to be returned.
	 *
	 * @param {String} p_formId The string id of the form with the checkboxes.
	 * @param {String} p_className The name of the class the checkboxes belong to.
	 * @return A comma-delimited string of the checked checkboxes.
	 * @type String
	 * @see Element#hasClassName
	 */
	function checkboxesToString(p_formId, p_className) {
		var retval = '';
		/* Use the id of the form to get a list of <input> elements it contains */
		var inputs = $(p_formId).getElementsByTagName('input');

		/* Loop through the list of <input> elements */
		for (var i = 0, il = inputs.length; i < il; i++)
			/* Does this element contain the desired className? */
			if (Element.hasClassName(inputs[i], p_className))
				/* Is this checkbox checked? */
				if (inputs[i].checked)
					/* Should a comma be added? */
					if (retval.length > 1) {
						retval += ',';
						retval += inputs[i].value;
					}
		return (retval);
	}
	//]]]>
</script>