var testimonials = new Array();

var testimonial = new Object();

testimonial.name='Eli';
testimonial.uni='Concordia';
testimonial.body='Received a call within 2 hrs of my request, the tutor did a great job, thank you!';
testimonials.push(testimonial);



var testimonial = new Array();
testimonial.name='Jad';
testimonial.uni='Concordia';
testimonial.body='The tutor was timely and very helpful, ended up doing great in the midterm.';
testimonials.push(testimonial);

var testimonial = new Object();
var timeToSwapTesimonial = 3500;


/*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;
}


