function verifNouvellePhoto() {
	if(document.nouvellePhoto.photo.value != "")
		document.nouvellePhoto.submit();
	else
		alert("Vous n'avez pas choisi de photo.");
}
function supprPhoto(ph) {
	document.supprPhoto.photo.value = ph;
	if(confirm("Voulez-vous supprimer cette photo ?"))
		document.supprPhoto.submit();
}
function openMenu(id) {
	var menu = document.getElementById(id);
	menu.style.display = "";
}
function closeMenu(id) {
	var menu = document.getElementById(id);
	menu.style.display = "none";
}
function animate(num) {
	if(num < 7) {
		var img1 = document.getElementById("imgAnim"+num);
		var op1 = parseFloat(img1.style.opacity);
		op1 = op1 + 0.01;
		img1.style.opacity = op1;
		img1.style.filter = "alpha(opacity=" + (op1 * 100) + ")";
		if(op1 > 0.3 && num < 6) {
			var img2 = document.getElementById("imgAnim"+(num+1));
			var op2 = parseFloat(img2.style.opacity);
			op2 = op2 + 0.01;
			img2.style.opacity = op2;
			img2.style.filter = "alpha(opacity=" + (op2 * 100) + ")";
		}
		if(op1 > 0.6 && num < 5) {
			var img3 = document.getElementById("imgAnim"+(num+2));
			var op3 = parseFloat(img3.style.opacity);
			op3 = op3 + 0.01;
			img3.style.opacity = op3;
			img3.style.filter = "alpha(opacity=" + (op3 * 100) + ")";
		}
		if(op1 > 0.9 && num < 4) {
			var img4 = document.getElementById("imgAnim"+(num+3));
			var op4 = parseFloat(img4.style.opacity);
			op4 = op4 + 0.01;
			img4.style.opacity = op4;
			img4.style.filter = "alpha(opacity=" + (op4 * 100) + ")";
		}
		if(op1 >= 1)
			timer = setTimeout("animate("+(num+1)+")", "15");
		else
			timer = setTimeout("animate("+num+")", "15");
	}
}
function checkEmail(emailAddr) {
	// Cette fonction vérifie la bon format d'une adresse e-mail.
	// Comme :
	// user@domain.com ou user.perso@domain.com
	var i;
	// Recherche de @
	i = emailAddr.indexOf("@");
	if (i == -1) {
		return false;
	}
	// Séparation du nom de l'utilisateur et du nom de domaine.
	var username = emailAddr.substring(0, i);
	var domain = emailAddr.substring(i + 1, emailAddr.length)
	// Recherche des espaces au début du nom de l'utilisateur.
	i = 0;
	while ((username.substring(i, i + 1) == " ") && (i < username.length)) {
		i++;
	}
	// Les enlève s'il en trouve.
	if (i > 0) {
		username = username.substring(i, username.length);
	}
	// Recherche d'espaces à la fin du nom de domaine.
	i = domain.length - 1;
	while ((domain.substring(i, i + 1) == " ") && (i >= 0)) {
		i--;
	}
	// Les enlève s'il en trouve.
	if (i < (domain.length - 1)) {
		domain = domain.substring(0, i + 1);
	}
	// Vérifie que le nom de l'utilisateur et du domaine ne soit pas vide.
	if ((username == "") || (domain == "")) {
		return false;
	}
	// Vérifie s'il n'y a pas de caractères interdits dans le nom de l'utilisateur.
	var ch;
	for (i = 0; i < username.length; i++) {
		ch = (username.substring(i, i + 1)).toLowerCase();
		if (!(((ch >= "a") && (ch <= "z")) || 
			((ch >= "0") && (ch <= "9")) ||
			(ch == "_") || (ch == "-") || (ch == "."))) {
				return false;
		}
	}
	var dotfound = false;
	// Vérifie s'il n'y a pas de caractères interdits dans le nom de domaine
	for (i = 0; i < domain.length; i++) {
		ch = (domain.substring(i, i + 1)).toLowerCase();
		if (!(((ch >= "a") && (ch <= "z")) || 
			((ch >= "0") && (ch <= "9")) ||
			(ch == "_") || (ch == "-") || (ch == "."))) {
				return false;
		}
		if(ch == ".") {
			dotfound = true;
		}
	}
	if(!dotfound) {
		return false;
	}
	return true;
}

