
$(document).ready(function(){
	$('.nav a').mouseover(function(){
		$(this).css('opacity',0.6);
	});
	$('.nav a').mouseout(function(){
		if(!$(this).hasClass('active')){
			$(this).css('opacity',1);
		}
	});
	
	$('#navigatie a').click(function() {
		$('.nav a').removeClass('active');
		$('.nav a').css('opacity',1);
		$(this).addClass("active");
		$(this).css('opacity',0.6);
		

		if(this.id == "ahome"){
			$("#navigatie").animate({
			 	top: '180px'
			 },1000);
		}else{
			$("#navigatie").animate({
			 	top: '0px'
			 },1000);
		}
		var effect = "easeOutQuad";
		switch(this.id)
		{
		case 'acontact':
		 	effect = 'easeOutBounce';
		  break;
		case 'aportfolio':
		  	effect = 'easeOutElastic';
		  break;
		default:
		  effect = 'easeOutQuad';
		}
		
		
		
		var elementClicked = $(this).attr("href");
		var destination = $(elementClicked).offset().top;
		 $("html,body").stop().animate({
		 	scrollTop: destination
		 },3000, effect,function(){
			
		});
		 return false;
	});
	
	$(window).load(function() {
		$('#slider').nivoSlider({
			effect:'random',
			slices:15,
			animSpeed:500,
			pauseTime:4000,
			startSlide:0, //Set starting Slide (0 index)
			directionNav:true, //Next & Prev
			directionNavHide:false, //Only show on hover
			controlNav:true, //1,2,3...
			controlNavThumbs:true, //Use thumbnails for Control Nav
	      controlNavThumbsFromRel:true, //Use image rel for thumbs
			controlNavThumbsSearch: '/images/btn_next.png', //Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
			keyboardNav:false, //Use left & right arrows
			pauseOnHover:true, //Stop animation while hovering
			manualAdvance:false, //Force manual transitions
			captionOpacity:1, //Universal caption opacity
			beforeChange: function(){},
			afterChange: function(){Cufon.replace('#slider .nivo-caption', { fontFamily: 'advent',hover : true });},
			slideshowEnd: function(){} //Triggers after all slides have been shown
		});
		$('.nivo-nextNav').text('');
		$('.nivo-prevNav').text('');
		Cufon.replace('.nivo-caption', { fontFamily: 'advent',hover : true });

	});

	Cufon.replace('.cufon', { fontFamily: 'advent' ,hover : true});
//	Cufon.replace('.cufon_content', { fontFamily: 'cambria' });

});


function changeroad(id,click){
		
	$('.peaceoftheroad').fadeOut("left",function(){
		$('body').removeClass('road1');
		$('body').removeClass('road2');
		$('body').addClass('road'+id);
		$('#roads a').removeClass("active");
		$('#'+click).addClass('active');
		$('.peaceoftheroad').fadeIn('slow',function(){

		});
	});


}


