$(function(){
	initCenter();
	$(window).resize(function(){ initCenter(); });
});

function initCenter(){
	var wHeight = $(window).height();
	var wWidth = $(window).width();
	var gHeight = $('#game').height();
	var gWidth = $('#game').width();
	
	centerW();
	centerH();
	
	if(wHeight <= 768){
		$('.shadow').css({'position':'relative'});
	} else {
		$('.shadow').css({'position':'absolute'});
	}
	
	function centerW(){
		if(wWidth >= 855){
			$('#game').css({
				'left':(wWidth - gWidth)/2
			});
		} else {
			$('#game').css({
				'left':0
			});
		}
	}
	
	function centerH(){
		if(wHeight <= gHeight){
			$('#game').css({
				'top':0
			});
		} else {
			$('#game').css({
				'top':(wHeight - gHeight)/2
			});
		}
	}
}
