var testimonials = new Array();

var testimonial = new Object();
testimonial.name='Ali';
testimonial.uni='Concordia';
testimonial.body='Very efficient and active link between tutors and students...I\'ve had the opportunity to tutor many students through this website...'

testimonials.push(testimonial);



var testimonial = new Array();
testimonial.name='Cyrille';
testimonial.uni='Concordia';
testimonial.body='A great source of income, and better than any job because of the time flexibility, thank you Contact My Tutor!';
testimonials.push(testimonial);

var testimonial = new Object();
var timeToSwapTesimonial = 5500;



/*CODE GOES BELLOW*/	  
var testTimonialTimer = setInterval (randomTestimonial , timeToSwapTesimonial);
var currentTestimonial = 0;
function lastTestimonial()
{    
  if (testimonials[currentTestimonial-1])
  {  
     swapTestimonial(currentTestimonial-1);
	 currentTestimonial --;
  }
  else 
   randomTestimonial();
}

function nextTestimonial()
{	 
  if (testimonials[currentTestimonial+1])
  {  
     swapTestimonial(currentTestimonial+1);
	 currentTestimonial ++;
  }
  else 
   randomTestimonial();
}

function randomTestimonial()
{
	
   var randomnumber=Math.floor(Math.random()*testimonials.length);
  swapTestimonial(randomnumber);
}

function swapTestimonial(id)
{ 
   if (!document.getElementById('testimonialAuthor'))
	   return;
		 
   var t = testimonials[id];
   document.getElementById('testimonialAuthor').innerHTML =  t.name + '<br/>'+t.uni;
   document.getElementById('testimonialContent').innerHTML = t.body;
}

