//Javascript for Frederick Yocums Website
//:fyocum:July 13, 2011

$(document).ready(function() {
//Setting the InfoPanels for the Artfolio
if($('body').hasClass('Folio')){
	
	$('.folioInfoPanel').addClass('Off');
	$('div.folioObj:not(:first)').removeClass('folioObj').addClass('offSet'); 

	//Set up the links to each object
	$('#folioNav li a').each(function(){ 
		var theObjToView = this.getAttribute('href',2);//Grab the href reference, 2 clips the value to the value in IE
	$(this).click(function(ev) {
		ev.preventDefault();//stop the original action
		$('div.folioObj').fadeOut('slow', function(){
			$(this).removeClass('folioObj').addClass('offSet').show();
			var theObjecttoDisplay = $(theObjToView).parent('.offSet');
			$(theObjecttoDisplay).removeClass('offSet').addClass('folioObj').fadeTo('slow', 1);//Find the object referenced with the link
		});//Remove the existing folioObj
		var theObjecttoDisplay = $(theObjToView).parent('.offSet');
		var theInfoPanelInfo = $(theObjToView).siblings('.folioInfoPanel').find('table').clone();
		$('#InfoPanel').empty().append(theInfoPanelInfo);
		$(theObjecttoDisplay).removeClass('offSet').addClass('folioObj').fadeTo('slow', 1);//Find the object referenced with the link

		});//End of click theObj function
	});//End of the folioNav link function
	
	$('#nav-Main>ul').children('li').addClass('visually-hidden'); //Shrink navMain sections of links
	//Method for hiding/showing the navMain sections on Folios
	
	$('#nav-Final ul a:not(.nav-Home,.nav-Contact)').click( function(ev) {
		ev.preventDefault();//stop the original action
		$(".shownDescription").slideUp('slow').removeClass('shownDescription');//slide up any previously displayed link sections
		var theSection = $(this).attr('class');
		var theNavLinks = $('#nav-Main ul li.'+theSection);
		$(theNavLinks).removeClass('visually-hidden').slideDown('slow').addClass('shownDescription').scrollIntoView(true);//slide down links, and scroll to show everything.
		//theNavLinks.scrollIntoView(true);
	});//End slideToggle navigational links
		
		
}//End pageType ArtFolio routine

});//End of document ready function

