$(document).ready(function() {
	$("div.photosRotation").cycle({
fx: 'fade',
speed: 4000,
speedIn: 500,
speedOut: 500
	});
});
function modifyHeight(selector)
{
	// Below: Checks if the height of the news/event post
	// Will interfere with the height of rowone, if so, it
	// adjusts the height accordingly.
	var newHeight = $(selector).height();
	console.log(newHeight);
	if (newHeight>'375')
	{
		$(".rowOne").css("min-height", newHeight+40);
		//console.log("Adjusted height to be larger than 375px.");
	} /*else if (newHeight<'450' && newHeight>'375')
						{
							$(".rowOne").css("min-height", newHeight+40);
						} */else {
		$(".rowOne").css("min-height", 375);
	}
}
function postSlider() {
	var active = jQuery('.postSlider .item.active');
	if ( active.length == 0 ) active = jQuery('.postSlider .item:last');
	var next =  active.next(".postSlider .item").length ? active.next(".postSlider .item")
	: jQuery('.postSlider .item:first');
	active.addClass('last-active');
	next.css({opacity: 0.0})
	.addClass('active')
	.animate({opacity: 1.0}, 1000, function() {
		modifyHeight(".postSlider .item.active");
		active.removeClass('active last-active');
		active.css({opacity: 0.0});
	});
}
function sleep(milliSeconds){
	var startTime = new Date().getTime();
	while (new Date().getTime() < startTime + milliSeconds);
}	
setInterval( "postSlider()", 5000 );
sleep(5000);
modifyHeight(".postSlider .item.active");

$(document).ready(function() {
	$(".custom-gallery").fancybox({
		'width'				: '75%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
});
