
/*  Le Phare JavaScript library - (c) 2007
/*--------------------------------------------------------------------------*/

Event.handler = {
   register: function(element) {
      if($(element)) {
         switch (element) {

            case 's05p01':
               fS05P01();
            break;
            case 's05p06':
               fs05p06();
            break;
            case 's14p02':
               S14P02(); // dans s14p02.js
            break;
            case 'corporate':
               initformParrainage();
            break;
            case 's21p01': // rech. recette
                  get_fS21p01Cla();

                  Event.observe('fS21p01Av', 'submit', function(e) {
                        $('todoAv').value='Av';
                        data_request_uri = new Array;
                        request_uri = '';
                        // Gestion de la difficulté 
                        data_array = new Array;
                        $$('.jsDiff').each(function(obj){
                           if(obj.checked)                           
                              data_array.push(obj.value);     
                        });
                        if(data_array.length>0)
                           data_request_uri.push('D-'+data_array.join('-'));
                        // gestion du temps total
                        if($('av_temps_total_').value!='')
                           data_request_uri.push('TT-'+$('av_temps_total_').value);
                        if($('av_temps_prepa_').value!='')
                           data_request_uri.push('TP-'+$('av_temps_prepa_').value);                        
                        // Gestion des type de plat
                        data_array = new Array;
                        $$('.jsTypePlat').each(function(obj){
                           if(obj.checked)                           
                              data_array.push(obj.value);     
                        });
                        if(data_array.length>0)
                           data_request_uri.push('P-'+data_array.join('-'));
                        // gestion du budget   
                        data_array = new Array;
                        $$('.jsBudget').each(function(obj){
                           if(obj.checked)                           
                              data_array.push(obj.value);     
                        });
                        if(data_array.length>0)
                           data_request_uri.push('B-'+data_array.join('-'));
                           
                        request_uri = data_request_uri.join('_');
                        $('fS21p01Av').action = '/recettes/cuisine/MesRecettes-'+no_accent(request_uri)+'.html';

                        //Event.stop(e);
                  });
                break;

            case 's22p01':
               Event.observe('printIngredients', 'click', function() {window.open('/fr/s22_ep_lst_course/s22p02_print_carnet_ingredients.php', 'MaListeDeCourses', 'menubar=yes,status=no,scrollbar=auto,width=550,height=600'); });
               Event.observe('addIngredients', 'click', function() {$('ajouterIngredient').toggle();});
               initAddIngredient();
               break;

            case 's23p01': // auth espace perso
               fs23p01();
            break;
            case 's23p03': // auth espace perso
               Event.observe('jsButtonOk','click',function(){
                  if($('jsMonBr').value!='' && $('jsMonBr').value!=0)
                  {
                     var br = $('jsMonBr').value;
                     window.open('../s23_ep_inscription/s23p05_pdf.php?id='+br);
                     $('jsConfirm').hide();
                     $('jsMonBr').value='';
                     $('jsBtnBonReduc_'+br).hide();
                  }  
               });
            break;            
            case 's23p02': // cre cpte espace perso
               fs23p02();
            break;

            
            case 's24p01': // rech. recette
                  get_fS21p01Cla();
                break;

            case 's24p02':
               fS24P02();
               break;

            case 'accueil': // recherche               
                  if($('fS01p01Sim')){
                     Event.observe('fS01p01Sim', 'submit', function() {$('todoSim').value='Sim';});
                  }
                  fs01p01();
                  
                  Event.observe('clicLostPassword','click',function(){Effect.BlindDown('lostPassword');Effect.BlindUp('login');});
                  Event.observe('ClickLogin','click',function(){Effect.BlindDown('login');Effect.BlindUp('lostPassword');});
                  monCarrousel({id : 'wrapper'});
                break;

            case 's21p03': // fiche recette

               sendToFriend(false);
               addCarnetRecette();
               addListeIngredients();
//                              loadTooltip(); // affiche l'info-bulle ardoise conseil
               //manageAccesEspacePerso();
                break;

            case 's26p02': // fiche recette
               //loadTooltip(); // affiche l'info-bulle ardoise conseil
               sendToFriend(true); // envoi de la recette à un ami
               addCarnetRecette();
               addListeIngredients();
               //manageAccesEspacePerso();
                break;

            case 'catalogue':
                loadTooltip();
                break;

            case 'recettes':
               //loadTooltip(); // affiche l'info-bulle ardoise conseil
               sendToFriend(false); // envoi de la recette à un ami
            break;
            case 'accueilJeu':
               initformJeux_USER();
            break;
            case 's19p02':

               initformJeux_PLAY();
                           
            break;
            case 'JeuAvent':
            case 's19p03':
               initformJeux_USER();
            break;
            case 'petitsChefs':
               initPetitChef();
            break;
            case 's04p01':
               fs04p01();
            break;
            case 'corporateInratables':
            (function($){
               $('#slider1').slideshow({timer: 4});
            })(jQuery);

                  var ZeFormDeja = new Validation('ZeFormDeja', {
                                       onSubmit:true,
                                       useTitles:true,
                                       stopOnFirst:true,
                                       onFormValidate: function() {$('todoDeja').value = 'connecting';}
                                 });
                                       
                  var ZeFormPas = new Validation('ZeFormPas', {
                                       onSubmit:true,
                                       useTitles:true,
                                       stopOnFirst:true,
                                       onFormValidate: function() {$('todoPas').value = 'submit_quest';}
                                 });                

            Event.observe('btnDejaCoinPerso','click',function(){$('formDeja').show();$('formPas').hide();});
            Event.observe('btnPasCoinPerso','click',function(){$('formPas').show();$('formDeja').hide();});
            break; 
         }
      }
   } // register
}

