
/*function swapImage(number, image) {
	
	$('#projectImage').attr('style', 'display:none;');
	$('#projectImage').fadeIn(0).attr('src', image + '.jpg');
	$('#image' + number + '_thumbnail').attr('src', image + '_thumbnail.jpg');
	
}*/

$(document).ready(function() {
		if(window.location.hash){
			
			var $loadTarget = $(window.location.hash);
			$loadTarget = $loadTarget.length && $loadTarget || $('[name=' + window.location.hash.slice(1) +']');
			
			if ($loadTarget.length) {
				var targetOffsetLoad = $loadTarget.offset().top-40;
				$('html,body').animate({scrollTop: targetOffsetLoad}, 1500);
			}
			
			$('a[href*=#]').each(function(i) {
				if($(this)	.attr('href') == window.location.hash) {
					$(this).addClass('selected');	
				} else {
					$(this).removeClass('selected');	
				}
			});
		}
	
	$('a[href*=#]').click(function() {
								   
	$('a[href*=#]').each(function(i) {
		if($('a[href*=#]').hasClass('selected')) {
			$('a[href*=#]').removeClass('selected');	
		}
	});
    
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname) {
        
            var $target = $(this.hash);
			var locationHref = window.location.href;
			var caller = this;
			var elementClick = $(caller).attr("href");
			
			
			$(caller).addClass("selected");

            
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			
			if ($target.length) {
            
                var targetOffset = $target.offset().top-40;
				
                $('html,body').animate({scrollTop: targetOffset}, 1500, function() {
									  
					window.location.hash = elementClick;
					
					
				});
                 return false;
                
            }
            
        }
    });

});