function check(){
				if(!document.getElementById('civilite1').checked && !document.getElementById('civilite2').checked && !document.getElementById('civilite3').checked){
					alert('Merci de donner votre civilite !');
					return false;
				}
				if(document.getElementById('nom').value == ""){
					alert('Merci de donner votre nom !');
					return false;
				}
				if(document.getElementById('teldom').value == "" && document.getElementById('telbur').value == "" && document.getElementById('telpor').value == ""){
					alert('Merci de donner au moins un numero de telephone !');
					return false;
				}
				if(document.getElementById('femail').value != document.getElementById('femail2').value || document.getElementById('femail2').value == ""){
					alert('Votre email comporte une erreur, merci de bien vouloir ressaisir cette information !');
					return false;
				}
				if(document.getElementById('fpassword').value != document.getElementById('fpassword2').value || document.getElementById('fpassword2').value == ""){
					alert('Votre mot de passe comporte une erreur, merci de bien vouloir ressaisir cette information !');
					return false;
				}
				return true;
			}
function selectAll(s){
		var n = ".count($tmp).";
		//var s = !document.getElementById('ville0').checked;
		for(var i=0;i<n;i++){
			if(document.getElementById('ville'+i)){
				document.getElementById('ville'+i).checked = s;
			}
		}
	}
function openpopup(arg){
				var xx=screen.width/2-250;
				var yy=screen.height/2-200;
				pop=window.open(arg,'','toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,copyhistory=0,menuBar=0,scrollbar=no,width=520,height=400,left='+xx+',top='+yy);
			}
			function ville (n){
				opener.ajoutville(n);
				window.close();
			}
			function ajoutville(n){
				with(document.forms["recherche"]){
					t=0;
					while (eval("ville"+t).value!="")t++;
					eval ("ville"+t).value=n;
					
				}
			}
			function defAlerte(){
				document.forms["recherche"].lanceur.value='alertes';
			}
			function openpopup3(arg){
				var xx=screen.width/2-400;
				var yy=screen.height/2-300;
				pop=window.open(arg,'','toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,copyhistory=0,menuBar=0,scrollbar=no,width=580,height=400,left='+xx+',top='+yy);
			}
			function openpopup4(arg){
				var xx=screen.width/2-400;
				var yy=screen.height/2-300;
				pop=window.open(arg,'','toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,copyhistory=0,menuBar=0,scrollbar=no,width=640,height=400,left='+xx+',top='+yy);
			}
			//Visite virtuelle
			function openvisite(arg){
				var xx=screen.width/2-400;
				var yy=screen.height/2-300;
				arg = arg.replace('_',' ');
				pop=window.open(arg,'','toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,copyhistory=0,menuBar=0,scrollbar=no,width=730,height=490,left='+xx+',top='+yy);
			
			}
			function openjpeg(arg,ww,hh){
				var xx=screen.width/2-ww/2;
				var yy=screen.height/2-hh/2;
				arg = arg.replace('_',' ');
				pop=window.open(arg,'','toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,copyhistory=0,menuBar=0,scrollbar=no,width='+ww+',height='+hh+',left='+xx+',top='+yy);
			
			}
			
