// JavaScript Document
function mostraImg(actual){


	var foto3=fotos[actual][3];
	var txt=fotos[actual][4];
	var alcada=fotos[actual][1];
	var tmp;



	document.getElementById("seg").onclick=function(){
		tmp=parseInt(actual)+1;	
		if(fotos[tmp]){
			actual++;
			mostraImg(actual);
		}
	}

	document.getElementById("ant").onclick=function(){
		tmp=parseInt(actual)-1;
		if(fotos[tmp]){
			actual--;
			mostraImg(actual);
		}
	}

	document.getElementById("infoimg").innerHTML=parseInt(actual)+1+" / "+fotos.length;


	var input = document.createElement('img');
	input.style.cursor='pointer';
	input.setAttribute('alt', 'Tanca la fotografia');

	var plantilla = document.createElement('div');
    plantilla.setAttribute('id', 'plantilla');

	var parent = document.getElementById('foto');


		input.onclick=function(){
			document.getElementById('frmmimatge').className='DetallHide';
			document.getElementById('foto').innerHTML="<img style='margin-bottom:200px;' src='imgweb/ajax-loader.gif' />";
		}



	input.setAttribute('src', foto3);
	document.getElementById('foto').innerHTML="";
	parent.insertBefore(input, null);




	document.getElementById('frmmimatge').className='DetallShow';
	document.getElementById('mf').style.left="50%";
	document.getElementById('mf').style.marginLeft="-400px";
	document.getElementById('mf').style.top="50%";
	alt=parseInt(alcada/2)+50;
	document.getElementById('mf').style.marginTop="-250px";


	if(txt){
	   document.getElementById('txtfoto').innerHTML=txt;
	}else{
	   document.getElementById('txtfoto').innerHTML="Galeria fotografica";
	}



}
