Refactoring RJS

I have some RJS that could use some refactoring. I use the function
called with afterFinish twice and Im wondering what the best way to
refactor is. This is all inline rjs in the controller mind you:

      page.visual_effect :slide_down, "add_appt_#{params

[:day]}", :afterFinish => “function(){
$(‘end_drop_#{params[:day]}#{params
[:appt_counter]}’).style.display = ‘block’;
$('end_drop
#{params[:day]}#{params
[:appt_counter]}’).style.visibility = ‘hidden’;
$('start_drop
#{params[:day]}#{params
[:appt_counter]}’).style.display = ‘block’;
$('start_drop
#{params[:day]}_#{params
[:appt_counter]}’).style.visibility = ‘hidden’;
}”