(function() {
  var accordion, box, changeTestimonial, _gaq;
  $$('.newsletter-form div').setStyle('display', 'none');
  box = new CeraBox();
  box.addItems('[href="#newsletter-form"]', {
    group: false,
    width: 400,
    height: 500
  });
  accordion = new Fx.Accordion($$('.toggler'), $$('.element'), {
    opacity: 0,
    onActive: function(toggler) {
      return toggler.setStyle('background-image', 'url("/images/right_arrow.png")');
    },
    onBackground: function(toggler) {
      return toggler.setStyle('background-image', 'url("/images/down_arrow.png")');
    },
    alwaysHide: true,
    display: -1
  });
  $$('a[href^="http"]').each(function(el) {
    return el.setProperty('target', '_blank');
  });
  changeTestimonial = (function() {
    var content, current, injectTestimonial, randomTestimonial, rotateTestimonial, testimonials, testimonialsAjax, _ref;
    _ref = [null, null, 0], testimonials = _ref[0], content = _ref[1], current = _ref[2];
    testimonialsAjax = function() {
      var testimonial;
      return testimonial = new Request.HTML({
        url: '/pages/testimonials/index.php',
        onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) {
          testimonials = responseElements.filter('.testimonial');
          testimonials.set('id', '');
          return randomTestimonial();
        }
      }).get();
    };
    randomTestimonial = function() {
      current = Math.floor(Math.random() * testimonials.length);
      content = testimonials[current];
      return injectTestimonial();
    };
    rotateTestimonial = function() {
      current++;
      if (current >= testimonials.length) {
        current = 0;
      }
      content = testimonials[current];
      return injectTestimonial();
    };
    injectTestimonial = function() {
      $('testimonial').empty();
      return content.inject($('testimonial'));
    };
    return function() {
      if (testimonials == null) {
        return testimonialsAjax();
      }
      return rotateTestimonial();
    };
  })();
  changeTestimonial();
  setInterval(changeTestimonial, 10000);
  _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-6603141-33']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga, s;
    ga = document.createElement('script');
    ga.type = 'text/javascript';
    ga.async = true;
    ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    s = document.getElementsByTagName('script')[0];
    return s.parentNode.insertBefore(ga, s);
  })();
}).call(this);

