

function trim(s)
{ 
	while (s.substring(0,1)==' ')					s=s.substring(1,s.length);
	while (s.substring(s.length-1,s.length)==' ')	s=s.substring(0,s.length-1);
	return s;
}

function getFieldValue(objField)
{
	if (objField)
	{
		if (objField.value)
		{
			// non-radiobutton, or one radiobutton (checked or not)
			return objField.value;
		}
		else
		{
			if (objField.type=='select-one')
			{
				return objField.options[objField.selectedIndex].value;
			}
			else
			{
				// assume multiple radiobuttons (only of checked one)
				var i;
				for (i=0; i<objField.length; i++)
					if (objField[i].checked)
						return objField[i].value;
			}
		}
	}

	//default return value
	return('');
}


function getRadioCheckResult(objField, blnRequired, strVerplichtBericht, strFormatBericht, strFormat)
{
	if (blnRequired && (getFieldValue(objField)==''))
		return strVerplichtBericht + '\n';
	else
		if (strFormat=='')
			return '';
		else
			if (strFormat.test(getFieldValue(objField)))
				return '';
			else
				return strFormatBericht + '\n';
}

function getTextfieldCheckResult(objField, blnRequired, strVerplichtBericht, strFormatBericht, strFormat)
{
	if (objField.value=='')
		if (!blnRequired)
			return '';
		else
			return strVerplichtBericht + '\n';
	else
		if (strFormat=='')
			return '';
		else
		{
			if (strFormat.test(trim(objField.value)))
				return '';
			else
				return strFormatBericht + '\n';
				}
}


