diff --git a/openx.admin.inc b/openx.admin.inc
index 053934a..89e5110 100644
--- a/openx.admin.inc
+++ b/openx.admin.inc
@@ -18,6 +18,7 @@ function _openx_settings($form, &$form_state) {
     '#description'  => t('<ul>
         <li>' . t('The zone ID can be found in the OpenX administration interface.') . '</li>
         <li>' . t('The name can be any alpha-numeric string, this will be used for the block name.') . '</li>
+        <li>' . t('Width, height and refresh are used for iFrame invocations.') . '</li>
     </ul>'),
     '#title'        => t('OpenX blocks'),
     '#type'         => 'fieldset',
@@ -32,12 +33,7 @@ function _openx_settings($form, &$form_state) {
 
   if (empty($form_state['zones'])) {
     $zones = variable_get('openx_zones', array());
-    if (empty($zones)) {
-      $form_state['zones'] = array_fill(0, 3, array('id' => '', 'name' => ''));
-    }
-    else {
-      $form_state['zones'] = $zones;
-    }
+    $form_state['zones'] = empty($zones) ? array_fill(0, 3, _openx_settings_get_empty_zone()) : $zones;
   }
 
   foreach ($form_state['zones'] as $index => $zone) {
@@ -52,14 +48,38 @@ function _openx_settings($form, &$form_state) {
       '#zone_id' => $index,
       '#name' => 'delete-zone-' . $index,
     );
+    $form['blocks']['openx_zones'][$index]['enabled'] = array(
+      '#type'           => 'checkbox',
+      '#default_value'  => isset($form_state['zones'][$index]['enabled']) ? $form_state['zones'][$index]['enabled'] : TRUE,
+    );
     $form['blocks']['openx_zones'][$index]['id'] = array(
       '#type'           => 'textfield',
       '#default_value'  => isset($form_state['zones'][$index]['id']) ? $form_state['zones'][$index]['id'] : '',
-      '#size'           => 6,
+      '#size'           => 4,
     );
     $form['blocks']['openx_zones'][$index]['name'] = array(
       '#type'           => 'textfield',
       '#default_value'  => isset($form_state['zones'][$index]['name']) ? $form_state['zones'][$index]['name'] : '',
+      '#size'           => 20,
+    );
+    $form['blocks']['openx_zones'][$index]['iframe'] = array(
+      '#type'           => 'checkbox',
+      '#default_value'  => isset($form_state['zones'][$index]['iframe']) ? $form_state['zones'][$index]['iframe'] : FALSE,
+    );
+    $form['blocks']['openx_zones'][$index]['width'] = array(
+      '#type'           => 'textfield',
+      '#size'           => 4,
+      '#default_value'  => isset($form_state['zones'][$index]['width']) ? $form_state['zones'][$index]['width'] : '',
+    );
+    $form['blocks']['openx_zones'][$index]['height'] = array(
+      '#type'           => 'textfield',
+      '#size'           => 4,
+      '#default_value'  => isset($form_state['zones'][$index]['height']) ? $form_state['zones'][$index]['height'] : '',
+    );
+    $form['blocks']['openx_zones'][$index]['refresh'] = array(
+      '#type'           => 'textfield',
+      '#size'           => 4,
+      '#default_value'  => isset($form_state['zones'][$index]['refresh']) ? $form_state['zones'][$index]['refresh'] : 0,
     );
   }
 
@@ -78,7 +98,7 @@ function _openx_settings($form, &$form_state) {
     '#title' => t('Site Variables'),
     '#description' => t('Specify site variables to allow OpenX to target ads to particular pages.'),
   );
-  
+
   $form_state['site_vars'] = isset($form_state['site_vars']) ? $form_state['site_vars'] : variable_get('openx_site_vars', array_fill(0, 3, array('key' => '', 'value' => '')));
   if (empty($form_state['site_vars'])) {
     $form_state['site_vars'] = array_fill(0, 3, array('key' => '', 'value' => ''));
@@ -90,7 +110,7 @@ function _openx_settings($form, &$form_state) {
      '#prefix' => '<div id="openx-site-vars-wrapper">',
      '#suffix' => '</div>',
   );
-  
+
   foreach ($form_state['site_vars'] as $key => $vars) {
     $form['targeting']['openx_site_vars'][$key]['key'] = array(
       '#type' => 'textfield',
@@ -115,7 +135,7 @@ function _openx_settings($form, &$form_state) {
       ),
     );
   }
-  
+
   $form['targeting']['add_row'] = array(
     '#type' => 'submit',
     '#value' => t('Add variable'),
@@ -165,18 +185,35 @@ function _openx_settings_add_zone_callback($form, &$form_state) {
 }
 
 function _openx_settings_add_zone($form, &$form_state) {
-  $form_state['zones'][] = array('id' => '', 'name' => '');
+  $form_state['zones'][] = _openx_settings_get_empty_zone();
   $form_state['rebuild'] = TRUE;
 }
 
 function _openx_settings_delete_zone($form, &$form_state) {
   unset($form_state['zones'][$form_state['clicked_button']['#zone_id']]);
   if (count($form_state['zones']) < 3) {
-    $form_state['zones'][] = array('id' => '', 'name' => '');
+    $form_state['zones'][] = _openx_settings_get_empty_zone();
   }
   $form_state['rebuild'] = TRUE;
 }
 
+/**
+ * _openx_settings_get_empty_zone
+ *
+ * @return array
+ */
+function _openx_settings_get_empty_zone() {
+  return array(
+    'enabled' => '',
+    'id' => '',
+    'name' => '',
+    'iframe' => '',
+    'width' => '',
+    'height' => '',
+    'refresh' => '',
+  );
+}
+
 function _openx_settings_site_vars_clean(&$form, &$form_state) {
   $errors = FALSE;
 
@@ -190,7 +227,7 @@ function _openx_settings_site_vars_clean(&$form, &$form_state) {
       form_error($form[$key]['key'], t('Key field is required when there is a value present'));
     }
   }
-  
+
   if (!$errors) {
     form_set_value($form, $site_vars, $form_state);
   }
@@ -212,14 +249,32 @@ function _openx_settings_add_variable_callback($form, &$form_state) {
 
 /**
  * Theme the OpenX blocks list as a table
+ *
+ * @param $variables
+ *
+ * @return string
  */
 function theme_openx_settings_zones($variables) {
-  $form =& $variables['form'];
-  $header = array(t('Zone ID'), t('Block name'), '');
+  $form = &$variables['form'];
+  $header = array(
+    t('Enabled'),
+    t('Zone ID'),
+    t('Block name'),
+    t('iFrame'),
+    t('Width'),
+    t('Height'),
+    t('Refresh'),
+    '',
+  );
   foreach (element_children($form) as $zone) {
     $rows[] = array(
+      drupal_render($form[$zone]['enabled']),
       drupal_render($form[$zone]['id']),
       drupal_render($form[$zone]['name']),
+      drupal_render($form[$zone]['iframe']),
+      drupal_render($form[$zone]['width']),
+      drupal_render($form[$zone]['height']),
+      drupal_render($form[$zone]['refresh']),
       drupal_render($form[$zone]['delete'])
     );
   }
@@ -228,10 +283,14 @@ function theme_openx_settings_zones($variables) {
 }
 
 function theme_openx_site_vars($variables) {
-  $form =& $variables['form'];
-  $header = array(t('Variable'), t('Value'), '');
+  $form = &$variables['form'];
+  $header = array(
+    t('Variable'),
+    t('Value'),
+    '',
+  );
   $rows = array();
-  
+
   foreach (element_children($form) as $key) {
     $rows[] = array(
       drupal_render($form[$key]['key']),
@@ -239,6 +298,6 @@ function theme_openx_site_vars($variables) {
       drupal_render($form[$key]['delete']),
     );
   }
-  
+
   return theme('table', array('header' => $header, 'rows' => $rows));
-}
+}
\ No newline at end of file
diff --git a/openx.inc b/openx.inc
index 68ea5d8..0ff9275 100644
--- a/openx.inc
+++ b/openx.inc
@@ -15,45 +15,13 @@
  */
 function _openx_javascript() {
   global $user;
-  static $spc_code;
+  static $js_added = FALSE;
 
-  // No need to add the header more than once
-  if (!empty($spc_code)) {
-    return;
-  }
+  // No need to add the JS more than once
+  if ( $js_added ) return;
 
-  if (!empty($_SERVER['HTTPS'])) {
-    $protocol = 'https';
-    $server = variable_get('openx_delivery_url_https', 'd.openx.org');
-  }
-  else {
-    $protocol = 'http';
-    $server = variable_get('openx_delivery_url', 'd.openx.org');
-  }
-  $url = $protocol . '://' . trim($server, '/') . '/spcjs.php';
-  
-  if ($site_vars = variable_get('openx_site_vars', FALSE)) {
-    $vars = array();
-    if (module_exists('token')) {
-      $data = array('global' => NULL, 'user' => $user);
-      
-      $node = menu_get_object('node');
-      
-      if (isset($node)) {
-        $objects['node'] = $node;
-      }
-    }
-    foreach ($site_vars as $var) {
-      if (!empty($var['key'])) {
-        if (module_exists('token')) {
-          $vars[$var['key']] = token_replace($var['value'], $data);
-        }
-        else {
-          $vars[$var['key']] = $var['value'];
-        }
-      }
-    }
-    
+  $url = _openx_get_delivery_url() . '/spcjs.php';
+  if ( $vars = _openx_get_site_vars() ) {
     if (!empty($vars)) {
       $url .= '?' . drupal_http_build_query($vars);
     }
@@ -71,26 +39,10 @@ function _openx_javascript() {
   $script .= implode(",\n", $js_zones);
   $script .= "\n  }";
 
-  $spc_code = array();
-  drupal_add_html_head(array(
-    '#type' => 'html_tag',
-    '#tag' => 'script',
-    '#attributes' => array(
-      'type' => 'text/javascript',
-    ),
-    '#value' => $script,
-    '#weight' => 1000,
-  ), 'openx_zones');
-  drupal_add_html_head(array(
-    '#type' => 'html_tag',
-    '#tag' => 'script',
-    '#attributes' => array(
-      'type' => 'text/javascript',
-      'src' => $url,
-    ),
-    '#value' => '',
-    '#weight' => 1001,
-  ), 'openx_script');
+  drupal_add_js($script, 'inline');
+  drupal_add_js($url, array('external', 'cache' => FALSE));
+
+  $js_added = TRUE; // Flag indicating that JS has been added
 }
 
 /**
@@ -112,3 +64,54 @@ function _openx_get_zone($index_or_key) {
   // There is no zone with such ID or name
   return FALSE;
 }
+
+
+/**
+ * _openx_get_delivery_url
+ *
+ * @return string
+ */
+function _openx_get_delivery_url() {
+  // Get protocol and server
+  if (empty($_SERVER['HTTPS'])) {
+    $protocol = 'http';
+    $server = variable_get('openx_delivery_url', 'd.openx.org');
+  } else {
+    $protocol = 'https';
+    $server = variable_get('openx_delivery_url_https', 'd.openx.org');
+  }
+  return $protocol . '://' . trim($server, '/');
+}
+
+
+/**
+ * _openx_get_site_vars
+ *
+ * @return array
+ */
+function _openx_get_site_vars() {
+  // Get site variables
+  $vars = array();
+  if ( ( $site_vars = variable_get('openx_site_vars', FALSE) ) == FALSE ) {
+    return FALSE;
+  }
+  if (module_exists('token')) {
+    global $user;
+    $data = array('global' => NULL, 'user' => $user);
+    $node = menu_get_object('node');
+    if (isset($node)) {
+      $data['node'] = $node;
+    }
+  }
+  foreach ($site_vars as $var) {
+    if (!empty($var['key'])) {
+      if (module_exists('token')) {
+        $vars[$var['key']] = token_replace($var['value'], $data);
+      } else {
+        $vars[$var['key']] = $var['value'];
+      }
+    }
+  }
+
+  return $vars;
+}
\ No newline at end of file
diff --git a/openx.module b/openx.module
index e2932e8..d734ce9 100644
--- a/openx.module
+++ b/openx.module
@@ -20,6 +20,7 @@ function openx_block_info() {
     if ($zone['id']) {
       $blocks[$index] = array(
         'info'    => t('OpenX Zone !id (!name)', array('!id' => $zone['id'], '!name' => (empty($zone['name']) ? t('untitled') : $zone['name']))),
+        'cache'   => DRUPAL_NO_CACHE,
       );
     }
   }
@@ -96,7 +97,7 @@ function openx_theme() {
  *
  * @param $index_or_key
  *   Number or String. The zone ID number or the it's 'nickname'
- * @return
+ * @return string
  *   HTML. The area where the banner will be displayed
  */
 function openx_invoke($index_or_key) {
@@ -105,10 +106,56 @@ function openx_invoke($index_or_key) {
     return '';
   }
 
-  // Add the JS on top of the page
-  _openx_javascript();
+  if ( ( ! isset($zone['enabled']) ) || ( ! $zone['enabled'] ) ) {
+    return '';
+  }
+
+  // iFrame or JavaScript Invocation
+  $output = '';
+  if (
+    isset($zone['iframe']) && $zone['iframe'] &&
+    isset($zone['id']) && is_numeric($zone['id']) &&
+    isset($zone['width']) && is_numeric($zone['width']) &&
+    isset($zone['height']) && is_numeric($zone['width']) &&
+    TRUE) {
+    // iFrame Invocation
+    $zone_id = (int)$zone['id'];
+    $refresh = ( isset($zone['refresh']) && is_numeric($zone['refresh']) ) ? (int)$zone['refresh'] : 0;
+    $width = (int)$zone['width'];
+    $height = (int)$zone['height'];
+
+    $ad_server_url = _openx_get_delivery_url();
+    $vars = _openx_get_site_vars();
+
+    for ( $random_hex_string = ''; strlen($random_hex_string) < 8; $random_hex_string .= dechex(rand(0,15)) );
+    $cb = time();
+    $iframe_url = $ad_server_url . '/afr.php?' . drupal_http_build_query(array_merge(array(
+      'zoneid' => $zone_id,
+      'refresh' => $refresh,
+      'cb' => $cb,
+    ), $vars));
+
+    $beacon_click_url = $ad_server_url . '/ck.php?' . drupal_http_build_query(array(
+      'n' => $random_hex_string,
+      'cb' => $cb,
+    ));
+
+    $beacon_image_url = $ad_server_url . '/avw.php?' . drupal_http_build_query(array_merge(array(
+      'zoneid' => $zone_id,
+      'cb' => $cb,
+      'n' => $random_hex_string,
+    ), $vars));
+
+    $output .= "<iframe id='{$random_hex_string}' name='{$random_hex_string}' src='{$iframe_url}' style='border: none;' width='{$width}' height='{$height}'><a href='{$beacon_click_url}' target='_blank'><img src='{$beacon_image_url}' style='border: none;' alt='' /></a></iframe>" . PHP_EOL;
+  } else {
+    // JavaScript Invocation
+    // Add the JS on top of the page
+    _openx_javascript();
+
+    $output .= '<script type="text/javascript"><!--// <![CDATA[' . PHP_EOL;
+    $output .= "  OA_show('{$zone['name']}');" . PHP_EOL;
+    $output .= '// ]]> --></script>' . PHP_EOL;
+  }
 
-  return "<script type='text/javascript'><!--// <![CDATA[
-    OA_show('{$zone['name']}');
-// ]]> --></script>";
+  return $output;
 }
