function splashSlides(){
  $('.splash img:gt(0)').css('opacity',0);
  setInterval(function(){
    $('.splash :first-child').addClass('back')
      .next('img').animate({opacity:1},2500)
      .next('img').removeClass('back').css('opacity',0).end().end()
      .appendTo('.splash');
  },5000);
}

function ourPeople(){
  $('.staff div[rel]').css('cursor','pointer').click(function(event){
    var person = $(event.target).closest('div').attr('rel');
    location = location.pathname+'#'+person;
  }).mouseenter(function(event){
    $(event.target).closest('div').addClass('hover');
  }).mouseleave(function(event){
    $(event.target).closest('div').removeClass('hover');
  }).each(function(){
    var name = jQuery.trim($(this).find('h3').clone().find('em').remove().end().text());
    $(this).attr('title','Jump to the bio of '+name);
    $(this).find('img').attr('title','Jump to the bio of '+name);
  });
}

function directions(){
  $('a[rel=map]').click(function(event){
    event.preventDefault();
    var addr = prompt('What is your starting address?\nOr, leave it blank to be taken to Google Maps.').replace(/ /g,'+');
    if (!addr){ window.location = 'http://maps.google.com/maps?f=q&source=s_q&q=596+Main+Street,+Eastsound,+WA+98245&ie=UTF8'; }
    var url = 'http://maps.google.com/maps?f=q&source=s_q&q='+addr+'+to+596+Main+Street,+Eastsound,+WA+98245&ie=UTF8';
    window.location = url;
  });
}

function contact(){
  var hash = location.hash;
  if (hash){
    $('#to').val(hash.replace('#',''));
  }
}
