jQuery(document).ready(function(){
	var imgActuel=0;
	var onAnim=false;
	if($("#escaladeBlockContent").length>0){
		$("#escaladeBlockContent").hide();
		$("#escaladeBlock h2 a").click(function (event) {
			event.preventDefault();
			$("#escaladeBlockContent").slideToggle("slow");
			});
		}
	if($("#formContact").length>0){
		$("#formContact").validate({
		invalidHandler: function(e, validator) {
			var errors = validator.numberOfInvalids();
			if (errors) {
				var message = errors == 1
					? 'Vous avez oubli&eacute; un champ. Il a &eacute;t&eacute; mis en surbrillance.'
					: 'Vous avez oubli&eacute; ' + errors + ' champs.  Ils ont &eacute;t&eacute; mis en surbrillance.';
				$("div.error span").html(message);
				$("div.error").show();
				} else {
				$("div.error").hide();
				}
			}
		});
	}
	if($(".photoGallery").length>0){
		$(".photoGallery li span a").fancybox({'transitionIn'	:	'elastic','transitionOut'	:	'elastic'});
		}
	if($(".videoGallery").length>0){
		$(".videoGallery li a").click(function() {
			$.fancybox({
					'padding'		: 0,
					'autoScale'		: false,
					'transitionIn'	: 'none',
					'transitionOut'	: 'none',
					'title'			: this.title,
					'width'		: 680,
					'height'		: 495,
					'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
					'type'			: 'swf',
					'swf'			: {
						 'wmode'		: 'transparent',
						'allowfullscreen'	: 'true'
					}
				});
			return false;
		});
	}
	if($("#montagneSlideshow").length>0){
		$(".montagneSlideshowThumbs li a").click(function(event){
			event.preventDefault();
			indexClicked=$(this).parent().index();
			if(indexClicked!=imgActuel){
				onAnim=true;
				$("#montagneSlideshowBigHolder img:eq("+imgActuel+")").fadeOut("fast",function(){
					$("#montagneSlideshowBigHolder img:eq("+indexClicked+")").fadeIn("fast");
					onAnim=false;
					imgActuel=indexClicked;
					});
				}
			});
		}
	});
