// New 'maroon spider' ad server code
sas_tmstp=Math.round(Math.random()*10000000000);
sas_masterflag=1;
function SmartAdServer(sas_pageid,sas_formatid,type) {
   var sas_target=((type=="1")?'nouser=true':'user=true');
   if (sas_masterflag==1) {
      sas_masterflag=0;
      sas_master='M';
   } else {
      sas_master='S';
   };
   document.write('<scr'+'ipt src="http://ads.maroonspider.com/call/pubj/' + sas_pageid + '/' + sas_formatid + '/' + sas_master + '/' + sas_tmstp + '/' + escape(sas_target) + '?"></scr'+'ipt>');
}

var googleAdData = parent['googleAdData'];
var adTypes = {
   1: { 'Width': 468, 'Height': 60, 'Src': '/ads/2007/bnr468x60_NN_freetrial1_v6.gif', 'Click': '/about/', 'CharitySrc': 'http://ad.uk.doubleclick.net/ad/N4331.newsnow/B3398028.3;sz=468x60;ord=[timestamp]?', 'CharityClick': 'http://ad.uk.doubleclick.net/jump/N4331.newsnow/B3398028.3;sz=468x60;ord=[timestamp]?', 'CharityEnabled': 0, 'AFS_AdType': 7 },
   2: { 'Width': 160, 'Height': 600, 'Src': '/ads/2007/bnr120x600_NN_freetrial1_v7.gif', 'Click': '/about/', 'CharitySrc': 'http://ad.uk.doubleclick.net/ad/N4331.newsnow/B3398028;sz=120x600;ord=[timestamp]?', 'CharityClick': 'http://ad.uk.doubleclick.net/jump/N4331.newsnow/B3398028;sz=120x600;ord=[timestamp]?', 'CharityEnabled': 0, 'AFS_AdType': 3 },
   3: { 'Width': 120, 'Height': 60, 'CharityEnabled': 0, 'AFS_AdType': 7 },
   4: { 'Width': 1, 'Height': 1, 'CharityEnabled': 0 },
   10: { 'Width': 300, 'Height': 250, 'CharityEnabled': 0, 'Src': '/ads/2007/bnr300x250_NN_freetrial1_v3.gif', 'Click': '/about/', 'AFS_AdType': 5 },
   11: { 'Width': 300, 'Height': 60, 'CharityEnabled': 0, 'AFS_AdType': 7 },
   12: { 'Width': 120, 'Height': 120, 'CharityEnabled': 0, 'AFS_AdType': 4 },
   14: { 'Width': 160, 'Height': 600, 'CharityEnabled': 0, 'AFS_AdType': 3 },
   15: { 'Width': 150, 'Height': 150, 'CharityEnabled': 0, 'AFS_AdType': 4 },
   16: { 'Width': 728, 'Height': 90, 'Src': '/ads/2007/bnr468x60_NN_freetrial1_v6.gif', 'Click': '/about/', 'CharitySrc': 'http://ad.uk.doubleclick.net/ad/N4331.newsnow/B3398028.3;sz=468x60;ord=[timestamp]?', 'CharityClick': 'http://ad.uk.doubleclick.net/jump/N4331.newsnow/B3398028.3;sz=468x60;ord=[timestamp]?', 'CharityEnabled': 0, 'AFS_AdType': 8 },
   101: { 'Width': 271, 'Height': 84, 'CharityEnabled': 0, 'AFS_AdType': 4 }
};

var GoogleEnabled = 1;

function houseAd(type, geoTarget) {
   var ad = adTypes[type];
   
   if(typeof(ad) == 'undefined')
     return;
   
   if(ad.CharityEnabled) {
      document.write('<a target="_blank" href="' + ad.CharityClick + '"><img width="' + ad.Width + '" height="' + ad.Height + '" src="' + ad.CharitySrc + '"/></a>');
      return;
   }
      
   if(GoogleEnabled) {
      var search = parent['googleSearchTerms'];
      if(search) {
	 // Serve Google AdSense for Search ad
	 document.write('<iframe width="' + ad.Width + '" scrolling="no" height="' + ad.Height + '" frameborder="0" name="googleAdsFrame" src="http://www.google.com/custom?client=pub-3001800171585987&q=' + escape(search) + '&sa=Search&safe=on&hl=en&channel=9930777144&alternate_ad_url=http://www.NewsNow.co.uk' + ad.Src + '&cof=DIV%3AFFFFFF%3BBGC%3AFFFFFF%3BLC%3A0000CC%3BVLC%3A0000CC%3BALC%3A0000CC%3BT%3A000000%3BGALT%3A008000%3BFORID%3A' + ad.AFS_AdType + '&adskip=0" marginwidth="0" marginheight="0" hspace="0" vspace="0" allowtransparency="true"></iframe>');
	 return;
      } 
      // else: serve standard AdSense for Content ad
      geoTarget = geoTarget.toUpperCase();
      google_ad_channel = googleAdData[geoTarget];
      if(!google_ad_channel)
	google_ad_channel = googleAdData['Default'];
      if(!google_ad_channel)
	google_ad_channel = "1010466422";
      
      google_ad_client = "pub-3001800171585987";
      if(ad.Src) google_alternate_ad_url = "http://www.newsnow.co.uk" + ad.Src;
      google_ad_width = ad.Width;
      google_ad_height = ad.Height;
      google_ad_format = ad.Width + 'x' + ad.Height + '_as';
      google_ad_type = "text_image";
      google_color_border = "FFFFFF";
      google_color_bg = "FFFFFF";
      google_color_link = "006699";
      google_color_text = "000000";
      google_color_url = "1B703A";
      document.write('<scr' + 'ipt type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></scr' + 'ipt>');
      return;
   }
   
   if(ad.Src)
     document.write('<a target="_blank" href="' + ad.Click + '"><img width="' + ad.Width + '" height="' + ad.Height + '" src="' + ad.Src + '"/></a>');
}

function flashAd(swf, gif, w, h, url, clicktag) {
 var server = parent['staticContentServer'];
 if(!server)
     server = 'www.cdn-eu.newsnow.net';
 if(swf.indexOf('http://') != -1) {
    swf = swf.replace(/(http:\/\/)[^\/]+/,'$1' + server);
 } else {
    swf = 'http://' + server + swf;
 }
   
 if(gif.indexOf('http://') != -1) {
    gif = gif.replace(/(http:\/\/)[^\/]+/,'$1' + server);
 } else {
    gif = 'http://' + server + gif;
 }
   
 document.write("<!-" + "-[if !IE]> -" + "->\n");
 document.write("<object type=\"application/x-shockwave-flash\" data=\"" + swf + "\" width=\"" + w + "\" height=\"" + h + "\">\n");
 document.write("<!-" + "- <" + "![endif]-" + "->\n");
 document.write("<!--[if IE]>\n");
 document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"" + w + "\" height=\"" + h + "\">\n");
 document.write("<param name=\"movie\" value=\"" + swf + "\" />\n");
 document.write("<!--><!--dgx-->\n");
 document.write("<param name=\"loop\" value=\"true\" />\n");
 document.write("<param name=\"menu\" value=\"false\" />\n");
 document.write("<param name=\"play\" value=\"true\"/>\n");
 document.write("<param name=\"quality\" value=\"high\"/>\n");
 document.write("\n");
 document.write("<a href=\"" + url + "\"><img border=\"0\" src=\"" + gif + "\" /></a>\n");
 document.write("\n");
 document.write("</object>\n");
 document.write("<!-" + "- <" + "![endif]-" + "->\n");
}
