

function copyAdress() {
	with ( document.adressForm ) {
		
		// copy text fields from top of the form to invoice section
		// the naming convention of the text fields looks like follows:
		// top     eg. name = 'strasse'
		// invoice eg. name = 'invoice_strasse'
		// so, loop over all textfields, check if it's pendant is present and 
		// copy value
		i=0;
		while ( elements[i] ) {
			if ( elements[i].type == 'text' ) {
				var fldName = elements[i].name;
				if ( fldName.substring(0,7) != 'invoice_' ) { // NOT 'invoice_*'
					if (elements[ 'invoice_' + fldName ])
						elements[ 'invoice_' + fldName ].value = elements[i].value;
				}
			}
			i++;
		}
		
		// the 'anrede is a select box ... need a different proceture here:
		i_opt = elements[ 'anrede' ].options.selectedIndex;
		elements[ 'invoice_anrede' ].options[ i_opt ].selected = true;

		i_opt = elements[ 'country_sid' ].options.selectedIndex;
		elements[ 'invoice_country_sid' ].options[ i_opt ].selected = true;
	}
}