// load
Event.observe(window, 'load', function() {

      if(document.body.id) Event.handler.register(document.body.id);
      if($('fS01p01Sim2'))
         Event.observe('fS01p01Sim2', 'submit', function() {
         var  reg=new  RegExp("[ /',-:!?]+", "g");
         
         $('sim2').value = $('sim2').value.split(reg).join('-');
         $('fS01p01Sim2').action = '/recettes/cuisine/'+no_accent($('sim2').value)+'.html';
         $('todoSim2').value='Sim';
         }); // formulaire de recherche dans la nav
});
function in_array (needle, haystack, argStrict) {
    // Checks if the given value exists in the array  
    // 
    // version: 1102.614
    // discuss at: http://phpjs.org/functions/in_array    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: vlado houba
    // +   input by: Billy
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);    // *     returns 1: true
    // *     example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'});
    // *     returns 2: false
    // *     example 3: in_array(1, ['1', '2', '3']);
    // *     returns 3: true    // *     example 3: in_array(1, ['1', '2', '3'], false);
    // *     returns 3: true
    // *     example 4: in_array(1, ['1', '2', '3'], true);
    // *     returns 4: false
    var  key      = '',        
         strict   = !! argStrict;
 
    if (strict) {
        for (key in haystack) {
            if (haystack[key] === needle) {                return true;
            }
        }
    } else {
        for (key in haystack) {            if (haystack[key] == needle) {
                return true;
            }
        }
    } 
    return false;
}
function trim (str, charlist) {
    // Strips whitespace from the beginning and end of a string  
    // 
    // version: 1107.2516
    // discuss at: http://phpjs.org/functions/trim    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: mdsjack (http://www.mdsjack.bo.it)
    // +   improved by: Alexander Ermolaev (http://snippets.dzone.com/user/AlexanderErmolaev)
    // +      input by: Erkekjetter
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)    // +      input by: DxGx
    // +   improved by: Steven Levithan (http://blog.stevenlevithan.com)
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // *     example 1: trim('    Kevin van Zonneveld    ');    // *     returns 1: 'Kevin van Zonneveld'
    // *     example 2: trim('Hello World', 'Hdle');
    // *     returns 2: 'o Wor'
    // *     example 3: trim(16, 1);
    // *     returns 3: 6    var whitespace, l = 0,
        i = 0;
    str += '';
 
    if (!charlist) {        // default list
        whitespace = " \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000";
    } else {
        // preg_quote custom list
        charlist += '';        whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1');
    }
 
    l = str.length;
    for (i = 0; i < l; i++) {        if (whitespace.indexOf(str.charAt(i)) === -1) {
            str = str.substring(i);
            break;
        }
    } 
    l = str.length;
    for (i = l - 1; i >= 0; i--) {
        if (whitespace.indexOf(str.charAt(i)) === -1) {
            str = str.substring(0, i + 1);            break;
        }
    }
 
    return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';}
