
/*validation du formulaire*/
function writediv(texte,zone)
     {
     document.getElementById(zone).innerHTML = texte;
     }
function verifGetchamps() {
	a =document.formSos.mail.value;
	b =document.formSos.cmail.value;
	c =document.formSos.pass.value;
	d =document.formSos.cpass.value;
	e =document.formSos.nom.value;
	f =document.formSos.prenom.value;
	g =document.formSos.societe.value;
	h =document.formSos.tel_por.value;
	i =document.formSos.tva.value;
	j =document.formSos.pays.value;
	k =document.formSos.ville.value;
	l =document.formSos.tel_fixe.value;
	n =document.formSos.postal.value;
	valide1 = false;

	for(var j=1;j<(a.length);j++){
		if(a.charAt(j)=='@'){
			if(j<(a.length-4)){
				for(var k=j;k<(a.length-2);k++){
					if(a.charAt(k)=='.') valide1=true;
				}
			}
		}
	}
if(a == "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! votre adresse mail est obligatoire</span>','mail');
return false;
}

if(valide1==false) {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Entrer une adresse mail valide</span>','mail');
	return false;
	}
if(b=="") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!!confirmer adresse mail est obligatoire</span>','cmail');
	return false;
	}
	
if(a!=b) {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!!confirmer bien votre adresse mail</span>','cmail');
	return false;
	}
if(c== "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Entrez votre mot de passe</span>','pass');
return false;
}
if(d== "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! La confirmation de votre mot de passe est obligatoire</span>','cpass');
return false;
}

if(c != d) {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! La confirmation de votre mot de passe est obligatoire</span>','cpass');
	return false;
	}
if(g== "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Entrez votre nom de societé SVP	</span>','societe');
return false;
}

if(e== "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Votre nom  Mr (Mm) est obligatoire</span>','nom');
return false;
}

if(f== "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Votre prenom  Mr (Mm) est obligatoire</span>','prenom');
return false;
}
if(k== "0") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Choisissez la ville de votre résidence</span>','ville');
return false;
}
if(n== "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Entrez le numero de votre code postal societe</span>','postal');
return false;
}
if(j== "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Choisissez pays  de votre societé SVP</span>','pays');
return false;
}
if(l== "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Entrez le numero de tel fixe de votre societe</span>','tel_fixe');
return false;
}

if(h== "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Entrez la tel portable de votre societé</span>','tel_por');
return false;
}
if(i== "") {
	writediv('<span style="border:none; display:block; width:235px; height:20px;color:#FF0000;float:right;">!! Entrez le numero de tva de votre societé SVP</span>','tva');
return false;
}

} 

function verifmail(mail) {
	a=mail;
	valide1 = false;

	for(var j=1;j<(a.length);j++){
		if(a.charAt(j)=='@'){
			if(j<(a.length-4)){
				for(var k=j;k<(a.length-2);k++){
					if(a.charAt(k)=='.') valide1=true;
				}
			}
		}
	}
	return valide1;
	
}




function changeimg(monimage) {
 			
 			var ancimage = monimage.src;
 			
 			if( ancimage.substring(ancimage.lastIndexOf("/"), ancimage.length) == "/picto-recherche1.gif"){
  			 	monimage.src= ancimage.substring(0,ancimage.lastIndexOf("/"), ancimage.length)+"/picto-recherche2.gif";
  			 	
  			 } 
  			 else{
  			 	monimage.src= ancimage.substring(0,ancimage.lastIndexOf("/"), ancimage.length)+"/picto-recherche1.gif";
  			 	
 
  			 }
		} 

