window.onload = function () {
	
	$("#content").hide();
	$(".resize").hide();

	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;	
	
	if ($(".resize").length > 0) {
		var img_w = $(".resize").width();
		var img_h = $(".resize").height();					
		$("#content").css({"width": parseInt(w - img_w - 120)+"px"});
	} else {
		$("#content").css({"width": parseInt(w - 160)+"px"});
	}

	var c_h = $("#content").height();
	var c_ih = $("#content").innerHeight();
	var c_iw = $("#content").innerWidth();
	var h_ih = $("h1").innerHeight();
	
	var c_padding = parseInt((h-c_h)/2 -45 );
	if (c_padding < 85) {c_padding = 85;}

	$(".resize").css({ "top": -70+"%", "right": -10+"%", "height": 200 + "%", "opacity": 0 });
	$(".resize").show();
	
	$("#content").css({ "padding-top": c_padding+"px","position": "static" });	
	$("#content .entry").css({ "opacity": 0 });
	$("#content h1").css({ "opacity": 0, "position": "absolute", "top": parseInt(c_padding+(c_ih/2)-40)+"px", "width": c_iw+"px" });	
	$("#content").show();
	
	
	$(".resize").animate({ "opacity": 1 }, 2000 );
	
	$("#content h1").animate({ "opacity": 1 }, 1500,function(){
		
		$(".timeout").fadeOut(1750, function(){
			$(".resize").animate({ "opacity": 0 }, 750);
		});

		$(".timeout").animate({ "opacity": 1 }, 2000, function(){
			$("#content h1").animate({ "top": c_padding + "px" }, 1000, function(){
				$("#content h1").css({ "position": "static" });
				$("#content .entry").animate({ opacity: 1 }, 1500); 
			});
			$(".resize").css({ "top": 0+"%", "height": 100 + "%", "right": 0+"%" });
			$(".resize").animate({ "opacity": 1 }, 1000 );	
		});		

	});

};	
