ciao a tutti

ho una mappa di google che prende i valori da php

non riesco a far funzionare le infowindow e non so per quale motivo inoltre mi stampa solo gli utenti di tipo 0 e gli altri invece no

il codice è

codice:
<?php    $dati_map = $db->prepare("SELECT nome,cognome,rag_sociale,citta,tipo,avatar FROM mftj_utenti WHERE user_permission=:user_permission");
    $dati_map->execute(array(':user_permission'=>1));
    $res_map = $dati_map->fetchAll();
    ?>
    function initMap() {
      var map = new google.maps.Map(document.getElementById('map'), {
        zoom: 3,
        scrollwheel:false,
        center: {lat: 41.87194, lng: 12.56738}
      });
      setMarkers(map);
    }
    var data = [
      <?php
      $riga = 0;
      foreach($res_map as $map) {
        if($map['tipo'] == 1) {
          $nome = $map['rag_sociale'];
        }
        else {
          $nome = $map['nome']." ".$map['cognome'];
        }
        $address=urlencode($map['citta']);
        $prepAddr = str_replace(' ','+',$address);
        $geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$prepAddr.'&sensor=false');
        $output= json_decode($geocode);
        $latitude = $output->results[0]->geometry->location->lat;
        $longitude = $output->results[0]->geometry->location->lng;
        if($map['tipo'] == 0) {
          $icon = 'http://www.francescopassanante.com/myfacetojob/img/professionisti.png';
        }
        elseif($map['tipo'] == 1) {
          $icon = 'http://www.francescopassanante.com/myfacetojob/img/aziende.png';
        }
        else {
          $icon = 'http://www.francescopassanante.com/myfacetojob/img/privati.png';
        }
        $tipo = $map['tipo'];
        ?>
        ['<?php echo $nome;?>', <?php echo $latitude;?>, <?php echo $longitude;?>, <?php echo $riga;?>, '<?php echo $icon;?>', '<?php echo $tipo;?>'],
        <?php
        $riga++;
      }
      ?>
    ];
    function setMarkers(map) {
      for (var i = 0; i < data.length; i++) {
        var utente = data[i];
        var marker = new google.maps.Marker({
          position: {lat: utente[1], lng: utente[2]},
          map: map,
          title: utente[0],
          zIndex: utente[3],
          icon: utente[4]
        });
        var contentString = '<div id="content">'+'<div id="siteNotice">'+'</div>'+'<h1 id="firstHeading" class="firstHeading">'+utente[0]+'</h1>'+
                            '<div id="bodyContent">'+'<p>'+utente[5]+'</p></div></div>';
        var infowindow = new.google.maps.InfoWindow();
        google.maps.event.addListener(marker,'click', (function(marker,contentString,infowindow){ 
          return function() {
            infowindow.setContent(contentString);
            infowindow.open(map,marker);
          };
        })(marker,contentString,infowindow));
      }
    }