The original idea going into the Constitutional Convention was to have Congress pick the president. A majority of delegates going into the Convention supported this, but discarded it after debates established it would violate the separation of powers.
The popular vote wasn't an option, however, because it would mean the southern states with their large, non-voting slave populations would have vastly reduced influence. The southern delegates would have never supported a popular vote. Thus, the electoral college.
Madison wrote about it here: http://memory.loc.gov/ll/llfr/002/0000/00610057.tif