function checklength(obvsString)
	 {
	 var dame=true;
	var max = 80;
			var txt;
			txt=document.getElementById(obvsString);
			var n = txt.value.length;
			//alert(n);
			if (n>max) //i is the maxlength of textarea which we have set to 80
			{ 
				alert("ha arribat a la longitut màxima de 80 caràcters del camp descripció ");
				txt.value = txt.value.substring(0, max); 
			   dame=false;
			 }
			
        
           return dame;
}
function Apertura_CierreDeBloque(bloc) 
   {
	   //alert(bloc);
	    var b1=false;
		if (document.getElementById(bloc).style.display == 'none'){  
		//alert("Apertura"); 
			document.getElementById(bloc).style.display = ''; 
		}
		else 
		{ 	
		  var numBloc = correspondenciaNomNumBloc(bloc);		    
		   //alert("cierre, mira en todo el bloque si hay algo incorrecto"); 
		   //alert(numBloc); 
		           vengoDeBloque=true;
                   var  bh = ComprovacionRellenoActividadesEnBloque(numBloc); 
                   //aUnEnBl=false;
                 // alert(bh );   
		   if(bh) document.getElementById(bloc).style.display = 'none'; 
		   			 
		}
		
}

function ocultar() 
{                    // alert("OCULTA"); 
	 	 if (document.URL.indexOf("EDUCA_EIPC")!=-1){
	 
		    document.getElementById('medi_social').style.display = 'none';  
		   // document.getElementById('arts_esceniques').style.display = 'none';
		    document.getElementById('educacio_ambiental').style.display = 'none';
		    document.getElementById('dinamitzacio_literaria').style.display = 'none';
         }
         else if (document.URL.indexOf("EDUCA_TEST")!=-1){
                 
                   //alert(h);
		    document.getElementById("medi_social").style.display = 'none';  
		  //alert(h);
		  
         }
         else if (document.URL.indexOf("EDUCA_EISC")!=-1){
		    document.getElementById('medi_social').style.display = 'none';  
		   document.getElementById('arts_esceniques').style.display = 'none';
		    document.getElementById('expressio_corporal').style.display = 'none';
		    document.getElementById('educacio_salut').style.display = 'none';
		     document.getElementById('societat_igualtat').style.display = 'none';
		     //document.getElementById('educacio_movilitat').style.display = 'none';
		    document.getElementById('dinamitzacio_literaria').style.display = 'none';
         }
         else if (document.URL.indexOf("EDUCA_EPCI")!=-1){
		    document.getElementById('medi_social').style.display = 'none';
		    document.getElementById('arts_esceniques').style.display = 'none';
		    document.getElementById('arts_visuals').style.display = 'none';
		    document.getElementById('expressio_corporal').style.display = 'none';
		    document.getElementById('educacio_salut').style.display = 'none';
		    document.getElementById('educacio_movilitat').style.display = 'none'; 
                    document.getElementById('societat_igualtat').style.display = 'none';
		    document.getElementById('dinamitzacio_literaria').style.display = 'none';
            }
      else if (document.URL.indexOf("EDUCA_EPCM")!=-1 || document.URL.indexOf("EDUCA_EPCS")!=-1 ){
		    document.getElementById('medi_social').style.display = 'none';
		    document.getElementById('arts_esceniques').style.display = 'none';
		    document.getElementById('arts_visuals').style.display = 'none';
		    document.getElementById('expressio_corporal').style.display = 'none';
		    document.getElementById('educacio_ambiental').style.display = 'none';	   
		    document.getElementById('educacio_salut').style.display = 'none';
            	    document.getElementById('educacio_movilitat').style.display = 'none';
                    document.getElementById('societat_igualtat').style.display = 'none';
                    document.getElementById('mitjans_comunicacio').style.display = 'none';
                    document.getElementById('dinamitzacio_literaria').style.display = 'none';
            }
      else if (document.URL.indexOf("EDUCA_ES")!=-1)
      {
		    document.getElementById('medi_social').style.display = 'none';
		    document.getElementById('arts_esceniques').style.display = 'none';
		    document.getElementById('arts_visuals').style.display = 'none'
		    document.getElementById('expressio_corporal').style.display = 'none';
		    document.getElementById('educacio_ambiental').style.display = 'none';	   
		    document.getElementById('educacio_salut').style.display = 'none';
                    document.getElementById('educacio_movilitat').style.display = 'none';
                    document.getElementById('societat_igualtat').style.display = 'none';
                    document.getElementById('dinamitzacio_literaria').style.display = 'none';
                    document.getElementById('dinamitzacio_participacio').style.display = 'none';
                    document.getElementById('projectes_recerca').style.display = 'none';
            }
       
}




function ocultarSC() 
{                    // alert("OCULTAsc"); 
	 	 if (document.URL.indexOf("EDUCA_EIPC")!=-1){
	 
		  document.getElementById('arts_esceniques').style.display = 'none';
		   
                }
   
         else if (document.URL.indexOf("EDUCA_EISC")!=-1){
		  
		   document.getElementById('arts_esceniques').style.display = 'none';
 
              }
         else if (document.URL.indexOf("EDUCA_EPCI")!=-1){
	
		    document.getElementById('arts_esceniques').style.display = 'none';

            }

      else if (document.URL.indexOf("EDUCA_EPCM")!=-1 || document.URL.indexOf("EDUCA_EPCS")!=-1 ){
		 
		    document.getElementById('arts_esceniques').style.display = 'none';
       }
	
      else if (document.URL.indexOf("EDUCA_ES")!=-1)
      {
		    
		    document.getElementById('arts_esceniques').style.display = 'none';
	
            }
       
}













function correspondenciaNomNumBloc(nomBloc){
var numBloc=0;
   switch (nomBloc){
   case "medi_social":
   	numBloc=1;
   	break;
   case "arts_esceniques":
   	numBloc=2;
   	break;
   case "arts_visuals":
   	numBloc=3;
   	break;
   case "expressio_corporal":
   	numBloc=4;
   	break;
   case "educacio_ambiental":
   	numBloc=5;
   	break;
   case "educacio_salut":
   	numBloc=6;
   	break;
   case "educacio_movilitat":
   	numBloc=7;
   	break;
   case "societat_igualtat":
   	numBloc=8;
   	break;  
   case "mitjans_comunicacio":
   	numBloc=9;
   	break;
   case "dinamitzacio_literaria":
   	numBloc=10;
   	break;
   case "dinamitzacio_participacio":
   	numBloc=11;
   	break;
   case "projectes_recerca":
   	numBloc=12;
   	break; 	
   	}
   return numBloc;
}