
function fbi(d, i, to) {
  gd = d;  gi = i;
   if (document.getElementById(i).src.indexOf(eval(to+".src")) == -1) {
      so(0, i); document.getElementById(i).src = eval(to+".src"); 
      fes(i, 0, 100, 20);   
   }
}

function fes(i, a, z, n) {
  fs = n;  fc = 0;
  fa = (a - z) / fs;
  ft = setInterval("fe('"+i+"')", 50);
}

function fe(i) {
  fc++;
  if (fa < 0) 
    so(Math.abs(fc * fa), i);
  else 
    so(100 - (fc * fa), i);
  
  if (fc == fs) {
    clearInterval(ft);
    document.getElementById(gd).style.backgroundImage = "url(" 
      + document.getElementById(gi).src + ")";
  }
}

function so(op, i) { 
  var o = document.getElementById(i).style;
  if (navigator.userAgent.indexOf("Firefox") != -1) {
    if (op == 100) { op = 99.999; }
  }
  o.filter = "alpha(opacity=" + op + ")";
  o.KhtmlOpacity = (op / 100); 
  o.MozOpacity = (op / 100);
  o.opacity = (op / 100);
}
