$(function() {
	// Afficher les producteurs
	var producteurs = $('#producteur_content .producteur');
	$(".title a", producteurs).click(function (){
		if($("#"+$(this).attr('id')+"_content").is(':hidden')){
			$(this).css('background-position', 'bottom center');
			$("#"+$(this).attr('id')+"_content").slideDown('slow');
		}else{
			$(this).css('background-position', '');
			$("#"+$(this).attr('id')+"_content").slideUp('slow');
		}
	});
	
	$("#RecetteRechercheForm").hover(
		function(){
			$("#recherche_desc").fadeIn('slow');
		},
		function(){
			$("#recherche_desc").fadeOut('slow');
		}
	);
	
	$('.horaire').css('top', "-"+(parseInt($('.horaire').css('height')) - 18)+"px");
	
	$('.horaire').hover(function(){
		 $(this).animate({
			top: '0px'
		},{
			duration: 500,
			queue: false,
			specialEasing: {
			  width: 'linear',
			  height: 'easeOutBounce'
			}
		}); 
		}, function(){
		$(this).animate({
			top: "-"+(parseInt($('.horaire').css('height')) - 18)+"px"
		},{
			duration: 500,
			queue: false,
			specialEasing: {
			  width: 'linear',
			  height: 'easein'
			}
		});
	});
	
	// IE 7 - 8 bord arrondi
	/*
	DD_roundies.addRule('#panier_content .abonnement_panier h4', '0 15px 0 0');
	DD_roundies.addRule('#panier_content .abonnement_panier div.bas_box', '0 0 15px 15px');
	DD_roundies.addRule('#recette_content .title', '0 15px 0 0');
	DD_roundies.addRule('#recette_content .content_recette', '0 0 15px 15px');
	DD_roundies.addRule('#bruits_plaine_content .descriptif_title', '0 20px 20px 20px');
	DD_roundies.addRule('#bruits_plaine_content p.date_redac', '0 15px 0 0');
	DD_roundies.addRule('#bruits_plaine_content .content_bruits_plaine', '0 0 15px 15px');
	DD_roundies.addRule('#producteur_content .descriptif_title', '0 20px 20px 20px');
	DD_roundies.addRule('#producteur_content .title', '0 15px 0 0');
	DD_roundies.addRule('#producteur_content .content-producteur', '0 0 15px 15px');
	*/
	
});

function affiche_mois (celule, value){
	if( $(celule).html() =="" ){
		$(celule).html(value);
	}else{
		$(celule).html('');
	}
}

function change_line(line){
	var i = 1;
	var month = new Array(null,'Avril','Mai','Juin','Juillet','Août','Sept.','Oct.','Nov.','Déc.','Janvier','Février','Mars');
	if($('#'+line.id+' div.legume').attr('class') == "legume" ){
		$('#'+line.id+' div.legume').attr('class','legume_on');
	}else{
		$('#'+line.id+' div.legume_on').attr('class','legume');
	}
	
	$('#'+line.id+' div div').each(function() {
		if($(this).attr('class').indexOf('_hover') < 0 ){
			$(this).attr('class',$(this).attr('class')+'_hover');
		}else {
			$(this).attr('class',$(this).attr('class').replace('_hover', ''));
		}
		i++;
	});
	i = 1;
	$('#'+line.id+' div p').each(function() {
		if($(this).attr('class').indexOf('_hover') < 0 ){
			$(this).attr('class',$(this).attr('class')+'_hover');
			$(this).html(month[i]);
		}else {
			$(this).attr('class',$(this).attr('class').replace('_hover', ''));
			$(this).html('');
		}
		i++;
	})
}


$(function() {
	jQuery('.plan').click(function (e) {
		jQuery.modal('<iframe width="600" height="356" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?msa=0&amp;hl=fr&amp;doflg=ptm&amp;ie=UTF8&amp;msid=206432301463845653954.00049bf171c9285b9e090&amp;ll=49.023236,2.080193&amp;spn=0.00985,0.018239&amp;z=15&amp;output=embed"></iframe>');
		return false;
	});
	jQuery('.plan2').click(function (e) {
		jQuery.modal('<iframe width="600" height="356" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?hl=fr&amp;ie=UTF8&amp;ll=48.98861,2.261424&amp;spn=0.009857,0.018239&amp;z=15&amp;output=embed"></iframe>');
		return false;
	});
});
