	/**
	 * 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) {
	
		// set the notification message, depending on the language set.
		
		if ( typeof(f.formlanguage) == 'undefined' || f.formlanguage == 'null' || f.formlanguage == null )
		
			var language = '';
			
		else
			
			var language = f.formlanguage.value;
		
		switch ( language.toUpperCase() ) {
		
			case 'EN':
			
				var notification = 'Please fill in all required fields.'; break;
			
			case 'NL': default:
			
				var notification = 'Vul a.u.b. alle verplichte velden in.'; break;
		
		} // switch()
	
		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 (notification);
								
								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 (notification);
								
								el.focus();
							
								return false;
								
							}
							
						}
					
						break;
				
					} // INPUT
					
					case 'SELECT': {
					
						var val = el.options[el.selectedIndex].value;
						
						if ( val.toUpperCase == 'NULL' || !val ) {
						
							alert (notification);
								
							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()
	
	/**
	 * A function to check whether the "accept the terms and conditions" checkbox
	 * is checked.
	 * 
	 * @author R.J.T. de Vries <rdevries@thirdwave.nl>
	 * @param		object		f		form to check
	 * @return	boolean				true if checked, false if not.
	 */
	function checkAcceptance(f) {
	
		// set the notification message, depending on the language set.
		
		if ( typeof(f.formlanguage) == 'undefined' || f.formlanguage == 'null' || f.formlanguage == null )
		
			var language = '';
			
		else
			
			var language = f.formlanguage.value;
		
		switch ( language.toUpperCase() ) {
		
			case 'EN':
			
				var notification = 'You can not continue if you do not accept the terms and conditions.'; break;
			
			case 'NL': default:
			
				var notification = 'U kunt niet doorgaan, als u niet akkoord gaat met de voorwaarden.'; break;
		
		} // switch()
		
		if ( !f.accept.checked ) { alert(notification); return false; }
		
		// should we send an email in the background ... to notify the webmaster
		// that current user has been redirected to PayPal?
		
		if ( f.cmd && f.cmd.value ) {
		
			var src = 'purchase.html&step=35';
			
			includeJS('jscript', src);
			
		}
		
		for ( var i = 0; i < 1000000; i++ ) {
		
			var j = 10;
		
		} // for()
		
		return true;
	
	} // checkAcceptance()
