$(document).ready(function() {
    $('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
});

$(document).ready(function() {
    $('.ImageContainer .Image:empty').each(function(){
		$(this).parent().hide();
	});	
});

$(document).ready(function() {
    $('.ImageContainer .Image').each(function(){
		theLink = $(this).find('a');
		if(theLink.length)
		{
			theLink.append('<span class="topMask"></span>');
		}
		else $(this).append('<span class="topMask"></span>');
	});
});

window.onload = function () {
    $('.ImageContainer .Image').each(function(){
		theImg = $(this).find('img');
		theHeight = theImg.height();
		parHeight = $(this).height();
		if(theHeight < parHeight)
		{
			offset = (parHeight - theHeight) / 2;
			theImg.css('top', offset+"px");
		}
		else if(theHeight > parHeight)
		{
			offset = -(theHeight - parHeight) / 2;
			theImg.css('top', offset+"px");
		}
	});
}

