var REPEAT=true;
var REPEAT_SPEED=8000; // in milliseconds

//class
function testimonial(id, testiment, employee, position, business){
  this.id=id;
  this.testiment=testiment;
  this.employee=employee;
  this.position=position;
  this.business=business;
}

// returns an array of testiments in a random order
function createTestiments(){
  var testiments = new Array();
  
  testiments[0] = new testimonial(1,"ALADN System Solutions has provided Airservices with a database which has a capability greater than anticipated at a price that was very competitive and ultimately delivered extremely good value for money.",
    "Sharon Johnson", "Property Manager", "Airservices Australia");

  testiments[1] = new testimonial(2,"Placed us at the cutting edge with regards to the application of technology to market research reporting techniques.",
    "Annemarie Rohan","Senior Project Manager", "Roberts Research Group");
  
  testiments[2] = new testimonial(3,"ALADN System Solutions has delivered a system that exceeds our expectations, and we fully expect it to reduce the time spent on tracking audit response, and to improve the standardization, quality and response time of our audit reporting.",
    "Jed Hart","Managing Director","BHP Aviation");
  
  testiments[3] = new testimonial(4,"The &lsquo;Can Do Attitude&rsquo; was particularly helpful in designing additional functionality that otherwise was thought not possible.",
    "Neil Larkins","Accounts Manager","AMCOR Cartons");
  
  testiments[4] = new testimonial(5,"I would not hesitate to call on ALADN System Solutions again and I would not hesitate to recommend them to anyone else.",
    "Gill Mayne","Special Projects Manager","IT/Security Mailing Services");
  
  testiments[5] = new testimonial(6,"ALADN System Solutions displayed a high level of technical proficiency and a strong grasp of the commercial context in which the database was to be used.",
    "Greg Coleman","Marketing Analyst","Pilkington/Asia Pacific");
  
  testiments[6] = new testimonial(7,"It added another dimension to our level of service to our customers.",
    "Peter Ryan", "State Manager", "SALMAT");
    
  testiments.sort(function() {return 0.5 - Math.random()});
      
  return testiments;
}

var currentTestimentPosition=0;
var updateID=0;
function updateTestiment(testiments)
{
    if(currentTestimentPosition==testiments.length){
        currentTestimentPosition=0;
        if(!REPEAT){
          clearInterval(updateID);
        }
        return;
    }
    document.getElementById('testiment').innerHTML="&ldquo;"+testiments[currentTestimentPosition].testiment+"&rdquo;";
    document.getElementById('employee').innerHTML=testiments[currentTestimentPosition].employee;
    document.getElementById('position').innerHTML="("+testiments[currentTestimentPosition].position+")";
    document.getElementById('business').innerHTML=testiments[currentTestimentPosition].business;
    currentTestimentPosition++;
}

function testiment()
{
  var testiments=createTestiments();
  updateID = setInterval(function (a,b) {
                updateTestiment(testiments);
             },REPEAT_SPEED);

}
