  function initRequiredFields () {
                collectFields ( 'input' ) ;
                collectFields ( 'textarea' ) ;
                collectFields ( 'select' ) ;
            }
            
            function collectFields ( pType ) {
                pElements = document.getElementsByTagName( pType );

                for ( var pPointer = 0 ; ( pFieldSelection = pElements[ pPointer ]) ; pPointer++ ) {
                    if ( pFieldSelection.id.match ( 'req_' ) || pFieldSelection.name.match ( 'req_' ) ) {
                        updateFieldStatus ( pFieldSelection ) ;

                        pFieldSelection.onchange = function () {
                            updateFieldStatus( this );
                        }
                    }
                }
            }
            
            function updateFieldStatus ( pField ) {
                pLabel = getLabelForId ( pField.id ) ;

                if ( pField.value.length == 0 || pField.value == '{txt_ausfuellen}' ) {
                    pLabel.className = 'required';
                } else {
                    pLabel.className = 'completed';
                }
            }
            
            function getLabelForId ( pFieldID ) {
                pLabels = document.getElementsByTagName( 'label' ) ;

                for ( var pPointer = 0 ; ( pLabelSelection = pLabels[ pPointer ]) ; pPointer++ ) {
                    if ( pLabelSelection.htmlFor == pFieldID ) {
                        return pLabelSelection ;
                    }
                }

                return false ;
            }

if (document.attachEvent)
attachEvent("onload", initRequiredFields);

else addEventListener("load", initRequiredFields, false);

