// JavaScript Document


 function verifMail(thisForm) {

var email = thisForm.value;

if (email == "" ) {
   return true;
}
var aroba = email.indexOf("@");
if (aroba == -1) {

return false;
}
var point = email.indexOf(".", aroba);
if ((point == -1) || (point == (aroba + 1))) {

return false;
}
var point = email.lastIndexOf(".");
if ((point + 1) == email.length) {

return false;
}
var point = email.indexOf("..")
if (point != -1) {
return false;
}

return true;
}

var ajax = new sack();
function isMail(champ) {
	var contact = champ.value;
	var aroba = contact.indexOf("@");
	if (aroba == -1) 
	{
		return false;
	}
	var point = contact.indexOf(".", aroba);
	if ((point == -1) || (point == (aroba + 1))) 
	{
		return false;
	}
	var point = contact.lastIndexOf(".");
	if ((point + 1) == contact.length) 
	{
		return false;
	}
	var point = contact.indexOf("..")
	if (point != -1) 
	{
		return false;
	}
	return true;
}

function whenCompletedCaptcha2()
{
	 var email_inscr;
	 var email_part;
	 
	 email_inscr = document.getElementById('inscription_email');
	 email_part =  document.getElementById('inscription_email_part');
	 
	 document.getElementById('inscription_etablissement').className="";
	 document.getElementById('inscription_adresse').className="";
	 document.getElementById('inscription_cp').className="";
	 document.getElementById('inscription_ville').className="";
	 document.getElementById('inscription_num_tva').className="";
	 document.getElementById('inscription_siret').className="";
	 document.getElementById('inscription_activite').className="";
	 document.getElementById('inscription_salarie').className="";
	 document.getElementById('inscription_civilite').className="";
	 document.getElementById('inscription_fonction').className="";
	 document.getElementById('inscription_tel').className="";
	 document.getElementById('inscription_email').className="";
	 document.getElementById('inscription_civilite_part').className="";
	 document.getElementById('inscription_fonction_part').className="";
	 document.getElementById('inscription_tel_part').className="";
	 document.getElementById('inscription_email_part').className="";
	 
	//alert('ok'); = marche
	if (ajax.responseStatus){
		var retourCaptcha = ajax.response;
	} else {
		var string = "<p>URLString Sent: " + ajax.URLString + "</p>";
	}
	if(retourCaptcha=='ko')
	{
		 alert('Les caractères ne correspondent pas avec ceux de l\'image.');
         document.getElementById("verif_saisie").focus();
         return false;
	}
	/*************************************** SOCIETE ******************************************/
	else if(document.getElementById("inscription_etablissement").value == '')
    {
         alert('Le champ "Etablissement" doit être rempli');
         document.getElementById("inscription_etablissement").focus();
		  document.getElementById("inscription_etablissement").className="input_rouge";
         return false;
    }
	else if(document.getElementById("inscription_adresse").value == '')
    {
         alert('Le champ "Adresse" doit être rempli');
         document.getElementById("inscription_adresse").focus();
		 document.getElementById("inscription_adresse").className="input_rouge";
         return false;
    }
    else if(document.getElementById("inscription_cp").value == '')
    {
         alert('Le champ "Code postal" doit être rempli');
         document.getElementById("inscription_cp").focus();
		  document.getElementById("inscription_cp").className="input_rouge";
         return false;
    }
	 else if(document.getElementById("inscription_ville").value == '')
    {
         alert('Le champ "Ville" doit être rempli');
         document.getElementById("inscription_ville").focus();
		 document.getElementById("inscription_ville").className="input_rouge";
         return false;
    }
	 else if(document.getElementById("inscription_num_tva").value == '')
    {
         alert('Le champ "N° TVA intracommunautaire" doit être rempli');
         document.getElementById("inscription_num_tva").focus();
		 document.getElementById("inscription_num_tva").className="input_rouge";
         return false;
    }
	 else if(document.getElementById("inscription_siret").value == '')
    {
         alert('Le champ "N° Siret" doit être rempli');
         document.getElementById("inscription_siret").focus();
		 document.getElementById("inscription_siret").className="input_rouge";
         return false;
    }
	 else if(document.getElementById("inscription_activite").value == '')
    {
         alert('Le champ "NAF / Activité" doit être rempli');
         document.getElementById("inscription_activite").focus();
		 document.getElementById("inscription_activite").className="input_rouge";
         return false;
    }
	 else if(document.getElementById("inscription_salarie").value == '')
    {
         alert('Le champ "Nbre salariés" doit être rempli');
         document.getElementById("inscription_salarie").focus();
		 document.getElementById("inscription_salarie").className="input_rouge";
         return false;
    }
	/************************ RESPONSABLE DU SUIVI DE L INSCRIPTION *******************************************/
	else if(document.getElementById("inscription_civilite").value == '')
    {
         alert('Le champ "M / Mme / Melle" doit être rempli');
         document.getElementById("inscription_civilite").focus();
		 document.getElementById("inscription_civilite").className="input_rouge";
         return false;
    }
	else if(document.getElementById("inscription_fonction").value == '')
    {
         alert('Le champ "Fonction" doit être rempli');
         document.getElementById("inscription_fonction").focus();
		 document.getElementById("inscription_fonction").className="input_rouge";
         return false;
    }
	else if(document.getElementById("inscription_tel").value == '')
    {
         alert('Le champ "Tel" doit être rempli');
         document.getElementById("inscription_tel").className="input_rouge";
		 document.getElementById("inscription_tel").focus();
         return false;
    }
	else if(document.getElementById("inscription_email").value == '')
    {
         alert('Le champ "E-mail" doit être rempli');
         document.getElementById("inscription_email").focus();
		  document.getElementById("inscription_email").className="input_rouge";
         return false;
    }
    else if (!isMail(document.getElementById("inscription_email")))
    {
         alert('Merci de bien vouloir renseigner une adresse email correcte dans le champ "E-mail"');
         document.getElementById("inscription_email").focus();
		  document.getElementById("inscription_email").className="input_rouge";
         return false;
    }
	/***************************** PARTICIPANT **************************************************/
	else if(document.getElementById("inscription_civilite_part").value == '')
    {
         alert('Le champ "M/ Mme / Mlle" doit être rempli');
         document.getElementById("inscription_civilite_part").focus();
		 document.getElementById("inscription_civilite_part").className="input_rouge";
         return false;
    }
	else if(document.getElementById("inscription_fonction_part").value == '')
    {
         alert('Le champ "Fonction" doit être rempli');
         document.getElementById("inscription_fonction_part").focus();
		 document.getElementById("inscription_fonction_part").className="input_rouge";
         return false;
    }
	else if(document.getElementById("inscription_tel_part").value == '')
    {
         alert('Le champ "Téléphone" doit être rempli');
         document.getElementById("inscription_tel_part").focus();
		 document.getElementById("inscription_tel_part").className="input_rouge";
         return false;
    }
	else if(document.getElementById("inscription_email_part").value == '')
    {
         alert('Le champ "E-mail" doit être rempli');
         document.getElementById("inscription_email_part").focus();
		 document.getElementById("inscription_email_part").className="input_rouge";
         return false;
    }
    else if (!isMail(document.getElementById("inscription_email_part")))
    {
         alert('Merci de bien vouloir renseigner une adresse email correcte dans le champ "E-mail"');
         document.getElementById("inscription_email_part").focus();
		 document.getElementById("inscription_email_part").className="input_rouge";
         return false;
    }
	
	document.getElementById("test").value = retourCaptcha;
	document.getElementById("form1").submit();
}

