  function set_select( source_object, target_object, prefix, selected_id) {
    secondtype = eval(prefix+source_object.options[source_object.selectedIndex].value);
    target_object.options.length=0;
    selected_index = 0;
    for( i = 0; i < secondtype.length; i++ )
    {
      if ( secondtype[i] )
      {
        target_object.options[i]= new Option(secondtype[i][0]);
        target_object.options[i].value = secondtype[i][1];
        if (selected_id > 0 && secondtype[i][1] == selected_id) selected_index = i;
      }
    }
    target_object.selectedIndex = selected_index;
  } // end function
  
$.fn.setSelect = function(source_object, target_object, prefix, selected_id)
{
	var secondtype = eval(prefix+source_object.val());
	target_object.html('');
	selected_index = 0;
	for (i = 0; i< secondtype.length; i++)
	{
		if (secondtype[i])
		{
			if (selected_id > 0 && secondtype[i][1] == selected_id) selected_index = i;
			$('<option value="'+secondtype[i][1]+'">'+secondtype[i][0]+'</option>').appendTo(target_object);
		}		
	}
	target_object.val(selected_index);
}
  
