//Must have JQuery Installed for this to work
$(document).ready(function(){

  //Centers center-box (defined by window width/height) and fades it in
  $(window).resize(function(){  
    $('.center-box').css({
      position:'fixed',
      left: ($(window).width() - $('.center-box').outerWidth())/2,
      top: ($(window).height() - $('.center-box').outerHeight())/2
    });
  });
  $(window).resize();
  $('.center-box').fadeIn(400);
  
  //Starts timer countdown
  var sec = $('.center-box #seconds').text()
  var timer = setInterval(function() {
    $('.center-box #seconds').text(--sec);
    if (sec == 0) {
      //Set Action here once timer is finished
      $('.lightbox-countdown, .center-box').fadeOut(400);
      clearInterval(timer);
    }
  }, 1000);
  
  //Makes all anchors hide lightbox-countdown
  $('.center-box a').click(function(){
    $('.lightbox-countdown, .center-box').fadeOut(400);
  });
  
});
