# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
--- C:\1\ad_flash.module
+++ Z:\home\cuturie.local\www\ad_flash.module
@@ -77,7 +77,8 @@
  * Drupal _init hook.  Include ad_flash_views.inc if the views.module is
  * enabled. */
 function ad_flash_init() {
-	drupal_add_js(drupal_get_path('module', 'ad_flash') . '/scripts/AC_RunActiveContent.js');
+	//drupal_add_js(drupal_get_path('module', 'ad_flash') . '/scripts/AC_RunActiveContent.js');
+	drupal_add_js(drupal_get_path('module', 'ad_flash') . '/scripts/swfobject.js');
 } 
 
 /**
@@ -208,7 +209,7 @@
 /**
  * Adapi implementation.
  */
-function ad_flash_adapi($op, &$node) {
+function ad_flash_adapi($op, $node) {
   $output = NULL;
 
   switch ($op) {
@@ -597,13 +598,42 @@
 	//jrm addition
 	$flash_path = preg_replace('&'. drupal_get_path('module', 'ad') .'/&', '', file_create_url($flash->filepath));
 	$target = variable_get('ad_link_target', '_self');
+	$n = 0;
+	$img = '';
+	$desc = '';
+	foreach ($node->files as $file)
+	{
+	  if($file->filepath != $flash->filepath && $n == 0){
+	    $img = $file->filepath;
+		$desc = $file->description;
+		$n++;
+	  }
+				
+	}
+	
+
 	$output = "<div class=\"flash-advertisement flash-advertisement-{$flash->type} ad-group-{$term}\" id=\"ad-{$ad->aid}\">";
+	$output .= '<a href="'.$ad->redirect.'/" title="'.$desc.'"><img src="'.$img.'" alt="'.$desc.'"/></a>';
     $output .= theme('ad_flash_' . $flash->type . '_render', $ad, $flash);
 	$output .="</div>";
 	return $output;
 }
 
 function theme_ad_flash_swf_render($ad, $flash) {
+
+		$output .= '<script type="text/javascript">';
+		$output .= 'var flashvars = {clickTAG:"'.$ad->redirect.'/@HOSTID___"};';
+		$output .= 'var params = {wmode:"transparent",menu: "false"};';
+		$output .= 'var attributes = {id: "ad-'.uniqid().'"};';
+		$output .= 'swfobject.embedSWF("' . $flash->path . '", "ad-'.$ad->aid.'", "'. $flash->width .'", "'. $flash->height .'", "9.0.0", " ", flashvars, params, attributes);';
+		$output .= '</script>';
+		
+    return $output;
+}
+
+/*
+
+function theme_ad_flash_swf_render($ad, $flash) {
 		$output .= '<object type="application/x-shockwave-flash" data="' . $flash->path . '" width="'. $flash->width .'" height="'. $flash->height .'" id="ad'.$ad->id.'">';
 		$output .= '<param name="allowScriptAccess" value="sameDomain" />';
 		$output .= '<param name="allowFullScreen" value="false" />';
@@ -616,6 +646,7 @@
 		
     return $output;
 }
+*/
\ No newline at end of file
 
 function theme_ad_flash_player_settings($ad, $flash) {
 	return array(
