$(document).ready(function(){
	//imageArray = new Array('headerImg1.jpg', 'headerImg2.jpg', 'headerImg3.jpg', 'headerImg4.jpg', 'headerImg5.jpg', 'headerImg6.jpg', 'headerImg7.jpg');
	//var random = Math.random() * imageArray.length;
	//var count = Math.floor(random);
	//image = 'images/'+imageArray[count];
	//$('#theImg img').attr('src', image);
	
// START script for the slideshow
//var $imageArray = new Array('headerImg1.jpg', 'headerImg2.jpg', 'headerImg3.jpg', 'headerImg4.jpg', 'headerImg5.jpg', 'headerImg6.jpg', 'headerImg7.jpg');
//var $random = Math.random() * $imageArray.length;
//var $count = Math.floor($random);
	
//$('#headerImg').css('background-image','url("images/'+$imageArray[$count++]+'")')// first background is random and count is increased so the event loads the next one
//	.everyTime(6000, 'controlled', function() {
//		if ($count >= $imageArray.length) $count = 0;
//		$(this).fadeOut('slow', function(){
//			$(this).css('background-image','url("images/'+$imageArray[$count]+'")').fadeIn('slow');								 
//			$count++;
//		});
//	});	
// END script for the slideshow

	linkArray = $('#gallerySelector a');
	galleryArray = $('#galleyDisplay div.galleryEntry');
	startupGal = $('#hGalNr').attr("value");
	
	hideGalleries(startupGal);
	function hideGalleries(except)
	{
		galCounter = 0;
		$(galleryArray).each(function() {
			galCounter++;
			if(galCounter == except) {
				$(this).show();
				return true;
				};
			$(this).hide();
		});
	}
	$(linkArray).each(function(){
		$(this).bind("click", function(){
			selectedID = $(this).attr("id").slice(4);
			hideGalleries(selectedID);
		});
	});
	// execute your scripts when the DOM is ready. this is a good habit 
	$(function() { 
		// initialize scrollable 
		$("div.scrollable").scrollable(); 
	});
});
