//-->
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(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_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function redirect()
{
location.href=document.rapide.acces.value;
}

function agrandir() {
  false;
}
function opennewwindow(page, nom, hauteur, largeur) {
options='height='+hauteur+',width='+largeur+',left=2, top=2,toolbar=no,scrollbars=yes';
newWindow=window.open(page, nom,options); 
}

function afficheMaxi(chemin)
	{
	Imageslim = new Image;
	Imageslim.src = chemin;
	titre='Jetsetmagazine.net';
	popupImage = window.open('','grande','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,height=10,width=10,left=0, top=0');
	html = '<HTML><HEAD><TITLE>'+titre+'</TITLE><link href="../../styles/styles.css" rel="stylesheet" type="text/css"></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0 onLoad="self.focus();">';
	html =html+'<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>';
    html =html+'<td valign="middle"><table border="0" align="center" cellpadding="0" cellspacing="0"><tr>';
	html =html+'<td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr>';
	html =html+'<td align="left"><strong><img src="../../images/logo_min.gif" width="97" height="40" hspace="10" vspace="3"></strong></td>';
    html =html+'<td align="right" valign="bottom"><img src="../../images/url.gif" width="136" height="10" hspace="3" vspace="2"></td>';
    html =html+'</tr></table></td></tr><tr>';
    html =html+'<td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr>';
	html =html+'<td width="10" valign="top" background="../../images/bg_v.gif"><img src="../../images/coinv.gif" width="13" height="17" border="0"></td>';
   	html =html+'<td rowspan="2" bgcolor="#FFFFFF" class="photolarge"><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+50,document.imageTest.height+110);window.moveTo(100,100);self.focus();"></td>';
    html =html+'</tr><tr><td valign="bottom" background="../../images/bg_v.gif"><img src="../../images/coinfooter.gif" width="13" height="28" border="0" style="background-color:#292C33"></td></tr>';
    html =html+'</table></td></tr></table></td></tr></table></body></HTML>';      
      
		
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close();
	}
function VerificationEmail(elm)
{
if (elm.value.indexOf("@") != "-1" &&
    elm.value.indexOf(".") != "-1" &&
    elm.value != "")
    return true;

return false;
}

function Verifmail(formulaire)
{
	//alert(formulaire.email_newsletter.value);
	if(VerificationEmail(formulaire.email_newsletter) == false)

		{
		alert('Adresse e-mail invalide!!');
        formulaire.email_newsletter.focus();
		return false;		
		}
		else return true;
}


window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
	
if (d) {d.style.display='block';}

}

function showme(id) {
var d = document.getElementById(id);
if (d) {d.style.display='block';}
}

function hideme(id) {
var d = document.getElementById(id);
if (d) {d.style.display='none';}
}



function positionne(id) {
	
	var d = document.getElementById(id);
marge=(screen.width-953)/2+'px';
if (d) 
	{
	d.style.right=marge;
	d.style.display='block';
	}

}





function SwapOut(im)
{
	showCode(im);
	hideCode(im+'_on');
}
function SwapOver(im)
{
	hideCode(im);
	showCode(im+'_on');
}



function verifForm(formulaire)
{ 
///////////NOM
if(document.contact.nom.value == "")
 {
alert(' Entrez votre nom svp !!');
document.contact.nom.focus();
return false; 
 }
/////////PRENOM
if(document.contact.prenom.value == "")
 {
alert(' Entrez votre prénom svp !!');
document.contact.prenom.focus();
return false; 
 }

    /////////tel
if(document.contact.tel.value == "")
 {
alert(' Entrez votre téléphone svp !!');
document.contact.tel.focus();
return false; 
 }
/////////////MAIL



	adresse = document.contact.mail.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
		{

}
	else
		{
		alert('Adresse email invalide!!');
        document.contact.mail.focus();
return false;		
}
	
if(document.contact.mail.value == "")
 {
alert(' Entrez votre adresse Email !!');
document.contact.mail.focus();
return false; 
 }
/////////SUJET
//if(document.contact.sujet.value == "")
 //{
//alert(' Choisissez l\'objet de votre message !!');
//document.contact.sujet.focus();
//return false; 
 //}
 /////////message
if(document.contact.message.value == "")
 {
alert(' Saisissez votre projet !!');
document.contact.message.focus();
return false; 
 }
if(document.contact.code.value == "")
 {
alert(' Recopiez le code svp  !!');
document.contact.code.focus();
return false; 
 }

else
return true;
}



/*function checkphoto() {
	if (document.form.i_traitement2.options[document.form.i_traitement2.selectedIndex].value=="") {
		form.file4.disabled=true;
		form.file5.disabled=true;
		form.file6.disabled=true;
	} else {
		form.file4.disabled=false;
		form.file5.disabled=false;
		form.file6.disabled=false;
	}
	if (document.form.autre_traitement.value=="") {
		form.file7.disabled=true;
		form.file8.disabled=true;
		form.file9.disabled=true;
	} else {
		form.file7.disabled=false;
		form.file8.disabled=false;
		form.file9.disabled=false;
	}

}
*/


function traitementChange() {
	obj=document.form.i_traitement1;
	v=obj.options[obj.selectedIndex].value;
	if (v.length>0){
		if (v.length==2) {
			obj.selectedIndex=obj.selectedIndex+1
		}
	}
}


