[jQuery] Corresponding indexes with images

[jQuery] Corresponding indexes with images

Hi there,
I want to construct an imageslider myself but i can't find the right
method to iterate over my array of images.
The array is grabbed from div#images which only contains images.
Roughly the content of my function looks like this:
$
".next"
.livequery
'click', function
{
$
"#images img:first"
.stop
.animate
{opacity: 0}, 250,
'linear', function
{
$
"#images img:first"
.hide
;
$
"#images img:last"
.show
.css
'opacity', 0
;
$
"#images img:last"
.animate
{opacity: 1}, 1000, 'linear'
;
}
;
return false;
}
Of course, this only works if there are only two images in the
containing div, but it's a dynamic amount.
So i'll need to pass their indexes to the function, but how?
Any help would be greatly appreciated!
Thanks,
knal.