Odd behavior from the respectable replace_html and his lovely sidekick prototype

Hello there, kind RoR folk. I have a wee bit of a pickle, so i'll get straight to the point.

In one of my views i have two matching dropdowns containing teams. Upon the changing of the selection, provided that the two are different, my desire is to spawn another dropdown containing referees. Below is the view code for one of the dropdowns. The other one is strikingly similar.

<%= form.collection_select "first_team_id", @teams, :id, :name, {}, {   :onchange => remote_function( :update => "referees",                                   :url => { :action => "update_referees" },                                   :with => "'match[first_team_id]=' + this.value + '&match[second_team_id]=' + $ ('match_second_team_id').value",                                   :condition => "this.value != $ ('match_second_team_id').value"                               )   } %>

The dropdown is contained in a partial aptly named "referees", and as to my best knowledge, i have populated a rjs file associated to the 'update_referees' action with the following:

page[:referees].replace_html :partial => "referees"

This, however, fails to produce the expected result and instead just spews the javascript inside my lovely 'referees' layer. However, being a persistent individual, i altered the .rjs to

page[:referees].replace :partial => "referees"

Unexpectedly, this does actually produce a dropdown, but unfortunately also destroys my layer and with it any hope i would have to rebuild my dropdown in case the team selection is altered.

After some hours of scraping through documentation and debugging prototype i noticed that Ajax.Updater actually runs through the code twice, first upon receiving it, and subsequently within the "updateContent" method. Sadly, however, on the first run of the code everything is left in order and fully peachy, but after the "updateContent" method, my previously cheery layer is filled with javascript.

If you've made it thus far, first of all i'd like to thank you for being so patient, and second i would like to ask whether i am doing something that i'm not supposed to or prototype is goofing.

Many thanks,     Andrei