
function rand( min, max ) {
    if (max) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    } else {
        return Math.floor(Math.random() * (min + 1));
    }
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
addLoadEvent(function() {
  var num = rand(1, 3);

if (num == 1) {
    document.getElementById('ate_ad_topic').innerHTML = 'Home Building?';
    document.getElementById('ate_ad_image').innerHTML = '<img src="http://www.newsobserver.com/static/images/qna/alt_images/stanton_homes_alt.jpg" alt="Expert image" />';
    document.getElementById('ate_ad_tagline').innerHTML = "<p style='font-size: 10px; font-weight: bold; color: gray;'>Stanton Homes answers your questions about Home Building</p>";
    document.getElementById('ate_spotlight_link').onclick = function(){s.tl(this,'o',"ATE: Spotlight: Stanton Homes");};
}

if (num == 2) {
    document.getElementById('ate_ad_topic').innerHTML = 'Health?';
    document.getElementById('ate_ad_image').innerHTML = '<img src="http://www.newsobserver.com/static/images/qna/alt_images/raleighent_alt.jpg" alt="Expert image" />';
    document.getElementById('ate_ad_tagline').innerHTML = "<p style='font-size: 10px; font-weight: bold; color: gray;'>Learn more about Raleigh Ear, Nose & Throat</p>";
    document.getElementById('ate_spotlight_link').onclick = function(){s.tl(this,'o',"ATE: Spotlight: Raleigh Ear, Nose & Throat");};
}

if (num == 3) {
    document.getElementById('ate_ad_topic').innerHTML = 'Auto Maintenance?';
    document.getElementById('ate_ad_image').innerHTML = '<img src="http://www.newsobserver.com/static/images/qna/alt_images/pinnacle_guys_alt.gif" alt="Expert image" />';
    document.getElementById('ate_ad_tagline').innerHTML = "<p style='font-size: 10px; font-weight: bold; color: gray;'>Pinnacle Automotive answers your questions about Auto Maintenance.</p>";
    document.getElementById('ate_spotlight_link').onclick = function(){s.tl(this,'o',"ATE: Spotlight: Kevin Parrish");};
}
})