/* Author: Ben Eggett */

// Welcome Screen Quotes 
$(function() {
  $('.quotes').click(function(){
 	var $nextitem = $('.quotes.current_quote').next();
    $(".quotes").removeClass('current_quote');
    $(".quotes").fadeOut('500');
    $nextitem.fadeIn('1000');
    $(this).addClass('current_quote');
    return false;
  });
});
setInterval(function(){
    var $next = $('.quotes.current_quote').next();
    if ($next.length==0) $next = $('.quotes.first')
    $next.trigger('click');
}, 6000);
 	
// Reloads page on logo click
$('#logo').click(function(){
		location.reload();
    });

// Navigation page interaction
$('.navigation li[id]').click(function(){
	$('.navigation li').removeClass('current');
	$(this).addClass('current');
	$('.pages, .overlay, .overlays').hide();
	$('#'+(this.id).replace(/nav_/, '')).fadeIn(600);
});

// Resume Arrows

$('.arrows').click(function(){
	// $('.navigation li').removeClass('current');
	// $('#nav_' + (this).addClass('current');
	$('.pages, .overlay, .overlays').hide();
	$('#'+ (this.title)).fadeIn(600);
});


//Grid overlay functions
$('.grid li').click(function(){
	$('.overlay').fadeIn(600);
	$('.overlays').hide();
	$('#overlay_'+(this.id)).show();
});

// Gallery Close button functions
$('.close_button').click(function(){
	$(this).parent('.overlays').hide();
	$('.overlay').fadeOut(600);
});

// Gallery - next project functions
$('.next_project').click(function(){
	var first_page = $(this).parents('.overlay').find('.overlays.first');
	var this_parent = $(this).parent('.overlays');
	this_parent.next().fadeIn(500);
  if (this_parent.next().length==0) first_page.fadeIn(500);
	this_parent.fadeOut(500);
});

// Gallery - previous project functions
$('.prev_project').click(function(){
	var first_page = $(this).parents('.overlay').find('.overlays.first');
	var this_parent = $(this).parent('.overlays');
	this_parent.prev().fadeIn(500);
	this_parent.fadeOut(500);
  if (this_parent.prev().length) first_page.fadeIn(500);

});

// Gallery Thumbnails
$('.thumbnails').click(function(){
	$(this).parents('.overlays').find('.feature').removeAttr('id').attr('id', (this).id.replace(/thumb_/, ''));
})


// Footer Links - portfolio/resume
$('footer a').click(function(){
	$('footer a').removeClass('current');
	$(this).addClass('current');
	$('.first').addClass('current');
	$('.pages, .overlay, .overlays, #main .section').hide();	
	$('#main .section .first').show();
	$('#main #'+(this.id)+'_section').fadeIn(600);

});





















