What do i do when sombody is having a seizure? What about a heart attack?

I'm just curious to know what i should do during a seizure and what i should do during a heart attack? I know i never restrain somebody during a seizure, and that you place them on their side incase they vomit so they don't choke, but is there anything else? And for a heart attack im pretty sure there is CPR involved but how would i know when to address CPR and when not too? what should i do during these 2 situations?