/*Displays the element
Parameters:
	1.  ID Prefix (End should end in a number)
	2.  Number of the first visible element
	3.  Max number of elements
	4.  Speed at whtch to rotate (In milliseconds)
	5.  Speed at which to fade (In milliseconds)
*/
function dispElement(bId,vElm,max,rsp,fsp){
	var sO;
	var sO2;
	var nElm = vElm + 1;
	if (vElm == max) nElm = 1;
	for (var i=1;i<=max;i++){
		if (i = vElm){
			fade(bId + vElm,fsp,100,0);
			fade(bId + nElm,fsp,0,100);
			vElm = nElm;
			i = max + 1;
		}
	}
	setTimeout("dispElement('" + bId + "'," + vElm + "," + max + "," + rsp + "," + fsp + ")",rsp);
}

//Fades the element in and out
function fade(id,fsp,opS,opE){
	var i=0;
	var speed = Math.round(fsp / 100); 
	var timer = 0;
	if (opS != opE){
		if (opS > opE){
			for (i=opS;i>=opE;i--){
				setTimeout("fadeOut('" + id + "'," + i + ")",(speed * timer));
				timer++;
			}
		}
		else{
			for (i=opS;i<=opE;i++){
				setTimeout("fadeIn('" + id + "'," + i + ")",(speed * timer));
				timer++;
			}
		}
	}
} 

//Fades the elment in
function fadeIn(id,op){
	var obj = document.getElementById(id);
	if (obj != null){
		obj.style.opacity = (op / 100); 
		obj.style.MozOpacity = (op / 100); 
    		obj.style.filter = "alpha(opacity=" + op + ")"; 
		if (op >= 0 && obj.style.display == 'none') obj.style.display = '';
	}
}

//Fades the element out
function fadeOut(id,op){
	var obj = document.getElementById(id);
	if (obj != null){
		obj.style.opacity = (op / 100); 
		obj.style.MozOpacity = (op / 100); 
	    	obj.style.filter = "alpha(opacity=" + op + ")"; 
		if (op <= 0) obj.style.display = 'none';
	}
}
