As it’s a Javascript function (and not PHP) you need to include it in the HTML of your template, rather than in your functions.php file.
It also needs to go within <script> tags inside the <head> tags of your template – which you’ll probably find in wp-content/themes/yourtheme/header.php.
For an example of how it’s used ‘in the wild’ take a look at this example on the jQZoom pages.