(function($) {
  Drupal.behaviors.uppGoogleAdmanager = {
    attach: function(context, settings) {
      var overlay = $('#gam-overlay', context);
      var popup = $('#gam-popup', context);
      var popup_close = $('#gam-popup-close', context);
      overlay.css('height', $(document).height());
      $(window).resize(function() {
        if (overlay.is(':visible')) {
          overlay.css('height', $(document).height());
        }
      });
      $('a', popup_close).click(function(e) {
        e.preventDefault();
        overlay.fadeOut('fast');
        popup.hide();
      });
      setTimeout(function() {
        popup_close.show();
      }, 3000);
      setTimeout(function() {
        overlay.fadeOut('fast');
        popup.hide();
      }, 5000);
    }
  };
})(jQuery);
;

