Hey Eliecer,
Let me try to explain what you normally should do and then you can decide if you want to do it my way or your way.
You should not put javascript in your text. Why? Well, because of the same reason we don't mix presentation with business logic. Because of the same reason that we style our pages with css and don't put inline styles over the place.
If I was on your place I would use delegation!
mootools.net/docs/core/Element/Element.Delegation
Delegation is part of the mootools core in 1.3 and 1.4. In mootools 1.2.5 you need to add the mootools-more classes.
Here is an example of delegation in action:
jsfiddle.net/compojoom/QsHw4/2744/
The first part is the actual ajax Request. It returns the following string:
"<div id="myid"><span>click me!</span> some text</div>"
Now look in the show response function. I create a new element - a div . The content of the div is going to be the response of our ajax request. The I attach an event to this div:
div.addEvent('click:relay(#myid span)', function(){
alert('clicked');
});
the :relay tells the event to only be executed when I click on span elements in a div with id #myid.
On the right in jsfiddle you have the result. When you click on the click me text -> you should get an alert in the browser. When you click on some text nothing will happen. So in this case you don't have any javascript in the code, but you are executing events.
But again - stay away from the standard infowindow in google maps! I wasted 4h today trying to figure out why the infowindow was smaller than the content when I was creating the dashboard in hotspots!!!
In the past I have discovered, that when I add content to the infowindow, the best thing to do would be to wrap this content in a div and set the height of that div. This way the infowindow is normally bigger than the content. But today my infowindow was smaller than than the div. No matter what height I was setting the height of the infowindow was with 160px smaller than my content...
At the end it turned out that if you have a map that is 300px high, no matter what you do, you can't get the size of the infowindow to be bigger than 140px... If you have a map that is 600px high - you can't have the info window height bigger than 300 something - this is all automatically calculated by google. No matter if you call the content_changed events for the infowindow or not... So my advise is really - stay away from it and just show the information somewhere else. Like in an overlay on the whole page or left from the map etc... Just use the infowindow to show a little content with few buttons...
Cheers,
Daniel