//*****************************************************************************
//* amBWRA                                                                    *
//*  BandWidthReduceAds                                                       *
//*  This function uses the NON-Cache Defeating version of the BanManPro code *
//*  AND functionalizes the code so that we only send it to the browser ONCE. *
//*  Should reduce the bandwidth required for serving ads.                    *
//*                                                                           *
//* NOTE                                                                      *
//*  CLIENT SIDE Javascript                                                   *
//*                                                                           *
//* Version History                                                           *
//*  08 Dec 2004 - OJM, Removed extra level of indirection.                   *
//*  11 Nov 2004 - OJM, Initial Release                                       *
//*****************************************************************************

function amBWRA( strRoot, nZoneID, strKeywords, nSiteID, bIFrame, nWidth, nHeight, nPageID )
   {

   var browName = navigator.appName;
   var browDateTime = (new Date()).getTime();

   if (bIFrame == true )
      {
      var browVersion = parseInt(navigator.appVersion);
      var ua=navigator.userAgent.toLowerCase();
      if (browName=='Netscape')
         {
         if (browVersion>=5)
            {
            document.write('<ifr'+'ame name="AdZone' + nZoneID + '" src="' + strRoot + '/ad.aspx?ZoneID=' +
                                            nZoneID + '&Keywords=' + strKeywords + '&Task=Get&' +
                                            'Browser=NETSCAPE6&SiteID=' + nSiteID + '&X=' + browDateTime +' " width=' + 
                                            nWidth + ' height=' + nHeight + 'Marginwidth=0 ' +
                                            'Frameborder=0 Marginheight=0 Hspace=0 Vspace=0 Scrolling=No></ifr'+'ame>');
            }
         else if ((browVersion>=4)&&(ua.indexOf('mac')==-1))
            {
            document.write('<S'+'CRIPT src="' + strRoot + '/ad.aspx?ZoneID=' + nZoneID +
                                            '&Keywords=' + strKeywords + '&Task=Get&Browser=NETSCAPE4&SiteID=' + nSiteID + '">');
            document.write('/'+'scr'+'ipt>');
            }
         else if (browVersion>=3)
            {
            document.write('<A HREF="' + strRoot + '/ad.aspx?ZoneID=' + nZoneID +
                                            '&Keywords=' + strKeywords + '&Task=Click&Mode=HTML&SiteID=' + nSiteID +
                                            'PageID='+browDateTime+'&RandomNumber='+browDateTime+'"' +
                                            ' target="_new"><img src="' + strRoot + '/ad.aspx?ZoneID=' +
                                            nZoneID +'&Keywords=' + strKeywords + '&Task=Get&Mode=HTML' +
                                            '&SiteID=' + nSiteID + '&PageID='+browDateTime+'&RandomNumber='+browDateTime+'"' +
                                            'width="' + nWidth + '" height="' + nHeight + '" border="0"></a>');
            }
         }
      else
         {
         document.write('<ifr'+'ame name="AdZone' + nZoneID + '" src="' + strRoot + '/ad.aspx?ZoneID=' + nZoneID +
                                         '&Keywords=' + strKeywords + '&Task=Get&SiteID=' + nSiteID + '&X='+ browDateTime +'" ' +
                                         ' width=' + nWidth + ' Height=' + nHeight +
                                         ' Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No>' +
                                         '</ifr'+'ame>');
         }
      }
   else
      {
      if (browName=='Netscape') 
         {
         document.write('<S'+'CRIPT LANG' + 'UAGE="JAV'+'ASCRIPT" src="' +
                                         strRoot + '/ad.aspx?ZoneID=' + nZoneID + '&Keywords=' +
                                         strKeywords +'&Task=Get&Browser=NETSCAPE4&IFR=False&SiteID=' + nSiteID +
                                         '&Random=' + browDateTime +'">'); 
         document.write('</'+'scr'+'ipt>');
         }
      if (browName != 'Netscape')
         {
         document.write('<S'+'CRIPT LANG'+'UAGE="JAV'+'ASCRIPT" src="' + strRoot + 
                                         '/ad.aspx?ZoneID=' + nZoneID + '&Keywords=' + strKeywords +
                                         '&Task=Get&IFR=False&SiteID=' + nSiteID + '&Random=' + browDateTime + '">');
         document.write('</'+'scr'+'ipt>');
                                                                     

         }
      }
   }

