var Nom = navigator.appName;
var Version = navigator.appVersion;

var ns = (Nom == 'Netscape') ? 1:0
var ie = (Nom == 'Microsoft Internet Explorer') ? 1:0 
var ie9 = (Nom == 'Microsoft Internet Explorer' && Version >= 9 ) ? 1:0

var canvas;
var context;
var ga = 0.0;
var timerId = 0;
var step = 0.2;
var images = Array("kodak.jpg", "France2.jpg", "cnrs.jpg");
var num_image = 0;

function initAnim() {
	if (ie && !ie9) {
		document.images.monImage.src = "image/client/" + images[0];
		document.images.monImage.style.visibility = "visible";
		document.images.monImage.style.display = "block";
	}
	else {
		canvas = document.getElementById("myCanvas");
		context = canvas.getContext("2d");
		timerId = setInterval("fadeIn()", 100);
	}
}

function Wait() { 
    clearInterval(timerId);
	timerId = setInterval("fadeIn()", 100);
}
function fadeIn() { 
	var img = new Image();
	img.src = "image/client/" + images[num_image%images.length];

	context.clearRect(0,0, canvas.width,canvas.height);
	context.globalAlpha = ga;

	img.onload = function() { context.drawImage(img, 50, 0, 68, 68);};

	ga = ga + step;
	if (ga < 0) {
		step = -step;
		++num_image;
	}
	if (ga > 1.0) {
		step = -step;
        clearInterval(timerId);
		timerId = setInterval("Wait()", 5000);
	}
}