/******************************************************************************
 *                                                                            *
 *  Fonctions pour preload images et bouton menus                                            *
 *                                                                            * 
 *  ***************************************************************************/ 
ie4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )); 
ns4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4 )) ;

if (ns4) { 
	layerRef="document.layers"; 
	styleRef=""; 
} else { 
	layerRef="document.all"; 
	styleRef=".style"; 
}
//**************************************************************************************
function Permut (flag,img,calque) {
   if (document.images) {
        if (document.images[img].permloaded) {
            if (flag==1) {
				document.images[img].src = document.images[img].perm.src;
				if (calque!='') {
   					eval(layerRef + '["' + calque +'"]' + styleRef + '.visibility = "visible"'); 
				}
			} else {
				document.images[img].src = document.images[img].perm.oldsrc;
				if (calque!='') {
   					eval(layerRef + '["' + calque +'"]' + styleRef + '.visibility = "hidden"'); 
				}
			}
        }
   }
}
function preloadPermut (img,adresse) {
   if (document.images) {
        img.onload = null;
        img.perm = new Image ();
        img.perm.oldsrc = img.src;
        img.perm.src = adresse;
        img.permloaded = true;
   }
}
/*************************************************************************************
* 
*	fonction pour les boutons radios des formulaires
*		formu est le nom du formulaire a qui s'applique la fonction
*		bouton le bouton a qui s'applique le rollover
*		k indice de l'input radio a coché	
*
*********************************************************************************/

function actioninzone (formu,bouton,k) {
	var Zcol0 = new Array(); 
	Zcol0[0]="./img/btn_grenoble.gif"; Zcol0[1]="./img/btn_banlieue.gif"; Zcol0[2]="./img/btn_isere.gif"; Zcol0[3]="./img/btn_toutes.gif";
	var Zcol1 = new Array(); 
	Zcol1[0]="./img/_btn_grenoble.gif"; Zcol1[1]="./img/_btn_banlieue.gif"; Zcol1[2]="./img/_btn_isere.gif"; Zcol1[3]="./img/_btn_toutes.gif";
	var tabImgZ = new Array();
	tabImgZ[0]=Zcol0; tabImgZ[1]=Zcol1; 

	for (i=0; i <2 ; i++) {
		for (j=0; j<4 ; j++) {
			var preload = new Image();
			preload.src = tabImgZ[i][j];
		}
	}
	var Ztablo=new Array();
	Ztablo[0]="btn_grenoble"; Ztablo[1]="btn_banlieue"; Ztablo[2]="btn_isere"; Ztablo[3]="btn_toutes";

	for (j=0; j<Ztablo.length; j++) {
			document.images[Ztablo[j]].src=tabImgZ[0][j] ;
			if (bouton==Ztablo[j]) {document.images[bouton].src=tabImgZ[1][j];}
	}
	if (formu=='form_achat') {
		document.form_achat.zon[k].checked=true ;
	}    
}
function actionintype (formu,bouton,k) {
	var Tcol0 = new Array(); 
	Tcol0[0]="./img/btn_appart.gif"; Tcol0[1]="./img/btn_villa.gif"; Tcol0[2]="./img/btn_chateau.gif"; Tcol0[3]="./img/btn_terrain.gif";
	Tcol0[4]="./img/btn_garage.gif"; Tcol0[5]="./img/btn_commerce.gif"; Tcol0[6]="./img/btn_autre.gif";
	var Tcol1 = new Array(); 
	Tcol1[0]="./img/_btn_appart.gif"; Tcol1[1]="./img/_btn_villa.gif"; Tcol1[2]="./img/_btn_chateau.gif"; Tcol1[3]="./img/_btn_terrain.gif";
	Tcol1[4]="./img/_btn_garage.gif"; Tcol1[5]="./img/_btn_commerce.gif"; Tcol1[6]="./img/_btn_autre.gif";
	var tabImgT = new Array();
	tabImgT[0]=Tcol0; tabImgT[1]=Tcol1; 

	var Ttablo=new Array();
	Ttablo[0]="btn_appart"; Ttablo[1]="btn_villa"; Ttablo[2]="btn_chateau";	Ttablo[3]="btn_terrain";
	Ttablo[4]="btn_garage";	Ttablo[5]="btn_commerce";	Ttablo[6]="btn_autre";

	for (j=0; j<Ttablo.length ; j++) {
		document.images[Ttablo[j]].src=tabImgT[0][j] ;
		if (bouton==Ttablo[j]) {document.images[bouton].src=tabImgT[1][j];}
	}
	if (formu=='form_achat') {
		document.form_achat.typ[k].checked=true ;
	} else {
		document.form_vente.typ[k].checked=true ;
	}		
}
/******************************************************************************
 *                                                                            *
 *  Fonctions popup                                          		      *
 *                                                                            * 
 *  ***************************************************************************/ 
