function startGallery() {
	var msgLog = $('messageLog');
	var theGallery = new gallery($('myGallery'), {
		timed: false,
		delay: 2000,
		showArrows: false,
		showCarousel: true,
		showInfopane: false,
		textShowCarousel: 'All images',
		elementSelector: "div.imageElement",
		titleSelector: "h3",
		subtitleSelector: "p",
		linkSelector: "a.open",
		imageSelector: "img.full",
		thumbnailSelector: "img.thumbnail",
		embedLinks: false,
		fadeDuration: 100,
		defaultTransition: "crossfade",
		slideInfoZoneOpacity: 0.7,
		slideInfoZoneSlide: true,
		useExternalCarousel: true,
		carouselElement: 'gall_thumb',
		thumbHeight: 50,
		thumbWidth: 50,
		thumbSpacing: 0,
		thumbCloseCarousel: false,
		thumbIdleOpacity: 0.8
		
	});

	// jQuery("a.carouselBtn").css("visibility","hidden");
	jQuery("div.carouselContainer").css({top: "", position: "absolute", bottom: "0"});

	var insertableGallery = jQuery("div.ngg-galleryoverview");
	jQuery("#galleryimg").append(insertableGallery);
	
	//$('nextButton').onclick = function (){theGallery.nextItem();}
	//$('prevButton').onclick = function (){theGallery.prevItem();}
	//$('startButton').onclick = startTimer;
	// $('showGalleryButton').onclick = showTheGallery;

	function showTheGallery(){
		jQuery("#myGallery").css({top: "0px", position: "relative", width: "700px", height: "453px"});
		$('showGalleryButton').set('value', 'hide gallery');
		$('showGalleryButton').onclick = hideTheGallery;
	}
	
	function hideTheGallery(){
		// jQuery("#myGallery").css({top: "-5000px"});
		$('showGalleryButton').set('value', 'Click for more images');
		$('showGalleryButton').onclick = showTheGallery;
	}
	
	function startTimer(){
		theGallery.options.timed = true;
		theGallery.galleryInit=1;
		//theGallery.doSlideShow(theGallery.nextIter);
		theGallery.doSlideShow(0);
		$('startButton').set('value', 'stop');
		$('startButton').onclick = pauseTimer;
	}
	
	function pauseTimer(){
		theGallery.options.timed = false;
		theGallery.clearTimer();
		$('startButton').set('value', 'start');
		$('startButton').onclick = startTimer;
	}
	
	function updateLog(){
		msgLog.set('html', theGallery.nextIter);
	}
	//msgLog.set('html', 'testing javascript');
}
window.addEvent('domready',startGallery);

