Drupal.locale = { 'pluralFormula': function ($n) { return Number(($n!=1)); }, 'strings': {"An AJAX HTTP error occurred.":"Ocorreu um erro HTTP no AJAX","HTTP Result Code: !status":"C\u00f3digo do Resultado HTTP:  !status","An AJAX HTTP request terminated abnormally.":"Uma requisi\u00e7\u00e3o HTTP AJAX terminou de forma anormal.","Debugging information follows.":"Estas s\u00e3o as informa\u00e7\u00f5es de depura\u00e7\u00e3o.","Path: !uri":"Caminho: !url","StatusText: !statusText":"Texto de Status: !statusText","ResponseText: !responseText":"Texto de Resposta: !responseText","ReadyState: !readyState":"ReadyState: !readyState","Hide":"Ocultar","Show":"Exibir","Show shortcuts":"Mostrar atalhos","Hide shortcuts":"Esconder atalhos","Remove":"Remover","Enabled":"Ativado","Default":"Padr\u00e3o","Add":"Adicionar","Configure":"Configurar","Key":"Chave","Select all rows in this table":"Selecionar todas as linhas da tabela","Deselect all rows in this table":"Desmarcar todas as linhas da tabela","Not published":"N\u00e3o publicado","Please wait...":"Por favor, espere um pouco...","Not enabled":"Desativado","By @name on @date":"Por @name em @date","By @name":"Por @name","Not in menu":"Fora do menu","Alias: @alias":"Endere\u00e7o: @alias","No alias":"N\u00e3o h\u00e1 um endere\u00e7o","New revision":"Nova revis\u00e3o","Drag to re-order":"Arraste para reordenar","Changes made in this table will not be saved until the form is submitted.":"As mudan\u00e7as feitas nesta tabela n\u00e3o v\u00e3o ser salvas antes do formul\u00e1rio ser enviado.","The changes to these blocks will not be saved until the \u003cem\u003eSave blocks\u003c\/em\u003e button is clicked.":"As altera\u00e7\u00f5es nesses blocos n\u00e3o v\u00e3o ser salvas enquanto o bot\u00e3o \u003cem\u003eSalvar Blocos\u003c\/em\u003e n\u00e3o for clicado.","This permission is inherited from the authenticated user role.":"Essa permiss\u00e3o \u00e9 herdada do papel de usu\u00e1rio autenticado.","No revision":"Sem revis\u00e3o","@number comments per page":"@number coment\u00e1rios por p\u00e1gina","Not restricted":"Sem restri\u00e7\u00f5es","(active tab)":"(aba ativa)","Not customizable":"N\u00e3o \u00e9 personaliz\u00e1vel","Restricted to certain pages":"Restrito para certas p\u00e1ginas","The block cannot be placed in this region.":"O bloco n\u00e3o pode ser colocado nessa regi\u00e3o.","Edit summary":"Editar resumo","Re-order rows by numerical weight instead of dragging.":"Re-ordernar as linhas por campos n\u00famericos de peso ao inv\u00e9s de arrastar-e-soltar.","Show row weights":"Exibir pesos das linhas","Hide row weights":"Ocultar pesos das linhas","Autocomplete popup":"Popup de autocompletar","Searching for matches...":"Procurando por dados correspondentes..."} };;
/*jslint bitwise: true, eqeqeq: true, immed: true, newcap: true, nomen: false,
 onevar: false, plusplus: false, regexp: true, undef: true, white: true, indent: 2
 browser: true */

/*global jQuery: true Drupal: true window: true ThemeBuilder: true */