function popup(page,largeur,hauteur) {

  var haut=(screen.height-hauteur)/2;
  var gauche=(screen.width-largeur)/2;
  var scrollbar = "yes";
  if(page == "form_mail.htm")
  	scrollbar = "no";
  window.open(page,'popupmail','top='+haut+',left='+gauche+',width='+largeur+',height='+hauteur+',resizable=no,toolbar=no,scrollbars='+scrollbar+',location=no');
}

/******************************************************************************
 *                                                                            *
 *  Defilement info status bar                                                *
 *                                                                            * 
 *  ***************************************************************************/ 
var Mess="Vercors Immobilier : Administrateur de biens - Transactions - Syndics de copropriétés - locations - Tel : 04.76.87.33.04";
var place=1;
function scrollIn() {
window.status=Mess.substring(0, place);
if (place >= Mess.length) {
place=1;
window.setTimeout("scrollOut()",300);
} else {
place++;
window.setTimeout("scrollIn()",100);
   } 
}
function scrollOut() {
window.status=Mess.substring(place, Mess.length);
if (place >= Mess.length) {
place=1;
window.setTimeout("scrollIn()",300);
} else {
place++;
window.setTimeout("scrollOut()",100);
   }
}
/******************************************************************************
 *                                                                            *
 *  Fonction pour affichage image en bas ecran toujours visible               *
 *                                                                            * 
 *  ***************************************************************************/ 
 // PARAMETRAGE DU SCRIPT
var tjs_delai=20;
var tjs_max=15;
var tjs_mode=1; // 0 - calque toujours en haut de page / 1 - calque en bas

