$(function() {

	$('#wrapper').center();
	
	debugCss();
	
});

(function($) {

	$.fn.center = function() {
	
		var $this = $(this);
		var $this_height = $this.height();
		var $this_width = $this.width();
		
		$this.css('position', 'absolute');
		
		centerThis();
		
		$(window).resize(centerThis);
		
		function centerThis() {
			$this.css({
				top: ($(window).height() / 2) - ($this_height / 2),
				left: ($(window).width() / 2) - ($this_width / 2)
			});
			
			$('body, html').height($(window).height());
		}
	}

})(jQuery);

function debugCss() {
	if ($.browser.msie) {
	
		if ($.browser.version == '6.0') {
			$('#wrapper').css('margin-top', '5px');
		}
		
		if ($.browser.version == '7.0') {
			$('#wrapper').css('margin-top', '10px');
		}
	}
}
