function IsEMail(emailStr)
{var validDomain=false;
var AtPos = emailStr.lastIndexOf("@");
var DotPos= emailStr.lastIndexOf(".");
if((AtPos>0)&&(DotPos>0)&&(AtPos<DotPos))
{var domainExtList='ac.ad.ae.af.ag.ai.al.am.an.ao.aq.ar.as.at.au.aw.az.ba.bb.bd.be.bf.bg.bh.bi.bj.bm.bn.bo.br.bs.bt.bv.bw.by.bz.ca.cc.cd.cf.cg.ch.ci.ck.cl.cm.cn.co.cr.cs.cu.cv.cx.cy.cz.de.dj.dk.dm.do.dz.ec.ee.eg.eh.er.es.et.fi.fj.fk.fm.fo.fr.fx.ga.gb.gd.ge.gf.gg.gh.gi.gl.gm.gn.gp.gq.gr.gs.gt.gu.gw.gy.hk.hm.hn.hr.ht.hu.id.ie.il.im.in.io.iq.ir.is.it.je.jm.jo.jp.ke.kg.kh.ki.km.kn.kp.kr.kw.ky.kz.la.lb.lc.li.lk.lr.ls.lt.lu.lv.ly.ma.mc.md.mg.mh.mk.ml.mm.mn.mo.mp.mq.mr.ms.mt.mu.mv.mw.mx.my.mz.na.nc.ne.nf.ng.ni.nl.no.np.nr.nt.nu.nz.om.pa.pe.pf.pg.ph.pk.pl.pm.pn.pr.ps.pt.pw.py.qa.re.ro.ru.rw.sa.sb.sc.sd.se.sg.sh.si.sj.sk.sl.sm.sn.so.sr.st.su.sv.sy.sz.tc.td.tf.tg.th.tj.tk.tm.tn.to.tp.tr.tt.tv.tw.tz.ua.ug.uk.um.us.uy.uz.va.vc.ve.vg.vi.vn.vu.wf.ws.ye.yt.yu.za.zm.zr.zw.com.edu.gov.int.mil.net.org.biz.pro.info.aero.name.coop.arpa.nato.museum.EoF';
  var domainExt=domainExtList.split(".");
  var emailExt=emailStr.substr(DotPos+1);
  emailExt=emailExt.toLowerCase();
  for(i=0;domainExt.length;i++)
  {if (domainExt[i]=='EoF')  break; //infinite loop else
   if (emailExt==domainExt[i])  {validDomain=true;break;}
  }
}

return(validDomain);
}
function CheckChampTel(Which) {
	if(window.event.keyCode==32||window.event.keyCode==8) return;
	if ((Which.value.length+1)%3==0) {Which.value+=" ";}
}
function champsok()
{

		if (document.form1.nom.value.length == 0)
		{
		alert("Veuillez saisir le champs nom.");
		document.form1.nom.focus();
		return false;
		}
		if (document.form1.prenom.value.length == 0)
		{
		alert("Veuillez saisir le champs prenom.");
		document.form1.prenom.focus();
		return false;
		}
				/*if (document.form1.fonction.value.length == 0)
		{
		alert("Veuillez saisir le champs fonction.");
		document.form1.fonction.focus();
		return false;
		}*/
				if (document.form1.adresse.value.length == 0)
		{
		alert("Veuillez saisir le champs adresse.");
		document.form1.adresse.focus();
		return false;
		}
		
		
		if (document.form1.codepostal.value.length == 0)
		{
		alert("Veuillez saisir le champs code postal.");
		document.form1.codepostal.focus();
		return false;
		}
		
		if (isNaN(document.form1.codepostal.value)) {
		alert("Veuillez saisir le champs code postal.");
		document.form1.codepostal.focus();
		 return false;
		}
			
		if (document.form1.codepostal.value.length <5)
		{
		alert("Veuillez saisir le champs code postal.");
		document.form1.codepostal.focus();
		return false;
		}
		
		
		if (document.form1.ville.value.length == 0)
		{
		alert("Veuillez saisir le champs ville.");
		document.form1.ville.focus();
		return false;
		}
		
				if (document.form1.tel.value.length < 10)
		{
		alert("Votre num&eacute;ro de t&eacute;l&eacute;phone est invalide.");
		document.form1.tel.focus();
		return false;
		}
		if (document.form1.tel.length != 10) 
		{           if ((document.form1.tel.value.substr(0,2)!="01") && (document.form1.tel.value.substr(0,2)!="02") && (document.form1.tel.value.substr(0,2)!="03") && (document.form1.tel.value.substr(0,2)!="04") && (document.form1.tel.value.substr(0,2)!="05") && (document.form1.tel.value.substr(0,2)!="06")&& (document.form1.tel.value.substr(0,2)!="08")&& (document.form1.tel.value.substr(0,2)!="09") )
						   {  
							   alert("Votre num&eacute;ro de t&eacute;l&eacute;phone est invalide.");
								document.form1.tel.focus();
									return false;
							}
		}
		
		
		
		

		if (document.form1.email.value==""){
			 alert("Veuillez saisir le champs e-mail.");
			 document.form1.email.focus();
			 return false;
			}
		   if (!IsEMail(document.form1.email.value)){
			 alert("Veuillez saisir le champs  e-mail.");
			 document.form1.email.focus();
			 return false ;
			}


			if (document.form1.activite.value==""){
			 alert("Veuillez saisir le champs activite.");
			 document.form1.activite.focus();
			 return false;
			}
			
						if (document.form1.statut.value==""){
			 alert("Veuillez saisir le champs statut");
			 document.form1.statut.focus();
			 return false;
			}


			if (document.form1.observation1.value==""){
			 alert("observation1");
			 document.form1.observation1.focus();
			 return false;
			}
		
					if (document.form1.observation2.value==""){
			 alert("observation2");
			 document.form1.observation2.focus();
			 return false;
			}
		
							if (document.form1.observation3.value==""){
			 alert("observation3");
			 document.form1.observation3.focus();
			 return false;
			}
		
}

