
/*  _____________________________________________
   |  NOUS JOINDRE - Validation du formulaire 
	 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ */
function send(form) {
	// check for email et autres
	if (checkMrEmail(form) && 
		checkMrEmptyFields(form, [
		 	{field:'prenom', msg:'Prénom est un champ obligatoire.'},
			{field:'nom', msg:'Nom est un champ obligatoire.'},
			{field:'email', msg:'Adresse courriel est un champ obligatoire.'},
		  {field:'message', msg:'Message est un champ obligatoire.'}])){
		form.submit();
	}
	
	return false;
} 
	 


/*  _____________________________________________
   |  FORMULAIRE - Validation du formulaire 
	 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ */
function sendFormulaire(form) {
	// check for email et autres
	if ( checkMrEmptyFields(form, [
		 	{field:'prenom', msg:'Prénom est un champ obligatoire.'},
			{field:'nom', msg:'Nom est un champ obligatoire.'},
			{field:'courriel', msg:'Adresse courriel est un champ obligatoire.'}])){
		if ( false == checkMrEmailsPlus(form, [
		                               {field:'courriel', msg:'Le format du courriel est incorrect. Il doit suivre le format suivant [texte]@[texte].[xxx]'}
		                              ] ) ) {
			
			return false;
		}
		if ( checkMrFileLabelExtension(form,[{field:'upload_photo1', label : "Le format des photos est incorrect."},
		                                     {field:'upload_photo2', label : "Le format des photos est incorrect."},
		                                     {field:'upload_photo3', label : "Le format des photos est incorrect."}
		                                     ] , [{ext : 'png'},
		                                          {ext : 'bmp'},
		                                          {ext : 'gif'},
		                                          {ext : 'jpg'},
		                                          {ext : 'jpeg'},
		                                          {ext : 'tif'},
		                                          {ext : 'eps'},
		                                          {ext : 'psd'},
		                                          {ext : 'emf'}]) == false )  {
			return false;
		}
		if ( checkMrFileLabelExtension(form,[{field:'upload_zip1', label : "Le format de la video est incorrect."}
				                                ] , [{ext : 'wmv'},
				                                     {ext : 'mpg'},
				                                     {ext : 'mpeg'},
				                                     {ext : 'avi'},
				                                     {ext : 'mov'},
				                                     {ext : 'ogg'},
				                                     {ext : 'flv'},
				                                     {ext : 'wma'}]) == false )  {
					return false;
		}
		if ( form.ConditionUtilisation.checked == false ) {
			alert("Veuillez accepter les conditions d\'utilisation");
			return false;
		}
		form.submit();
	}
	
	return false;
} 
	 
	 
/*  _____________________________________________
   |  ÉQUIPE - Changer la bio 
	 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ */
function afficherBio(bio) {	
	
	if(document.getElementById('fleche_'+bio).className=="actif"){
		document.getElementById('fleche_'+bio).className = "";
		document.getElementById(bio).style.display = "none";
	}
	else{
		for (var x=1;x<=7;x++)
		{
			document.getElementById('fleche_bio'+x).className = "";
			document.getElementById('bio'+x).style.display = "none";
		}
		document.getElementById(bio).style.display = "block";
		document.getElementById('fleche_'+bio).className = "actif";
	}
	
}


/*  _____________________________________________
   |  MON CARNET PERSO - Afficher les signets 
	 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ */
function afficherListe(liste) {	
	
	if(document.getElementById('fleche_'+liste).className=="actif"){
		document.getElementById('fleche_'+liste).className = "";
		document.getElementById(liste).style.display = "none";
	}
	else{
		//for (var x=1;x<=6;x++)
		//{
			//document.getElementById('fleche_liste'+x).className = "";
			//document.getElementById('liste'+x).style.display = "none";
		//}
		document.getElementById(liste).style.display = "block";
		document.getElementById('fleche_'+liste).className = "actif";
	}
	
}


/*  _____________________________________________
   |  MON CARNET PERSO - Affiche la liste d'épicerie
	 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ */
function listeDepicerie() {

	var items = document.getElementById('liste').item;
	 
	var liste = '';
	for (i=0; i< items.length; ++i) {
		if (items[i].checked) {
		    liste += escape(items[i].value)+',';
		}
	}

	if (liste == '') {
		alert('Vous devez sélectionner au moins un élément.');
	} else {
		window.open('listedepicerie_popup.html?'+liste.substr(0,(liste.length-1)), 'toutsimplementclodine_listedepicerie', 'scrollbars=yes,width=529,height=550,top=200,left=200' );
	}
	
	return false;
}


/*  _____________________________________________
   |  MAISON - Changer Vidéo 
	 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ */
$().ready( function() {	
	showTabs = true; // pour avoir le tab

	// Season id
	$('#menu_videos li a').each( function (index) {
		$(this).bind('click', function() {
			$("#menu_videos a").removeClass("over");
			$(this).addClass("over");
			
			var nom = $(this).attr('id');
			if(nom=="cuisine"){
				document.getElementById('lien_maison').style.display = "none";
				document.getElementById('lien_cuisine').style.display = "block";
			}
			else {
				document.getElementById('lien_cuisine').style.display = "none";
				document.getElementById('lien_maison').style.display = "block";
			}
	
			loadPlaylists(playlists[$(this).attr('id')], true, 'left');
			return false;
		});
	});
});

var playlists = {
	cuisine: [35974526001],
	maison: [36067537001]
};


/*  _____________________________________________
   |  CUISINE - Changer le thème 
	 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ */
function changerThemes(theme) {

		var bloc = new Array("nouveautes","rubriques","categories","top");
		
		for (var x=0;x<=3;x++)
		{
			document.getElementById('lien_'+bloc[x]).className = "";
			document.getElementById(bloc[x]).style.display = "none";
		}
		document.getElementById(theme).style.display = "block";
		document.getElementById('lien_'+theme).className = "over";

}


/*  _____________________________________________
   |  CUISINE - Imprimer une recette 
	 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ */
function imprimeRecette(url) {
	var fenetre = window.open(url, 'toutsimplementclodine_chroniqueur', 'scrollbars=yes,width=705,height=700,top=200,left=200' );
}


/*  _____________________________________________
   |  POPUP - Ouvrir une fenêtre en popup 
	 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ */
function ouvrirFenetre(nom,url,largeur,hauteur) {
	var fenetre = window.open(url, nom,"width=" + largeur + ",height=" + hauteur + ",resizable=no,scrollbars=yes,toolbar=no,status=no,location=no,directories=no");
}


/*  _____________________________________________
   |  CARNET D'ADRESSES - Changer l'année 
	 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ */
var dataComboDate = new Array();

function changeDateCombo(combo,value) {
	combo.length = 0;
	
	if (value != '') {
		new_element = new Option('Sélectionner une date', '');
		combo.options[combo.length] = new_element;

		for (i=0; i<dataComboDate[value].length; i=i+2) {
				new_element = new Option(dataComboDate[value][i+1], dataComboDate[value][i]);
				combo.options[combo.length] = new_element;
		}
		combo.style.display = 'inline';
		document.getElementById('texte_annee').style.display = 'none';
	} else {
		combo.style.display = 'none';
		document.getElementById('texte_annee').style.display = 'inline';
	}
}
