// JavaScript Document
$(document).ready(function() {
   // put all your jQuery goodness in here.
   
   _speed = 150;
   _scroll = 200
   
   $('.main-menu-item a').mouseenter(function() {
		$(this).children().animate({marginTop: '-38px'}, _speed );
	});
   $('.main-menu-item a').mouseleave(function() {
		$(this).children().animate({marginTop: '0px'}, _speed );
	});

	$('#up').mouseenter(function() {
		$(this).animate({marginTop: '11px', paddingBottom: '2px'}, _speed );
	});
	$('#up').mouseleave(function() {
		$(this).animate({marginTop: '13px', paddingBottom: '0px'}, _speed );
	});
	$('#down').mouseenter(function() {
		$(this).animate({paddingBottom: '2px'}, _speed );
	});
	$('#down').mouseleave(function() {
		$(this).animate({paddingBottom: '0px'}, _speed );
	});

	if(_post_ids != ""){
		_current_post_scroll = "start";
		
		$('#up').click(function() {
			if(_current_post_scroll == "start"){
				$('body').scrollTo({ top:0, left: '-=0'}, _scroll );
			} else if(_current_post_scroll == 0){
				_current_post_scroll = "start";
				$('body').scrollTo({ top:0, left: '-=0'}, _scroll );
			}else if(_current_post_scroll == _post_ids.length){
				_current_post_scroll--;
				$('body').scrollTo("#"+_post_ids[(_current_post_scroll)], _scroll );
			}else if(_current_post_scroll > 0){
				_current_post_scroll--;
				$('body').scrollTo("#"+_post_ids[(_current_post_scroll)], _scroll );
			}
		});
		$('#down').click(function() {
			if(_current_post_scroll == "start"){
				_current_post_scroll = 0;
				$('body').scrollTo("#"+_post_ids[(_current_post_scroll)], _scroll );
			} else if(_current_post_scroll == 0){
				_current_post_scroll++;
				$('body').scrollTo("#"+_post_ids[(_current_post_scroll)], _scroll );
			}else if(_current_post_scroll < _post_ids.length-1){
				_current_post_scroll++;
				$('body').scrollTo("#"+_post_ids[(_current_post_scroll)], _scroll );
			}
		});
	}else{
		$('#up').click(function() {
			$('body').scrollTo( {top:'-='+_scroll+'px', left:'+=1'}, _scroll );
		});
		$('#down').click(function() {
			$('body').scrollTo( {top:'+='+_scroll+'px', left:'+=1'}, _scroll );
		});
	}
	$("#email_field").val('enter your email');

	$('#email_field').click(function() {
		$("#email_field").val('');
	});
	$('#email_field').blur(function() {
		if ($("#email_field").val() == ''){
			$("#email_field").val('enter your email');
		}
	});
	
	_showingAlbum = 0;
	$('.show-album-bottom').click(function() {
		if(_showingAlbum == 0){
			$(this).css({'background-position' : '0px 0px'});
			$('.album-bottom').slideDown(_speed);
			_showingAlbum = 1;
		}else{
			$(this).css({'background-position' : '0px -16px'});
			$('.album-bottom').slideUp(_speed);
			_showingAlbum = 0;
		}
	});
	
	$('.tour-date-top').click(function(){
		$(this).find('.tour-date-button').toggleClass('selected-arrow','');
		$(this).parent().toggleClass('selected','');
		$(this).parent().find(".tour-date-bottom").slideToggle(_speed);
	});

	$("a[rel=lightbox]").fancybox({
		'transitionIn'		: 'fade',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {}
	});

	$('.song h3').click(function(){
		$(this).toggleClass('selected','');
		$(this).parent().find(".lyrics").slideToggle(_scroll);
	});

	
 }); //$(document).ready(function() {
