$(document).ready(function() {

// DIAPORAMA
$('#Slideshow').cycle({
		fx: 'fade',
		speed: '1200',
		timeout: '10'
	});
	
// jQuery SMOOTHSCROLL| Version 10-04-30
$('a[href*=#]').click(function() {
var duration=800;
var easing='swing';
var newHash=this.hash;
var target=$(this.hash).offset().top;
var oldLocation=window.location.href.replace(window.location.hash, '');
var newLocation=this;
if(oldLocation+newHash==newLocation)
{
$('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function() {
window.location.href=newLocation;
});
return false;
}
});

// FORM VALIDATION
$("#envoi").validate({
rules: {
nom: "required",
email: {
required: true,
email: true
},
message: {
required: true,
minlength: 8
}
},
messages: {
nom: "Requis",
email: "Adresse valide obligatoire",
message: "Message manquant"
}
});

// SCROLL TO

$(function() {

var $sidebar   = $("#MainNav"),
$window    = $(window),
offset     = $sidebar.offset(),
topPadding = 0;

$window.scroll(function() {
if ($window.scrollTop() > offset.top) {
$sidebar.stop().animate({
marginTop: $window.scrollTop() - offset.top + topPadding
});
} else {
$sidebar.stop().animate({
marginTop: 0
});
}
});

});

});
