my headlights did that.they were intermitent for awhile then just didn't work.....i had the same problem where both didn't work if one was being weird too, then i'd hit that light and they'd both work??
does the fog work when you hit it with your fist at all? i just had that problem with my car with both headlights. it was my low beam (cuz i'm too lazy to turn it off during the day) and they kinda wore out but if i hit that light it would work until i turned it off/ on again. looked at the bulb and the filament wasn't "broken" but it looked kinda weird compared to the high beam which always worked no matter......so try that. and then maybe check your ground.......that's all i got good buddy