var pausebetweenmsg=10000;
var glidespeed=80;
var curobjindex=0;
var nbobj=0;
var flag="up";

if (window.addEventListener) window.addEventListener("load", collectElementbyClass, false);
else if (window.attachEvent) window.attachEvent("onload", collectElementbyClass);
else if (document.getElementById) window.onload=collectElementbyClass;

function actualstyle(el, cssproperty){
	if (el.currentStyle) style=el.currentStyle[cssproperty]
	else if (window.getComputedStyle) {
		var elstyle=window.getComputedStyle(el, "");
		style=elstyle.getPropertyValue(cssproperty);
	}
	return style;
}

function collectElementbyClass(){
	var classname="testim";
	glidearray=new Array();
	var inc=0;
	var alltags=document.all? document.all : document.getElementsByTagName("*");
	for (i=0; i<alltags.length; i++) {
		if (alltags[i].className==classname) glidearray[inc++]=alltags[i];
	}
	nbobj=glidearray.length;
	if (nbobj>0) onebyoneglide();
	
}

function onebyoneglide(){
	if (curobjindex<glidearray.length) glidetimer=setInterval("glideroutine()",glidespeed)
}

function glideroutine(){
	if (flag=="up") {
		if(curobjindex==0) {
			glidearray[curobjindex].style.display="block";
		}
		//Test IE
		//Test autre
		if(parseFloat(actualstyle(glidearray[curobjindex], "opacity"))<1) {
			glidearray[curobjindex].style.opacity=parseFloat(actualstyle(glidearray[curobjindex], "opacity"))+0.2;
		}
		else {
			flag="down";
			clearInterval(glidetimer);
			setTimeout("onebyoneglide()", pausebetweenmsg);
		}
	}
	
	else if(flag=="down") {
		//Test IE 
		
		//Test autre
		if (parseFloat(actualstyle(glidearray[curobjindex], "opacity"))>0) {
			glidearray[curobjindex].style.opacity=parseFloat(actualstyle(glidearray[curobjindex], "opacity"))-0.2;
		}
		else {
			glidearray[curobjindex].style.display="none";
			if(curobjindex<nbobj-1) curobjindex++;
			else curobjindex=0;
			flag="up";
			glidearray[curobjindex].style.display="block";
		}
		
	}
}