// JavaScript Document
 // Nos dice cuantas imágenes tenemos


 // Creem un Array con els nombres de les imatges, introduixen tantas como necessitis (numberOfImages)


    //Retorna un numero entre 0 i nums-1
 function getRandom(nums)
 {
 var ranNum= Math.round(Math.random()*nums);
 return ranNum;
 }
 

 // Escribimos la etiqueta img con una imagen aleatoria
 //document.write("<img xsrc='" + image[randomNumber] + "' />");
function laimatge(){
	document.getElementById("cos").style.display="none";
	var mfotospr=new Array(numberOfImages); 
	for (i=0;i<numberOfImages;i++){ 
        mfotospr[i]=i; 
	} 
	for (j=0;j<5;j++){ 
		var aleatori = faleatori(mfotospr.length-1); 
        document.getElementById("foto"+j).src=image[mfotospr[aleatori]].src;
        mfotospr.splice(aleatori,1);
	} 	
 }
 
function laimatgeini(){
	num=getRandom(numberOfImages-1);
	document.getElementById("foto4").src=image[num].src;
}

//Mostra la imatge
function canviaimatges(img){
 document.getElementById('foto4').src=img.src;
}

