$(document).ready(function() {
	//set the width of the bg fractal container:
	var siteWidth = $('body').width();
	var resetWidth = function() {
		if (siteWidth < 1400) {
			$('#background').width(siteWidth).children('img').css({'position': 'relative', 'left': -(1400 - siteWidth) / 2});
		} else if (siteWidth > 1400) {
			$('#background').css('left', (siteWidth - 1400) / 2);
		}
	}
	$(window).resize(function() {
		siteWidth = $('body').width();
		resetWidth();
	});
	resetWidth();
	
	//load the background fractal:
	var img = new Image();
	$(img).load(function() {
		$(this).hide();
		$('#background').append(this);
		if (siteWidth < 1400) {
			$(this).css({'position': 'relative', 'left': -(1400 - siteWidth) / 2});
		}
		$(this).fadeIn('slow');
	}).attr('src', '/images/bg-fractal.jpg');
	
});