diff -up openx6/openx.admin.inc openx5/openx.admin.inc
--- openx6/openx.admin.inc	2008-12-12 11:17:53.000000000 +1300
+++ openx5/openx.admin.inc	2009-07-31 11:42:06.000000000 +1200
@@ -6,6 +6,7 @@
  * @author Jeff Warrington (jaydub) is new maintainer March 2008
  * @author Chris Nutting <Chris.Nutting@openx.org>
  * @author Bruno Massa
+ * @author David Thomas <davidwhthomas@gmail.com>
  *
  * @file
  * Module settings.
@@ -71,6 +72,19 @@ function _openx_settings() {
     '#description'    => t('For example "ads.example.org/delivery". "https://" is automatically prefixed.'),
     '#required'       => TRUE,
   );
+  $form['adserver']['openx_affiliate_id'] = array(
+    '#type' => 'textfield', 
+    '#default_value' => variable_get('openx_affiliate_id', ''), 
+    '#title' => t('OpenX website/affiliate id for this site'),
+    '#description' => t('This is the website/affiliate id e.g: 1')
+  );
+  $form['adserver']['openx_click_target'] = array(
+    '#type' => 'select', 
+    '#default_value' => variable_get('openx_click_target', '_blank'), 
+    '#title' => t('OpenX ad click window'),
+    '#description' => t('Open ads in the same or new window.'),
+    '#options' => array('_blank' => 'New Window', '_self' => 'Same Window'),
+  ); 
 
   return system_settings_form($form);
 }
diff -up openx6/openx.inc openx5/openx.inc
--- openx6/openx.inc	2009-02-11 21:00:16.000000000 +1300
+++ openx5/openx.inc	2009-07-31 11:42:06.000000000 +1200
@@ -1,11 +1,12 @@
 <?php
-// $Id: openx.inc,v 1.3 2009/02/11 08:00:16 brmassa Exp $
+// $Id:$
 
 /**
  * @author Gerd Riesselmann
  * @author Jeff Warrington (jaydub) is new maintainer March 2008
  * @author Chris Nutting <Chris.Nutting@openx.org>
  * @author Bruno Massa
+ * @author David Thomas <davidwhthomas@gmail.com>
  *
  * @file
  * Module settings.
@@ -31,6 +32,8 @@ function _openx_javascript() {
     $server = variable_get('openx_delivery_url', 'd.openx.org');
   }
   $url = $protocol .'://'. trim($server, '/') .'/spcjs.php';
+  $url .= '?id='.variable_get('openx_affiliate_id', ''); // add affiliate / website id
+  $url .= '&amp;target='.variable_get('openx_click_target', '_blank'); // open same/new window?
 
   $zones = variable_get('openx_zones', array());
   $spc_code = "<script type='text/javascript'><!--// <![CDATA[\n  var OA_zones = {\n";
diff -up openx6/openx.info openx5/openx.info
--- openx6/openx.info	2009-05-04 11:14:07.000000000 +1200
+++ openx5/openx.info	2009-07-31 10:48:44.000000000 +1200
@@ -1,10 +1,5 @@
-; $Id: openx.info,v 1.2 2008/12/11 22:01:19 brmassa Exp $
-core        = "6.x"
+; $Id:$
 name        = "OpenX"
-description = "Integrates the OpenX adserver into Drupal"
-; Information added by drupal.org packaging script on 2009-05-03
-version = "6.x-1.01"
-core = "6.x"
+description = "Integrates the OpenX adserver into Drupal 5"
+version = "5.x-1.01"
 project = "openx"
-datestamp = "1241392447"
-
diff -up openx6/openx.install openx5/openx.install
--- openx6/openx.install	2008-12-12 11:17:53.000000000 +1300
+++ openx5/openx.install	2009-07-31 10:48:03.000000000 +1200
@@ -6,6 +6,7 @@
  * @author Jeff Warrington (jaydub) is new maintainer March 2008
  * @author Chris Nutting <Chris.Nutting@openx.org>
  * @author Bruno Massa
+ * @author David Thomas <davidwhthomas@gmail.com>
  *
  * @file
  * Module settings.
diff -up openx6/openx.module openx5/openx.module
--- openx6/openx.module	2009-02-11 20:59:03.000000000 +1300
+++ openx5/openx.module	2009-07-31 10:48:27.000000000 +1200
@@ -1,11 +1,12 @@
 <?php
-// $Id: openx.module,v 1.5 2009/02/11 07:59:03 brmassa Exp $
+// $Id:$
 
 /**
  * @author Gerd Riesselmann
  * @author Jeff Warrington (jaydub) is new maintainer March 2008
  * @author Chris Nutting <Chris.Nutting@openx.org>
  * @author Bruno Massa
+ * @author David Thomas <davidwhthomas@gmail.com>
  *
  * @file
  * Integrates Drupal with OpenX Ad server
@@ -54,37 +55,30 @@ function openx_help($section, $arg = NUL
 }
 
 /**
- * Implementation of hook_menu().
+ * Implementation of hook_init
  */
-function openx_menu() {
-  $items['admin/settings/openx'] = array(
-    'access arguments'  => array('administer site configuration'),
-    'description'       => 'Configure OpenX AdServer integration behavior and appearance.',
-    'file'              => 'openx.admin.inc',
-    'page callback'     => 'drupal_get_form',
-    'page arguments'    => array('_openx_settings'),
-    'title'             => 'OpenX',
-  );
-  return $items;
+function openx_init(){
+  if( arg(0) == 'admin' ){
+    include_once(drupal_get_path('module', 'openx').'/openx.admin.inc');
+  }
 }
 
 /**
- * Implementation of hook_theme().
+ * Implementation of hook_menu().
  */
-function openx_theme() {
-  return array(
-    'openx_settings_zones' => array(
-      'file'      => 'openx.admin.inc',
-      'arguments' => array('form')
-    ),
-    'openx_block' => array(
-      'file'      => 'openx.inc',
-      'arguments' => array('index')
-    ),
-    'openx_channel' => array(
-      'arguments' => array()
-    ),
-  );
+function openx_menu($may_cache) {
+  $items = array();
+  if($may_cache){
+    $items[] = array(
+      'path'              => 'admin/settings/openx',
+      'access'            => user_access('administer site configuration'),
+      'description'       => 'Configure OpenX AdServer integration behavior and appearance.',
+      'callback'     => 'drupal_get_form',
+      'callback arguments'=> array('_openx_settings'),
+      'title'             => 'OpenX',
+    );
+  }
+  return $items;
 }
 
 /**
@@ -96,7 +90,7 @@ function openx_theme() {
  *   HTML. The area where the banner will be displayed
  */
 function openx_invoke($index_or_key) {
-  module_load_include('inc', 'openx');
+  include_once(drupal_get_path('module', 'openx').'/openx.inc');
   if (!$zone = _openx_get_zone($index_or_key)) {
     return '';
   }