function gest_visitor_Code(){
              

}

	function no_accent (my_string) {
		var new_string = "";
		var pattern_accent          = new Array("'","é", "è", "ê", "ë", "ç", "à", "â", "ä", "î", "ï", "ù", "ô", "ó", "ö", " ", "-&-");
		var pattern_replace_accent  = new Array("-","e", "e", "e", "e", "c", "a", "a", "a", "i", "i", "u", "o", "o", "o", "-","Et");
		if (my_string && my_string!= "") {
			new_string = preg_replace(pattern_accent, pattern_replace_accent, my_string);
		}

      return new_string;
		
	}  

	function preg_replace (array_pattern, array_pattern_replace, my_string)  {
	var new_string = String (my_string);
		for (i=0; i<array_pattern.length; i++) {
			var reg_exp= RegExp(array_pattern[i], "gi");
			var val_to_replace = array_pattern_replace[i];
			new_string = new_string.replace (reg_exp, val_to_replace);
		}
		return new_string;
	}
	
	
var monCarrousel = function (opts){
     var id    = 'wrapper',
         timer = 4,
         cur   = 1,
         rewind = function(){
            cur = 1; 
         },
         count  = $$('#'+id+' a').each(
                                       function(obj){
                                             obj.id = 'jsTop_'+ cur;         
                                             cur++;
                                       }).length, 
                 
         show = function(idx){
             var current = 'jsTop_' + cur,
                 index   = 'jsTop_' + idx;
                   
             FadeEffect(current);
                $(current).setStyle({'z-index' : '1'});
             $('bulletNum').update(idx + ' : ');                
             $(index).setStyle({'z-index' : '2'});
             ShowEffect(index);
             $('jsTitreRecette').update($(index).title);
             $('jsTitreRecette').href = $(index).href; 
             $(current).hide();
             cur = idx;
             
         },
         FadeEffect = function(element){
      
            new Effect.Fade(element, { duration: 1, from:1.0, to:0.0});
         },
         ShowEffect = function(element){
            new Effect.Appear(element, {duration:1, from:0.0, to:1.0});
         },
         slideshow  = function() {
                           var idx = cur + 1;
        
                           if (idx > count) idx = 1;
                           show(idx);
                },
         prev = function(){
               var idx = cur - 1;
     
               if (idx == 0) idx = count;
               show(idx);
               if (timer!=0) {
                     clearInterval(interval);
                     interval = setInterval(slideshow, timer * 1000);
               }                  
         },
         next =function(){
                  slideshow();
                  if (timer!=0) {
                     clearInterval(interval);
                     interval = setInterval(slideshow, timer * 1000);
                  }
         }
                         
         
         rewind();      

         if (timer!=0) {
            var interval = setInterval(slideshow, timer * 1000);
         }
             
         Event.observe('jsBtnPrev','click',prev);
         Event.observe('jsBtnNext','click',next);
         
}	
 function get_fS21p01Cla()
 {
    Event.observe('fS21p01Cla', 'submit', function(event) {

         // on trim les champs
         $('cla_recette_').value = trim($F('cla_recette_'));
         $('cla_ingredients_').value = trim($F('cla_ingredients_'));
         
         if($F('cla_ingredients_')!='')
            request_uri = $F('cla_recette_')+'_ingredient_'+$F('cla_ingredients_');
         else
            request_uri = $F('cla_recette_');   
         
         // on vérifie si les champs ne sont pas vides et on un mot clé de plus de 3 lettres
         // sinon on affiche un petit message d'avertissement
         if($F('cla_recette_').empty() && $F('cla_ingredients_').empty())
            {
                  $('err_msg').show();
                  Effect.BlindUp('err_msg', {delay:3});
                  Event.stop(event);
           }
           else if($F('cla_recette_').length <= 3  && (!$F('cla_recette_').empty()) || $F('cla_ingredients_').length <=3 && (!$F('cla_ingredients_').empty()))
            {
                  $('err_msg').show();
                  Effect.BlindUp('err_msg', {delay:3});
                  Event.stop(event);
            }
            
         $('fS21p01Cla').action = '/recettes/cuisine/recette-'+no_accent(request_uri)+'_type_classic.html';
         $('todoCla').value='Cla';
   });
 }
 
