--- C:\Documents and Settings\acfulton\Desktop\ad.new\ad.admin.inc	2009-11-23 19:40:02.000000000 +1300
+++ C:\Documents and Settings\acfulton\Desktop\ad.new\ad.admin.inc.new	2010-02-24 17:24:02.691940000 +1300
@@ -756,7 +756,25 @@
     '#default_value' => isset($group->weight) ? $group->weight : 0,
     '#description' => t('When listing ad groups, those with lighter (smaller) weights get listed before ad groups with heavier (larger) weights.  Ad groups with equal weights are sorted alphabetically.')
   );
-
+  
+  if (module_exists('imagecache')) {
+    $raw_presets = imagecache_presets();
+    $presets[''] = t('None');
+    foreach ($raw_presets as $preset_id => $preset_info) {
+      $preset = $preset_info['presetname'];
+      $presets[$preset] = $preset;
+    }
+
+    $form['imagecache_preset'] = array(
+      '#type' => 'select',
+      '#title' => t('Imagecache preset'),
+      '#options' => $presets,
+      '#required' => TRUE,
+      '#default_value' => variable_get('ad_groups_imagecache_'. $group->tid, ''),
+      '#description' => t('Use Imagecache to automatically resize/process the image before it is displyed.'),
+    );
+  }
+  
   $form['vid'] = array(
     '#type' => 'hidden',
     '#value' => _ad_get_vid(),
@@ -802,6 +820,8 @@
  */
 function ad_admin_group_form_submit($form, &$form_state) {
   $status = taxonomy_save_term($form_state['values']);
+  variable_set('ad_groups_imagecache_'.  $form_state['values']['tid'], $form_state['values']['imagecache_preset']);
+  
   switch ($status) {
     case SAVED_NEW:
       $groups = variable_get('ad_groups', array());
