function checkForm() {
	var swt = 0;
    msg = "";
    var reg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]{2,}[.][a-z]{2,4}$/;

	if (document.inputform["fields[societe]"].value == "") {
      msg += "Votre société\n";
		swt = 1;
   }
	if (document.inputform["fields[crm_contact_genre_id]"].value == 0) {
      msg += "Votre civilité\n";
		swt = 1;
   }
   if (document.inputform["fields[nom]"].value == "") {
      msg += "Votre nom\n";
		swt = 1;
   }
   if (document.inputform["fields[prenom]"].value == "") {
      msg += "Votre prénom\n";
		swt = 1;
   }
   if (document.inputform["fields[adresse1]"].value == "") {
      msg += "Votre adresse\n";
		swt = 1;
   }
	if (document.inputform["fields[cp]"].value == "") {
      msg += "Votre code postal\n";
		swt = 1;
   }
	if (document.inputform["fields[ville]"].value == "") {
      msg += "Votre ville\n";
		swt = 1;
   }
	if (document.inputform["fields[telephone]"].value == "") {
      msg += "Votre téléphone\n";
		swt = 1;
   }
	if (document.inputform["fields[email]"].value == ""){
		msg += "Votre email \n";
		swt = 1;
	} else if (reg.exec(document.inputform["fields[email]"].value) == null){
		msg += "Votre adresse email est invalide \n";
		swt = 1;
	}
    if (document.inputform["fields_account[password]"].value == "") {
      msg += "Votre mot de passe\n";
		swt = 1;
   }
   if (document.inputform["code"].value == "") {
      msg += "Code de l'image\n";
		swt = 1;
   }

   if (swt == 1){
      alert("Vous n'avez pas renseigné les informations suivantes : \n\n" + msg);
		return false;
   } else {
      document.inputform.submit();
   }
}

function clickAppelOffreConsultation(user_id,appel_id) {
	var url="/js/lcl-appel-offre/record_consultation.php?user_id="+ user_id + "&appel_id="+ appel_id;
	xmlHttp=GetXmlHttpObject(StateAppelOffreConsultation);
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function StateAppelOffreConsultation() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
state = "ok";
} 
} 


//Fonction de communication globale
function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null

if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera") 
return 
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
var strName="Msxml2.XMLHTTP"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
} 
try
{ 
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler
return objXmlHttp
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled") 
return 
} 
} 
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler 
return objXmlHttp
}
} 