var x;
			var y;
			 function position(e) {
			 	 x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
			 	 y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
			}
			
			if (navigator.appName.substring(0,3) == "Net") document.captureEvents(Event.MOUSEMOVE);
			document.onmousemove = position;
			
			function popupcentree(page,largeur,hauteur,options){
			var top=(screen.height-hauteur)/2;
			var left=(screen.width-largeur)/2;
			window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
			}
			function ariane(txt,u){
				document.getElementById('ariane').innerHTML = "Vous etes dans : "+txt;
				if(u != ""){
					document.getElementById('ret_ariane').innerHTML = "<a href='"+u+"'>&lt;&lt; Retour</a>";
				}
			}

			function delFav(id){
				if(!confirm("Etes-vous sur de vouloir retirer ce bien de votre selection ?")){
					return false;
				}
				if(document.getElementById('mail_sel').value == ''){
					document.getElementById('mail_sel_redirect').value = 0;
					document.getElementById('mail_sel_id').value = id;
					document.getElementById('mail_sel').style.top = y + 25;
					document.getElementById('mail_sel').style.left = x - 200;
					document.getElementById('mail_sel').style.display = 'inline';
					return;
				}
				data = "id="+id+"&amp;email="+document.getElementById('email_sel').value;
				if(window.XMLHttpRequest) // FIREFOX
			         xhr = new XMLHttpRequest();
			    else if(window.ActiveXObject) // IE
			         xhr = new ActiveXObject("Microsoft.XMLHTTP");
			    else
			         return(false);
				xhr.open("POST", "./page.php?action=delFav", false);
				xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  
				xhr.send(data);
			    data = xhr.responseText;
			    document.getElementById('i'+id).style.display = 'none';
			    document.getElementById('2i'+id).style.display = 'none';
			    if(data == 'ok'){
					alert("Le bien a ete supprime de votre selection.");
				}
				return false;
			}
			
			function addFav(id){
				if(document.getElementById('email_sel').value == ''){
					document.getElementById('mail_sel_redirect').value = 0;
					document.getElementById('mail_sel_id').value = id;
					document.getElementById('mail_sel').style.top = y + 25;
					document.getElementById('mail_sel').style.left = x - 200;
					document.getElementById('mail_sel').style.display = 'inline';
					return;
				}
				data = "id="+id+"&amp;email="+document.getElementById('email_sel').value;
				if(window.XMLHttpRequest) // FIREFOX
			         xhr = new XMLHttpRequest();
			    else if(window.ActiveXObject) // IE
			         xhr = new ActiveXObject("Microsoft.XMLHTTP");
			    else
			         return(false);
				xhr.open("POST", "./page.php?action=fav", false);
				xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  
				xhr.send(data);
			    data = xhr.responseText;
				alert("Le bien a ete ajoute à votre selection.");
			}
			
			function sendSelAll(){
				data = "email="+document.getElementById('email2').value;
				if(window.XMLHttpRequest) // FIREFOX
			         xhr = new XMLHttpRequest();
			    else if(window.ActiveXObject) // IE
			         xhr = new ActiveXObject("Microsoft.XMLHTTP");
			    else
			         return(false);
				xhr.open("POST", "./page.php?action=mailSelAll", false);
				xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  
				xhr.send(data);
			    data = xhr.responseText;
			    document.getElementById('sel_rep').innerHTML = '<font color="#00FF40">'+"L'email a bien ete envoye a "+document.getElementById('email2').value+"."+'</font>';
			}
			
			function sendFriend(u){
				document.getElementById('mail').style.display = 'none';
				data = "url="+u;
				data += "&amp;email="+document.getElementById('email').value;
				if(window.XMLHttpRequest) // FIREFOX
			         xhr = new XMLHttpRequest();
			    else if(window.ActiveXObject) // IE
			         xhr = new ActiveXObject("Microsoft.XMLHTTP");
			    else
			         return(false);
				xhr.open("POST", "./page.php?action=mailF", false);
				xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  
				xhr.send(data);
			    data = xhr.responseText;
			    if(data == 'ok'){
					alert("L'email a bien ete envoye a "+document.getElementById('email').value+".");
				}
				else{
					alert('erreur');
				}
			}
			
			function mailFriend(){
				document.getElementById('mail').style.top = y + 25;
				document.getElementById('mail').style.left = x - 200;
				document.getElementById('mail').style.display = 'inline';
			}
			
			function mailSel(){
				if(document.getElementById('mail_sel').value == ''){
					document.getElementById('mail_sel_redirect').value = 1;
					document.getElementById('mail_sel').style.top = y + 25;
					document.getElementById('mail_sel').style.left = x - 200;
					document.getElementById('mail_sel').style.display = 'inline';
				}
				else{
					document.location.href = './page.php?menu=8&amp;type=sel';
				}
			}
			
			function sendSelOk(){
				document.getElementById('mail_sel').style.display = 'none';
				 if(document.getElementById('mail_sel_redirect').value == 1){
					data = "email="+document.getElementById('email_sel').value;
					if(window.XMLHttpRequest) // FIREFOX
				         xhr = new XMLHttpRequest();
				    else if(window.ActiveXObject) // IE
				         xhr = new ActiveXObject("Microsoft.XMLHTTP");
				    else
				         return(false);
					xhr.open("POST", "./page.php?action=mail_sel", false);
					xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  
					xhr.send(data);
				    data = xhr.responseText;
				    if(data != 'ok'){						
				    	alert("Vous devez ajouter au moins un bien a votre selection pour acceder a cette rubrique");
				    	/*document.getElementById('email_sel').value = '';
				    	mailSel();*/
				    	return false;
				    }
			    	document.location.href = './page.php?menu=8&amp;type=sel';
			    }
			    else{
			    	addFav(document.getElementById('mail_sel_id').value);
			    }
			}
			
			
			function viewBien(){
				data = "login="+document.getElementById('login_vendre').value;
				data += "&amp;pw="+document.getElementById('pw_vendre').value;
				if(window.XMLHttpRequest) // FIREFOX
			         xhr = new XMLHttpRequest();
			    else if(window.ActiveXObject) // IE
			         xhr = new ActiveXObject("Microsoft.XMLHTTP");
			    else
			         return(false);
				xhr.open("POST", "./page.php?action=my_sale", false);
				xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  
				xhr.send(data);
			    data = xhr.responseText;
			    if(data.indexOf('ko') > -1){
			    	document.getElementById('err_vendre').style.display = 'inline';
			    	return;
			    }
			    else{
			    	document.location.href = data;
			    	return;
			    }
			}
