How do I implement millis instead of delay in this code?

I make all my variables global. Any code can access any variable from anywhere.