$.fn.center = function (absolute) {
	return this.each(function () {
		var t = $(this);

		t.css({
			position:	absolute ? 'absolute' : 'fixed',
			left:		'50%',
			top:		'50%',
			zIndex:		'99'
		}).css({
			marginLeft:	'-' + (t.outerWidth() / 2) + 'px',
			marginTop:	'-' + (t.outerHeight() / 2) + 'px'
		});

		if (absolute) {
			t.css({
				marginTop:	parseInt(t.css('marginTop'), 10) + jQuery(window).scrollTop(),
				marginLeft:	parseInt(t.css('marginLeft'), 10) + jQuery(window).scrollLeft()
			});
		}
	});
};

$(document).ready(function(e) {
  $("#body_background, nav#menu div nav").corner("5px bottom");
	

  if (center_design_on_page) {
    $('#page #header').corner('5px top');
    $('#page #body').css({'minHeight': ($(window).height() / 2)});
    $('#page').css({'maxHeight': $(window).height() - ($('#site_bar').height() * 2)}).center();
    $(window).resize(function(e){
      $('#page').css({'maxHeight': $(window).height() - ($('#site_bar').height() * 2)}).center();
    })
  }
  if (stretchy != null && stretchy.image != null) {
    $(document).bgStretcher({
	    images: [stretchy.image],
	    imageWidth: stretchy.imageWidth,
	    imageHeight: stretchy.imageHeight, slideShow: false
	  }); 
  }
});