var TCH_graphic_selected_GLOBAL_h;
var TCH_graphic_selected_GLOBAL_a;
// function to load additional content for the selected attack

function TCH_load_content (preference,where) {

        // find the selection (event_id) and load the image/player divs that match it
        // preference is either "prefer_old" or "prefer_new"
        // prefer_old checks for an old value and uses that if it exists
        // prefer_new only uses the new default value.

        var player_id;
	eval('ref = document.TCH_list_form.TCH_list_select_'+where+';')
        eval ('player_id = TCH_graphic_selected_GLOBAL_'+ where+';');

	
        if(!images_ready || typeof(ref)=="undefined") {
                return;
        }

        // first check to see if there is a stored value
        if (typeof(player_id)!="undefined" && preference == "prefer_old") {
                // use the existing value & set the form selection to it
		i=0
                while(i<ref.length){
			if(ref[i].value==player_id){
				ref[i].selected=true
			}
		i++;
		}
        } else {
                // use the new value & store it for later in the global var.
                player_id = ref[ref.selectedIndex].value;
                eval('TCH_graphic_selected_GLOBAL_'+where+' = player_id;');
        };

        TCH_load_image(player_id,where);

        return;
};


// function to load the correct image

function TCH_load_image(player_id,where) {
        var image_src;
        var image_object = getObj("TCH_attack_image_"+where)

        // change src to the correct image
        // image names are in the form: shot_$event_id.png
        image_src = PATH + game_id + '-' + player_id + '.png';
        image_object.src = image_src+"?"+Math.random()*99999;

        return;
};


