Take a look at the circuit below ..
Part of it, build around H11L1 and Q1, is an example of an optically isolated zero-crossing circuit .. (The H11L1 can be replaced by any similar opto-coupler, D1-D4 should be 1N4004 or any other diodes rated for 400V) ..