
	function imageSlideShow() {
	  
		var $alt = $('#slideshow img.firstimage');
		var $neu = $alt.next().length ? $alt.next() : $('#slideshow img:first');
		$alt.addClass('image');
		$alt.removeClass('firstimage');
		$neu.css({opacity: 0.0});
		$neu.addClass('firstimage');
		$neu.animate({opacity: 1.0}, 3000, function() {
				$alt.removeClass('image');
		});	  
	}
	
	function switchGallery(iGalleryID) {
		var sHTML = '<div id="slider"><ul>';
		var iCnt;
		var aImages = aReferences[iGalleryID];
		
		if(aImages.length > 0) {
			for(iCnt = 0; iCnt < aImages.length; iCnt++) {
				sHTML += '<li style="background-image: url(' + aImages[iCnt] + ');" /></li>';
			}
		}
		
		sHTML += '</ul></div>';

		$("#headerimage").html(sHTML);
		$("#gallerybuttons").remove("#gallerybuttons");
		
		$("#slider").easySlider({ 
								controlsBefore:	'<div id="gallerybuttons">',
								controlsAfter:	'</div>',
								speed: 1000,
								continuous: true
								});

	}
	
	if(bInitReferences) {
		stepcarousel.setup({
			galleryid: 'references', //id of carousel DIV
			beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
			panelclass: 'panel', //class of panel DIVs each holding content
			panelbehavior: {speed: 600, wraparound: false, persist: true},
			defaultbuttons: {enable: true, moveby: 2, leftnav: ['/images/references_button_left.gif', 0, 0], rightnav: ['/images/references_button_right.gif', -15, 0]},
			statusvars: ['statusA', 'statusB', 'statusC'], // Register 3 "status" variables
			contenttype: ['inline'] // content type <--No comma following the very last parameter, always!
		});
	
		switchGallery(0);	
	} else {

		$(document).ready(function() {
		   setInterval( "imageSlideShow()", 6000 );
		});
		
	}
	