var flag = true;

      if(flag){
    d.style.display="block";
    flag=false;
   }else{
    d.style.display="none";flag=true;
   }