function gallery()
{
	var picId='bigPic';

	// Check to see if we have thumbnails on this page
	var d = document.getElementById( 'thumbs' );
	if(!d)
		return;

	// Get the child anchor elements
	var piclinks = d.getElementsByTagName( 'a' );
	
	for ( var i = 0; i < piclinks.length; ++i )
	{
		piclinks[i].i = i;
		// add onclick function to the anchors
		piclinks[i].onclick = function()
		{
			if( !/sequential/.test( d.className ) )
				d.className='sequential';

			var ie = this.getElementsByTagName( 'img' )[0];

			// hide/show thumbnails
			for ( var j = 0; j < piclinks.length; ++j )
			{
				piclinks[j].getElementsByTagName( 'img' )[0].className = '';
				piclinks[j].parentNode.style.display = ( j < this.i - 1 || j > this.i + 1 ) ? 'none' : 'inline';
			}

			ie.className = 'current';

			// clear last image of there was one
			var oldp = document.getElementById( picId );
			if( oldp )
				oldp.parentNode.removeChild( oldp );

			// create the elements, and display the big image
			var nc = document.createElement( 'div' );
			d.parentNode.appendChild( nc );
			nc.style.display = 'none';
			nc.id = picId;

			// The text
			var nt = document.createElement( 'h3' );
			nt.appendChild( document.createTextNode( ie.title ) );
			nc.appendChild( nt );
			var np = document.createElement( 'p' );
			np.appendChild( document.createTextNode( ie.alt ) );
			nc.appendChild( np );
			
			var newpic = document.createElement( 'img' );
			newpic.src = this.href;
			newpic.alt = ie.alt;
			newpic.title = 'Click to return to images';
			newpic.onclick = function()
			{
				// simply reloads the page to get back to normal
				window.location=window.location;
			}
			
			nc.appendChild( newpic );
			nc.style.display= 'block';
			return false;
		}
	}
}