// -- Fonction pour ouvrir une popup avec l'image correspondant à la référence en entrée dans le répertoire images/maisons
function apercu(ref){
	html ='<html><head><title>Thiviers-Immobilier.com - Aperçu de la référence '+ref+'</title>';
	html+='<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">';
	html+='</head><body bgcolor=#FFFF99 text=#000000 link=#000000 vlink=#000000 alink=#000000>';
	html+='<div align=center><img src="images/commun/logo_details.gif" width=200 height=18></div><br>';
	html+='<table width=440 border=0 cellspacing=0 cellpadding=0 align=center><tr>';
	html+='<td background="images/commun/fon_details.gif" height=300 align=center>';
	html+='<img src="images/maisons/'+ref+'.jpg" width=400 height=275 border=1></td>';
	html+='</tr></table><br><table border=0 cellspacing=0 cellpadding=0 height=25 align=center>';
	html+='<tr><td background="images/commun/boutfon.gif" width=120 align=center><b>';
	html+='<a href="javascript:window.close();"><font face=Verdana size=1>FERMER</font></a></b></td>';
	html+='</tr></table></body></html>';
	var f=window.open("about:blank","fenetre","height=410,width=500");
	f.document.write(html);
	f.focus();
}
// -- Fonction pour ouvrir une popup avec l'image et le titre de l'article (utilisé dans le catalogue)
function popup(image,titre){
	html ='<base href="http://thiviers-immobilier.com">';

	html+='<html><head><title>Thiviers-immobilier.com - Aperçu</title>';
	html+='<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">';
	html+='</head><body bgcolor=#FFFF99 text=#000000 link=#000000 vlink=#000000 alink=#000000>';
	html+='<div align=center><img src="images/commun/logo_details.gif" width=200 height=18></div><br>';
	html+='<table width=440 border=0 cellspacing=0 cellpadding=0 align=center><tr>';
	html+='<td background="images/commun/fon_details.gif" height=300 align=center>';
	html+='<img src="'+image+'" width=400 height=275 border=1></td>';
	html+='</tr></table><br><table border=0 cellspacing=0 cellpadding=0 height=25 align=center>';
	html+='<tr><td background="images/commun/boutfon.gif" width=120 align=center><b>';
	html+='<a href="javascript:window.close();"><font face=Verdana size=1>FERMER</font></a></b></td>';
	html+='</tr></table></body></html>';
	var f=window.open("about:blank","fenetre","height=410,width=500");
	f.document.write(html);
	f.focus();
}
// -- Fonctions standards macromedia (gestion du formulaire)
function MM_findObj(n, d) { //v3.0
  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); return x;
}
function MM_validateForm() { //v3.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+='- Le champ '+nm+' doit contenir une adresse mail valide.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- Le champ '+nm+' doit contenir un nombre.\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+='- Le champ '+nm+' doit contenir un nombre entre '+min+' et '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- Le champ '+nm+' est obligatoire.\n'; }
  } if (errors) alert('Il y a des erreurs sur les champs suivants :\n'+errors);
  document.MM_returnValue = (errors == '');
}