[Resolved] Pass Arguments to toggle()?

[Resolved] Pass Arguments to toggle()?

Hey everyone,

I have a little jQuery snippet that allows me to swap an image in and out of a specified div. See the code:

$("button#buttonID").toggle(function(){
     $('img#imageID').attr('src','images/oneImageToSwap.jpg');
}, function(){
     $('img#imageID').attr('src','images/otherImageToSwap.jpg');
});


This works fine. However, I'm going to have a bunch of images to swap in and out of different divs, and I'd love to be able to reuse this function so that I could just pass the names of the divs and the images that will be going in and out.

Here's the problem: according to the jQuery Documentation, the toggle effect doesn't take any arguments: http://docs.jquery.com/Effects/toggle

Anyone have any ideas how I could accomplish this?

Thanks a lot in advance for your help!