Check if infowindow is opened Google Maps v3

Until google doesn't give us any better way of doing this, you can add a property to the infoWindow objects. Something like:

google.maps.InfoWindow.prototype.opened = false;
infoWindow = new google.maps.InfoWindow({content: '<h1> Olá mundo </h1>'});

if(infoWindow.opened){
   // do something
   infoWindow.opened = false;
}
else{
   // do something else
   infoWindow.opened = true;
}

This is an undocumented feature, and is therefore subject to change without notice, however the infoWindow.close() method sets the map on the object to null (this is why infoWindow.open(map, [anchor]) requires that you pass in a Map), so you can check this property to tell if it is currently being displayed:

function isInfoWindowOpen(infoWindow){
    var map = infoWindow.getMap();
    return (map !== null && typeof map !== "undefined");
}

if (isInfoWindowOpen(infoWindow)){
    // do something if it is open
} else {
    // do something if it is closed
}

Update: Another potentially useful way to write this is to add an isOpen() method to the InfoWindow prototype.

google.maps.InfoWindow.prototype.isOpen = function(){
    var map = this.getMap();
    return (map !== null && typeof map !== "undefined");
}