		firstLoad = true;
		shotsPerPage = 15;
		currentPage = 0;
		shotList = new Array();
		

		function galleryPrev()
		{
			if(currentPage > 0) { currentPage--; }
			else { currentPage = numPages-1; }
			printPages();
		}

		function galleryNext()
		{
			if(currentPage < numPages-1) { currentPage++; }
			else { currentPage = 0; }
			printPages();
		}
		
		function addshots(dir,filename,endnum)
		{
			startnum = 0;
			for(i=1; i<=endnum; i++)
			{
				shotList[i - 1] = "" + dir + "/" + filename + (i) + "Thumb.jpg";
			}
			printPages();
		}

		function printPages()
		{
			numPages = Math.ceil(shotList.length/shotsPerPage);
			if(document.location.href.split("#")[1] > 0 && firstLoad)
			{
				calculatedIndex = currentShotNumber - document.location.href.split("#")[1];
				currentPage = Math.floor(calculatedIndex/shotsPerPage);	
			}
			outString = "";
			for(i = 0; i < shotsPerPage; i++)
			{
				n = shotsPerPage*currentPage+i;
				if(shotList[n])
				{
					thumbnail = shotList[n].replace(".jpg",".jpg");
					realPic = shotList[n].replace("Thumb.jpg",".jpg");
					outString += "<a href='"+ realPic +"' rel='lightbox[Gallery]'  title='Behind-The-Scenes'>";
					outString += "<img src='"+thumbnail+"' alt='Behind-The-Scenes' /></a>";
				}
			}
			document.getElementById("galleryPictures").innerHTML = outString;
			outString = "<a href='javascript:galleryPrev();'>&lt;&lt; Previous</a> ";
			outString += Number(currentPage+1) + " of " + numPages;
			outString += " <a href='javascript:galleryNext();'>Next &gt;&gt;</a>"
			document.getElementById("pageNum").innerHTML = outString;
		}