function rotater(imgCount, rotateSpeed, topz, showId, hideId)
{
  if(!imgCount) return;
  if(imgCount<2) return;
  if(!rotateSpeed) rotateSpeed = 5000; //five seconds
  if(!topz) topz = 30;
  if(!showId) showId = 2;
  if(!hideId) hideId = 1;

  var showEl = 'rotate'+showId;
  var hideEl = 'rotate'+hideId;
  
  fadeOut(hideEl);
	document.getElementById(showEl).style.zIndex = topz;
  fadeIn(showEl);
  
  showId++; hideId++;
  if(showId>imgCount) showId=1;
  if(hideId>imgCount) hideId=1;
  
  
  setTimeout('rotater('+imgCount+','+rotateSpeed+','+(++topz)+',"'+showId+'","'+hideId+'")',rotateSpeed);
}



function fadeIn(id,opac){
  if(!id) return;
  if (opac==100) return;
  if(!opac) opac=0;
  if(opac < 100){
    opac+=5;
    var el = document.getElementById(id);
    if(!el) return;
    var s=el.style;
    s.visibility='visible';
    if(typeof(s.filter)!='undefined'){ // IE5.5+
      s.zoom=1;
      s.filter='alpha(opacity:'+opac+')';
    } else {
      s.opacity = s.MozOpacity = opac/100;
    }
    
    try
    {
      if(typeof(s.opacity)!='undefined')  s.opacity = opac/100;
      if(typeof(s.MozOpacity)!='undefined')  s.MozOpacity = opac/100;
    }
    catch(e)
    {
    }
    
    setTimeout('fadeIn("'+id+'",'+opac+')',50);
  }
}



function fadeOut(id,opac){
  if(!id) return;
  if(opac == 0) return;
  if(!opac) opac=100;
  if(opac > 0){
    opac-=5;
    var el = document.getElementById(id);
    if(!el) return;
    var s=el.style;
    s.visibility='visible';
    if(typeof(s.filter)!='undefined'){ // IE5.5+
      s.zoom=1;
      s.filter='alpha(opacity:'+opac+')';
    } else {
      s.opacity = s.MozOpacity = opac/100;
    }
    
    try
    {
      if(typeof(s.opacity)!='undefined')  s.opacity = opac/100;
      if(typeof(s.MozOpacity)!='undefined')  s.MozOpacity = opac/100;
    }
    catch(e)
    {
    }
    
    setTimeout('fadeOut("'+id+'",'+opac+')',50);
  }
}





