(function ($)
{
	$.fn.maxHeight = function ()
	{
		var max = 0;
		this.each (function ()
		{
			max = Math.max (max, $(this).height());
		});

		return max;
	};
})(jQuery);

$(document).ready (function ()
{
	$('#contentHomeLeft .contentBlock285:even').addClass ('marginRight');
	$('#contentHomeLeft .newsItemSmall:even').addClass ('newsItemMarginRight');
	for ($i = 1; $i <= $('#contentHomeLeft .contentBlock285').size (); $i += 2)
	{
		elements = $('#contentHomeLeft .contentBlock285:eq(' + ($i - 1) + '), #contentHomeLeft .contentBlock285:eq(' + ($i) + ')');
		elements.height (elements.maxHeight ());
	}
	
	if (false && $('#formOutput').size () > 0)
	{
		$.fancybox ($('#formOutput').parent (1).html (), {
        		'autoDimensions' : false,
			'width' : 350,
			'height' : 'auto',
			'transitionIn' : 'none',
			'transitionOut' : 'none'
		});
	}
});

function ShowBuilding (url)
{
	$.fancybox (url, {
		'padding' : 0,
		'margin' : 0,
		'titleShow' : false,
		'width' : 610,
		'height' : 610,
		'autoScale' : false,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'type' : 'iframe'
	});

	return false;
}

function ShowNews (url)
{
	$.fancybox (url, {
		'padding' : 0,
		'margin' : 0,
		'titleShow' : false,
		'width' : 610,
		'height' : 610,
		'autoScale' : false,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'type' : 'iframe'
	});

	return false;
}

$(document).ready (function () {
	$('a.overlay').fancybox ();
});
