$(window).load(function() {

	// slideshow part

	slideShowCheck = $('#slides img');

	if(slideShowCheck.length > 1){

		$('#slideshow-pause').click(function(){

			$('#slides').cycle('pause');

			$(this).hide(); $('#slideshow-play').show();

			return false;

		});

		$('#slideshow-play').click(function(){

			$('#slides').cycle('resume');

			$(this).hide(); $('#slideshow-pause').show();

			return false;

		});

		$('#slideshow-play').hide();

		$('#slideshow').hover(function(e){$('#controls').fadeIn();},function(){$('#controls').fadeOut();});

		$('#slides').cycle({fx:'fade', speed:1000, timeout: 5000, next:'#slideshow-next', prev:'#slideshow-prev'});

	} else if(slideShowCheck.length == 1) {

		// center the image

		wrapHeight = $('#slideshow').closest(".project-details-header").innerHeight();

		imgHeight = $(slideShowCheck).attr('height');

		if(imgHeight < wrapHeight){

			imgHeight = imgHeight / 2;

			imgWidth = slideShowCheck.attr('width') / 2;

			$('#slides').css('height',wrapHeight-30); //dont know why "-30", but it works

			slideShowCheck.css({position:'absolute', left: '50%', top: '50%', 'margin-top': '-'+imgHeight+'px','margin-left': '-'+imgWidth+'px'});

		}

	}

});
