accessing javascript variables
<p>I want to assign array of photos to imagearray but the following script is not working.
i cant able to access variables a,i,cnlink etc in new fadeSlideShow() .how to access this outside the function and assign it to imagearray</p>

<pre><code> &lt;script type="text/javascript"&gt;
         var i; var a; var cnLink; var cn;var cnSplit;
         var photos = new Array();
         var photoslink = new Array();
         function x() {
            a = document.getElementById('HiddenField4').value;
            cnLink = document.getElementById('hdnLink').value;
              cn = document.getElementById('HiddenField3').value;
          cnSplit = cnLink.split(';');
             while (i &lt; cn) {
                 photoslink[i] = cnSplit[i];
                 photos[i] = b[i];
                 i++;
             }
         }

         var mygallery2 = new fadeSlideShow({
             wrapperid: "fadeshow2",
             dimensions: [568, 313],
             imagearray: [
             photos
         //&lt;--array of images!
    ],
             displaymode: { type: 'auto', pause: 2500, cycles: 0, wraparound: false },
             persist: false, //remember last viewed slide and recall within same session?
             fadeduration: 500, //transition duration (milliseconds)
             descreveal: "always",
             togglerid: "fadeshow2toggler"
         })


&lt;/script&gt;
</code></pre>
