var ts = new Array();
var currTestimonials;
var tw = $('#testimonials').width();

$(document).ready(function () {
  $.each($('#testimonials_list li'),function(i,v){
	ts[i] = v.innerHTML;
  });
  currTestimonials = 0;
  setInterval(nextTestimonials, 10000);

  $('input').click(function(){
	e = $(this);
	if(e.attr('placeholder') == e.val()) {
	  e.val('');
	}
  });

  $('input').blur(function(){
	e = $(this);
	if(e.val() == '') {
	  e.val(e.attr('placeholder'));
	}
  });
});

function nextTestimonials() {
  if (currTestimonials == ts.length - 1) {
	currTestimonials = 0;
  } else {
	currTestimonials += 1;
  }

  tsdiv = $('#testimonials');
  tsdiv.hide('slide', {
	direction: 'left'
  }, tw);
  tsdiv.html(ts[currTestimonials]);
  tsdiv.show('slide', {
	direction: 'right'
  }, tw);

}


