diff -r e5f95b7d6406 sites/all/modules/ad/remote/ad_remote.module
--- a/sites/all/modules/ad/remote/ad_remote.module	Sat Dec 26 17:08:31 2009 +0000
+++ b/sites/all/modules/ad/remote/ad_remote.module	Thu Dec 31 16:48:03 2009 -0800
@@ -95,11 +95,11 @@
     // build a snippet to display on the remote web page
     $output = '<!--'. t('start') .'-->';
     // build a wrapper script which collects the url the ad is displayed on
-    $output .= "\n<script language='JavaScript' type='text/javascript'>\n var adurl = window.location.href;\n";
+    $output .= "\n<script language='JavaScript' type=\"text/javascript\">\n var adurl = window.location.href;\n";
     $url = ad($group, $quantity, array('hostid' => $hostid, 'ad_display' => 'javascript'));
     // break up the inner script so the browser doesn't parse it
-    $url = str_replace(array('<script', '</script>', 'u=admin/content/ad/ad_remote'), array('"<scr" + "ipt', '"+"</scr" + "ipt>"', 'u="+adurl+"'), $url);
-    $output .= "document.write($url)\n</script>\n";
+    $url = trim(str_replace(array('<script', '</script>', 'u=admin/content/ad/ad_remote', "type='text/javascript'", "src='", "'>"), array('<scr\' + \'ipt', '\'+\'</scr\'+ \'ipt>', 'u="+adurl+"', 'type="text/javascript"', 'src="', '">'), $url));
+    $output .= "document.write('$url')\n</script>\n";
     $output .= '<!--'. t('end') .'-->';
 
     $form['code']['snippet'] = array(
