$(document).ready(function() {
  // Slideshow
  $('.slideshow-container').addClass('dynamic');
  $('.slide').hide();
  $('.slide.slide-1').show();
  $('.slideshow-container .controls span.slide-1').addClass('current');
  $('.slideshow-container .controls').show();
  $('.slideshow-container .controls span').each( function(i) {
    $(this).bind('click dblclick keypress', function() {
      slide = $(this).attr('class');
      $('.slide').hide();
      $('.slide.' + slide).show();
      $('.slideshow-container .controls span').removeClass('current');
      $(this).addClass('current');
    });
  });

  // Contact form validation
  $('form .tip').each(function() { $(this).hide(); });
  // Message
  $('form#contact-us textarea#message').bind('focus', function() {
    if ($(this).val().length < 10) { $("#message-tip").show(); }
    else { $('#message-tip').hide(); }
    if ($('form#contact-us input#phone').val().length < 6 && $('form#contact-us input#email').val().length < 6) { $("#contact-tip").show(); }
    else { $('#contact-tip').hide(); }
  });
  $('form#contact-us textarea#message').blur(function() { $('.tip').hide();  });
  // Quotes
  $('q.pull').each(function($i) {
    $(this).parent().before($(this).clone().addClass('pulled').prepend('<span class="hide">Start pulled quote:</span>...').append('...<span class="hide">End pulled quote.</span>'));
  });
  $('.product form[target="paypal"] input[type="image"]').each(function($i) {
    $(this).bind('mouseover focus', function() {

    });
  });
});

