
        var imageidx = 0;
		var gallery = [];
		var thesePics = [];
	
        loadImages();

        function loadImages()
        {

			gallery[0] = ["gallery1.jpg", "432", "518"];
			gallery[1] = ["gallery2.jpg", "432", "518"];
			gallery[2] = ["gallery3.jpg", "432", "518"];
			gallery[3] = ["gallery4.jpg", "432", "518"];
			gallery[4] = ["gallery5.jpg", "432", "518"];
			gallery[5] = ["gallery6.jpg", "432", "518"];
			gallery[6] = ["gallery7.jpg", "432", "360"];
			gallery[7] = ["gallery8.jpg", "432", "518"];
			gallery[8] = ["gallery9.jpg", "432", "518"];
			gallery[9] = ["gallery10.jpg", "432", "518"];
			gallery[10] = ["gallery11.jpg", "432", "518"];
			gallery[11] = ["gallery12.jpg", "339", "509"];
		


	
			}
                                                    
      
                                                    
        function swapNext()
        {
            var links;
            image = thesePics[++imageidx];
			var imagesLength = thesePics.length -1;
            if ( imageidx >= imagesLength )
            {
                links = '<a href="javascript:swapPrev();">Previous</a>'
            }            
            else
            {
                links = '<a href="javascript:swapPrev();">Previous</a>&nbsp;<a href="javascript:swapNext();">Next</a>'

            }            

            MOOdalBox.open('loadimg.php?img='+image[0],links, image[1] + ' ' + image[2])

        }    

        function swapPrev()
        {
            var links;
            image = thesePics[--imageidx];
            if ( imageidx <= 0 )
            {
                links = '<a href="javascript:swapNext();">Next</a>'
            }            
            else
            {
                links = '<a href="javascript:swapPrev();">Previous</a>&nbsp;&nbsp;<a href="javascript:swapNext();">Next</a>'

            }            

            MOOdalBox.open('loadimg.php?img='+image[0],links, image[1] + ' ' + image[2])
        }    

        function start(whatPics)
        {
			imageidx = 0;
			if(whatPics) {
				var image = whatPics[0]; 
				thesePics = whatPics;
			}
			else {
				var image = images[0];	
				whatPics = images;
				thesePics = whatPics;
			}
            MOOdalBox.open('loadimg.php?img='+image[0],'<a href="javascript:swapNext();">Next</a>', image[1] + ' ' + image[2])
        }
