Had a 757 climbing out of MIA and at 20,000 ft smelled electrical smoke through the whole cabin and cockpit. We declared an emergency and went back to MIA and landed. SwissAir101 at Halifax had the same problem a year before so didn't want to duplicate it. It ended up with no fire and we were fine. Downloading nonessential busses immediately put the fumes down to a tolerale level.