$(document).ready(function(){
	var menu=$("#menu");
	menu.height(function(i,h){return h;});
	$('a',menu).each(function() {
		$(this).wrap($("<div>").addClass("elm_menu"));
	});
	$("#menu li:has(>ul)").each(function(){
		$this=$(this);
		window.t=$this;
		var elm_menu=$(">.elm_menu",this);
		var a=$(">a",elm_menu);
		var ul=$(">ul",this);
		var siblings=$this.siblings(":has(>ul)").children("ul");
		a.click(function(){
			
			ul.slideToggle();
			siblings.slideUp();
			return false;
		});
		ul.hide();
	});
	
	$(".current a",menu).each(function(){
		$this=$(this)
		p=$this.parents("ul").show();
		$this.add(p.siblings("div").children("a").first()).prepend($("<div class='puce'>"));
	});
	if($.browser.msie && $.browser.version<7)
		$("li",menu).css({"padding-bottom":1});
	//$(".saison").addClass("saison_"+["hiver","automne","printemps"][Math.floor(Math.random()*3)]);
	$(".saison").addClass("saison_"+["hiver","automne","printemps"][Math.floor((new Date()).getMonth()/2)%3]);
	$("#feuilles>div>div").ifixpng();
	$("#champagnes_vignerons>div").ifixpng();
	var fancyboxOptions={
		type:"image",
		titlePosition:'inside',
		showNavArrows:true,
		titleFormat:function(titre,imgs,num){
			var count=imgs.length;
			var t;
			if(count>1)
			{
				t="Image "+(num+1)+" sur "+count;
				//if(titre!=undefined)
					//t+=" : "+titre;
			}
			//else
				//t=titre;
			return t;
		}
	};
	$(".gallerie,.diaporama").each(function(k,v){
		$("a",this).attr('rel','gal'+k).fancybox(fancyboxOptions);
	});
	$(".diaporama").each(function(){
		var $this=$(this);
		var a=$("a",this);
		var first=a.first();
		//a.not(first).hide();
	});
	$("a.fancybox").fancybox(fancyboxOptions);
	function resize()
	{
		$("#all").height($("#corps").height());
	}
	$("img").load(resize);
	resize();
	window.resize=resize;
}); 

//verification des champs du formulaire
$(function(){
	$("#formulaire_contact").validate();
});

//PHOTOTHEQUE
$(window).load(function(){
    $(".phototheque").slideViewerPro({ 
		// slideViewerPro options (defaults) 
		galBorderWidth: 0,  // the border width around the main images 
		thumbsTopMargin: 3, // the distance that separates the thumbnails and the buttons from the main images 
		thumbsRightMargin: 3, // the distance of each thumnail respect to the next one 
		thumbsBorderWidth: 3, // the border width of each thumbnail. Note that the border in reality is above, not around 
		buttonsWidth: 20, // the width of the prev/next buttons that commands the thumbnails 
		galBorderColor: "black", // the border color around the main images 
		thumbsBorderColor: "#d8d8d8", // the border color of the thumbnails but not the current one 
		thumbsActiveBorderColor: "black", // the border color of the current thumbnail 
		buttonsTextColor: "#444444", //the color of the optional text in leftButtonInner/rightButtonInner 
		thumbsBorderOpacity: .5, // could be 0, 0.1 up to 1.0 
		thumbsActiveBorderOpacity: .8, // could be 0, 0.1 up to 1.0 
		easeTime: 1250, // the time it takes a slide to move to its position 
		asTimer: 4000, // if autoslide is true, this is the interval between each slide 
		thumbs: 7, // the number of visible thumbnails 
		thumbsPercentReduction: 12, // the percentual reduction of the thumbnails in relation to the original 
		thumbsVis: true, // with this option set to false, the whole UI (thumbs and buttons) are not visible 		
		easeFunc: "easeOutElastic", //easing function
		leftButtonInner: "◄", //could be an image "<img src='images/larw.gif' />" or an escaped char as "&larr"; 
		rightButtonInner: "►", //could be an image or an escaped char as "&rarr"; 
		autoslide: false, // by default the slider do not slides automatically. When set to true REQUIRES the jquery.timers plugin 
		typo: false, // the typographic info of each slide. When set to true, the ALT tag content is displayed 
		typoFullOpacity: 0.9, // the opacity for typographic info. 1 means fully visible. 
		shuffle: false // the LI items can be shuffled (randomly mixed) when shuffle is true 
    }); 
});



















