Most companies have you sign away your intellectual property rights for ideas you have while working for a company that are related to the business. Any ideas for products or improvements to products are usually claimed by your employer. It really does not matter if it happened as you went to bed at home, or if you had it on the Golf course, or had it during your regular work hours. Mostly because it is impossible to prove when you had the idea.
If you had an idea for a product that is not in your company's line of business they could still lay claim to the idea, for this reason before I started working on a side project I would get something in writing from your employer that they are not going to lay claim to your Idea and are aware that you are developing it on your own time away from work without the use of company resources. This would protect you from any claims your company might decide to make once you get to a finished product with out their help.
It is important that you avoid the use of company resources. This includes your work laptop, pens and paper you "accidentally" brought home from work, and any scrap material that your company was going to discard that would work on your project. If you get this type of material support from your company then they may have a claim against it, even if they originally declined to claim the idea. Your company probably has deeper pockets and a legal battle of this type is not something most part time inventors can afford.
Most importantly consult a lawyer, and get them to draw up the paperwork protecting you. You should be able to get that done for $500-1000 and that expense can save you from tens of thousands in legal fees down the road. That advice might save you from starting a project you are just going to lose as well.