it's either going to be the switch or even possibly an earth fault
there have also been reports that the rear lights can cause the headlights to pack up, the most obvious one being that you put the wrong bulb in the brake lights and evern time you press the brakes the headlights come on, so peole think youare flashing them through
but the switch would be the first port of call, although where you've get a replacement from is anyones guess