
$(document).ready(function(){

	
/* selected page on top nav*/
		 $(function(){
			   var path = location.pathname;
		
			   if ( path ) {
				 $('nav#mainNav ul li a[href$="' + path + '"]').parent().attr('class', 'selected');
			   };
			   
			   if(path =="/"){				  
				   $('nav#mainNav ul li.home').addClass('selected');
			   }
		 });
	

/* open close contact form*/	 
	 $(".contact a").toggle(function(e) {
	 
 			e.preventDefault();
			$(this).parent().addClass("selected");
			$("#contactForm").slideDown();
			return false;		
		}, function(e) {
  			e.preventDefault();
			$(this).parent().removeClass("selected");
			$("#contactForm").slideUp();
			return false;		
		});
		
/*close contact form if click on page*/		
	$(window).click(function() {
		$("#contactForm").slideUp("fast");
		$(".contact").removeClass("selected");
				
	});
	
/*show contact form on a link*/
	$(".showContact").click(function(e) {	
		e.preventDefault();
		$(".contact").addClass("selected");
		$("#contactForm").slideDown();
		$.scrollTo(0);
		return false;
	});
	
	
	   
 /*twitter feed at footer*/
      $('#rrt').relatedTweets({
         debug:0
         ,from_users:'elladesign'
         ,status:1
         ,realtime:1
         ,n:10
		 ,animate: 'opacity'
         ,show_avatar:0
         ,show_author:0
		 ,stay_time: 10000
      });
	  
	  
	
/* ----------- background caption fades in-------------------- */
	  $("#content article").hover(function () {
	
			$(".backgroundCaption").stop().animate({"opacity": "1"}, "slow");
			  
		  },function() {
		
			$(".backgroundCaption").stop().animate({"opacity": "0"}, "slow");

    });
	

	$(".thumbnail").hover(function(){
	
			$(this).css("position", "relative");
			$(this).stop().animate({ top: "-10px"}, "slow");
			
			
			},function() {	
							
				$(this).stop().animate({ top: "0"}, "slow");
				
				
    });



/* -----------------show octopus on active scroll portfolio on portfolio page-------------------- 
function isScrolledIntoView(elem)
{	 
    var docViewTop = $(window).scrollTop();
    var docViewBottom = docViewTop + $(window).height();

    var elemTop = $(elem).offset().top - 200;
    var elemBottom = elemTop + $(elem).height();

	  
	  if(window.pageYOffset >= elemTop && window.pageYOffset <= elemBottom){

		  $(elem).find('.cornerOctopus').fadeIn();
	
	  } else{  
		  $(elem).find('.cornerOctopus').hide();	
		
	  }	  
}


 
				   $(window).bind('scroll.test', function() {
							 isScrolledIntoView("#workOneLg");
							 isScrolledIntoView("#workTwoLg");
							 isScrolledIntoView("#workThreeLg");
							isScrolledIntoView("#workFourLg");
							isScrolledIntoView("#workFiveLg");
							isScrolledIntoView("#workSixLg");
							isScrolledIntoView("#workSevenLg");
							isScrolledIntoView("#workEightLg");
							 isScrolledIntoView("#workNineLg");
							 isScrolledIntoView("#workTenLg");
							isScrolledIntoView("#workElevenLg");
							isScrolledIntoView("#workTwelveLg");
					});*/




	
/* ---- scrolling portfolio settings ---------
$.scrollTo(0);
*/

	
	$(".top").click(function(e) {
		e.preventDefault();
		$.scrollTo(0, 1200,{easing:'easeInOutBack'} );
		return false;	
	});	
	
	$(".printFolio figure.thumbnail").click(function(e) {
		e.preventDefault();
		$(".printFolio article header").hide();
		$(this).siblings("header").fadeIn("fast");
		return false;

	});
		
	$(".webFolio figure.thumbnail").click(function(e) {
		e.preventDefault();	
		var id = $(this).attr('id');		
		$.scrollTo( '#'+id+'Lg', 800, {easing:'easeInOutBack'} );			 				 
 		 return false;
	});

	
	
	
/* -----------brochure portfolio page settings------------------ */	
	
jQuery(function( $ ){
	var $pane = $('.brochures'), //the item being scrolled
		$items = $pane.find('li'),//the items
		$paginator = $('#paginator');//the container of the links/buttons
	

	
	$pane.serialScroll({
		items:$items, // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'a.prev',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'a.next',// Selector to the 'next' button (absolute too)
		axis:'x',// The default is 'y' scroll on both ways

		duration:700,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
	
	});


});





});

