function openclose(){ if(openclose.running) return; openclose.running= true; // code openclose.running= false; }