
var curr, nex, object;
var numPics = 25;
var isSwap = false;
function swap()
{
	isSwap = true;
	pause(1000);
	object = document.getElementById(nex);
		//Internet Explorer
	object.style.filter = 'alpha(opacity=' + 0 + ')';
	//Mozilla
	object.style.MozOpacity = 0;
	//All others
	object.style.opacity = 0;
	object.style.zIndex = 3;
	fadeIn(5);
}
function fadeIn(opac)
{
  //Internet Explorer
  object.style.filter = 'alpha(opacity=' + opac + ')';
  //Mozilla
  object.style.MozOpacity = opac/100;
  //All others
  object.style.opacity = opac/100;
  
  if(opac > 100)
  {
	  finishswap();
	  return;
  }
  	opac += 5;
  	setTimeout(function(){fadeIn(opac)}, 50);
}
function finishswap()
{
	document.getElementById(curr).style.zIndex = 1;
	object.style.zIndex = 2;
	curr = nex;
	nex++;
	if(nex > numPics)
		nex = 1;
	pause(100);
	isSwap = false;
}
function clicker()
{
	if(nex > numPics)
		nex = 1;
	swap();
}
function start()
{
	setTimeout("swap();", 3000);
}
function pause(millis)
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
} 