// extends check event
var CheckBoxChecker = {

   check: function(element){
      element = $(element);
      typeElement = element.readAttribute('type');
      if(typeElement == 'checkbox') {
         element.checked = true;
      }
   },

   uncheck: function(element){
      element = $(element);
      typeElement = element.readAttribute('type');
      if(typeElement == 'checkbox') {
         element.checked = false;
      }
   }
}

Element.addMethods(CheckBoxChecker);


/*********************/

function fS05P01() {
   var fDemInfos = new Validation('fDemInfos', {
      useTitles:true,
      stopOnFirst:true,
      onFormValidate: function() {
         $('todoS05P01').value = "submit_quest";
      }
   });

   if($('searchSubmitter')) {
      Event.observe('searchSubmitter', 'click', function() {$('searchTodo').value = "email-subscribe"; $('searchEmailForm').submit();});
   }

   if($('errMsg') && $('errMsg').innerHTML  != '') {
      Element.show('errMsg'); Effect.BlindUp('errMsg', {delay:3});
   }
   
   if($('jsAbonnementComptePerso'))
   {
      Event.observe('jsAbonnementComptePerso','click',function(obj){

            $('password').toggle();
      });
   }
}
function fs01p01()
{
   if($('jsBtnFermer'))
   {// si le bouton jsBtnFermer exist on applique dessus le hide promis !
      Event.observe('jsBtnFermer','click',function(){$('bienvenue').hide();});
      
   }
   

   $$('input[type=text], input[type=password]').each(function(inputVisitor)
   {
      Event.observe(inputVisitor,'click',function(){
         if(inputVisitor.value==inputVisitor.title)
         {
            inputVisitor.value = '';
         }
      
      });
      Event.observe(inputVisitor,'blur',function(){
         if(inputVisitor.value=='')
         {
            inputVisitor.value = inputVisitor.title;
         }
      
      });
      
   });
}

function Open_jeu_table_jeu()
{

      var mylightWindow2 = null;
      if (!mylightWindow2) {
          var elem = $('mylinkID2');
          mylightWindow2 = new lightwindow();
      }
      mylightWindow2.activateWindow({
      	href: '/fr/s19_jeuxN2/s19p00_iframe.php',// 
      	title: 'Gagnez votre table de fête', 
      	width: 670,
      	height: 470
      });
}

function fs23p01() {
   var fs23p01 = new Validation('fLogin', {
         useTitles:true,
         stopOnFirst:true,
         onFormValidate: function() {
            $('todoLogin').value = "login";
         }
   });

   var fs23p01lost = new Validation('fLostPassword', {
         useTitles:true,
         stopOnFirst:true,
         onFormValidate: function() {
            $('todoLostPassword').value = "search_password";
         }
   });

   if($('errMsg') && $('errMsg').innerHTML  != '') {
      Element.show('errMsg'); Effect.BlindUp('errMsg', {delay:3});
   }
}
function fs04p01(){
      var zeForm = new Validation('ZeForm', {
                                       onSubmit:true,
                                       useTitles:true,
                                       stopOnFirst:true,
                                       onFormValidate: function() {$('todo').value = 'submit_quest';}
                                 });
}
function fs05p06(){
      var zeForm = new Validation('zeFormEnvoyerAmi', {
                                       onSubmit:false,
                                       useTitles:true,
                                       stopOnFirst:true,
                                       onFormValidate: function() {$('todoSendToFriend').value = 'submit_quest';}
                                    });

   if($('sendToFriend'))
   {
      Event.observe('sendToFriend', 'click', function() {
         if(zeForm.validate()) {
            var params =  $('zeFormEnvoyerAmi').serialize();
            new Ajax.Request('/fr/s05_newsletter/_sendToFriendGreetings.php', { method: 'post', evalJS:true, parameters: params, onSuccess: function(transport) {
                                       $('envoyer').hide();
                                       $('jsMsgReponseEnvoyerAmi').update(transport.responseText);
                                       $('jsReponseEnvoyerAmi').show();
                                    }
                                 });
            }
      });
   }                                    
}
function fs23p02() {
   var fS23P02 = new Validation('fS23P02', {
      useTitles:true,
      stopOnFirst:true,
      onFormValidate: function() {
         $('todoS23P02').value = "submit_quest";
      }
   });
   
   Validation.addAllThese([
      ['validate-conf-email', 'Confirmation incorrecte.',
      function(v,elt) {
         var ret = (v == $F('visitor_email_'));
         return (ret);
      }],
      ['validate-conf-pwd', 'Confirmation incorrecte.',
      function(v,elt) {
         var ret = (v == $F('visitor_password_'));
         return (ret);
      }]
   ]);


   if($('errMsg') && $('errMsg').innerHTML  != '') {
      Element.show('errMsg'); Effect.BlindUp('errMsg', {delay:3});
   }      
}
// fonction pour les bon de reduction
function fs23p03(br)
{
      if(confirm('<a href="www.google.com">Vous êtes sur</a> le point d\'imprimer votre bon de réduction. Vous ne pouvez en imprimer qu\'un !\n\r Attention, la génération du bon de réduction peut prendre quelques minutes.'))
      {
         window.open('../s23_ep_inscription/s23p05_pdf.php?id='+br);      
         $('jsBtnBonReduc_'+br).hide();
      }
      else
         return false;
}

