$(document).ready(function() {
	// start downloading background image
	
	$('<img id="bg"/>')
		.attr('src', $('link[rel=background]').attr('href'))
		.load(function() {
						
			$(this).css({
				display: 'none',
				width: "100%",
				position: 'absolute',
				top: 0,
				left: 0,
				zIndex: 1
			});
			$(window).bind('resize', resizeMe);
			$('body').append($(this));
			$(this).fadeIn('slow', function() {
				$("#loader").hide();
			});
			$(".circle").fadeIn('fast');
		});
	resizeMe();
});

function resizeMe() {
	win_width = parseInt($(window).width());
	
	$("#title img").css("width", 758*(win_width/1920));
	$("#sub-headline img").css("width", 625*(win_width/1920));
	$("#continue img").css("width", 461*(win_width/1920));
	$('#gift-descriptions li > img').css('width', 137*(win_width/1920));
	$("#microwave h2 img").css("width", 237*(win_width/1920));
	$("#buzz-cut h2 img").css("width", 291*(win_width/1920));
	$("#headphones h2 img").css("width", 352*(win_width/1920));
	$("#dying-plant h2 img").css("width", 59*(win_width/1920));
	$("#merry-christmas img").css("width", 571*(win_width/1920));
	$("#come-and-claim img").css("width", 574*(win_width/1920));
	$("#love-orangecoat img").css("width", 294*(win_width/3072));
	$("#beep img").css("width", 441*(win_width/3072));
	$('body').css({
		fontSize: 16*(win_width/1920),
		lineHeight: 26*(win_width/1920) + "px"
	})
	$('#content').css({
		height: parseInt($(window).width())/1.78
	});
}
