var Testimonials = {
  index: 0,
  quotes: [
    {
      quote: "This is the best event in the industry: very useful, very well run and most enjoyable.",
      author: "Christophe Asselineau, Simmons and Simmons<br>",
      size: 23
    },  {      
      quote: "When it comes to industry insight and information on desalination, Global Water Intelligence is sashimi grade.",
      author: "Lawrence Molloy, Water Engineer and Desalination Representative, Ebara Pumps",
      size: 18
     }, {      
      quote: "Informative, stimulating, and very well organized.",
      author: "Tim Brick, Chairman, Metropolitan Water District of Southern California",
      size: 20
    }, {
     quote: "A great conference",
      author: "Bruce Babbitt, Former US Secretary of the Interior and Governor of Arizona",
      size: 20
    }, {
      quote: "A perfect blend of informal networking and good (in-depth in some cases) presentations.",
      author: "Jorge Arroyo, Director of Special Projects, Texas Water Development Board",
      size: 18
    }
  ],
  
  incrementCounter: function() {
    this.index++;
    if (this.index == this.quotes.length) { this.index = 0; }
  },
  
  fillContent: function() {
    this.quote.update(this.quotes[this.index].quote);
    this.quote.setStyle({fontSize: this.quotes[this.index].size + 'px'});
    this.author.update(this.quotes[this.index].author);
  }
};

Event.onDOMReady(function() {
  var insert = new Insertion.Before($('awards'), '<div id="quotes"><div class="content"><div class="quote"></div><div class="author"></div></div></div>');
  Testimonials.div = $('quotes');
  Testimonials.div.setStyle({
    
  });
  Testimonials.quote = Testimonials.div.getElementsBySelector('.quote')[0];
  Testimonials.author = Testimonials.div.getElementsBySelector('.author')[0];
  Testimonials.content = Testimonials.div.getElementsBySelector('.content')[0];
  Testimonials.fillContent();
  var loop = new PeriodicalExecuter(function(pe) {
    new Effect.Fade(Testimonials.content, {
      duration: 0.3,
      afterFinish: function() {
        Testimonials.incrementCounter();
        Testimonials.fillContent();
        new Effect.Appear(Testimonials.content, {
          duration: 0.3
        });
      }
    });
  }, 8);
});

