$(document).ready(function(){

	$('#mwlink1').click(function(){ 
  		$('#medewerker1').show();
  		$('.medewerkerdesc:not(:#medewerker1)').hide();
	});
	$('#mwlink2').click(function(){ 
  		$('#medewerker2').show();
  		$('.medewerkerdesc:not(:#medewerker2)').hide();
	});
	$('#mwlink3').click(function(){ 
  		$('#medewerker3').show();
  		$('.medewerkerdesc:not(:#medewerker3)').hide();
	});
	$('#mwlink4').click(function(){ 
  		$('#medewerker4').show();
  		$('.medewerkerdesc:not(:#medewerker4)').hide();
	});
	$('#mwlink5').click(function(){ 
  		$('#medewerker5').show();
  		$('.medewerkerdesc:not(:#medewerker5)').hide();
	});
	$('#mwlink6').click(function(){ 
  		$('#medewerker6').show();
  		$('.medewerkerdesc:not(:#medewerker6)').hide();
	});
	$('#mwlink7').click(function(){ 
  		$('#medewerker7').show();
  		$('.medewerkerdesc:not(:#medewerker7)').hide();
	});
	$('#mwlink8').click(function(){ 
  		$('#medewerker8').show();
  		$('.medewerkerdesc:not(:#medewerker8)').hide();
	});
	$('#mwlink9').click(function(){ 
  		$('#medewerker9').show();
  		$('.medewerkerdesc:not(:#medewerker9)').hide();
	});





	myFields = '100';
		if ($('#field53 :selected').text() == "Informatie")
		{
			for(z=65;z<=myFields;z++){
				$('#field'+ z).parent().parent().hide();
				$('input[name=field'+ z +']').parent().parent().hide();
			}
			$('input[name=field136]').parent().parent().hide();
			$('input[name=field137]').parent().parent().hide();
			$('input[name=field139[0]]').parent().parent().hide();
		}
	
	$("#field53").change(function()
	{

		if ($('#field53 :selected').text() == "Informatie")
		{
			for(z=65;z<=myFields;z++){
				$('#field'+ z).parent().parent().hide();
				$('input[name=field'+ z +']').parent().parent().hide();
			}
			$('input[name=field136]').parent().parent().hide();
			$('input[name=field137]').parent().parent().hide();
			$('input[name=field139[0]]').parent().parent().hide();
		}
		if ($('#field53 :selected').text() == "Aanmelden")
		{
			for(z=65;z<=myFields;z++){
				$('#field'+ z).parent().parent().show();
				$('input[name=field'+ z +']').parent().parent().show();
			}
			$('input[name=field136]').parent().parent().show();
			$('input[name=field137]').parent().parent().show();
			$('input[name=field139[0]]').parent().parent().show();
		}
	});
	//Remove outline from links

		
		
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); 	
	
	var menu1 = false;
	var menu2 = false;
	var menu3 = false; 
	
	
	
	//When mouse rolls over
	$("#contact").mouseover(function(){
		$("#contact_sub").stop().animate({width:'745px'},{queue:false, duration:1100})
		$("#contact").css("background-image", "url(http://www.vriensarcheo.nl/images/nav_background.jpg)");
		$("#contact").css("width", '890px');
		
	});
	
	//When mouse is removed
	$("#contact").mouseout(function(){
		if(menu3 == false){
			$("#contact_sub").stop().animate({width:'0px'},{queue:false, duration:10})
			$("#contact").css("background-image", "none");		
		}		
	});
	
	$("#watwijdoen").mouseover(function(){
		$("#watwijdoen_sub").stop().animate({width:'745px'},{queue:false, duration:1100})
		$("#watwijdoen").css("background-image", "url(http://www.vriensarcheo.nl/images/nav_background.jpg)");
		$("#watwijdoen").css("width", '890px');
	});
	
	//When mouse is removed
	$("#watwijdoen").mouseout(function(){
		if(menu1 == false){
			$("#watwijdoen_sub").stop().animate({width:'0px'},{queue:false, duration:10})
			$("#watwijdoen").css("background-image", "none");
		}
	});
	
	$("#vacatures").mouseover(function(){
		$("#vacatures_sub").stop().animate({width:'745px'},{queue:false, duration:1100})
		$("#vacatures").css("background-image", "url(http://www.vriensarcheo.nl/images/nav_background.jpg)");
		$("#vacatures").css("width", '890px');
	});
	
	//When mouse is removed
	$("#vacatures").mouseout(function(){
		if(menu2 == false){
			$("#vacatures_sub").stop().animate({width:'0px'},{queue:false, duration:10})
			$("#vacatures").css("background-image", "none");		
		}
	});
	
	if(sPage == 'flexibel-in-te-zetten-personeel.php' || sPage == 'specialisaties.php' || sPage == 'diensten.php' || sPage == 'introductie.php' || sPage == 'werkwijze-inschrijven.php' || sPage == 'pay-rollconstructie.php' || sPage == 'opleidingsprogramma.php' || sPage == 'kennismaking.php' || sPage == 'werkwijze.php' || sPage == 'payroll.php' || sPage == 'kernwaarden.php' || sPage == 'opleidingen.php' || sPage == 'de-carrierestap.php' || sPage == 'nieuws.php' || sPage == 'personeel.php'  ){
			$("#watwijdoen_sub").stop().animate({width:'745px'},{queue:false, duration:1, easing: 'easeOutQuad'})
			$("#watwijdoen").css("background-image", "url(http://www.vriensarcheo.nl/images/nav_background.jpg)");
			$("#watwijdoen").css("width", '890px');
			menu1 = true;	
			
	}else if(sPage == 'vacature-overzicht.php' || sPage == 'inschrijven.php' || sPage == 'voltooid2.php' || sPage == 'vacatures2.php'){
			$("#vacatures_sub").stop().animate({width:'745px'},{queue:false, duration:1100, easing: 'easeOutQuad'})
			$("#vacatures").css("background-image", "url(http://www.vriensarcheo.nl/images/nav_background.jpg)");
			$("#vacatures").css("width", '890px');
			menu2 = true;
		
	}else if(sPage == 'routebeschrijving.php' || sPage == 'contactformulier.php' || sPage == 'downloads.php' || sPage == 'links.php' || sPage == 'adresgegevens.php'){
			$("#contact_sub").stop().animate({width:'745px'},{queue:false, duration:1100, easing: 'easeOutQuad'})
			$("#contact").css("background-image", "url(http://www.vriensarcheo.nl/images/nav_background.jpg)");
			$("#contact").css("width", '890px');
			menu3 = true;
	}
	
});
