// Menu animations

	if ($.browser.msie) {
	;
	}
	else {
		$(document).ready(function() {

			$("div.menu ul li").prepend("<span></span>"); //Throws an empty span tag right before the a tag
		
			$("div.menu ul li").each(function() { //For each list item...
				var linkText = $(this).find("a").html(); //Find the text inside of the <a> tag
				$(this).find("span").show().html(linkText); //Add the text in the <span> tag
				$("#menu li").each(function() { //For each list item…
			var linkText = $(this).find("a span").html(); //Find the text inside of the <a> tag
			var linkHref = $(this).find("a").attr('href'); //Find the href inside of the <a> tag
			$(this).find("span.off").show().html(linkText)
			.click(function(){ window.location = linkHref; });; //Add the text in the <span> tag
			});
			});
			
		
			$("div.menu ul li").hover(function() {	//On hover...
				$(this).find("span").stop().animate({
					marginTop: "-40" //Find the <span> tag and move it up 40 pixels
				}, {duration:800, easing: 'easeOutQuart'});
			} , function() { //On hover out...
				$(this).find("span").stop().animate({
					marginTop: "0"  //Move the <span> back to its original state (0px)
				}, {duration:200, easing: 'easeOutQuart'});
			});
		
		});
	}


// Hover images
$(document).ready(function () {

		// transition effect
		style = 'easeInOutQuart';

		// if the mouse hover the portfolio-item
		$('.portfolio_item').hover(
			function() {
				//display heading and caption
				$(this).find('img').stop(false,true).animate({top:-85}, {duration:150});
				$(this).find('#block_content').stop(false,true).animate({top:-10}, {duration:150});
				$(this).find('#img_icon').stop(false,true).animate({top: 51}, {duration:150});
				$(this).find('#project_details').stop(false,true).animate({opacity:.85}, {duration:300});
				
			},

			function() {
				//hide heading and caption
				$(this).find('img').stop(false,true).animate({top:-65}, {duration:150});
				$(this).find('#block_content').stop(false,true).animate({top:10}, {duration:150});
				$(this).find('#img_icon').stop(false,true).animate({top: 31}, {duration:150});
				$(this).find('#project_details').stop(false,true).animate({opacity:0}, {duration:300});
			}
		);
		
		// if the mouse hover the social media icons
		$('.sociable li').hover(
			function() {
				//display heading and caption
				$(this).find('img').stop(false,true).animate({marginTop:-22}, {duration:200});
			
			},

			function() {
				//hide heading and caption
				$(this).find('img').stop(false,true).animate({marginTop:-0}, {duration:200});
	
			}
		);

	});
	

// Back to top
$(function() {
	$(window).scroll(function() {
		if($(this).scrollTop() != 0) {
			$('#toTop').fadeIn();	
		} else {
			$('#toTop').fadeOut();
		}
	});
 
	$('#toTop').click(function() {
		$('body,html').animate(
				{ scrollTop:0 },{
                    duration: 800,
                    easing: 'easeInOutQuart'
                })
	});	
});


// Stage ervaringen dropdown
$(document).ready(function() {
  $('#stage-holder a.ervaringen').each(function() {
    var tis = $(this), state = false, answer = tis.next('div').hide().css('height','auto').slideUp();
    tis.click(function() {
      state = !state;
      answer.slideToggle(state);
      tis.toggleClass('active',state);
    });
  });
});