function traitement2Change() {
	obj=document.form.i_traitement2;
	v=obj.options[obj.selectedIndex].value;
	if (v.length>0){
		if (v.length==2) {
			obj.selectedIndex=obj.selectedIndex+1
		}
	}
}


function disabledTaitement() {
	obj=document.form.i_traitement1;
	if (obj.options[obj.selectedIndex].value=="") document.form.i_traitement2.disabled=true;
}

function lectnb(snbre,signe) {
	var s=snbre.toString();
	var sign="";
	var nbre="";
	var virg=0;
  for (var p=0; p<s.length; p++) {
		var c=s.charAt(p);
		if ((c>="1" && c<="9") || ((c=="0")&&(nbre!=""))) nbre+=c;
		if (((c==",")||(c==".")) && (virg==0)) {
			nbre+=".";
			virg++;
		}
		if ((c=="-")&&(nbre=="")&&(signe==1)) sign="-";
	}
	return (nbre=="")?"0":(sign+nbre);
}
function strtoint(snbre,signe) {
	if (strtoint.arguments.length<2) signe=0;
	return Math.round(parseFloat(lectnb(snbre,signe)));
}
function dateeditblur(src,sDateCourante) {
 s=src.value;
 if (s!="") {
  sJour="";sMois="";sAn="";
  p=1;
  for (i=0;i<s.length;i++) {
   c=s.charAt(i);
   if ((c>='0') && (c<='9')) {
    if (p==1) {
    	if ((sJour!="")||(c!='0'))
      sJour+=c;
    } else if (p==2) {
    	if ((sMois!="")||(c!='0'))
      sMois+=c;
    } else {
    	if ((sAn!="")||(c!='0'))
      sAn+=c;
    }
   } else {
    if ((c=='-') || (c=='/')) p++;
   }
  }
  sJourCourant=sDateCourante.substring(0,2);
  sMoisCourant=sDateCourante.substr(2,2);
  sAnCourant=2004+parseInt(sDateCourante.substr(5,2));
  iJour=parseInt(sJour);
  if (sJour.length==1) {
   sJour='0'+sJour;
  } else if ((sJour.length!=2) || (iJour<1)) {
   sJour=sJourCourant;
  }
  iMois=parseInt(sMois);
  if (iMois>12) sMois="12";
  if (sMois.length==1) {
   sMois='0'+sMois;
  } else if ((sMois.length!=2) || (iMois<1)) {
   sMois=sMoisCourant;
  }
  if (sAn=="") sAn=sAnCourant;
  iAn=parseInt(sAn);
  if (iAn<20) {
   iAn+=2004;
  } else if (iAn<100) {
   iAn+=1900
  } else if ((iAn<1900) || (iAn>2020)) {
   iAn=sAnCourant;
  }
  iJourMaxi=31;
  if ((iMois==4)||(iMois==6)||(iMois==9)||(iMois==11)) {
   iJourMaxi=30;
  } else if (iMois==2) {
   iJourMaxi=(((iAn%4==0) && (iAn%100!=0)) || (iAn%400==0))?29:28;
  }
  if(iJour>iJourMaxi) sJour=iJourMaxi;
  src.value=sJour+"/"+sMois+"/"+iAn;
 }
}

function checklength (src,lng) {
	if (src.value.length>lng) {
		src.value = src.value.substring(0, lng);
	}
}

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+' 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((document.getElementById("i_traitement1").value) == "-1") errors += "- le choix du premier traitement est necessaire.\n";
  if((document.getElementById("preferee_contact").value) == "-1") errors += "- comment vous contacter est necessaire.\n";
  if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


function verif1()
{
var r="";
	if (document.form.nom.value=="") r+="- Nom de famille est obligatoire.\n";
	if (document.form.prenom.value=="") r+="- Prénom est obligatoire.\n";
	if (document.form.age_client.value=="" || strtoint(document.form.age_client.value)==0) r+="- Age est obligatoire.\n";
	if (document.form.nationalite.value=="") r+="- Nationalité est obligatoire.\n";
	if (document.form.tel.value=="") r+="- Téléphone fixe est obligatoire.\n";
	if (document.form.email.value=="") r+="- Email est obligatoire.\n";
	e=document.form.email.value;
	
	if (e!="") {
		p=e.indexOf('@');
		if (p<1 || p==(e.length-1)) r+="- E-mail n'est pas valide.\n";
	}

	if (r!="") alert("Les erreurs suivantes se sont produites:\n"+r);
	if (r=="") {
			 hideme('form1');
	 showme('form2');
	 document.getElementById('onglet1').src="../../images/donnees_off.gif";
	 document.getElementById('onglet2').src="../../images/traitement_on.gif";
	}
	
	//return (r=="");
	return false;
}

function verif2()
{
var r="";
if((document.getElementById("i_traitement1").value) == "none") r += "- le choix du premier traitement est necessaire.\n";

	if (document.form.raisons_intervention.value=="") r+="- Raisons de la demande d'intervention est obligatoire.\n";

	if (r!="") alert("Les erreurs suivantes se sont produites:\n"+r);
	if (r=="") {
			 hideme('form2');
	 showme('form3');
	 document.getElementById('onglet2').src="../../images/traitement_off.gif";
	 document.getElementById('onglet3').src="../../images/antecedent_on.gif";
	}
	
	return false;
}
function verif3()
{
	document.form.submit();
}
