$(document).ready(function() {
  //$('.navigation li a').mousedown(function() { $(this).addClass('pressed') }).mouseup(function() { $(this).removeClass('pressed') });         
   
   //toggle button
   $('a#toggleButton').click(function(){
   		$("#toggleWrapper").toggle("fast");	
   		return false;
   });   
});

$(document).ready(function() {
  //$('.navigation li a').mousedown(function() { $(this).addClass('pressed') }).mouseup(function() { $(this).removeClass('pressed') });         
   
   //toggle button
   $('a#otherButton').click(function(){
   		$("#toggleWrapper").toggle("fast");	
   		return false;
   });   
});

//services dropdown custom function
$(document).ready(function() {
	$('#srvcTtoggleButton').click(function(event) {
		
		//bind to body for click anywhere close
		$("body").one("click",function() {			
			$("#dropDownItems").animate({opacity: "hide"}, "fast");
		});		
		event.stopPropagation();
				
   		$("#dropDownItems").toggle('fast');
   });
   
   
   //option has been clicked
   /*
   1. Get the link text of the item and set the selected text to it
   2. Toggle the currently shown element in place with the chosen element
   3. Set the clicked link to the class 'visible'
   */
   $('#dropDownItems li a').click(function(e) {
   		  	
   		var target = e.target; //target of the link
   		var linkText = $(this).text();   		
   		var hash = $(this).attr('href').split('#')[1]; //should map to the id of the content to show
   		   		
   		$("#dropDownItems").animate({opacity: "hide"}, "fast");
   		$('#dropDownItems li a').removeClass('visible selected');
   		$(this).addClass('visible selected');   	
   		   		
   		//set the selected text	
   		$('#selectedText').html(linkText);
   		   		
   		//hide currently visible content   		
   		$(this).parent().parent().parent().nextAll(".visibleContent").animate({opacity: "hide"}, "fast").removeClass('visibleContent').addClass('invisible');
   		
   		//show the div we want
   		$('#' + hash).animate({opacity: "show"}, "fast").addClass('visibleContent').removeClass('invisible');
   		
   		return false;
   });   
});

//portfolio item hover overshadow
$(document).ready(function() {
	$(".portfolioItem").hover(function(){
		var overlay = $(this).children(".overlay");						
		$(this).stop().children(".overlay").animate({opacity: "show"}, "slow").css('cursor', 'pointer');  
		
		//get anchor and set the on click of hover image to that url
		var target = $(this).children("a").attr('href');
		$(overlay).click(function(){
            window.location = target;
        });
		
	},function(){
		$(this).stop().children(".overlay").animate({opacity: "hide"}, "slow").css('cursor', 'pointer');  
	});
});





  
  