function verifannformulaire() {
	a =document.formAnn.titre.value;
	b =document.formAnn.desc.value;
	c =document.formAnn.nom_comp.value;
	d =document.formAnn.tel.value;
	e =document.formAnn.fax.value;
	f =document.formAnn.mail.value;
	var chkZ = 1;
 	for(i=0;i<d.length;++i)
   	if(d.charAt(i) < "0"
   	|| d.charAt(i) > "9")
     chkZ = -1;
	var chkZZ = 1;
	for(i=0;i<e.length;++i)
   	if(e.charAt(i) < "0"
   	|| e.charAt(i) > "9")
     chkZZ = -1;
	
	
	if(a == "") {
	writediv('<span style="border:none; display:block; width:250px; height:20px;color:#FF0000;float:left;">!! Le titre pour valider votre annonce</span>','titre');
	return false;
	}
	if(b == "") {
	writediv('<span style="border:none; display:block; width:250px; height:20px;color:#FF0000;float:left;">!! La discription pour valider votre annonce</span>','desc');
	return false;
	}
	if(c == "") {
	writediv('<span style="border:none; display:block; width:250px; height:20px;color:#FF0000;float:left;">!! Entez votre nom complet  </span>','nom_comp');
	return false;
	}
	if(chkZ == -1 || d=="") {
   	writediv('<span style="border:none; display:block; width:250px; height:20px;color:#FF0000;float:left;">!! Entez numero pour votre telephonne  </span>','tel');
   	return false;
  	}
		if(chkZZ == -1 ) {
   	writediv('<span style="border:none; display:block; width:250px; height:20px;color:#FF0000;float:left;">!! Entez numero pour votre fax  </span>');
   	return false;
  	}
	if(verifmail(f)==false || f=="" ){
	writediv('<span style="border:none; display:block; width:250px; height:20px;color:#FF0000;float:left;">!! Entez une adresse mail ou bien une adresse valide  </span>','mail');	
	return false;
	}
}



 function validation()
{
a =document.auto.mail.value;
	
	if(document.auto.text.value=="")
	{
	writediv('<span style="border:none; display:block; width:420px; height:20px;color:#FF0000;float:left;"> Texte de l/annonce pour valider votre annonce</span>','text');
	return false;
	}
		

	
	if(document.auto.nom.value=="")
	{
			writediv('<span style="border:none; display:block; width:420px; height:20px;color:#FF0000;float:left;">!! Entez votre nom complet   </span>','nom');
		
		return false;
	}
	if(document.auto.num_tel.value=="")
	{
	writediv('<span style="border:none; display:block; width:420px; height:20px;color:#FF0000;float:left;">!! Entez numero pour votre telephonne</span>','num_tel');
		return false;
	}
	if(document.auto.pass.value=="")
	{
		writediv('<span style="border:none; display:block; width:420px; height:20px;color:#FF0000;float:left;">!! Entez votre Mot de passe désiré</span>','pass');
		return false;
	}

		if(document.auto.mail.value=="")
	{
		writediv('<span style="border:none; display:block; width:420px; height:20px;color:#FF0000;float:left;">!! votre adresse mail est obligatoire</span>','mail');
		return false;
	}else
	{
	a =document.auto.mail.value;
	valide1 = false;
	for(var j=1;j<(a.length);j++){
		if(a.charAt(j)=='@'){
			if(j<(a.length-4)){
				for(var k=j;k<(a.length-2);k++){
					if(a.charAt(k)=='.') valide1=true;
				}
			}
		}
	}
	if(valide1==false) {
writediv('<span style="border:none; display:block; width:420px; height:20px;color:#FF0000;float:left;">!! Vous devez entrer une adresse mail valide</span>','mail');
	return false;
	}
	}
}


function div_long(statu){
	if(statu=='plus'){
	document.getElementById('localite').style.height="700px";
	document.getElementById('plus').style.visibility="hidden";
	document.getElementById('moins').style.visibility="visible";
	}
	if(statu=='moins'){
	document.getElementById('localite').style.height="200px";
	document.getElementById('moins').style.visibility="hidden";
	document.getElementById('plus').style.visibility="visible"
	}					
}

function affichage_popup(nom,interne)
{
window.open (nom,interne, config='height=600, width=800, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no')
}



















