var time 		= 1000;
var colorOver	= '#29a1db';
var colorOut	= '#232323';
var topPad;

$(function(){
	// init
	topPad = $(".shell").css("padding-top").replace("px", "");
	var first = $('.title:first').attr('id');
	$('.menu li:first').addClass('active');
	$('.section:even').addClass('alt');
	goToByScroll(first);
	
	// create buttons
	$('.button').wrapInner('<span><span></span></span>');
	
	// mask titles
	$('.title').wrapInner('<div class="mask"></div>');
	
	// grid spacing
	$('.space .grid:nth-child(3n+2)').addClass('extra-pad');
	$('.grid a').hover(
		function() {
			$(this).find('img').stop().animate({'backgroundColor':colorOver}, { queue:false, duration:time, easing:'easeOutExpo' });
		}, function () {
			$(this).find('img').stop().animate({'backgroundColor':colorOut}, { queue:false, duration:time, easing:'easeOutExpo' });
	});
	
	$('.downloads li').hover(
		function() {
			$(this).stop().animate({'backgroundColor':'#565656'}, { queue:false, duration:time, easing:'easeOutExpo' });
		}, function () {
			$(this).stop().animate({'backgroundColor':colorOut}, { queue:false, duration:time, easing:'easeOutExpo' });
	});
	
	// menu functions
	$('.menu li a')
		.append('<span class="hover"></span>')
		.hover(
			function() {
				$('.hover',this).stop().animate({'opacity':1}, time, 'easeOutExpo')
			}, function() {
				$('.hover',this).stop().animate({ 'opacity':0}, time, 'easeOutExpo')
		})
		.click(function(){
			var section = $(this).text();
			
			goToByScroll(section);
			
			$(".menu li").each(function(){
				$(this).removeClass("active");
			});
	
			$(this).parent("li").addClass("active");
		});
	/*
	var myPlaylist = new jPlayerPlaylist({
  		jPlayer: "#jquery_jplayer_N",
  		cssSelectorAncestor: "#jp_container_N"
		}, [
			{
		    title:"Let's Just Fall",
		    artist:"Wolcott",
		    mp3:"mp3gallery/content/songs/d45p_vol1_lets-just-fall/01 Let's Just Fall.mp3",
		    poster: "mp3gallery/content/images/lets-just-fall_200.jpg",
		    free:true
		  },
		  {
		    title:"Cotton Fields'",
		    artist:"Wolcott",
		    mp3:"mp3gallery/content/songs/d45p_vol1_lets-just-fall/02 Cotton Fields.mp3",
		    poster: "mp3gallery/content/images/lets-just-fall_200.jpg"
		  },
		  {
		    title:"The Best One",
		    artist:"Wolcott",
		    mp3:"mp3gallery/content/songs/d45p_vol2_the-best-one/01 The Best One.mp3",
		    poster: "mp3gallery/content/images/the-best-one_200.jpg"
		  },
		  {
		    title:"Backwards Mind",
		    artist:"Wolcott",
		    mp3:"mp3gallery/content/songs/d45p_vol2_the-best-one/02 Backwards Mind.mp3",
		    poster: "mp3gallery/content/images/the-best-one_200.jpg"
		  },
		  {
		    title:"Waiting in Line",
		    artist:"Wolcott",
		    mp3:"mp3gallery/content/songs/d45p_vol3_waiting-in-line/01 Waiting in Line.mp3",
		    poster: "mp3gallery/content/images/waiting-in-line_200.jpg"
		  },
		  {
		    title:"It Don't Matter Anyway",
		    artist:"Wolcott",
		    mp3:"mp3gallery/content/songs/d45p_vol3_waiting-in-line/02 It Don't Matter Anyway.mp3",
		    poster: "mp3gallery/content/images/waiting-in-line_200.jpg"
		  },
		  {
		    title:"Galaxy in my Eyes",
		    artist:"Wolcott",
		    mp3:"mp3gallery/content/songs/d45p_vol4_galaxy/01 Galaxy in my Eyes.mp3",
		    poster: "mp3gallery/content/images/galaxy_200.jpg"
		  },
		  {
		    title:"The Ballad of '86'",
		    artist:"Wolcott",
		    mp3:"mp3gallery/content/songs/d45p_vol4_galaxy/02 The Ballad of '86'.mp3",
		    poster: "mp3gallery/content/images/galaxy_200.jpg"
		  }
		], {
		  playlistOptions: {
		    enableRemoveControls: false
		  },
		  swfPath: "/js/jPlayer",
		  supplied: "mp3"
		});
		*/

}); 

function goToByScroll(id){
	$("html,body").animate({scrollTop: $("#" + id).offset().top - topPad}, time, 'easeInOutExpo');
}
