curpic=1;
longdelay=5000;
opacity=100;
opacitydir=-5;
 
<!-- opacity - NOTE: Object HAS to have it set in the html or css to be able to change it!!! -->
function fnPulseOpacity()
{
  opacity=opacity+opacitydir;
  // once totally faded, change direction of fade
  if (opacity==0) {
    opacitydir=5;
    opacity=0;
    // if current pic is the initial one, switch image to heroshot3, and alt text to heroshot2 (Dup of background)
    if (curpic==1) {
      tempsrc=document.getElementById("heroshot").src;
      tempalt=document.getElementById("heroshot").alt;
      document.getElementById("heroshot").src=document.getElementById("heroshot3").src;
      document.getElementById("heroshot").alt=document.getElementById("heroshot2").alt;
      }
    // if current pic is FADPIC3, switch image to heroshot, and alt text to heroshot2 (Dup of background)
    if (curpic==0) {
      document.getElementById("heroshot").src=tempsrc;
      document.getElementById("heroshot").alt=document.getElementById("heroshot2").alt;
      }
    curpic=(1-curpic);
    };
  // once totally opac, change direction of fade
  if (opacity==100) {
    opacitydir=-5;
    opacity=100;
    // if current pic is the initial one, switch alt text back to initial one
    if (curpic==1) {
      document.getElementById("heroshot").alt=tempalt;
      }
    // if current pic is heroshot3, switch alt text to heroshot3
    if (curpic==0) {
      document.getElementById("heroshot").alt=document.getElementById("heroshot3").alt;
      }
    }
/* for IE */
if (document.getElementById("heroshot").filters) {
  document.getElementById("heroshot").filters.alpha.opacity=opacity;
  }
/* CSS3 standard */
document.getElementById("heroshot").style.opacity=(opacity/100);
  delay=100;
  if ((opacity==100)||(opacity==0)) { delay=longdelay;};
  setTimeout("fnPulseOpacity()",delay);
}

function fnFadeInitialiser()  {
setTimeout("fnPulseOpacity()",2500+(Math.floor(Math.random()*2)*2500));
}

addLoadEvent(fnFadeInitialiser);
