

$(document).ready(function(){
	

	$('a.imgpopup').lightBox();

	initializeSlideshow();
	
});





// runs on pageload
var bExtraPreLoadCommands = false;
function RunOnLoad()
{
	FixExternalLinks();
	//initLightbox();
	//preloadimages();

	// look for the bExtraOnLoadCommands flag and run extra functions if they are present
	if (bExtraPreLoadCommands)
	{
		ExtraOnLoadCommands();
	}
}





function bookmarkthis(title,url) {
  if (window.sidebar) { // firefox
     alert('Your web browser does not support adding a bookmark or favorite through script. Please use the menus at the top of your browser window to add a bookmark or favorite link. Thank you.');
  } else if (window.opera && window.print) { // opera
     alert('Your web browser does not support adding a bookmark or favorite through script. Please use the menus at the top of your browser window to add a bookmark or favorite link. Thank you.');
  } else if (document.all) { // IE
     window.external.AddFavorite(url, title);
  } else {
     alert('Your web browser does not support adding a bookmark or favorite through script. Please use the menus at the top of your browser window to add a bookmark or favorite link. Thank you.');
  }
}







var oSlideshow = undefined;
var oSlides = undefined;
var iSlideMaxIndex = 0;
var iCurrentSlideIndex = -1;
var iSlideFadeSpeed = 2500;
var iWaitForEachSlide = 4000;
var oSlideTimer = undefined;

function showNextSlide() {
	if (iCurrentSlideIndex >= 0 && iCurrentSlideIndex <= iSlideMaxIndex) {
		oSlides.eq(iCurrentSlideIndex).fadeOut(iSlideFadeSpeed);
	}
	
	iCurrentSlideIndex++;
	if (iCurrentSlideIndex > iSlideMaxIndex) {
		iCurrentSlideIndex = 0;
	}
	
	oSlides.eq(iCurrentSlideIndex).fadeIn(iSlideFadeSpeed, function() {
		oSlideTimer = setTimeout(showNextSlide, iWaitForEachSlide);
	});
}

function initializeSlideshow() {
	oSlideshow = $('#slideshow');
	if (oSlideshow.length > 0) {
		oSlides = $('.slide', oSlideshow);
		iSlideMaxIndex = oSlides.length - 1;
		showNextSlide();
	}
}




