Take a look at PsSuspend. You can just put the command into your macro software and bind start and stop keys. If you need the resume to be automatic, you could do a simple batch file and macro that.
In addition, I don't think you'd find any luck trying to do something like this in JS. That would be a really, really bad security hole if you could just invoke a JS script that could touch things outside its little box. Go to a website and have it delete System32 for you? I'll pass, haha.