function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) 
		x=document.getElementById(n); 
	return x;
}

function afficherOuiNon(msg,page) {
	var result = confirm(msg);
	if ( result == true )
		document.location.href = page;
}

function setTitlePage(str) {
	if ( str != "" ) {
		if ( window.top != null ) {
			winref = window.top.document;
		}
		else {
			winref = window.document;
		}
		winref.title = str;
	}
}


function MM_validateForm() { 
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-3); i+=4) {
		test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { 
			nm = args[i+3]; 
			if ((val=val.value)!="") {
      	if (test.indexOf('isEmail')!=-1) {
					p=val.indexOf('@');
        	if (p<1 || p==(val.length-1)) 
						errors+='- '+nm+' doit être une adresse mail valide.\n';
      	} 
				else if (test!='R') {
        	if (test.indexOf('inRange') != -1) {
						p=test.indexOf(':');
						//alert(val.charAt(0)+" "+val.length);
						if ( ( val.charAt(0) == '0' ) && ( val.length == 2 ) ) {
							val = parseFloat(val.substring(1,2));
							//alert(val);
						}
						if ( p < 0 ) {
							if (isNaN(val)) 
								errors+='- '+nm+' doit être une valeur numérique.\n';	
						}	else {
          		min=test.substring(8,p); 
							max=test.substring(p+1);
          		if ( val < min || max < val ) {
								//alert(val);
								errors+='- '+nm+' doit être une valeur numérique comprise entre '+min+' et '+max+'.\n';
							}
						}
    			}
				}
		 } 
		 else if (test.charAt(0) == 'R') 
		 	errors += '- '+nm+' est obligatoire.\n'; }
  } 
	if (errors) 
		alert('Les erreurs suivantes sont apparues : \n'+errors);
  document.MM_returnValue = (errors == '');
	return document.MM_returnValue;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}