Index: /branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_maintenanceActions.gsp
===================================================================
--- /branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_maintenanceActions.gsp	(revision 777)
+++ /branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_maintenanceActions.gsp	(revision 778)
@@ -6,23 +6,4 @@
     var ma_fields = ["toBeDeleted", "isNew", "description", "reasoning", "assetSubItem.id", "procedureStepNumber"];
     var ma_focusField = "procedureStepNumber";
-
-
-    function addChild(wrapperId, cloneId, lazyList, fields, focusField, childCount){
-
-        var clone = jQuery("#"+cloneId).clone();
-        clone.attr('id', lazyList+childCount);
-        var htmlId = lazyList+'['+childCount+'].';
-
-        var fieldsMap = {};
-        jQuery.each(fields, function(index, field) {
-            fieldsMap[field] = clone.find('[id$="'+field+'"]');
-            fieldsMap[field].attr('id',htmlId + field)
-                                        .attr('name',htmlId + field);
-        });
-
-        jQuery("#"+wrapperId).append(clone);
-        clone.show();
-        fieldsMap[focusField].focus();
-    }
 
     // Click event on add button.
Index: /branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/create.gsp
===================================================================
--- /branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/create.gsp	(revision 777)
+++ /branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/create.gsp	(revision 778)
@@ -7,4 +7,5 @@
         <title>Create TaskProcedure</title>
         <nav:resources override="true"/>
+        <g:javascript src="dynamicOneToMany.js" />
     </head>
     <body>
Index: /branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/edit.gsp
===================================================================
--- /branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/edit.gsp	(revision 777)
+++ /branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/edit.gsp	(revision 778)
@@ -7,4 +7,5 @@
         <title>Edit TaskProcedure</title>
         <nav:resources override="true"/>
+        <g:javascript src="dynamicOneToMany.js" />
     </head>
     <body>
Index: /branches/features/taskProcedureRework/web-app/js/dynamicOneToMany.js
===================================================================
--- /branches/features/taskProcedureRework/web-app/js/dynamicOneToMany.js	(revision 778)
+++ /branches/features/taskProcedureRework/web-app/js/dynamicOneToMany.js	(revision 778)
@@ -0,0 +1,29 @@
+
+// Depends on jQuery.
+
+// Add a child by cloning a template and appending to wrapper element.
+// Used with a parent and LazyList of children (One-to-Many).
+// Since javascript has no pointers the childCount source var must be incremented by the calling code.
+// @param wrapperId The id of the wrapper element, e.g: div or tbody.
+// @param cloneId The id of the element to clone.
+// @param lazyList The name of the LazyList.
+// @param fields A list of fields in the clone that need name and id set.
+// @param focusField Which field in the fields list to focus on after adding.
+// @param childCount The current child count, used to set LazyList index, remember to increment!
+function addChild(wrapperId, cloneId, lazyList, fields, focusField, childCount){
+
+    var clone = jQuery("#"+cloneId).clone();
+    clone.attr('id', lazyList+childCount);
+    var htmlId = lazyList+'['+childCount+'].';
+
+    var fieldsMap = {};
+    jQuery.each(fields, function(index, field) {
+        fieldsMap[field] = clone.find('[id$="'+field+'"]');
+        fieldsMap[field].attr('id',htmlId + field)
+                                    .attr('name',htmlId + field);
+    });
+
+    jQuery("#"+wrapperId).append(clone);
+    clone.show();
+    fieldsMap[focusField].focus();
+}
