<script>var poiskaktive = true;</script>Затем ее состояние нужно проверить внутри события тэга button :
<button onclick="if(poiskaktive) DoSome();">Тык!</button>
DoSome = () => alert('DoSome')
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.