
window.addEventListener?window.addEventListener('load',so_init,false):window.attachEvent('onload',so_init);

var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;

function so_init() {
   if (!d.getElementById || !d.createElement) return;

   css = d.createElement('link');
   css.setAttribute('href', 'spotlight.css');
   css.setAttribute('rel', 'stylesheet');
   css.setAttribute('type', 'text/css');
   d.getElementsByTagName('head')[0].appendChild(css);

   lis = d.getElementById('spotlight_elements').getElementsByTagName('li');
   for (i = 0; i < lis.length; i++) lis[i].style.display = 'none';
   lis[0].style.display = 'block';
}
function so_switch_fwd() {
   nIndex = (lis[current + 1] == i) ? 0 : current + 1;
   if (nIndex == i) {
      for (i = 0; i < lis.length; i++) lis[i].style.display = 'none';
      lis[0].style.display = 'block';
      nIndex = 0;
   } else {
      cDisp = lis[current].style.display = 'none';
      nDisp = lis[current + 1].style.display = 'block';
   }
   current = nIndex;
}
function so_switch_bwd() {
   nIndex = (current == 0) ? current + (i-1) : current - 1;
   if (nIndex == i-1) {
      lis[current].style.display = 'none';
      lis[nIndex].style.display = 'block';
   } else {
      cDisp = lis[current].style.display = 'none';
      nDisp = lis[current - 1].style.display = 'block';
   }
   current = nIndex;
}