/******************************************************************************************/

function verification()
{
	
	if(document.getElementById("verif_saisie").value=="")
 	{
 	 	alert('Merci de bien vouloir renseigner "Vérification caractère"');
        document.getElementById("verif_saisie").focus();
		document.getElementById("verif_saisie").className="input_rouge";
        return false;
 	}
	else 
	{
		ajax.setVar("captcha", document.getElementById("verif_saisie").value);
		ajax.requestFile = "ajaxCaptcha.php";
		ajax.method = "POST";
		ajax.element = 'div_login';
		ajax.onCompletion = whenCompletedCaptcha2;
		ajax.runAJAX();
	}
	return false;
}

/******************************************************************************************/
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		tetiere3_04_over = newImage("images/tetiere3_04-over.gif");
		tetiere3_05_over = newImage("images/tetiere3_05-over.gif");
		tetiere3_06_over = newImage("images/tetiere3_06-over.gif");
		preloadFlag = true;
	}
}

// -->

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 newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		colonne_gauche1_05_over = newImage("images/colonne_gauche1_05-over.gif");
		colonne_gauche1_06_over = newImage("images/colonne_gauche1_06-over.gif");
		colonne_gauche1_07_over = newImage("images/colonne_gauche1_07-over.gif");
		colonne_gauche1_08_over = newImage("images/colonne_gauche1_08-over.gif");
		colonne_gauche1_09_over = newImage("images/colonne_gauche1_09-over.gif");
		colonne_gauche1_10_over = newImage("images/colonne_gauche1_10-over.gif");
		preloadFlag = true;
	}
}

// -->

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];}
}