$(document).ready(function() {
  /* delete link dashed border */
  $("a").bind("focus", function() {
    if (this.blur) {
      this.blur();
    }
  });

  var position = 0;
  var slideWidth = 560;
  var slides = $('.slide');
  var numberOfSlides = slides.length;

  $('.servicesPic').css('overflow', 'hidden');

  slides
  .wrapAll('<div id="slideInner"></div>')
  .css({
    'float' : 'left',
    'width' : slideWidth
  });

  $('.servicesBotton a:first').css("background-color", "#c35519");

  $('#slideInner').css('width', slideWidth * numberOfSlides);

  setInterval(function(){
    slideImg(position);
    position ++;
    if(position == numberOfSlides)
      position = 0;
  },5000
  );

  $('.servicesBotton a').bind("click", function(){
    position = $('.servicesBotton a').index(this);
    slideImg(position);
  });

  function slideImg(position){
    $(".servicesBotton a").removeAttr('style');
    $(".servicesBotton a:eq("+position+")").css("background-color", "#c35519");
    $('#slideInner').animate({
      'marginLeft' : slideWidth*(-position)
    });
  }
});
