var count = 8;

var f = new Array(count);
  for (i=0; i<=count; i++) {
    f[i] = 0;  
}

function opi(num) {   
   for(i=1; i<=count; i++) {
      theElement = document.getElementById('block-'+i);
	  theElement.style.display = 'none';
	  if (i != num) f[i] = 0;  
	  
	 /* alert(theElement.style.display+'///block-'+i);*/
   }
    
	f[num] += 1;
	
  if (f[num]%2 != 0) 
   {
     theElement = document.getElementById('block-'+num);
     theElement.style.display = 'block';
	
   }
}