/* Top Nav Hide the subs */
  $(document).ready(function(){ 
	
	
	
	 // disables the work and about links:
	 $("#work > a").attr("href", "#");
	 $("#about > a").attr("href", "#");

	 // hides the breadcrumb:
	 $("#home-breadcrumb").hide();
	 
	 // hides the additional WORK and ABOUT elements:
	 $("#about-additional-text").hide();
	 $("#additional-projects").hide();
	 // hides the contact info in the right column:
	 $("#block-block-1").hide();
	 $("#block-block-2").hide();
	// Straighten out the spacing issues
	$("#work-container").css('margin-bottom','-20px');
	 $("div > .main-block").css('padding-bottom','20px');
	 
	
 }); 
  
  
/* begin ROTATOR 
  
  $(document).ready(function(){ 
			$('#slides').slides({
				preload: true,
				preloadImage: 'img/loading.gif',
				play: 5000,
				pause: 2500,
				
				hoverPause: true
			});
		});
  
 end ROTATOR */
  
  
  
/* Top Nav Home animations */ 
/* begin WORK */ 
$(document).ready(function(){ 
    $('#primary ul.menu > li').click(function(e) {
		var clicked = $(e.target);		
		var length = clicked.parents('li').length;
		
		// If clicked list item is a child of another list item, we'll exit here
		if(length > 1) {
	        return;
		} else {
			var lid = clicked.parent().attr('id');
			
			/** ANIMATE INTO WORK PAGE **/
			if (lid == 'work') {
				$("#about").children('ul').fadeOut(10, function() { 
					$("#about").animate({width: '86px'
				 }, 200);
				});
				
				$("#about").removeClass('active'); 
				$(this).animate({
					width: '304px'
				}, 600 );
				$(this).addClass('active'); 
				$(this).children('ul').fadeIn(500);
				$(this).css('width','auto'); 
			   
			   
			   $("#work-container").slideDown(500);
			   $("#additional-projects").slideDown(500);
			   $("#breadcrumb-state").text("Work: Featured Projects");
				
			   $("#about-container").slideUp(500);
			   $("#home-breadcrumb").slideDown(500, function() { 
					 //
				});
			  $("#home-flash").slideUp(500);
			  $("#block-block-1").slideUp(500);
	 		$("#block-block-2").slideUp(500);

			} 
			// END WORK
			
			
			/** ANIMATE INTO ABOUT PAGE **/
			else if (lid == 'about') {
			    $("#work").children('ul').hide();
				$("#work").removeClass('active');
				$("#work").animate({
					width: '86px'
				}, 200, function() { 
					//
				});
				$(this).removeClass('active'); 	
				 $(this).animate({
					width: '212px',
					'text-align': 'left'
				 }, 200, function() { 
					$(this).children('ul').fadeIn(300);
				 });
				 $(this).addClass('active'); 
				
				$(this).css('width','auto'); 
				
				 
				 $("#about-container").slideDown(500);
				
				 $("#work-container").slideUp(800);
			
				 // breadcrumb:
				$("#breadcrumb-state").text("About");
				 $("#about-additional-text").slideDown(500);
				 $("#home-breadcrumb").slideDown(500, function() { 
					 //
				});
			 $("#home-flash").slideUp(500);
			  $("#block-block-1").slideDown(500);
	 		$("#block-block-2").slideDown(500);
				 
			} 
			// END ABOUT
		}
	});
	
	/** ANIMATE BACK TO HOMEPAGE **/
	$(".reset-home").click(function () {

		// Close top menu
		$("#primary ul li").each(function() { 
			$(this).removeClass('active'); 
			if (($(this).attr('id') == "about" ) || ($(this).attr('id') == "work")) {
				$(this).css('width','86px');
			}
		});
$("#work").children('ul').fadeOut(10);
$("#about").children('ul').fadeOut(10);
		 // breadcrumb:
		$("#home-breadcrumb").slideUp(200);
	$("#block-block-1").slideUp(500);
	 		$("#block-block-2").slideUp(500);
		$("#about-container").slideDown(500);
		$("#work-container").slideDown(500);
	  $("#about-additional-text").slideUp(500);
	  $("#home-flash").slideDown(500);
		  
		  $("#additional-projects").slideUp(500, function () {
		   // Animates the body:
			
			
		
		// end Animates the body
		});
     
      return false;
    }); 
	// END HOME
}); 
 

// JavaScript Document
