function openWindow(window, content, marker) {
window.setContent(content);
window.open(map, marker);
}
function openInfoWindow(window, content, marker) {
return function() {
window.setContent(content);
window.open(map, marker);
};
}
openInfoWindow(someWindow, someContent, someMarker);
И так:google.maps.event.addListener(marker, 'click', openInfoWindow(someWindow, someContent, someMarker));
openInfoWindow(someWindow, someContent, someMarker)();
При добавлении слушателя событий — без изменений.google.maps.event.addListener(marker, 'click', function() {
openWindow(someWindow, someContent, someMarker);
});