n=null;
var wiV=window;
var doV=document;
var daV=new Date();
var tiV=daV.getTime();
var reV=escape(doV.referrer);
var wiVL = escape(window.location);
var urV='';

function u(p,k)
{
    urV = urV + '&' + p +'=' + k;
}


function cn(k){return k!=null?'"'+k+'"':'""'}

function adS(wiv,dov,url)
{
wiV.riv_fontFamily='verdana,arial,sans-serif';
wiV.riv_headlineSize=11;
wiV.riv_headlineWeight='BOLD';
wiV.riv_textSize=10;
wiV.riv_linkSize=8;

u('a0',wiV.riv_backgroundColor);
u('a1',wiV.riv_borderColor);
u('a2',wiV.riv_headlineColor);
u('a3',wiV.riv_textColor);
u('a4',wiV.riv_linkColor);
u('a5','verdana,arial,sans-serif');
u('a6',11);
u('a7','BOLD');
u('a8',10);
u('a9',8);
adWidth=200;
adHeight=200;
adType=3;
if (wiV.riv_adWidth<50)
{
    wiV.riv_adWidth=180;
}
if (wiV.riv_adHeight<50)
{
    wiV.riv_adHeight=180;
}
dimensiondiff = wiV.riv_adWidth-wiv.riv_adHeight;
adType = wiV.riv_adType;


if (adType==null)
{
if (dimensiondiff<-54 && wiV.riv_adWidth!=120 && wiV.riv_adHeight!=240)
{

            wiV.riv_adWidth = 120;
            wiV.riv_adHeight = 240;
            adType = 2;
}
else if (dimensiondiff>80)
{
            wiV.riv_adWidth = 468;
            wiV.riv_adHeight = 60;            
            adType = 1;
}
else
{
    adType=3;
    wiV.riv_adWidth  =200;
    wiV.riv_adHeight = 200;
}
}

u('a10',wiV.riv_adWidth);
u('a11',wiV.riv_adHeight);
u('a12',adType);
rid = Math.random();
apox = -2;
apoy = -2;
    
dov.write('<div id="adl_ad'+rid+'" style="width:0px;height:0px;"></div>');
if (document.getElementById('adl_ad'+rid)!=null)
{
    dov.write('<iframe id="ad2_ad'+rid+'" name="af" width='+cn(wiV.riv_adWidth)+' height='+cn(wiV.riv_adHeight)+' frameborder="0" style="background-color:'+wiV.riv_backgroundColor+';border:1px solid #'+wiV.riv_borderColor+';" src="" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no">');
    dov.write("</iframe>");
    apos = apo(document.getElementById('adl_ad'+rid));
    agt=navigator.userAgent.toLowerCase();
    if (agt!=null)
    {
        if (agt.indexOf("firefox") != -1 && apos!=null)
        {

            apox = apos[0];
            apoy = apos[1];
        }
    }
    document.getElementById('ad2_ad'+rid).src = 'http://ad1.adleaf.com/adHit.jsp?id='+wiV.riv_client+wiV.urV+'&ref='+wiV.reV+'&loc='+wiV.wiVL+'&x='+apox+'&y='+apoy;
}
else
{
    dov.write('<iframe id="adl_ad'+rid+'" name="af" width='+cn(wiV.riv_adWidth)+' height='+cn(wiV.riv_adHeight)+' frameborder="0" style="background-color:'+wiV.riv_backgroundColor+';border:1px solid #'+wiV.riv_borderColor+';" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no"  src="http://ad1.adleaf.com/adHit.jsp?id='+wiV.riv_client+wiV.urV+'&ref='+wiV.reV+'&loc='+wiV.wiVL+'&x='+apox+'&y='+apoy+'">');
    dov.write("</iframe>");
}
}

function apo(eEl)
{
   if (!eEl && this)    
   {                         
      eEl = this;       
   }                         

   var DL_bIE = document.all ? true : false;

   var nLeftPos = eEl.offsetLeft;      
   var nTopPos = eEl.offsetTop;      
   var ePE = eEl.offsetParent; 
   lc = 0;
   while (ePE != null && lc<500)
   {                                        
      lc++;
      if(DL_bIE)                            
      {

         if( (ePE.tagName != "TABLE") && (ePE.tagName != "BODY") )
         {                                  
            nLeftPos += ePE.clientLeft;
            nTopPos += ePE.clientTop; 
         }
      }
      else                                   
      {
         if(ePE.tagName == "TABLE")  
         {                                   
            var nParBorder = parseInt(ePE.border);
            if(isNaN(nParBorder))            
            {                                
               var nParFrame = ePE.getAttribute('frame');
               if(nParFrame != null)         
               {
                  nLeftPos += 1;             
                  nTopPos += 1;             
               }
            }
            else if(nParBorder > 0)         
            {
               nLeftPos += nParBorder;      
               nTopPos += nParBorder;
            }
         }
      }
      nLeftPos += ePE.offsetLeft;   
      nTopPos += ePE.offsetTop;
      ePE = ePE.offsetParent;
   }                                         
   return [nLeftPos,nTopPos];                
}

adS(wiV,doV,'');

