Sounds like you've got some bad electrical connections, most likely bad grounds. This is common with cars that have a few years/miles on them, as corrosion starts to creep into the electrical connections. There are a few things you can do to help get things back to normal. Before you do any of this, disconnect the battery and download the the wiring diagram for the car (it's on Hyundai's WebTech site).
1) Pull and reinstall all the fuses to ensure that they're making good contact.
2) Do the same thing with all the relays you can access.
3) Pull the connectors off all the headlight/tail light bulbs or pull the bulbs and clean the contacts. Scotchbrite or a pencil eraser will clean them easily.
4) Locate the various grounds for the lights, engine, battery, etc on the wiring diagram. Undo and clean all the connections, then re-connect them. Coat the outside of the connections with dielectric grease or Vaseline to protect them from corrosion.
Once you're done, reconnect the battery. You'll have to reprogram your radio, but it's unavoidable.
If that doesn't correct the problem, it may be something more serious. Regardless, you'll have eliminated any existing ground problems and prevented any impending ones.