--- affiliates.module	2009-04-16 10:53:30.000000000 +0200
+++ affiliatesNEW.module	2009-06-20 23:26:34.000000000 +0200
@@ -383,6 +383,7 @@ function affiliate_form_button_add_edit(
     '#default_value' => $affiliate->type,
     '#options'       => array(
       'image' => 'Image',
+      'flash'  => 'Flash',
       'text'  => 'Text',
       ),
   );
@@ -405,8 +406,8 @@ function affiliate_form_button_add_edit(
     '#type'          => 'textfield',
     '#title'         => t('Hosted button URL'),
     '#default_value' => $affiliate->anchor,
-    '#size'          => 40,
-    '#maxlength'     => 256,
+    '#size'          => 80,
+    '#maxlength'     => 2048,
     '#description' => t('If your button is hosted elsewhere, enter the URL here.')
   );
 
@@ -492,6 +493,9 @@ function affiliate_form_button_add_edit_
     }      
    $button_url = $_FILES['files']['name']['image'] ? $base_url .'/'. $directory .'/'. $_FILES['files']['name']['image'] : $form_values['anchor'];
   } 
+  else if ($form_values['type'] == 'flash') { 	
+    $button_url = $form_values['anchor'];
+  }
   else {
     $button_url = "";  		
   }
@@ -960,25 +964,42 @@ function affiliates_list() {
       // what they're going to be adding to their site.
       $output .= "\n<img src=\"" . $row->anchor . "\"/><br/>";
     }
+    else if ($row->type == "flash") {
+      // Print flash code
+      $output .= $row->anchor ."<br/>";
+      
+    }
     else {
       // Print text code.
       $output .= $row->label . "<br/>";
     }
 
     // Now add the textarea for copying the code.
+    
+    
     $output .= "<textarea rows=\"7\" cols=\"50\">";
-    $output .= "<a href=\"" . $base_url . "/aff/" . $user->uid . "/" . (int)$row->ad_id . "\">";
+    
 
     if ($row->type == "image") {
+      $output .= "<a href=\"" . $base_url . "/aff/" . $user->uid . "/" . (int)$row->ad_id . "\">";
       $output .= "\n<img border=\"0\"";
       $output .= " alt=\"" . variable_get('site_name', $base_url);
       $output .= "\" title=\"" . variable_get('site_name', $base_url) . "\" src=\"" . $row->anchor . "\"/>";
+      $output .= "</a>";
+    }
+    else if ($row->type == "flash") {
+      $codewithvars = str_replace(".swf?", ".swf",$row->anchor);
+      $codewithvars = str_replace(".swf", ".swf?userid=".$user->uid."&adid=".(int)$row->ad_id."&", $codewithvars);
+      $output .= $codewithvars;
     }
     else {
+      $output .= "<a href=\"" . $base_url . "/aff/" . $user->uid . "/" . (int)$row->ad_id . "\">";
       $output .= $row->label;
+      $output .= "</a>";
+
     }
 
-    $output .= "</a></textarea><br/>\n";
+    $output .= "</textarea><br/>\n";
     //Now add the label assigned through the admin interface.
     $output .= $row->label . " : " . $row->points . " points<br/><br/>";   
   }
