The function can go in all kinds of places. When I am actually working on javascript I quite often have it in the page itself enclosed in <script> tags so that it is all in one page. However, probably the best place to put it is in its own file. If you want to load it for product_info only then it goes in modules/pages/jscript_myscript.js. 'myscript' can be whatever you want.
The php/html bit of the code:
Code:
<SELECT id="fontSel" onChange="changePicture(this.value);">
needs to be built into the creation of the select list. THis is built in modules/attributes.php. It is a bit convoluted in there due to the fact that it works though every possible configuration of attributes. At first glance (but I'd need to check) your looking around line 608 for something like:
Code:
$options_menu[] = zen_draw_pull_down_menu('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_array, $selected_attribute, 'id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '"') . "\n";
You can slot the onchange event in before the id something like
Code:
$options_menu[] = zen_draw_pull_down_menu('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_array, $selected_attribute, ' onChange="changePicture(this.value);" id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '"') . "\n";
onBut I may have got the wrong place in attributes.php for your configuration and also becasue it is late at night and I am not checking 
Finally, the ID that is being refered to is the ID of the image that you are going to change. So, the original default image needs to have an ID. Something like:
Code:
<img src="whatever" alt="whatever" id="this_is_the_id"/>
Then the javascript will find that image by its id and replace it with the new image. That's what getElementById does.
I hope that helps. If you are still confused then post again.