(function ($) {
  /**
   * Gardens version of Drupal contextual links
   * Override the default behavior and style by moving the edit gear to the left
   * of the element and outside the content area.
   *
   * Gardens also adds edge detection so that the links aren't displaying off screen
   */

  Drupal.gardensContextualLinks = Drupal.gardensContextualLinks || {};

  /**
   * UI interaction delay timeout IDs are stored in the delayTimeouts array
   */
  Drupal.gardensContextualLinks.delayTimeouts = [];


  Drupal.behaviors.gardensContextualLinks = {
    attach: function (context) {
      // Set up contextual links for logged in users, but not when the themebuilder is open
      if ($('body').hasClass('logged-in') && !$('body').hasClass('themebuilder')) {
        // Create the proxy links overlay
        // This will contain the contextual links and be placed over the
        // active contextual links region
        var $proxy = $('<div class="contextual-links-region-proxy" style="display:none;"></div>')
          .prependTo('body')
          .bind('mouseleave.gardensFeatures.contextualLinks',
            {
              'functions': [
                { 'action': Drupal.behaviors.gardensContextualLinks.deactivateProxy, 'delay': 300 }
              ]
            }, Drupal.behaviors.gardensContextualLinks.createDelay);
        var $boxTop = $('<div>').addClass('contextual-links-region-proxy-outline outline-top').insertAfter($proxy);
        var $boxRight = $('<div>').addClass('contextual-links-region-proxy-outline outline-right').insertAfter($boxTop);
        var $boxBottom = $('<div>').addClass('contextual-links-region-proxy-outline outline-bottom').insertAfter($boxRight);
        $('<div>').addClass('contextual-links-region-proxy-outline outline-left').insertAfter($boxBottom);

        // Process each instance of a contextual link set
        $('div.contextual-links-wrapper', context).once('gardens-contextual-links', function () {
          var $wrapper = $(this),
              $region = $wrapper.closest('div.contextual-links-region'),
              $trigger = $('<a class="contextual-links-trigger" href="#" />').text(Drupal.t('Configure'));
          $wrapper.prepend($trigger);
          Drupal.behaviors.gardensContextualLinks.establishBindings($region, $wrapper);
        });
      }
    },
    establishBindings: function ($region, $wrapper) {
      var $proxy = $('.contextual-links-region-proxy');

      // Listen for events
      $region.bind('mouseenter.gardens_features',
        {
          'region': $region,
          'wrapper': $wrapper,
          'functions': [
            {'action': Drupal.behaviors.gardensContextualLinks.activateProxy, 'delay': 150 }
          ]
        }, Drupal.behaviors.gardensContextualLinks.createDelay);
      $region.bind('mouseleave.gardensFeatures.contextualLinks',
        {
          'region': $region,
          'wrapper': $wrapper,
          'functions': [
            {'action': Drupal.behaviors.gardensContextualLinks.deactivateProxy, 'delay': 350 }
          ]
        }, Drupal.behaviors.gardensContextualLinks.createDelay);
    },
    activateProxy: function (event) {
      // Get the contextual links proxy and empty it of any links already in it
      var $proxy = $('.contextual-links-region-proxy');
      $proxy.hide().empty();

      // Clone the current contextual links and add them to the proxy region
      var $contextLinks = event.data.wrapper.clone();
      $contextLinks.appendTo($proxy);

      // Get the trigger and the links to bind events to them.
      var $trigger = $('.contextual-links-trigger', $proxy),
          $links = $('.contextual-links', $proxy);

      // Get the offset of the original region and position the proxy over it
      var $region = event.data.region,
          offset = $region.offset(),
          regionWidth = $region.width(),
          regionHeight = $region.height();

      // Place the proxy element
      $proxy
        .css({
          'left' : offset.left,
          'top' : offset.top,
          'width' : $region.width(),
          'height' : 0
        });

      // Place the dotted outlines. The 'spacing' and 'adjust' add a little
      // space between the dotted lines and the content.
      var spacing = 3,
          adjust = 1;
      $('.contextual-links-region-proxy-outline.outline-top').css({
        'left': (offset.left - adjust),
        'height': '1px',
        'top': (offset.top - adjust),
        'width': (regionWidth + spacing)
      });
      $('.contextual-links-region-proxy-outline.outline-right').css({
        'left': (offset.left + regionWidth + adjust),
        'height': (regionHeight + spacing),
        'top': (offset.top - adjust),
        'width': '1px'
      });
      $('.contextual-links-region-proxy-outline.outline-bottom').css({
        'left': (offset.left - adjust),
        'height': '1px',
        'top': (offset.top + regionHeight + adjust),
        'width': (regionWidth + spacing)
      });
      $('.contextual-links-region-proxy-outline.outline-left').css({
        'left': (offset.left - adjust),
        'height': (regionHeight + spacing),
        'top': (offset.top - adjust),
        'width': '1px'
      });

      // Establish bindings
      // Close the proxy if a contextual action link is clicked
      $('a', $links).bind('click.gardens_features',
        {},
        Drupal.behaviors.gardensContextualLinks.deactivateProxy);
      // Show the links when the gear is hovered
      $trigger.bind('mouseenter.gardens_features',
        {
          'functions': [
            { 'action': Drupal.behaviors.gardensContextualLinks.showLinks, 'delay': 150 }
          ]
        }, Drupal.behaviors.gardensContextualLinks.createDelay);
      // Hide the links when the user mouses out
      $links.bind('mouseleave.gardens_features',
        {
          'functions': [
            { 'action': Drupal.behaviors.gardensContextualLinks.hideLinks, 'delay': 50 }
          ]
        }, Drupal.behaviors.gardensContextualLinks.createDelay);

      // Show the proxy and dotted lines
      $proxy.nextAll('.contextual-links-region-proxy-outline').andSelf().show();

      // Check for collision of the gear icon with the viewport edge
      event.data.element = $trigger;
      Drupal.behaviors.gardensContextualLinks.queueEdgeCollisionCorrection(event);
    },
    deactivateProxy: function (event) {
      $('.contextual-links-region-proxy').nextAll('.contextual-links-region-proxy-outline').andSelf().hide();
    },
    showLinks: function (event) {
      var $links = $(event.currentTarget).next();
      event.data.element = $links;
      $links.slideDown(125);
      // Check for collision of the links with the viewport edge
      Drupal.behaviors.gardensContextualLinks.queueEdgeCollisionCorrection(event);
    },
    hideLinks: function (event) {
      $(event.currentTarget).slideUp(200);
    },
    createDelay: function (event) {
      // Clear the existing timeouts first
      Drupal.behaviors.gardensContextualLinks.destroyDelay();
      // Go through the functions passed in the event and call them with their
      // designated delay.
      for (var i = 0; i < event.data.functions.length; i++) {
        var delay = event.data.functions[i].delay || 500;
        var action = event.data.functions[i].action;
        // @todo This implementation suffers from improper handling of closures
        // when calling the setTimeout function. It works now because only
        // one function is ever called, even though the loop is present to
        // support more than one function being passed in on event.data.functions.
        // A more robust approach that deals with the function closure is needed.
        Drupal.gardensContextualLinks.delayTimeouts.unshift(setTimeout(function () {
            action(event);
            event = null;
          }, delay)
        );
      }
    },
    destroyDelay: function () {
      // Go through the timeout IDs and clear them
      while (Drupal.gardensContextualLinks.delayTimeouts.length > 0) {
        clearTimeout(Drupal.gardensContextualLinks.delayTimeouts.pop());
      }
    },
    queueEdgeCollisionCorrection: function (event) {
      // Queue the collision detection after any animations that may be
      // associated with the links
      event.data.element.queue(function (next) {
        // If the object was just hidden, we don't need to act on it further. Just return out.
        if (event.data.element.is(':hidden')) {
          // Call the next animation in the fx queue and return
          next();
          return false;
        }
        // If the element is visible, attempt to correct any edge collision
        Drupal.behaviors.gardensContextualLinks.correctEdgeCollision(event);
        // Call the next animation in the fx queue
        next();
        return true;
      });
    },
    correctEdgeCollision: function (event) {
      // Check for RTL setting
      var isRTL = ($('html').attr('dir') === 'rtl'),
          isLinks = event.data.element.is('.contextual-links'),
          isTrigger = event.data.element.is('.contextual-links-trigger');
      // Remove the edge-collision class if it exists before we determine a collision
      if (isTrigger) {
        event.data.element.parent().removeClass('edge-collision');
      }
      if (isLinks) {
        event.data.element.removeClass('edge-collision');
      }
      // Get the dimensions of the element and the viewport
      var element = {
          offset: event.data.element.offset(),
          dimensions: {
            width: event.data.element.outerWidth(false)
          }
        },
        viewport = {
          dimensions: {
            width: $('html').width()
          }
        };
      // Determine if the element is rendered outside the viewport
      var isCollided = ((!isRTL && element.offset.left < 0) || (isRTL && ((element.offset.left + element.dimensions.width) > viewport.dimensions.width)));

      // If the left edge of the links is outside the viewport, move them inside the content; or,
      // If the right edge of the links is outside the viewport, move them inside the content
      if (isCollided && isLinks) {
        event.data.element.addClass('edge-collision');
      }
      // If the trigger has collided with the window edge, mark its parent as having collided
      if (isCollided && isTrigger) {
        event.data.element.parent().addClass('edge-collision');
      }
    }
  };
})(jQuery);;
(function ($) {

$(document).ready(function() {

  // Accepts a string; returns the string with regex metacharacters escaped. The returned string
  // can safely be used at any point within a regex to match the provided literal string. Escaped
  // characters are [ ] { } ( ) * + ? - . , \ ^ $ # and whitespace. The character | is excluded
  // in this function as it's used to separate the domains names.
  RegExp.escapeDomains = function(text) {
    return (text) ? text.replace(/[-[\]{}()*+?.,\\^$#\s]/g, "\\$&") : '';
  }

  // Attach onclick event to document only and catch clicks on all elements.
  $(document.body).click(function(event) {
    // Catch the closest surrounding link of a clicked element.
    $(event.target).closest("a,area").each(function() {

      var ga = Drupal.settings.googleanalytics;
      // Expression to check for absolute internal links.
      var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
      // Expression to check for special links like gotwo.module /go/* links.
      var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
      // Expression to check for download links.
      var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i");
      // Expression to check for the sites cross domains.
      var isCrossDomain = new RegExp("^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\/.*(" + RegExp.escapeDomains(ga.trackCrossDomains) + ")", "i");

      // Is the clicked URL internal?
      if (isInternal.test(this.href)) {
        // Is download tracking activated and the file extension configured for download tracking?
        if (ga.trackDownload && isDownload.test(this.href)) {
          // Download link clicked.
          var extension = isDownload.exec(this.href);
          _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]);
        }
        else if (isInternalSpecial.test(this.href)) {
          // Keep the internal URL for Google Analytics website overlay intact.
          _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]);
        }
      }
      else {
        if (ga.trackMailto && $(this).is("a[href^=mailto:],area[href^=mailto:]")) {
          // Mailto link clicked.
          _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]);
        }
        else if (ga.trackOutbound && this.href) {
          if (ga.trackDomainMode == 2 && isCrossDomain.test(this.href)) {
            // Top-level cross domain clicked. document.location is handled by _link internally.
            _gaq.push(["_link", this.href]);
          }
          else if (ga.trackOutboundAsPageview) {
            // Track all external links as page views after URL cleanup.
            // Currently required, if click should be tracked as goal.
            _gaq.push(["_trackPageview", '/outbound/' + this.href.replace(/^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\//i, '').split('/').join('--')]);
          }
          else {
            // External link clicked.
            _gaq.push(["_trackEvent", "Outbound links", "Click", this.href]);
          }
        }
      }
    });
  });
});

})(jQuery);
;

