--- support_fields.module	2011-03-23 12:41:03.000000000 +0100
+++ support_fields_new.module	2011-03-23 12:40:42.000000000 +0100
@@ -1,5 +1,4 @@
 <?php
-// $Id: support_fields.module,v 1.1.2.2.2.6 2011/01/27 14:57:36 span Exp $
 
 /**
  * @file 
@@ -262,36 +261,43 @@ function support_fields_form_alter(&$for
     
     // Set up a wrapper
     $form['support']['support-fields-ahah-wrapper'] = array(
-      '#value' => '<div id="support-fields-ahah-wrapper"></div>',
-      '#type' => 'markup',
+      '#prefix' => '<div id="support-fields-ahah-wrapper">',
+      '#suffix' => '</div>',
+      '#type' => 'fieldset',
       '#description' => t('Please fill out these values.'),
     );
     
     // Get all fields for support_ticket
 		$type = content_types('support_ticket');
+
 		// Loop through fields and put them into the magic box (the wrapper)
     foreach($type['fields'] as $fields => $field) {
+      
 		  if(variable_get('support_fields_' . $client . '_' . $field['field_name'], FALSE) == TRUE) { // Field exists
 		    // If there are groups around
-		    if(module_exists('fieldgroups')) {
+		    if(module_exists('fieldgroup')) {		    
+		        // Setting the groups that will display 
 		        $group = fieldgroup_get_group('support_ticket', $field['field_name']); // Get any related group
-		        if($group && $form['support'][$group] == "") { // If not false
+		        if($group) { // If there actually is a group
 		          $form['support']['support-fields-ahah-wrapper'][$group] = $form[$group]; // Move the group over
 		          unset($form[$group]); // Unset the root groop
 		      }
 		    }
-		    else { // No group found, regular field is moved
+		    
+		    // Get the rest of the fields if they do not belong to a group
+		    if($form[$field['field_name']] != NULL) {
 		      $form['support']['support-fields-ahah-wrapper'][$field['field_name']] = $form[$field['field_name']];
 		    }
-		  }
+ 		  }
       unset($form[$field['field_name']]); // Remove all fields that are not activated
     }
-    // If there were groups, remove them from the original form
-    if(module_exists('fieldgroups')) {
+    // If there were other groups, remove them from the original form
+    if(module_exists('fieldgroup')) {
       $groups = fieldgroup_groups('support_ticket'); // Get all groups
 		  foreach($groups as $group) {
-		  if($form[$group['group_name']])
-		    unset($form[$group['group_name']]); // And remove them if they exist on the form
+		    if($form[$group['group_name']]) {
+		      unset($form[$group['group_name']]); // And remove them if they exist on the form
+		    }
 		  }
     }
     // Add our submit function, which will clean up form storage, so that redirects will work.
