Replace
document.getElementById(foo).innerHTML = (r_card[i]);
with
document.getElementById('foo').innerHTML = (r_card[i]);
You have no variable named foo
.
As a side note, you could make the array declaration cleaner with
var r_card = [
"Ace of Diamonds",
"Two of Diamonds"
...
];