Como carregar um mapa do Google em um iframe com JavaScript?

Estou com um problema ao carregar um mapa do Google em um iframe. eu quero fazeralgo assim, mas dentro de um iframe. Eu tentei de diferentes maneiras:

Tentando chamar a função showNewMap () antes de carregar o script. Mas eu recebo o seguinte erro: Uncaught TypeError: Object [objeto global] não tem nenhum método 'showNewMap':http://jsfiddle.net/9RE4h/1/

var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
var doc = iframe.contentWindow || iframe.contentDocument;
if (doc.document) { doc = doc.document;}

function showNewMap() {

    var mapContainer =  doc.createElement('div');
    mapContainer.setAttribute('style',"width: 500px; height: 300px");
    doc.body.appendChild(mapContainer);

    var mapOptions = {
        center: new google.maps.LatLng(-35.000009, -58.197645),
        zoom: 5,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    }

    var map = new google.maps.Map(mapContainer,mapOptions);
}

var script = doc.createElement('script');
script.type = 'text/javascript';
script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true&' + 'callback=showNewMap';
doc.getElementsByTagName('head')[0].appendChild(script);

Alguma ideia para resolver o problema?

questionAnswers(3)

yourAnswerToTheQuestion