function openConfirmation(br)
{

   var h = $('jsConfirm').getHeight(),
      l  = $('jsConfirm').getWidth(), 
   PosX  = ( screen.availHeight - h ) / 2, 
   PosY  = ( screen.availWidth - l ) / 2;    
   
   positionScroll = Array((document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft,(document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop);
                  
   $('jsConfirm').setStyle({
      left: positionScroll[0]+PosY+'px',
      top: positionScroll[1]+PosX+'px' 
   });
   $('jsMonBr').value=br;
   $('jsConfirm').show();
   
}
// charge la page de liste des recettes
function goToPage(formId, page){
   $(formId +'_pg_cur').value = page;
   $(formId).submit();
}

   //console.log($('fS21p01'+form));
   //$('fS21p01'+form).submit();
// trim en javascript
function trim (myString)
{
   return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
}


// affiche l'info-bulle ardoise conseil
function loadTooltip() {
  if($('ardoiseConseil')) new Tooltip('ardoiseConseil', {opacity: 1, backgroundColor: "#FC9", borderColor: "#C96", textColor: "#000", textShadowColor: "#FFF"});
 }


// envoie la recette à un ami
function sendToFriend(petitChef) {

   var todo = (petitChef==true) ? "submit_quest_petit_chef" : "submit_quest";

   if($('jsLienEnvoyerAmie'))
   {
      // formulaire d'envoi
      Event.observe('jsLienEnvoyerAmie', 'click', function() {$('envoyer').toggle();});

      var zeForm = new Validation('zeFormEnvoyerAmi', {
                                       onSubmit:false,
                                       useTitles:true,
                                       stopOnFirst:true,
                                       onFormValidate: function() {$('todoSendToFriend').value = todo;}
                                    });
   }

   if($('sendToFriend'))
   {
      Event.observe('sendToFriend', 'click', function() {
         if(zeForm.validate()) {
            var params =  $('zeFormEnvoyerAmi').serialize();
            new Ajax.Request('/fr/s05_newsletter/_sendToFriend.php', { method: 'post', evalJS:true, parameters: params, onSuccess: function(transport) {
                                       $('envoyer').hide();
                                       $('jsMsgReponseEnvoyerAmi').update(transport.responseText);
                                       $('jsReponseEnvoyerAmi').show();
                                    }
                                 });
            }
      });
   }
}

/*
function manageAccesEspacePerso() {
   if($('userNotLogged'))
   {
      if($F('userNotLogged') == '1') {
         Event.observe('jsCreateEspacePerso', 'click', function() {
               $('zeFormEspacePerso').action='/fr/s23_ep_inscription/s23p02_creer_mon_compte.php';
               $('zeFormEspacePerso').submit();
         });

         Event.observe('jsConnectEspacePerso', 'click', function() {
               $('zeFormEspacePerso').action='/fr/s23_ep_inscription/s23p01_identification.php';
               //alert($('zeFormEspacePerso'));
               //$('zeFormEspacePerso').submit();
               var myF = document.getElementById('zeFormEspacePerso');
               myF.submit();
         });

      }
   }
}
*/


// Ajout de la liste des ingrédients
function addListeIngredients() {

   if($('jsListeIngredients'))
   {
      if($F('userNotLogged') == '1')
      {
         // formulaire d'envoi
         Event.observe('jsListeIngredients', 'click', function() {
            $('accesEspacePerso').toggle();
         });
      }
      else
      {
         // formulaire d'envoi
         Event.observe('jsListeIngredients', 'click', function() {$('listeIngredients').toggle();});
         Event.observe('addIngredients', 'click', function() {
            var params =  $('zeFormListeIngredients').serialize();
            new Ajax.Updater('listeIngredients', '/fr/s22_ep_lst_course/_addIngredientsEspacePerso.php', { method: 'post', evalJS:true, parameters: params });
         });
      }
   }
}


// Ajout ingr liste de courses
function checkAllIngredients() {$$('input.jsChkIngredient').invoke('check');}
function uncheckAllIngredients() {$$('input.jsChkIngredient').invoke('uncheck');}

function addCarnetRecette() {

   if($('jsLienCarnetRecette'))
   {
      if($F('userNotLogged') == '1')
      {
         // formulaire d'envoi
         Event.observe('jsLienCarnetRecette', 'click', function() {$('accesEspacePerso').toggle();});
      }
      else
      {
         // formulaire d'envoi
         Event.observe('jsLienCarnetRecette', 'click', function() {$('carnetRecette').toggle();});

         Event.observe('addRecette', 'click', function() {
            var params =  $('zeFormCarnetRecette').serialize();
            new Ajax.Updater('carnetRecette', '/fr/s24_ep_carnet_recettes/_addRecetteEspacePerso.php', { method: 'post', evalJS:true, parameters: params });
         });
      }
   }
}
5
// suppression de la recette du carnet
function deleteRecette(idR) {
   if(confirm('En êtes-vous sûr(e) ?')) {
      $('idRecToDel').value=idR;
      $('fS24p01').submit();
   }
   return false;
}


// appelée dans s05/_confirmation_ami
function sendToFriendAgain() {
   $('jsReponseEnvoyerAmi').hide();
   ['ami_name_', 'ami_firstname_', 'ami_email_'].each(function(s) { $(s).value=''; });
   $('envoyer').show();
}
function initformParrainage()
{
	 if($('zeForm'))
	 {
      var zeForm = new Validation('zeForm', {
            useTitles:true, stopOnFirst:true, onFormValidate: function() {$('todo').value = 'submit_parrainage';}
         });    
    }        
}
function initformJeux_PLAY()
{
      if($('zeForm'))
      {
			var todo = "play";
	
	      var zeForm = new Validation('zeForm', {
	            useTitles:true, stopOnFirst:true, onFormValidate: function() {$('todo').value = todo;}
	         });                          
      }
}

function initformJeux_USER()
{
	if($('zeFormForm'))
	{
		var todo = "submit_quest";
	
	   var zeForm = new Validation('zeFormForm', {
	         useTitles:true, stopOnFirst:true, onFormValidate: function() {$('todo').value = todo; }
	      });
	}        
}
function initAddIngredient()
{
   Event.observe('delIngredients', 'click', function() {
            if(!confirm('En êtes-vous sûr(e)')) return false;
            $('todo_del_ingredient').value = 'del'; 
            $('zeFormListeIngredients').submit();
      
         });
         
   Event.observe('zeFormAjouterIngredient','submit',function(obj)
         {  obj.stop();
            if($F('ingredients_texte_ingredient_')=='') 
            {
               $('advice_texte_ingredient').show();
              
            }
            else 
            { 
               $('todo_add_ingredient').value = 'add';
               $('zeFormAjouterIngredient').submit();
            }
         }); 

   
}

function JeuxFrancine()
{
   if(!myLightWindow2)
   {
       myLightWindow2 = new lightwindow();
   }
   myLightWindow2.activateWindow({
   	href: '/fr/s19_jeuxN8/s19p01_jeu_intro.php',
   	type: "external",
      height: 541,
      width: 522
   });
}

function initPetitChef()
{
   $$('select').each(function(obj){
      Event.observe(obj,'change',function(){
         if(this.value!=0)
            window.location.href='/fr/s26_petits_chefs/s26p02_fiche_recette.php?recette='+this.value;         
      })
   });   
}
