///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  var testimonialContents = new Array();
  var testimonialsCount;
  var previousTestimonial = 0;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function init_rsquare_enhancements() {
// if we have a testimonials wrapper, then we'll initialize the testimonials process
  if (document.getElementById( 'testimonials_wrapper' )) { init_testimonials(); }
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function init_testimonials() {

// Collect the testimonial content containers - <div class="testimonial_content">
  var testimonialsWrapperChildren = document.getElementById( 'testimonials_wrapper' ).childNodes;
  for ( var i = 0; i < testimonialsWrapperChildren.length; i++ ) {
    if ( testimonialsWrapperChildren[i].nodeName.toLowerCase() == 'div' ) { testimonialContents.push( testimonialsWrapperChildren[i] ); }
  }

  testimonialsCount = testimonialContents.length;
//alert( testimonialsCount );
// Rotate the tesrimonials
  rotate_testimonials();

}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function rotate_testimonials() {
  var currentTestimonial = get_random( testimonialsCount );
//alert( currentTestimonial );

  while (currentTestimonial == previousTestimonial ) { currentTestimonial = get_random( testimonialsCount ); } 

  testimonialContents[previousTestimonial].className = "testimonial_content hidden";

  previousTestimonial = currentTestimonial;
		
// Show a random testimonial
  testimonialContents[currentTestimonial].className = "testimonial_content shown";


// Go get another one
  rotateTimer=setTimeout( "rotate_testimonials()", 10000 );
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function get_random( maxCount ) {
  return Math.floor( Math.random() * maxCount );
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Submit and then reset the target form
//
// MOD--MAILCHIMP
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function submit_reset_form( formID ) {
  var targetForm = document.getElementById( formID );
  targetForm.submit();
  targetForm.reset();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

