	var imageCount;
	var currentImage;
	var ssp = 0;
	var slideshow = 0;
	function prevImage() {
		stopShow();
		if (slideshow) slideshow.prevSlide(500);
		if (ssp) if (currentImage > 1) { ssp.previousImage(); } else { ssp.loadContent(imageCount-1); }
	}
	function nextImage() {
		stopShow();
		if (slideshow) slideshow.nextSlide(500);
		if (ssp) if (currentImage < imageCount) { ssp.nextImage(); } else { ssp.loadContent(0); }
	}
	function playShow() {
		if (ssp) ssp.toggleDisplayMode('Auto');
		if (slideshow) slideshow.playShow();
		$('#stopButton').show();
		$('#playButton').hide();
	}
	function stopShow() {
		if (ssp) ssp.toggleDisplayMode('Manual');
		if (slideshow) slideshow.pauseShow();
		$('#stopButton').hide();
		$('#playButton').show();
	}
	function hideText() {
		$('#hideButton').hide();
		$('#showButton').show();
		$('#text').fadeOut(600,function(){
			if (ssp) $('#imageContainer').slideCropPositionResize({clip: 0, aspect: 0, center: 0, vertical: 110, resizeTo: '#siteContainer'});
			if (slideshow) slideshow.resizeCurrentSlide();
		});
	}
	function showText() {
		$('#hideButton').show();
		$('#showButton').hide();
		$('#text').fadeIn(600);
		if (ssp) $('#imageContainer').slideCropPositionResize({clip: 0, aspect: 0, center: 0, vertical: 110, resizeTo: '#siteContainer'});
		if (slideshow) slideshow.resizeCurrentSlide();
	}
	function showImage(imageNumber) {
		if (ssp) ssp.loadContent(imageNumber-1);
		if (slideshow) slideshow.skipTo(imageNumber,500);
		stopShow();
		hideText();
	}
	function showLoaded(show) {
		$('#imageNav').append('<span id="imageNavInfo"><span id="current">1</span>/<span id="total">1</span></span>');
		$('#total').html(show.slideCount());
		$('#current').html(show.slideNumber());
		$('#hideButton').show();
		$('#showButton').hide();
		$('#stopButton').show();
		$('#playButton').hide();
		if ($('#imageNav').is(':hidden')) {
			$('#imageNav').fadeIn(1000);
		}
		$('#imageNav').hide().css({visibility:'visible'}).fadeIn(500);
		$('#imageContainer').hide().css({visibility:'visible'}).fadeIn(500);
	}
	function slideChanged() {
		$('#current').html(slideshow.slideNumber());
	}
	function albumLoaded(albumData) {
		imageCount = albumData.data.totalImages;
		$('#total').html(imageCount);
	}
	function imageLoaded(imageData) {
		currentImage = imageData.data.number;
		$('#current').html(currentImage);
		if ($('#imageNav').is(':hidden')) {
			$('#imageNav').fadeIn(100);
		}
	}
	function onSlideShowProReady() {
		ssp = $('#ssp')[0];
		ssp.addEventListener("imageData","imageLoaded");
		ssp.addEventListener("albumData","albumLoaded");
	}
	// SWFObject embed
	var flashvars = {
		paramXMLPath: "8.xml",
		useExternalInterface: true,
		initialURL: escape(document.location)
	};
	var params = {
		base: ".",
		bgcolor: "#ce4F00",
		allowfullscreen: "true",
		wmode: "transparent"
	};
	var attributes = {
		id: "ssp"
	};
	//swfobject.embedSWF("slideshowpro.swf", "slideshow", "100%", "100%", "9.0.0", false, flashvars, params, attributes);
	$(window).load(function() {
		if (!slideshow) {
			if ($('#slideshow').children().length == 1) {
				element=jQuery('#slideshow').children().first();
				slideshow=jQuery.fn.bindResize({marginVertical: 110, resizeTo: '#siteContainer', element: element});
				$('#imageContainer').hide().css({visibility:'visible'}).fadeIn(500);
			} else if ($('#slideshow').length) {
				var options = {
					showTime: 10000,
					startDelay: 8000,
					marginVertical: 110,
					resizeTo: '#siteContainer',
					element: '#slideshow',
					slideClass: '.slide',
					transTime: 1000,
					onLoad: function(){showLoaded(this)},
					onChange: function(){slideChanged()}
				};
				slideshow=jQuery.fn.elementSlideshow(options);
			}
		}
	});
	$('#facebook').ready(function() {
		$('#facebook').hide().css({visibility:'visible'}).fadeIn(500);
	});

