var  envoi = false ;
function  affiche_photo(x) {
	var chemin ='defile.php?id='+x ;
	envoi = window.open(chemin,'PHOTOS','height=500,width=600');
}


function PopupImage(img) {
        titre="Murat Immobilier";
        w=open("",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=yes');
        w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
        w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
        w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0 onClick='window.close();'>");
        w.document.write("");
        w.document.write("</BODY></HTML>");
        w.document.close();
}
function retour() {
	window.history.back();
}

//koddi 20060622
function PopupPicture(URL) { 

 // hauteur=300;
  //largeur=300;563

  hauteur=853;
  largeur=375;
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open("popup.php?"+URL, "", "top="+top+",left="+left+",width="+largeur+",height="+hauteur+",resizable=1");
}
function get_element(id)
{
if (document.getElementById) 
myElementRef = document.getElementById(id);
else if (document.all) myElementRef = document.all[id]; 
else if (document.layers) myElementRef = document.layers[id];
return myElementRef;
}
//---------------------------------------------------
//fonction de la suppression d'une annonce
function verify(){ 
msg = "ATTENTION, vous êtes sur le point de supprimer dévinitivement une annonce, \"OK\" pour valider votre choix, ou \"ANNULER\""; 
return confirm(msg); 
} 

// fonbction  disabled
function pocheck(){
if (document.form.nom.value!=''	&& document.form.email.value!='' && document.form.control.value!=''){
document.form.envoi.disabled=false; 
	}
else{
document.form.envoi.disabled=true; 	
}
}

//fonction de validation des champs du formulaire	contact.php
function estnum(y) {
	var temoin="0123456789/"
	for (i=0;i<y.length;i++) {
		c=y.substring(i,i+1)
		if (temoin.indexOf(c,0)==-1) return false
	}
	return true
}
function validForm() {
//contrôle des champs obligatoires
	if (document.form.nom.value=='') {
		alert ("Merci de saisir votre Nom")
		document.form.nom.focus();
		return false;
	}
	if (estnum(document.form.phone.value)==false) {
		alert("Merci de saisir du numérique")
		document.form.phone.focus()
		return false
	}
	if (document.form.phone.value.length<10) {
		alert("Votre Numéro de Tel sur 10 chiffres")
		document.form.phone.focus()
		return false
	} 	
	
if(document.form.control.value!=document.form.control_rep.value){
		alert("Réponse fausse dans le contrôle anti-spam : merci de vérifier votre calcul...");
		document.form.control.focus();
		return false;
		}
return true;
	
}

function validIdForm() {
	var oForm = document.form_id;
	if (oForm.agentname.value=='') {
		alert ("Merci de saisir votre Login")
		oForm.agentname.focus();
		return false;
	}
	if (oForm.agentpassword.value=='') {
		alert ("Merci de saisir votre Mot de passe")
		oForm.agentpassword.focus();
		return false;
	}
	return true;
}

function validRech() {
//contrôle des champs obligatoires
	if (document.rech.title.value==''){
		alert ("Merci de choisir une Rubrique")
		document.rech.title.focus();
		return false;
	}

	return true;
}