	/**
	 * A function to check the input in the reg. forms.
	 * 
	 * We check all form-fields in the given form (f) that have comp=1
	 * (compulsory) for some value.
	 * 
	 * @author R.J.T. de Vries <rdevries@thirdwave.nl>
	 * @param object	f		the form to check
	 * @return boolean		true if all fields have been filled out, false if not.
	 */
	function checkFields(f) {
	
		for ( var i = 0; i < f.elements.length; i++ ) {
		
			var el = f.elements[i];
			
			// Is this a compulsory element?
			
			if ( el.getAttribute('comp') ) {
			
				switch ( el.tagName.toUpperCase() ) {
			
					case 'INPUT': {
					
						if ( el.getAttribute('type').toUpperCase() == 'RADIO' ) {
						
							if ( !getRadioValue(f, el.name) ) {
							
								alert ("Vul a.u.b. alle verplichte velden in.");
								
								el.focus();
							
								return false;
							
							}
						
						} else {
						
							// The value of the input has no length! Field was not filled out,
							// return false!
						
							if ( !el.value.length ) { 
							
								alert ("Vul a.u.b. alle verplichte velden in.");
								
								el.focus();
							
								return false;
								
							}
							
						}
					
						break;
				
					} // INPUT
					
					case 'SELECT': {
					
						var val = el.options[el.selectedIndex].value;
						
						if ( val.toUpperCase == 'NULL' || !val ) {
						
							alert ("Vul a.u.b. alle verplichte velden in.");
								
							el.focus();
						
							return false;
						
						}
					
						break;
					
					}
			
				} // switch()
				
			}
		
		} // for()
			
		return true;
	
	} // checkFields()
	
	/**
	 * Get the value of the radio input with the given name in the given
	 * form, or false if no value has been assigned.
	 * 
	 * @author R.J.T. de Vries <rdevries@thirdwave.nl>
	 * @param object 		f			form that contains radio input
	 * @param string		name	name of the radio input
	 * @return boolean				true if radio input has a checked element,
	 *												false if not.
	 */
	function getRadioValue(f, name) {
	
		// Get the object that represents all radio inputs in the form with
		// the given name.
	
		var oInputCol = eval('f.' + name);
		
		// Loop through all elements in the radio input collection and
		// return true if any of the elements is checked.
		
		for ( var i = 0; i < oInputCol.length; i++ ) {
		
			if ( oInputCol[i].checked ) {
			
				return true;
				
			}
		
		} // for()
		
		// We didn't return true ... so we return false;
		
		return false;
	
	} // getRadioValue()
