I have been haveing panic attacks since I was hit by a car, is the wreck a reason why I am haveing them? I went to the emergency room.

Very likely. If it's the first several mos after the accident, you are probably having an acute stress response-who wouldn't- and it should pass with time, esp if you have someone supportive to talk to. If it's been several mos, it may be ptsd, and it would be helpful to seek psychiatric help. Very common and very treatable. Good luck.
Survivor Anxiety. It is very common to experience a heightened sense of anxiety following a threatening or near death experience. The sympathetic nervous system becomes over-activated and it takes time to resettle. Anxiety is a natural, adaptive response we experience when we feel unsafe or threatened. Time aids desensitization but so does actively spending time each day relaxing your nervous system.
Get help. There are very effective medications for your panic attacks, first, avoid benzodiazepines, like Xanax (alprazolam) . For my patients with symptoms as you describe, i usually prescribe 25 mgs of nortriptyline, at bedtime. It's four dollars a month at walmart and you need a script. This may or may not be what you need. Never just try taking any drug from a friend or relative. It is not safe, may be a felony..!