Whoa I am stumped.

long story short... using mootools and the Sortables feature. No prob there. The problem I am having, is that I am going to have multiple lists on the same page (and wont know how many lists).

So I use $$ and get an array of all the lists. (they are all named "list1","list2", and so on).

Then I loop through the array and create a Sortable instance for each one.... this is where my problem begins.

I am pretty sure that each instance of Sortables has to be assigned it's own unique variable. So I tried using an array. But the array doesnt work. I get an error asking for a semicolon right before the declaration.

Im stumped in how to get it assigned to a unique variable name on each itteration, and why an array wont work?

Is there a way I can make a string with the iteration number in it, and then create a variable with the same name as the value of the string? Is there an easier approach? Javascript is an unfamiliar beast with me, most of my developer years have been tackling php and other server side languages.

anyways.. here is what i have right now... and the whole "var mySortables[i]" isnt working..

Code:
var z=$$('ul[id^=list]');	
for(i=0;i<z.length;i++) {
     var mySortables[i] = new Sortables('z[i]',{
			clone: true,	
			revert: true,
			handle:'div.rowGreyInner',
			opacity: 0,
			onComplete: function(){
					var myString = mySortables[i].serialize(); 
			} 
	});
 }

Would anyone be kind enough to point me in a direction, or something I can look up?

Thanks for your time!

- Ryan