function fonctions(){
	
	//Menu
	
	/*var span =('#menu span');
		var spanWidth = $('#menu ul li a#active_menu').parent('li').width();
		var spanPos = $('#menu ul li a#active_menu').parent('li').position();
		var spanPosLeft = spanPos.left + 10;
		
		$(span).css('width',spanWidth);
		$(span).css('left',spanPosLeft);
		
		$('#menu ul li').hover(function(){
		var spanNewWidth = $(this).width();
		var spanNewPos = $(this).position();
		var spanNewPosLeft = spanNewPos.left + 10;
		
		$(span).stop().animate({width:spanNewWidth, left:spanNewPosLeft},1000,'easeOutExpo');
		}, function(){
		$(span).stop().animate({width:spanWidth, left:spanPosLeft},2000,'easeOutElastic');
	});*/
	
	$('#header ul li').hover(function(){
		$('ul',this).stop(true,true).animate({height:'show'},1000,'easeOutExpo');
	},function(){
		$('ul',this).stop(true,true).animate({height:'hide'},1000,'easeOutExpo');
	});
	
	//Bloc Accueil
	
	var accueil1Height = $('.blocAccueil1').height()-5;
	var accueil2Height = $('.blocAccueil2').height()+5;
	
	if ( accueil1Height < accueil2Height ) {
		$('.blocAccueil1').height(accueil2Height);
		} else {
		$('.blocAccueil2').height(accueil1Height);
	}
	
	//Bloc Annonces
	
	var annonces1Height = $('.blocAnnonces1').height();
	var annonces2Height = $('.blocAnnonces2').height();
	
	if ( annonces1Height < annonces2Height ) {
		$('.blocAnnonces1').height(annonces2Height);
		} else {
		$('.blocAnnonces2').height(annonces1Height);
	}
	
	//Annonces
	
	$('#listeAnnonces a:even').addClass('even');
	$('#listeAnnonces a:odd').addClass('odd');
	
	$('#contenu .bloc.blocAnnonces1 #listeAnnonces a').each(function(){
		$(this).hover(function(){
			$('#contenu .bloc.blocAnnonces1 #listeAnnonces a').addClass('nobg');
			$(this).addClass('hover');
			$('#contenu .bloc.blocAnnonces1 #listeAnnonces a').not($(this)).stop().animate({opacity:0.3},200,'');
			},function(){
			$('#contenu .bloc.blocAnnonces1 #listeAnnonces a').stop().animate({opacity:1},200,'');
			$('#contenu .bloc.blocAnnonces1 #listeAnnonces a').removeClass('nobg').removeClass('hover');
		});
	});
	
	$('#contenu .bloc.blocAnnonces1 #catAnnonces ul').hover(function(){
		$('ul',this).stop(true,true).animate({opacity:'show',height:'show'},400,'');
		},function(){
		$('ul',this).stop(true,true).animate({opacity:'hide',height:'hide'},400,'');
	});
	
	//Details Vehicule
	
	$('#detailsVehicule div:even').not('#detailsVehicule div.large:even').addClass('even');
	$('#detailsVehicule div:odd').not('#detailsVehicule div.large:odd').addClass('odd');
	
	//Contact
	
	$('#contact input[type=submit]').click(function(){
		$('p.verif').hide();
		
		var valNom = $('#contact input[name=nom]').val();
		var valVille = $('#contact input[name=ville]').val();
		var valEmail = $('#contact input[name=email]').val();
		var valTelephone = $('#contact input[name=telephone]').val();
		var valMessage = $('#contact textarea[name=message]').val();
		
		if ( valNom == '' || valVille == '' || valEmail == '' || valTelephone == '' || valMessage == '' ){
			$('p.verif').show().text('').append('Veuillez remplir tous les champs correctement.');
			return false;
		}
	});
	
	//Envoyer à un ami
	
	$('#sendToFriend input[type=submit]').click(function(){
		$('p.verif').hide();
		
		var valNom = $('#sendToFriend input[name=nom2]').val();
		var valEmail = $('#sendToFriend input[name=email2]').val();
		var valEmailAmi = $('#sendToFriend input[name=emailfriend]').val();
		var valMessage = $('#sendToFriend textarea[name=message2]').val();
		
		if ( valNom == '' || valEmail == '' || valEmailAmi == '' || valMessage == '' ){
			$('p.verif').show().text('').append('Veuillez remplir tous les champs correctement.');
			return false;
		}
	});
	
	//Slider
	
	if ( $('#slider .items')[0] ) {
		$('#slider .items').bxSlider({
			mode: 'horizontal',
			speed: 2000,
			infiniteLoop: false,
			pause: 3000,
			autoHover: false,
			controls: false,
			auto: true,
			pager: true,
			easing: 'easeInOutExpo'
		});
	}
	
	$('#slider .items .item').each(function(){
		var sliderBlocs = $('.slider-bloc',this).length;
		var sliderBlocsWidth = 300 / sliderBlocs - 40;
		$('.slider-bloc',this).css('width',sliderBlocsWidth);
	});
	
	//Fancybox
	
	$('.fancybox').fancybox({
		'overlayColor': '#000',
		'overlayOpacity': 0.8,
		'titleShow': false
	});
	
}

$(document).ready(function(){
	fonctions();
});
