jQuery(document).ready(function(){
	initHome();
});

function initHome(){
	// load PFA flash
	$('#flash-content').each(function(){
		var $a = $('a', this);
		if ($a.attr('rel') !== '') {
			var config = {
				src: $a.attr('rel'),
				height: $(this).height(),
				width: $(this).width(),
				wmode: 'opaque',
				bgcolor: '#394e60',
				version: [8, 0, 0],
				onFail: function(){
					$('#flash-replace, #flash-content img').css('display', 'block');
				}
			};
			var flashvars = {
				strUrl: $a.attr('href'),
				strTarget: $a.attr('target'),
				strLogoPath: $('#vca-logo').attr('src')
			};
			$(this).flashembed(config, flashvars);
			$('.header img, #flash-replace').css('display', 'none');
		}
	});

	// resize columns
	resizeColumns();
	$('.welcome-img img').load(function(){
		resizeColumns();
	});
}

function resizeColumns(){
		var tallest = 0;
		$('.content, .welcome-img, .widget-wrapper, .promos').each(function(){
			tallest = $(this).height() > tallest ? $(this).height() : tallest;
		});
		$('.content, .welcome-img, .widget-wrapper, .promos').height(tallest);
}

