
 // FUNCIÓ PER A LA VALIDACIÓ DE FORMULARIS
 function comprovacio(camps,noms,eltexte,frase){

		var camps = camps.split(',');
		var noms = noms.split(',');
		var correcte = 1;

		for(i=0;i<(camps.length);i++){

			if(camps[i]=='email'){

				if ((document.getElementById('email').value =="") || !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email').value))){

	      	alert("Email incorrecte.");
	      	return (false);

	    	}

			}
			else	if(!document.getElementById(camps[i]).value){

				alert(eltexte+noms[i]);
				document.getElementById(camps[i]).focus();
				correcte=0;
			}
		}

		if(correcte){

			if(confirm(frase)) correcte=1;
			else correcte=0;

		}

		if(correcte){
			return true;
		}
		else return false;
}

function SeleccioFotos(nom_foto,id_foto,num_fotos)
{
	var ruta;

		ruta = "./includes/tallfoto.php?ruta=../img/galeria/" + nom_foto + "&posx=0&posy=0&width=433&height=283&opcio=reduir";
		document.getElementById('imatge_gran').src = ruta;
		for(i=0; i<num_fotos; i++)
		{
			if(document.getElementById("titol"+i) != null)
				document.getElementById("titol"+i).className = "titols_petits";
		}
		document.getElementById("titol"+id_foto).className = "titols_petits_seleccionats";
}

//FUNCIÓ PER MOSTRAR UNA IMATGE AMPLIADA
function Ampliar_foto(ruta_foto,amplada,altura)
{
	var ventana=null;
	var Top=parseInt((screen.height-altura)/2);
	var Left=parseInt((screen.width-amplada)/2);

	ruta_foto = "./includes/tallfoto.php?ruta=." + ruta_foto + "&posx=0&posy=0&width=" + amplada + "&height=" + altura + "&opcio=escala";
	ventana=window.open("about:blank","foto","scrollbar=no,top="+Top+",left="+Left+",width="+amplada+",height="+altura+",status=no,menubar=no,scrollbar=no,directories=no,toolbar=no,resizable=no,border=no,location=no");
	ventana.document.write("<body style='margin-top:0px; margin-left:0px; margin-right:0px; margin-left:0px;'>");
	ventana.document.write("<img src='" + ruta_foto + "'>");
	ventana.document.write("</body>");
	ventana.focus();
}

function ImprimirDocument(ruta_pdf)
{
	ventana = window.open("popup.php?path=" + ruta_pdf, "", "scrollbar=no,status=no,menubar=no,scrollbar=no,directories=no,toolbar=no,resizable=yes,border=no,location=no");
	ventana.window.print();
}

function Canviar_partit(equip1,equip2,dia,hora,lloc,poblacio)
{
	document.getElementById("equip1").innerHTML = equip1;
	document.getElementById("equip2").innerHTML = equip2;
	document.getElementById("dia").innerHTML = dia;
	document.getElementById("hora").innerHTML = hora;
	document.getElementById("lloc").innerHTML = lloc;
	document.getElementById("poblacio").innerHTML = poblacio;
}

function Canviar_resultat(equip_local,equip_visitant,data_alta,resultat_local,resultat_visitant,on)
{
	document.getElementById("equip_local").innerHTML = equip_local;
	document.getElementById("equip_visitant").innerHTML = equip_visitant;
	document.getElementById("data_alta").innerHTML = data_alta;
	document.getElementById("resultat_local").innerHTML = resultat_local;
	document.getElementById("resultat_visitant").innerHTML = resultat_visitant;
	document.getElementById("on").innerHTML = on;
}

//<![CDATA[
function load() {
	if (GBrowserIsCompatible()) {
		var icon = new GIcon();
		icon.image = '';
		icon.iconSize = new GSize(132, 36);
		icon.iconAnchor = new GPoint(0, -50);
		icon.infoWindowAnchor = new GPoint(-20,-10);
		var direccion = "BM GRANOLLERS<br>Carrer dels voluntaris'92<br>08402 Granollers";
		var marcador = new GMarker(new GLatLng(41.599125,2.288847),icon);
		GEvent.addListener(marcador, 'click', function(){marcador.openInfoWindowHtml(direccion);});
		var map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(0.007253,0.014591), 16);
		map.setMapType(G_NORMAL_MAP);
		map.addControl(new GSmallMapControl());
		map.addOverlay(marcador);
		marcador.openInfoWindowHtml(direccion);
	}
}
//]]>

actiu = '';
function dreta(capa){
	document.getElementById(capa).scrollLeft=document.getElementById(capa).scrollLeft+5;
	if(actiu)
		setTimeout("dreta('"+capa+"')",1);
}

function esquerra(capa){
	document.getElementById(capa).scrollLeft=document.getElementById(capa).scrollLeft-5;
	if(actiu)
		setTimeout("esquerra('"+capa+"')",1);
}

function SeleccioFotos(nom_foto,id_foto,num_fotos)
{
	var ruta;
		ruta = "includes/tallfoto.php?ruta=../img/galeria/" + nom_foto + "&posx=0&posy=0&width=450&height=450&opcio=escala";
		document.getElementById('imatge_gran').src = ruta;
//		document.getElementById('numeroFoto').innerHTML = (parseInt(id_foto)+1);

}