[cycle] plugin: Implement caption count (ex: "Image 1 of 10")

[cycle] plugin: Implement caption count (ex: "Image 1 of 10")

Hi, I'm using the [cycle] plugin but a Wordpress version (Smooth Slider), so the code is a bit harder to manipulate for me.
So my problem is this:

How do you add a caption ("1 of 10")  that tells which slide the slideshow is on like here:
http://jquery.malsup.com/cycle/count.html

I have added
  1. after: onAfter,
and
  1. function onAfter(curr,next,opts) { var caption = 'Image ' + (opts.currSlide + 1) + ' of ' + opts.slideCount; $('#caption').html(caption); }

to the javascrip part in the head, then <p id="caption"></p> where I want the caption, but it doesn't work.
I get this error in Chrome:
Uncaught TypeError: Object onAfter has no method 'apply'


related to jcycle.js line 929.
or even this one in Firefox:
cycle terminating; zero elements found by selector


Can you help?