function MM_validateFormDR() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormDR.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(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+' doit contenir une adresse Email valide.\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+' est obligatoire.\n'; }
  }

var testno = a.n_facture.value.substring(0, 3);
var testno2 = a.n_facture.value.substring(3, 8);
if (a.hors_garantie.checked==false) {
if (a.n_facture.value=="") {
errors+='- Numéro de Bon de livraison est obligatoire.\n';
} else if ((a.n_facture.value.length!=8)|| (isNaN(testno2)) || ( (testno!="BLF")&&(testno!="BLA")&&(testno!="blf")&&(testno!="bla") ) ) {
errors+='- Numéro de Bon de livraison invalide.\n';
}
}
  if (errors) { alert('Attention :\n'+errors); }
  document.MM_returnValue = (errors == '');
}
function test_hg() {
if (a.hors_garantie.checked==true) {
HGHIDE.style.display="none";
HGHIDE2.style.display="none";
} else {
HGHIDE.style.display="block";
HGHIDE2.style.display="block";
}

}
function testCI_5() {
var ok = document.getElementById("CI_5ID");
if (a.CI_5.checked) {
ok.style.display="block";
} else {
ok.style.display="none";
}
}
function testCI_6() {
var ok = document.getElementById("CI_6ID");
if (a.CI_6.checked) {
ok.style.display="block";
} else {
ok.style.display="none";
}
}
function test_presse() {

var ok = document.getElementById("autrepresse");

if (a.presseliste.options[a.presseliste.selectedIndex].text=="Autre") {

ok.style.display="block";

} else {

ok.style.display="none";

}

}

function test_moteur() {

var ok = document.getElementById("autremoteur");

if (a.moteurrechercheliste.options[a.moteurrechercheliste.selectedIndex].text=="Autre") {

ok.style.display="block";

} else {

ok.style.display="none";

}

}

function test_secteur() {

var ok = document.getElementById("autresecteur");

if (a.secteur.options[a.secteur.selectedIndex].text=="Autre") {

ok.style.display="block";

} else {

ok.style.display="none";

}

}


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_findObj(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+' doit contenir une adresse Email valide.\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+' est obligatoire.\n'; }

  }



  if (f.cv.value.length==0) { errors +='- Vous devez choisir un CV.\n'; } else {

  aaa=f.cv.value.split(".");

  if ((aaa[1]!="pdf")&&(aaa[1]!="PDF")&&(aaa[1]!="doc")&&(aaa[1]!="DOC")&&(aaa[1]!="rtf")&&(aaa[1]!="RTF")&&(aaa[1]!="txt")&&(aaa[1]!="TXT")) {

   errors += '- Votre CV doit être au format Word ou Wordpad (extension .RTF, .TXT, .DOC, .PDF obligatoire).\n';

   }



  }

  if (f.lm.value.length==0) { errors +='- Vous devez choisir une lettre de motivation.\n'; } else {

  aaa=f.lm.value.split(".");

  if ((aaa[1]!="pdf")&&(aaa[1]!="PDF")&&(aaa[1]!="doc")&&(aaa[1]!="DOC")&&(aaa[1]!="rtf")&&(aaa[1]!="RTF")&&(aaa[1]!="txt")&&(aaa[1]!="TXT")) {

   errors += '- Votre Lettre de motivation doit être au format Word ou Wordpad (extension .RTF, .TXT, .DOC, .PDF obligatoire).\n';

   }



  }



  if (errors) alert('Attention :\n'+errors);

  document.MM_returnValue = (errors == '');

}

function showtd(id) {

for (a=0;a<maxtd.value;a++) {

var ok = document.getElementById("TD"+a);

	ok.style.display="none";

}

var ok = document.getElementById(id);

	ok.style.display="block";

}

var blockdata = "";
if (document.all) { blockdata="block" }
if (document.getElementById &&!document.all) {  blockdata="table-row" }

        function swap(id) { var a = (eval("ID_"+id));
if (a.style.display=="none") {

        show(id);
        } else {

        hide(id);
        }

}
function show(id) {
for (a=1;a<=f.maxi.value;a++) {
MM_swapImage('imgID_'+a,'','images/bplus.gif',0);
var ok = document.getElementById("ID_"+a);
        ok.style.display="none";
}
 ok = document.getElementById("ID_"+id);
        ok.style.display=blockdata;

        MM_swapImage('imgID_'+id,'','images/bmoins.gif',0);

        }

function hide(id) {
        document.getElementById("ID_"+id).style.display="none";
        MM_swapImage('imgID_'+id,'','images/bplus.gif',0);
        }

function alerte_delete(txt,url) {
if (confirm(txt)) {
document.location=url;
}
}

function movedown(){
if (window.moveupvar) clearTimeout(moveupvar)
if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
crossobj.style.top=parseInt(crossobj.style.top)-speed
else if (ns4&&crossobj.top>=(contentheight*(-1)+100))
crossobj.top-=speed
movedownvar=setTimeout("movedown()",100)
}

function moveup(){
if (window.movedownvar) clearTimeout(movedownvar)
if (iens6&&parseInt(crossobj.style.top)<=0)
crossobj.style.top=parseInt(crossobj.style.top)+speed
else if (ns4&&crossobj.top<=0)
crossobj.top+=speed
moveupvar=setTimeout("moveup()",100)
}

function stopscroll(){
if (window.moveupvar) clearTimeout(moveupvar)
if (window.movedownvar) clearTimeout(movedownvar)
}

function movetop(){
stopscroll()
if (iens6)
crossobj.style.top=0
else if (ns4)
crossobj.top=0
}

function movebottom(){
stopscroll()
if (iens6)
crossobj.style.top=contentheight*(-1)+100
else if (ns4)
crossobj.top=contentheight*(-1)+100
}
