Hi,

I got some problems with my array of modals.
I'm using prototype with Controls.Modal.
Here is my code:

Code:
    
    var links = $$('.changeDiagram');
    var i = 0;
    var modals = new Array();
    
    links.each( function(link) {
        link.onclick = function() {
            console.log(i);
            console.log(modals[i]);
            $('questionid').value = link.next().value;
            $('previewid').value = link.next('.diagramImagePreview').id;
            
            modals[i] = new Control.Modal(link, {  
                opacity: 0.3,
                className: 'modal'
            });
            
            modals[i].open();
            
            $('closemodal').onclick = function() {
                modals[i].close();
            };    
        }
        i++; 
    });
I get my modal the first time I press one of the links and as long as I press the same link I continue to get my modal.
One thing to note is that my console.log(modals[i]) is unidentified but it works so far.
The real problem starts when I press on another link to get my modal.
Nothing appers and it seems like "link" is the problem. A null value.

If you got any questions please ask.



Cheers,
Sogeking