
$(document).ready(function () {    
    //hide playlist div on pageload
    $('#jp_playlist_1').hide();
    //toggle playlist
    $('.jp-toggle').click(function(){
      $(this).toggleClass('hide');
      $('#jp_playlist_1').slideToggle()
    })
  });

//slides need to get called when all images loaded or heights all go to shit
$(window).load(function () {
  // Set starting slide to 1
  var startSlide = 1;
  // Get slide number if it exists
  if (window.location.hash && IsNumeric(window.location.hash)) {
  	startSlide = window.location.hash.replace('#','');
  };
  $('#slider').slides({
  	preload: true,
  	container: 'slides-container',
  	preloadImage: 'images/loading.gif',
  	effect: 'fade',
  	crossfade: false,
  	fadeSpeed: 350,
  	generateNextPrev: true,
  	generatePagination: true
  });
  //when slide selected in main nav, load that slide and scroll to it
  $('.slide-link').click(function(){
      var target = $(this).attr('href').replace('#','');
      $('#slider .pagination li:eq(' + (target - 1) + ') a').click();
      AnimatedScrollTo('#slider');
      return false;
  });
  //scroll to a normal section
  $('.section-link').click(function(){
      var target = $(this).attr('href');
      AnimatedScrollTo(target);
      return false;
  });
  function IsNumeric(input)	{
     return (input - 0) == input && input.length > 0;
  };
  function AnimatedScrollTo(element) {
    $('html,body').animate({ scrollTop: $(element).offset().top }, { duration: 'slow', easing: 'swing'});
  };
});
//functions


