// Code JavaScript

/* variables globales */
var affiche = false; 		// flag de detection de l'affichage
var flag_Contenu = false; 		// flag de detection de l'affichage des Contenu


/* CAFE NOIR Affiche les Contenus */
function Inint_AJAX() {
   try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
   try { return new XMLHttpRequest();          } catch(e) {} //Native Javascript
   alert("XMLHttpRequest not supported");
   return null;
};

function afficherMasquer()
/* change la classe CSS des objets donn&eacute;s en param&egrave;tres. Syntaxe :
afficherMasquer('id_div1','afficher','id_div2','masquer','id_div3','masquer',...) */
{ 
   var args=afficherMasquer.arguments;
   var action, objet, css;
   
   // on parcours tous les arguments de la fonction
   for(var i=0; i<(args.length-1); i+=2)
   {
      if((objet=document.getElementById(args[i]))!=null)
      {
         action=args[i+1];
         switch(action)
         {
            /* la valeur de "css" est &agrave; remplacer avec les noms des classes
            utilis&eacute;es dans la feuille de style */
            case 'afficher':
            case '1':
               css='apparent';
               break;
               
            case 'afficherSOUS':
            case '1':
               css='apparentSOUS';
               break;


            case 'masquer':
            case '0':
            default:
               css='cache';
         }
         
         objet.className=css;
      }
   }
}


// Affichage FORMULAIRE
function afficherFORMULAIRE()
/* change CSS class of objects Syntax :
afficherFORMULAIRE('id_div1','afficher','id_div2','masquer','id_div3','masquer',...) */
{ 
   var args=afficherFORMULAIRE.arguments;
   var action, objet, css;
   
   // we browse all the args of the function
   for(var i=0; i<(args.length-1); i+=2)
   {
      if((objet=document.getElementById(args[i]))!=null)
      {
         action=args[i+1];
         switch(action)
         {
            /* "css" value must be replaced by class name
            used in the CSS sheet */
            case 'afficher':
            case '1':
               css='apparentFORM';
               break;
               
            case 'masquer':
            case '0':
            default:
               css='cache';
         }
         
         objet.className=css;
      }
   }
}
// Affichage FORM opaque
function afficherFORMopaque()
/* change CSS class of objects Syntax :
afficherFORMULAIRE('id_div1','afficher','id_div2','masquer','id_div3','masquer',...) */
{ 
   var args=afficherFORMopaque.arguments;
   var action, objet, css;
   
   // we browse all the args of the function
   for(var i=0; i<(args.length-1); i+=2)
   {
      if((objet=document.getElementById(args[i]))!=null)
      {
         action=args[i+1];
         switch(action)
         {
            /* "css" value must be replaced by class name
            used in the CSS sheet */
            case 'afficher':
            case '1':
               css='apparentOPAQ';
               break;
               
            case 'masquer':
            case '0':
            default:
               css='cache';
         }
         
         objet.className=css;
      }
   }
}



/* Efface le texte par defaut d'un input Recherche */
function clean(element) {
	if(element.value == "Rechercher dans l'annuaire") element.value = "";
}

/* Efface le texte par defaut d'un input Recherche dans le site */
function cleanSITE(element) {
	if(element.value == "Rechercher dans le site") element.value = "";
}

/* Efface le texte par defaut d'un input Rechercher */
function cleanANUA(element) {
	if(element.value == "Rechercher") element.value = "";
}

/* Efface le texte par defaut d'un input NOTE */
function cleanNOTE(element) {
	if(element.value == "Vos commentaires ici ...") element.value = "";
}

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

//      <![CDATA[
            var images = new Array (8);
            images[0] = "http://www.plaisirs-gourmands.com/Presentation-concept-Plaisirs-Gourmands-WEB.html_files/Presentation-concept-Plaisirs-Gourmands-WEB.001.png";
            images[1] = "http://www.plaisirs-gourmands.com/Presentation-concept-Plaisirs-Gourmands-WEB.html_files/Presentation-concept-Plaisirs-Gourmands-WEB.002.png";
            images[2] = "http://www.plaisirs-gourmands.com/Presentation-concept-Plaisirs-Gourmands-WEB.html_files/Presentation-concept-Plaisirs-Gourmands-WEB.003.png";
            images[3] = "http://www.plaisirs-gourmands.com/Presentation-concept-Plaisirs-Gourmands-WEB.html_files/Presentation-concept-Plaisirs-Gourmands-WEB.004.png";
            images[4] = "http://www.plaisirs-gourmands.com/Presentation-concept-Plaisirs-Gourmands-WEB.html_files/Presentation-concept-Plaisirs-Gourmands-WEB.005.png";
            images[5] = "http://www.plaisirs-gourmands.com/Presentation-concept-Plaisirs-Gourmands-WEB.html_files/Presentation-concept-Plaisirs-Gourmands-WEB.006.png";
            images[6] = "http://www.plaisirs-gourmands.com/Presentation-concept-Plaisirs-Gourmands-WEB.html_files/Presentation-concept-Plaisirs-Gourmands-WEB.007.png";
            images[7] = "http://www.plaisirs-gourmands.com/Presentation-concept-Plaisirs-Gourmands-WEB.html_files/Presentation-concept-Plaisirs-Gourmands-WEB.008.png";
            var index = 0;
            function WindowLoaded(evt)
            {
                document.body.onselectstart = function () { return false; };
            }
            function Step(i)
            {
                GoTo(index + i)
            }
            function GoTo(newIndex)
            {
                if(newIndex >= 0 && newIndex < images.length)
                {
                    index = newIndex;
                    document.Slideshow.src = images[index];
                }
            }
//      ]]>