var d=document, imgs = new Array(), zInterval = null, current=0, pause=false, play=false;
var Left,Top,aLeft = new Array (),aTop = new Array ();
function fade_init() 
{
	if(!d.getElementById || !d.createElement)
		return;
	
	imgs = d.getElementById("imageFade").getElementsByTagName("Div"); // Image
	
	for(i=0;i<imgs.length;i++)
	{
		if(i==0)
		{
			imgs[i].style.display = "block";
			imgs[i].xOpacity = .99;	
		}
		else
		{
			imgs[i].style.display = "none";
			imgs[i].xOpacity = 0;			
		}
	}
	setTimeout(doPlay,2000);
}

function so_init() 
{
	if(!d.getElementById || !d.createElement)
		return;

	setTimeout(so_xfade,1000);
}

function so_xfade() 
{
	
	cOpacity = imgs[current].xOpacity;
	nIndex = imgs[current+1]?current+1:0;

	nOpacity = imgs[nIndex].xOpacity;
	
	cOpacity-=.02; 
	nOpacity+=.02;
	
	imgs[nIndex].style.display = "block";	
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;
	
      //alert("a="+nOpacity);
	//alert("b="+cOpacity);


	setOpacity(imgs[current]); 
	setOpacity(imgs[nIndex]);
	
	if(cOpacity<=0) 
	{
		imgs[current].style.display = "none";
		current = nIndex;
		setTimeout(so_xfade,1000);
	} 
	else 
	{
		setTimeout(so_xfade,50);
	}
}	
function setOpacity(obj) 
{
	if(obj.xOpacity>.99) 
	{
		obj.xOpacity = .99;
		return;
	}
	obj.style.opacity = obj.xOpacity;
	obj.style.MozOpacity = obj.xOpacity;
	obj.style.KhtmlOpacity = obj.xOpacity;
	obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
}

function doPlay()
{
	so_init();		
}
