function UTIL_showHideLayers() {
  var i,p,v,obj,args=UTIL_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=UTIL_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='block')?'block':(v='none')?'none':v; }
    obj.display=v; }
}  

function MM_findObj2(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj2(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function retour_message() {
document.formulaire.Submit.value="Veuillez patienter ....";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);}

function MM_validateForm() { //v4.0
  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=MM_findObj2(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') {
        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 (val<min || max<val) 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('Champs non renseignés ou incorrects! ');
  document.MM_returnValue = (errors == '');
}
function UTIL_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=UTIL_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
var tablou=new Array;
tablou[1]="off";
tablou[2]="off";
tablou[3]="off";
tablou[4]="off";
tablou[5]="off";
tablou[6]="off";
tablou[7]="off";
/*tablou[8]="off";
tablou[9]="off";*/

var tablou_ss=new Array;
tablou_ss[1]="off";
tablou_ss[2]="off";
tablou_ss[3]="off";
tablou_ss[4]="off";
tablou_ss[5]="off";
tablou_ss[6]="off";
tablou_ss[7]="off";
/*tablou_ss[8]="off";
tablou_ss[9]="off";
tablou_ss[10]="off";*/

function affiche_menu(n) { 
  var p;
  p='menu_contenu_'+n;
  
  if (tablou[n]=="off") {
  UTIL_showHideLayers('menu_contenu_'+n,'','block');
  tablou[n]="on";
  }
  else{
  UTIL_showHideLayers('menu_contenu_'+n,'','none');
  tablou[n]="off";
  }
}
function affiche_ss_menu(n) { 
  var p;
  p='menu_ss_contenu_'+n;
  
  if (tablou_ss[n]=="off") {
  UTIL_showHideLayers('menu_ss_contenu_'+n,'','block');
  tablou_ss[n]="on";
  }
  else{
  UTIL_showHideLayers('menu_ss_contenu_'+n,'','none');
  tablou_ss[n]="off";
  }
}

function recherche_prod(){
window.location.href="produit.php?id="+document.getElementById('raysearch').options[document.getElementById('raysearch').selectedIndex].value;
}

function and_DIVfc(nb)
{
  var string="";

    for(i=1;i<=nb;i++)
    {
      string += "<tr><td><font size='2' color='#404040'>Nom :</font></td><td><input type='text' id='nom_part"+i+"' name='nom_part"+i+"'></td><td><font size='2' color='#404040'>Pr&eacute;nom :</font></td><td><input type='text' id='prenom_part"+i+"' name='prenom_part"+i+"'></td><td><font size='2' color='#404040'>Date d\'anniversaire :</font></td><td><input type='text' id='date_anniv"+i+"' name='date_anniv"+i+"' size='10'></td></tr>";
    }
    document.getElementById('and_DIV').innerHTML= string;

    for(i=1;i<=nb;i++)
    {
	    	$(function() {
    		$("#date_anniv"+i).datepicker();
            $("#format").value = "mm/dd/yy";
    		$("#format").change(function() { $('#date_anniv'+i).datepicker('option', {dateFormat: $(this).val()}); });
    	});
	}

}