// Script principal
var tjs_hauteur=0;
function PrintCalque(left,top,width,height,contenu) {

	tjs_hauteur=height;
	if ((document.all)||(document.getElementById)) {
		var Z="<DIV id='tomber' style='position:absolute;left:"+left+";top:"+top+";width:"+width+";height:"+height+"'>"+contenu+"</DIV>";
	} else {
		var Z="<LAYER name='tomber' left="+left+" top="+top+" width="+width+" height="+height+">"+contenu+"</LAYER>";
	}
	document.write(Z);
	setTimeout("Start()",tjs_delai);
}
function Start() {
	MoveLayer("tomber",GetTop("tomber"));
	setTimeout("Start()",tjs_delai);
}
function Debug() {
	var obj=document.body
	var Z="";
	for (var i in obj) {
		Z+=i+"="+obj[i]+"\n";
	}
	alert(Z);
}
function MoveLayer(nom,top) {
	if (document.getElementById) { //IE5 et NS6
		document.getElementById(nom).style.top=top;
	}
	if ((document.all)&&(!document.getElementById)) { //IE4 seul
		document.all[nom].style.top=top;
	}
	if (document.layers) { //NS4.X seul
		document.layers[nom].top=top;
	}
}
function GetTop(nom) {
	// Partie 1 : Récupération de la position du calque et de la page
	if (document.getElementById) { //IE5 
		var pos=parseInt(document.getElementById(nom).style.top);
		var wintop=parseInt(document.body.scrollTop);
		var avail=document.body.clientHeight;
	}
	if ((document.getElementById)&&(!document.all)) { //NS6
		var pos=parseInt(document.getElementById(nom).style.top);
		var wintop=parseInt(window.pageYOffset);
		var avail=window.innerHeight;
	}
	if ((document.all)&&(!document.getElementById)) { //IE4 seul
		var pos=parseInt(document.all[nom].style.top);
		var wintop=parseInt(document.body.scrollTop);
		var avail=document.body.clientHeight;
	}
	if (document.layers) { //NS4.X seul
		var pos=parseInt(document.layers[nom].top);
		var wintop=parseInt(window.pageYOffset);
		var avail=window.innerHeight;
	}

	// Partie 2 : Traitement de la position
	if (tjs_mode==0) { // toujours en haut
		var delta=Math.ceil((pos-wintop)/3);
		if (delta>tjs_max) {delta=tjs_max;}
		if (delta<-1*tjs_max) {delta=-1*tjs_max;}
		var top=pos-delta;
	}
	if (tjs_mode==1) {// toujours en bas
		var delta=Math.ceil((pos-(wintop+avail-tjs_hauteur)));
		if (delta>tjs_max) {delta=tjs_max;}
		if (delta<-1*tjs_max) {delta=-1*tjs_max;}
		var top=pos-delta;
	}
	return top;
} 
/******************************************************************************
 *                                                                            *
 *  Fonctions diverses                                                        *
 *                                                                            * 
 *  ***************************************************************************/ 
//fonction pour verifier si les biens ont été selectionner dans le bon ordre
//form est le formulaire, paramurl est le parametre a transmettre a url, prov est la provenance du l'appel fonction
function verifpdf (form,paramurl,prov) {
	var tab = new Array();
	for (var k=0;k<=35;k++){
		
		tab[k]='ref'+k;
	}
	var i=0; var valide=true; var ok=false;
	while (i < 35 && valide && !ok) {
		//alert(form.elements[tab[i]].value);
		if (form.elements[tab[i]].value=='0') {
			//cas du premier (aucun remplit)
			if (i==0) {
				alert("Erreur : le bien N°1 est vide !");
				valide=false;
			}
			var j=i+1;
			while (j <35 && valide) {
				//alert(j+' '+form.elements[tab[j]].value);
				if ((form.elements[tab[j]].value!='0') && (form.elements[tab[j]].value!='')){
					alert("Erreur : vous devez obligatoirement sélectionner les biens dans l'ordre croissant sans laisser de référence vide intermédiaire !");
					valide=false;
				} else {
					j++;
				}
			}
		if (valide) ok=true;
		}
		i++;
	}
	if (valide) {
		if (prov=='voir') {form_pdf.action="./docpdf.php?go="+paramurl;form_pdf.target='blank';form_pdf.submit();}
		if (prov=='enregistrer') {form_pdf.action="./docpdf.php?go="+paramurl+"&save=yes";form_pdf.target='';form_pdf.submit();}
	}
}
//fonction pour compter le nombre de caracteres saisies dans un textarea
function compter(txtarea,nbinput,max) {
	
	var valeur=txtarea.value;
	var nb=valeur.length;
	if (nb>max) { 
		alert("Pas plus de "+max+" caractères dans ce champ !!");
		txtarea.value=valeur.substring(0,max);
		nb=max;
	}
	nbinput.value=nb;
}
function timer() {
	if (document.form_MAJmodif) compter(document.form_MAJmodif.description,document.form_MAJmodif.nbcar,455);
	if (document.form_ajout) compter(document.form_ajout.description,document.form_ajout.nbcar,455);
	setTimeout("timer()",100);
}
//fonction pour faire une alert suite a l'envoi d'email via rubrique contact popup popmail
function messagebox(param)
{
	if (param=="mailok") {
		alert("Votre email à été envoyé avec succés.") ;
		window.close();
	}
	if (param=="confirmraz") {
		var oki=confirm("Voulez vous vraiment initialiser le compteur de visiteurs ?") ;
		if (oki==true){
			location.href="./MAJstats.php?go=raz";
			
		}
	}
}

