
if (document.images)
{
    adImages = new Array("http://www.fishingwithrusty.com/images/dresser.jpg",
                         "http://www.fishingwithrusty.com/images/gun_stock.jpg",                                                   
                         "http://www.fishingwithrusty.com/images/lt_contact.jpg",
                         "http://www.fishingwithrusty.com/images/lt_about.jpg",
                         "http://www.fishingwithrusty.com/images/lt_info.jpg");                         
                       
    swImages = new Array("http://www.fishingwithrusty.com/images/signworks_1_logo_rustysBoat.jpg",
                         "http://www.fishingwithrusty.com/images/signworks_2_logo_suburban_dash.jpg",
                         "http://www.fishingwithrusty.com/images/signworks_3_logo_with_info.jpg",
                         "http://www.fishingwithrusty.com/images/signworks_1_logo_rustysBoat.jpg");
                       
    sportsmanImages = new Array("../images/sm_concealed_classes.jpg",
                         "http://www.fishingwithrusty.com/images/sm.jpg",
                         "http://www.fishingwithrusty.com/images/text1.jpg",
                         "http://www.fishingwithrusty.com/images/text2.jpg");
                                                 
                                                                       
    thisAd = 0;
    dwAd = 0;
    sportsmanAd = 0;
}
else {
    alert("Document.images was not initialized...");
}

function loopThroughLtAd(num) {   
  document.getElementById('burnsChev_Ad').style.display = 'none';
  document.getElementById('ltAd').style.display = 'block';
  setTimeout( "showGreeneAd();", 5000);
} 

function showGreeneAd() {
  document.getElementById('ltAd').style.display = 'none';
  document.getElementById('greeneAd').style.display = 'block';
  setTimeout( "showPsaAd();", 5000);
}

function showPsaAd() {
  document.getElementById('greeneAd').style.display = 'none';
  document.getElementById('psaAd').style.display = 'block';
  setTimeout( "showSgnWrksAd();", 5000);
}

function showSgnWrksAd() {
  document.getElementById('psaAd').style.display = 'none';
  document.getElementById('sgnWrksAd').style.display = 'block';  
  cycleDrmWrksImgs(0);
}

function loopThroughDrmWrksAd(num) { 
  setTimeout(function(){cycleDrmWrksImgs(num)},5000);
  //num++;
}

function cycleDrmWrksImgs(num)
{
    if (document.dwImgBanner)
    { 
        document.getElementById('dw_picsDiv').style.display = 'none';
        
        if(num == 0) {                  
            document.dwImgBanner.src = 'http://www.fishingwithrusty.com/images/signworks_1_logo_rustysBoat.jpg';                                                                          
            setTimeout( "loopThroughDrmWrksAd(1);", 5000);                                               
        } 
        else if(num == 1) { 
            document.dwImgBanner.src = 'http://www.fishingwithrusty.com/images/signworks_2_logo_suburban_dash.jpg';                                 
            setTimeout( "loopThroughDrmWrksAd(2);", 5000);       
        } 
        else if(num == 2) { 
            document.dwImgBanner.src = 'http://www.fishingwithrusty.com/images/signworks_3_logo_with_info.jpg';                           
            setTimeout( "loopThroughDrmWrksAd(3);", 5000);       
        }                                 
        else {                                          
            showSportsmanAds(); 
        }
        document.getElementById('dw_picsDiv').style.display = 'block';
    }
}

function showSportsmanAds() {
  document.getElementById('dw_picsDiv').style.display = 'none';
  document.getElementById('sgnWrksAd').style.display = 'none';
  document.getElementById('sportsmanAd').style.display = 'block';
  cycleSportsmanImgs(0);
}

function loopThroughSportsmanAd(num) { 
  setTimeout(function(){cycleSportsmanImgs(num)},5000);
}

function cycleSportsmanImgs(num)
{
    if (document.images)
    {

        if (document.adBanner.complete)
        {
            if (++sportsmanAd == sportsmanImages.length)
                sportsmanAd = 0;
                
            if(num == 0) { 
                document.getElementById('sportsman_infoBlock').style.display = 'none'; 
                document.getElementById('sportsman_infoBlock2').style.display = 'none';   
                document.getElementById('sportsman_infoBlock3').style.display = 'none';            
                document.getElementById('sportsman_rotator').style.display = 'block';  
                setTimeout( "loopThroughSportsmanAd(1);", 5000);                                             
            } 
            else if(num == 1) { 
                document.getElementById('sportsman_rotator').style.display = 'none'; 
                document.getElementById('sportsman_infoBlock2').style.display = 'none'; 
                document.getElementById('sportsman_infoBlock3').style.display = 'none';                  
                document.getElementById('sportsman_infoBlock').style.display = 'block';
                setTimeout( "loopThroughSportsmanAd(2);", 5000);        
            }          
            else {
                document.getElementById('sportsman_rotator').style.display = 'none'; 
                document.getElementById('sportsman_infoBlock').style.display = 'none';                          
                document.getElementById('sportsman_infoBlock2').style.display = 'none';     
                document.getElementById('sportsman_infoBlock3').style.display = 'block';    
                cycleBurnsAds();                         
            }
            //document.sportsmanImgBanner.src = sportsmanImages[sportsmanAd];
        }
      }
}

function cycleBurnsAds() {
  document.getElementById('sportsmanAd').style.display = 'none';
  document.getElementById('burnsChev_Ad').style.display = 'block';
  
  setTimeout( "loopThroughLtAd(0);", 5000);      
}

var randomnumber = 0;

function determineAds() {      

      randomnumber = Math.floor(Math.random()*5);      
      
      if(randomnumber == 0) {        
        loopThroughLtAd(0);
      }
      else if(randomnumber == 1) {          
        showGreeneAd();
      }  
      else if(randomnumber == 2) {
        showPsaAd();
      }
      else if(randomnumber == 3) {
        showSgnWrksAd();
      }  
      else if(randomnumber == 4) {
        showSportsmanAds();
      }   
      else if(randomnumber == 5) {
        cycleBurnsAds();
      }            
      else{
        showSportsmanAds();
      }            
}

function gotoAd()
{
    document.location.href = adURLs[thisAd];
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}