
/****************************************
 ** Ad Rotate
 ** 03/08/2010
 ** JSL, modified from Did You Know rotating factoid
 ****************************************/


addOnLoadEvent_r_ad(r_ad);


function addOnLoadEvent_r_ad(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}


var array_count = 2;
var adLink = new Array(array_count);
var adImgSrc = new Array(array_count);
var adImgAlt = new Array(array_count);

adLink[0] = "http://knowhow.lexisnexis.at";
adImgSrc[0] = "/images/banner-ads/banner3a.jpg";
adImgAlt[0] = "LexisNexis KnowHow";

adLink[1] = "http://www.lexisnexis.at/trial/at_LexisNexis-Online.asp";
adImgSrc[1] = "/images/banner-ads/banner3b.jpg";
adImgAlt[1] = "LexisNexis Online";


function r_ad() {
  var obj1;
  var obj2;
  //use different techniques to get the object for browser compatibilities
  if (document.all) {
    obj1 = document.all["rotatingAd_href"];
    obj2 = document.all["rotatingAd_img"];
  }
  else if (document.getElementById) {
    obj1 = document.getElementById("rotatingAd_href");
    obj2 = document.getElementById("rotatingAd_img");
  }
  else if (document.layers) {
    obj1 = document.layers["rotatingAd_href"];
    obj2 = document.layers["rotatingAd_img"];
  }

  if (obj1 && obj2) {
    var index = Math.floor(Math.random() * array_count);
    obj1.setAttribute("href", adLink[index]);
    obj2.setAttribute("src", adImgSrc[index]);
    obj2.setAttribute("alt", adImgAlt[index]);
  }
}