/******************************************************************************
 *                                                                            *
 *  Fonctions de verification de formulaire                                   *
 *                                                                            * 
 *  ***************************************************************************/  
//expressions regulieres
var exp_nom = /[a-zA-Z\s\-]{1,25}/ ;
var exp_prenom = /[a-zA-Z\s\-]{1,25}/;
var exp_numrue = /\d{0,5}/;
var exp_rue = /\w{1,40}/;
var exp_cp=/[0-9][0-9]\d{3}/;
var exp_ville=/[a-zA-Z\-\s]{1,25}/;
var exp_email=/^[a-z][a-z_0-9\.]+@[a-z_0-9\.]+\.[a-z]{2,3}$/i;
var exp_pssw = /\w{4,25}/;
var exp_login = /\w{4,25}/;
var exp_tel = /\d{10}/;
var exp_surface = /^\d{0,10}$/;
var exp_prix = /^\d{0,10}$/;
var exp_jpg = /^.*[\.]{1}[j]{1}[p]{1}[e]?[g]{1}$/i;
var exp_ref = /^[a-zA-Z0-9]{0,10}$/;


//initialisation des variables necessaire pour la verif du formulaire
var message="";
var msgbox=false;
var blank="";

//fonction de validation d'expression
function isValid(pattern, str){
    return pattern.test(str);
}
//fonction de construction du message d'erreur
var cpt=0;
function buildmess(champ) {
         //alert ("coucou");
    msgbox=true;
    cpt++;
    message+=blank+champ;
    if (blank=="") {
       blank = ", " ;
    }
}
//fonction de verification de formulaire
function veriform(form){
	if (form.name=="form_MAJpassword") {

		if (!isValid(exp_pssw,form.newpssw2.value) || (form.newpssw1.value!=form.newpssw2.value)){
		  buildmess("Confirmer mot de passe");
		  form.newpssw1.value="";
		  form.oldpssw.value="";
		  form.newpssw2.value="";
		  form.oldpssw.focus();
		} 
		if (!isValid(exp_pssw,form.newpssw1.value)){
		  buildmess("Nouveau mot de passe");
		  form.newpssw1.value="";
		  form.oldpssw.value="";
		  form.newpssw2.value="";
		  form.oldpssw.focus();
		} 
		if (!isValid(exp_pssw,form.oldpssw.value)){
		  buildmess("Mot de passe actuel");
		  form.newpssw1.value="";
		  form.oldpssw.value="";
		  form.newpssw2.value="";
		  form.oldpssw.focus();
		}
		if (!isValid(exp_login,form.login.value)){
		  buildmess("Login");
		  form.login.value="";
		  form.login.focus();
		} 
	}
	if (form.name=="form_login") {
		if (!isValid(exp_login,form.login.value)){
		  buildmess("Login");
		  form.login.value="";
		  form.login.focus();
		} 
		if (!isValid(exp_pssw,form.password.value)){
		  	buildmess("Mot de passe");
		  	form.password.value="";
			if (!isValid(exp_login,form.login.value)){
				form.login.focus();
			} else {
				form.password.focus();
			}
		} else {
			if (!isValid(exp_login,form.login.value)) {
					form.password.value="";
			}
		}
		
    }	
	if (form.name=="form_achat") {

       if (!isValid(exp_prix,form.pxmax.value)){
          buildmess("Prix max");
          form.pxmax.value="";
          form.pxmax.focus();
       }
       if (!isValid(exp_prix,form.pxmin.value)){
          buildmess("Prix min");
          form.pxmin.value="";
          form.pxmin.focus();
       }
       if (!isValid(exp_surface,form.surftermax.value)){
          buildmess("Surface terrain max");
          form.surftermax.value="";
          form.surftermax.focus();
       }
       if (!isValid(exp_surface,form.surftermin.value)){
          buildmess("Surface terrain min");
          form.surftermin.value="";
          form.surftermin.focus();
       }
       if (!isValid(exp_surface,form.surfmax.value)){
          buildmess("Surface habitable max");
          form.surfmax.value="";
          form.surfmax.focus();
       }
       if (!isValid(exp_surface,form.surfmin.value)){
          buildmess("Surface habitable min");
          form.surfmin.value="";
          form.surfmin.focus();
       }
    }
    
    if (form.name=="form_mail") {

       if (form.commentaire.value==""){
          buildmess("Commentaire");
          form.commentaire.value="";
          form.commentaire.focus();
       }
       if (form.sujet.value==""){
          buildmess("Sujet");
          form.sujet.value="";
          form.sujet.focus();
       }
       if (!isValid(exp_email,form.email.value)){
          buildmess("E-mail");
          form.email.value="";
          form.email.focus();
       }
    }

    if (form.name=="form_vente") {
		
			   if ((form.villebien.value!='') && (!isValid(exp_ville,form.villebien.value))){
				  buildmess("Commune");
				  form.villebien.value="";
				  form.villebien.focus();
			   }
			   if ((form.surfter.value!='') && (!isValid(exp_surface,form.surfter.value))){
				  buildmess("Surface terrain");
				  form.surfter.value="";
				  form.surfter.focus();
			   }
			   if ((form.surfhab.value!='') && (!isValid(exp_surface,form.surfhab.value))){
				  buildmess("Surface habitable");
				  form.surfhab.value="";
				  form.surfhab.focus();
			   }
			   /*if ((form.email.value!='') && (!isValid(exp_email,form.email.value))){
				  buildmess("Email");
				  form.email.value="";
				  form.email.focus();
			   }*/
			   if ((form.email.value!='') && (!checkEmail(form.email.value))){
				  buildmess("Email");
				  form.email.value="";
				  form.email.focus();
			   }
			   if ((form.fax.value!='') && (!isValid(exp_tel,form.fax.value))){
				  buildmess("Fax");
				  form.fax.value="";
				  form.fax.focus();
			   }
               if (!isValid(exp_tel,form.telephone.value)){
                  buildmess("Téléphone");
                  form.telephone.value="";
                  form.telephone.focus();
               }
				if ((form.ville.value!='') && (!isValid(exp_ville,form.ville.value))){
				  buildmess("Ville");
				  form.ville.value="";
				  form.ville.focus();
			   }
				if ((form.cp.value!='') && (!isValid(exp_cp,form.cp.value))){
				  buildmess("Code Postal");
				  form.cp.value="";
				  form.cp.focus();
			   }
				if ((form.adresse2.value!='') && (!isValid(exp_rue,form.adresse2.value))){
				  buildmess("Adresse2");
				  form.adresse2.value="";
				  form.adresse2.focus();
			   }
				if ((form.adresse1.value!='') && (!isValid(exp_rue,form.adresse1.value))){
				  buildmess("Adresse1");
				  form.adresse1.value="";
				  form.adresse1.focus();
			   }
				if ((form.prenom.value!='') && (!isValid(exp_prenom,form.prenom.value))){
				  buildmess("Prénom");
				  form.prenom.value="";
				  form.prenom.focus();
			   }
               if (!isValid(exp_nom,form.nom.value)){
                  buildmess("Nom");
                  form.nom.value="";
                  form.nom.focus();
               }
     }
	if ((form.name=="form_ajout") || (form.name=="form_MAJmodif")) {

		   if ((form.email.value!='') && (!checkEmail(form.email.value))){
			  buildmess("Email");
			  form.email.value="";
			  form.email.focus();
		   }
		   if ((form.fax.value!='') && (!isValid(exp_tel,form.fax.value))){
			  buildmess("Fax");
			  form.fax.value="";
			  form.fax.focus();
		   }
		   if (!isValid(exp_tel,form.tel.value)){
			  buildmess("Téléphone");
			  form.tel.value="";
			  form.tel.focus();
		   }
		   if (!isValid(exp_ville,form.ville.value)){
			  buildmess("Ville");
			  form.ville.value="";
			  form.ville.focus();
		   }
		   if (!isValid(exp_cp,form.cp.value)){
			  buildmess("Code Postal");
			  form.cp.value="";
			  form.cp.focus();
		   }
		   if ((form.adresse2.value!='') && (!isValid(exp_rue,form.adresse2.value))){
			  buildmess("Adresse2");
			  form.adresse2.value="";
			  form.adresse2.focus();
		   }
		   if (!isValid(exp_rue,form.adresse1.value)){
			  buildmess("Adresse1");
			  form.adresse1.value="";
			  form.adresse1.focus();
		   }
		   if (form.prenom.value != "" && !isValid(exp_prenom,form.prenom.value)){
			  buildmess("Prénom");
			  form.prenom.value="";
			  form.prenom.focus();
		   }
		   if (!isValid(exp_nom,form.nom.value)){
			  buildmess("Nom");
			  form.nom.value="";
			  form.nom.focus();
		   }
		   if (form.description.value==''){
			  buildmess("Description");
			  form.description.value="";
			  form.description.focus();
		   }
		   if ((form.surfterrain.value!='') && (!isValid(exp_surface,form.surfterrain.value))){
			  buildmess("Surface terrain");
			  form.surfterrain.value="";
			  form.surfterrain.focus();
		   }
		   if ((form.surfhabitable.value!='') && (!isValid(exp_surface,form.surfhabitable.value))){
			  buildmess("Surface habitable");
			  form.surfhabitable.value="";
			  form.surfhabitable.focus();
		   }
		   if ((form.nbpiece.value!='') && (!isValid(exp_surface,form.nbpiece.value))){
			  buildmess("Nb de pièces");
			  form.nbpiece.value="";
			  form.nbpiece.focus();
		   }
		   if (form.zonegeo.value==0){
			  buildmess("Zone géographique");
			  form.zonegeo.focus();
		   }
		   if (!isValid(exp_prix,form.prix.value)){
			  buildmess("Prix");
			  form.prix.value="";
			  form.prix.focus();
		   }
		   if (!isValid(exp_ville,form.lieu.value)){
			  buildmess("Lieu");
			  form.lieu.value="";
			  form.lieu.focus();
		   }
		   if (!isValid(exp_ref,form.reference.value)){
			  buildmess("Référence");
			  form.reference.value="";
			  form.reference.focus();
		   }
		   if (form.type.value==0){
			  buildmess("Type");
			  form.type.focus();
		   }
		   /*if ((form.photo.value!='')&&(!isValid(exp_jpg,form.photo.value))){
			  buildmess("Photo non au format jpg");
		   }*/
		   
	}
   if (msgbox==true) {
	   if (cpt>1) {
       	alert("Saisie invalide pour les champs : " + message);
	   } else {
		 alert("Saisie invalide pour le champ : " + message);  
	   }
       message="";
       blank="";
       msgbox=false;

   } else {
       form.submit() ;
   }
}
/******************************************************************************/


