function addScript( url, callback ) {
    var script = document.createElement('script');
    if( callback ) script.onload = callback();
    script.type = 'text/javascript';
    script.src = url;
    document.body.appendChild( script );
    console.log('Added: ' + url);
}

function loadMapsAPI() {
    addScript( 'https://maps.googleapis.com/maps/api/js?key=AIzaSyDxpjfVxlLazmPt1gkiw_wIy55ofWAUJvY&callback=mapsApiReady' );
}

function mapsApiReady() {
    addScript( '/assets/plugins/snazzy/snazzy-info-window.min.js' );
    addScript( window.wb_search_map_init );
}

$(document).ready(function(){
    loadMapsAPI();
});

//window.onload = loadMapsAPI;
