var testimonial =
{
  init: function()
  {
    testimonial.frameRate = 25;
    testimonial.duration = .5;
    testimonial.cnt = 11;
    testimonial.divs=[];
    for (d=1; d <= testimonial.cnt; d++)
    {
      testimonial.divs[d]=document.getElementById("testimonial" + d);
    }
    testimonial.div1=testimonial.divs[1];
    testimonial.originalBg=Core.getComputedStyle(testimonial.divs[1],"backgroundImage");
    testimonial.targetW = 0;
    testimonial.originW = 600;
    testimonial.fixedW = testimonial.originW;
    testimonial.increment = (testimonial.targetW - testimonial.originW) / (testimonial.duration * testimonial.frameRate);
    testimonial.w = testimonial.originW;
    testimonial.cntr = 1;
    setTimeout(testimonial.animate, 10000);
  },

  animate: function()
  {
    testimonial.w += testimonial.increment;
    if ((testimonial.targetW > testimonial.originW && testimonial.w >= testimonial.targetW) || (testimonial.targetW < testimonial.originW && testimonial.w <= testimonial.targetW))
    {
      testimonial.w = testimonial.targetW;
      testimonial.targetW = (testimonial.targetW * -1) + testimonial.fixedW;
      testimonial.originW = (testimonial.originW * -1) + testimonial.fixedW;
      testimonial.increment = (testimonial.targetW - testimonial.originW) / (testimonial.duration * testimonial.frameRate);
      setTimeout(testimonial.animate, testimonial.originW * 10000/testimonial.fixedW);
      if(testimonial.originW == 0)
      {
        testimonial.cntr++;
        if (testimonial.cntr > testimonial.cnt)
        {
          testimonial.cntr=1;
	  testimonial.div1.style.backgroundImage=testimonial.originalBg;
        }
	else
	{
          testimonial.div1.style.backgroundImage=Core.getComputedStyle(testimonial.divs[testimonial.cntr],"backgroundImage");
	}
      }
    }
    else
    {
      setTimeout(testimonial.animate, 1000 / testimonial.frameRate);
    }
    testimonial.div1.style.width = Math.round(testimonial.w) + "px";
  }
};

Core.start(testimonial);

