Example:
Using a JS object to draw a collection of markers, taking the position and additional attributes from the object itself.
On each loop the marker is drawn, and it receives a click listener, which in turn opens an infowindow whose content is the markers properties, taken from the JS object.
Made as an example for Stack Overflow
Modified http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=visualization,drawing,places,weather,geometry to a secure url
Modified http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js to a secure url
https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=visualization,drawing,places,weather,geometry
https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js