var capaold='';
function veurecapa(capa){
	if(capa!='profes'){
		document.getElementById('profes').style.visibility='hidden';
		document.getElementById('mprofes').className='menu';
	}
	if(capa!='escola'){
		document.getElementById('escola').style.visibility='hidden';
		document.getElementById('mescola').className='menu';
	}
	if(capa!='estudis'){
		document.getElementById('estudis').style.visibility='hidden';
		document.getElementById('mestudis').className='menu';
	}
	if(capa!='estudiant'){
		document.getElementById('estudiant').style.visibility='hidden';
		document.getElementById('mestudiant').className='menu';
	}
	
	if(capa){
		
			document.getElementById(capa).style.visibility='visible';
			document.getElementById('m'+capa).className='menuon';
		
	}
}

function  checkvalor(f)
{
    if ((f.nom.value ==""))
    {
      alert("El camp Nom és obligatori.");    
      f.nom.focus();
      return (false);     
    }  
    if ((f.email.value =="") || !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(f.email.value)))
    {
      alert("Email incorrecte.");
      return (false);
    }
     
     return (true);    
}  

function veure(capa){
	
	if(capaold!=''){
		//piano
		document.getElementById(capaold).style.visibility='hidden';
		document.getElementById("i"+capaold).style.color='#545454';
		document.getElementById("i"+capaold).style.backgroundColor='#ffffff';
	}
	
	capaold=capa;
		document.getElementById(capa).style.visibility='visible';
		document.getElementById("i"+capa).style.color='#FFFFFF';
		document.getElementById("i"+capa).style.backgroundColor='#5d6a9c';
}

function comprovacio(camps,noms,eltexte,frase){
	camps=camps.split(',');
	noms=noms.split(',');
	correcte=true;

	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(eltexte+noms[i]);
      	correcte=false;
    	}
		}else	if(!document.getElementById(camps[i]).value){
			alert(eltexte+noms[i]);
			document.getElementById(camps[i]).focus();
			correcte=false;
		}
	}
	
	if(correcte){
		if(confirm(frase)) correcte=true;
		else correcte=false;
	}
	
	return correcte;
}