/*
SCRIPT EDITE SUR L'EDITEUR JAVASCRIPT
http://www.editeurjavascript.com
*/
imgLoaded = 0;
CountAffichImg = new Array;
PathImg = new Array;
PassVerif = 0;
ImgRecord = new Array;
a1 = new Image;
a2 = new Image;
a2.src = 'memory/couple_cache.gif';
function loadImg()
	{
	a1.src = "memory/mem_1.gif";
	CountImg();
	a1.src = "memory/mem_2.gif";
	CountImg();
	a1.src = "memory/mem_3.gif";
	CountImg();
	a1.src = "memory/mem_4.gif";
	CountImg();
	a1.src = "memory/mem_5.gif";
	CountImg();
	a1.src = "memory/mem_6.gif";
	CountImg();
	a1.src = "memory/mem_7.gif";
	CountImg();
	a1.src = "memory/mem_8.gif";
	CountImg();
	a1.src = "memory/mem_9.gif";
	CountImg();
	a1.src = "memory/mem_0.gif";
	CountImg();
	a1.src = "memory/mem_10.gif";
	CountImg();
	a1.src = "memory/mem_11.gif";
	CountImg();
	RandomMem('i11',11);
	RandomMem('i12',12);
	RandomMem('i13',13);
	RandomMem('i14',14);
	RandomMem('i15',15);
	RandomMem('i16',16);
	RandomMem('i21',21);
	RandomMem('i22',22);
	RandomMem('i23',23);
	RandomMem('i24',24);
	RandomMem('i25',25);
	RandomMem('i26',26);
	RandomMem('i31',31);
	RandomMem('i32',32);
	RandomMem('i33',33);
	RandomMem('i34',34);
	RandomMem('i35',35);
	RandomMem('i36',36);
	RandomMem('i41',41);
	RandomMem('i42',42);
	RandomMem('i43',43);
	RandomMem('i44',44);
	RandomMem('i45',45);
	RandomMem('i46',46);
	document.messMem.mess.value = "Maintenant, retrouvez les paires...";
	}
function CountImg()
{
PathImg[imgLoaded] = a1.src;
CountAffichImg[imgLoaded] = 0;
CountAffichImg[imgLoaded+12] = 0;
imgLoaded++;
return(true)
}
function RandomMem(imgName,ImgNb)
	{
	ImgTemp = Math.round(Math.random() * 11);
	while (CountAffichImg[ImgTemp]>=2)
		{
		ImgTemp = Math.round(Math.random() * 11);
		}
	ImgRecord[ImgNb] = PathImg[ImgTemp];
	CountAffichImg[ImgTemp]++;
	return(true);
	}
count = 0;
gagne=0;
function AddClic(ImgNb,ImgName)
{
if (PassVerif == 0)
	{
	if (ImgName.src != a2.src)
		{
		alert('Cette image est déjà retournée');
		}
	else
		{
		ImgName.src = ImgRecord[ImgNb];
		count++;
		ImgNamey = ImgName;
		if (count == 1)
			{
			ImgNb1=ImgNb;
			ImgNamex=ImgNamey;
			ImgURL1=ImgRecord[ImgNb];
			}
		else
			{
			PassVerif=1;
			if (ImgRecord[ImgNb] == ImgURL1)
				{
				gagne++;
				if (gagne > 1) s="s";
				else s="";
				document.messMem.mess.value = gagne + ' paire' + s + ' trouvée' + s ;
				PassVerif = 0;
				count=0;
					if (gagne==12)
					{
					document.messMem.mess.value = "Bravo! Vous avez gagné !"
					}
				}
			else
				{
				document.messMem.mess.value = "Ce n'est pas pour cette fois";
				tempoMem2 = setTimeout("ImgNamey.src='memory/couple_cache.gif';ImgNamex.src='memory/couple_cache.gif';document.messMem.mess.value = 'Trouvez les paires';PassVerif = 0;", 1200);
				count=0;
				}
			}
	}
}
}
ThisPage = location.href;