// adapted from http://javascript.about.com/library/bladlink2.htm
var imgs    = new Object();
var links   = new Object();
var curimg  = new Object();

function rotate_ads(type) {
  // don't need to do anything
  if (imgs[type].length < 2) {
    return;
  }

  if (document.images) {
    curimg[type]++;

    if (curimg[type] >= imgs[type].length) {
      curimg[type] = 0;
    }

    var image_name = type + '_image';

    document[image_name].src = imgs[type][curimg[type]];

    setTimeout("rotate_ads('"+type+"');",5000);
  }
}

function visit_page(type) {
  window.open(links[type][curimg[type]],"new"+curimg[type]);
}
