 $(document).ready(function() {
 setFlashPos();
 setContactBtn();
 });

 $(window).resize(function() {
 setFlashPos();
 setContactBtn();
 });

function setFlashPos() {

 // get the dims of the main content box
  
  var boxH = $('#flash').outerHeight();
  var boxW = $('#flash').outerWidth();
  
  // get the window dimensions
  
  var windowH = $(window).height();
  var windowW = $(window).width();
  
  // find the margin amount to apply in order to center the box vertically
  
  var theTop = Math.ceil((windowH - boxH)/2);
  var theLeft = Math.ceil((windowW - boxW)/2);
  
  if (theTop > 0) {
  
  $('#flash').css('top', theTop);

	} else {
	
   $('#flash').css('top', 0);	
	
	}
	
	if (theLeft > 0) {
  
  $('#flash').css('left', theLeft);

	} else {
	
   $('#flash').css('left', 0);	
	
	}

}

function setContactBtn() {

var offset = $('#flash').offset();

$('#contactBtn').css('top', offset.top+543);
$('#contactBtn').css('left', offset.left+570);

$('#barCover').css('top', offset.top+560);
$('#barCover').css('left', offset.left);

}
