function refreshDocJSTOD(frequency) {
  var max = testimonial.length;
  var dateObj = new Date();
  switch(frequency) {
    case "month": // 0 - 11
      testimonialIndex = dateObj.getMonth();
      break
    case "dayOfTheMonth": // 1 - 31
      testimonialIndex = dateObj.getDate() - 1 // 0 - 30
      break;
    case "dayOfTheWeek": // 0 - 6
      testimonialIndex = dateObj.getDay();
      break;
    case "hour": // 0 - 23
      testimonialIndex = dateObj.getHours();
      break;
    case "now": // Default
    default:
      testimonialIndex = getRandomIndex(max);
   }
 testimonialIndex = testimonialIndex % max;
 document.write(testimonial[testimonialIndex]);
}

function getRandomIndex(max) {
 var randomNum = Math.random();
 randomNum = randomNum * max;
 randomNum = parseInt(randomNum);
 if(isNaN(randomNum)) randomNum = 0; // for Netscape
 return randomNum;
}