
function none() { return; }

function getRef(id)
{   

var obj;
  if (document.getElementById&&!document.all) {
    obj = document.getElementById(id);
	} else if (document.all) { //IE 4 et +
		obj = eval('document.all.'+id);
	} else {
	}
  return obj;
}


function popupVendu (url) {
	//var options = "width=800,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,";
	var options = "width=800,height=400,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no";
	var name = "popup";
	var popWin = window.open(url, name, options);
	popWin.focus();
	
}


function view_annonce (id) {
    var url = "/transaction_bien.php?id="+id;
    var name = "popup";
    var options = "height=550,width=765,toolbar=yes,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no";
    a = window.open (url, name, options);
    a.focus();
}

function view_annonce_loc (id) {
    var url = "/location_bien.php?id="+id;
    var name = "popup";
    var options = "height=550,width=765,toolbar=yes,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no";
    a = window.open (url, name, options);
    a.focus();
}

// Encodage de l'URL
function urlencode (str) {
    var newstr;
    newstr = str.replace (/&/g, "%26");
    return newstr;
}

	
// Imprimer
function vprint () {
  from = ""+self.location+"";
	motif = /\?/;
	if (from.search(motif)==-1)
		var url = from+"?print=1";
	else
		var url = from+"&print=1";
//  openMini2 (url,380,465);
	var options = "toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=650,height=500";
	var name = "POPUP";
	var popWin = window.open(url, name, options);
	popWin.focus();
}
  
function confirmAction (action, id) {
  from = ""+self.location+"";
  from = urlencode(from);
  if(confirm("Etes-vous sûr ?"))
    self.location = home+page+"?page=action&action="+action+"&id="+id+"&from=" + from;
}  
function confirmAlert (action, id) {
  from = ""+self.location+"";
  from = urlencode(from);
  if(confirm("Avertir les modérateurs ?"))
    self.location = home+page+"?page=action&action="+action+"&id="+id+"&from=" + from;
}  
function confirmUnalert (action, id) {
  from = ""+self.location+"";
  from = urlencode(from);
  if(confirm("Supprimer l'alerte ?"))
    self.location = home+page+"?page=action&action="+action+"&id="+id+"&from=" + from;
}  
  
  
  
function submitonce(theform) {
 if (document.all || document.getElementById) {
  // hunt down "submit" and "reset"
  for (i=0;i<theform.length;i++) {
   var tempobj=theform.elements[i];
   if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") {
    tempobj.disabled=true;
   }
  }
 }
}

function submitmultiple(theform) {
 if (document.all || document.getElementById) {
  // hunt down "submit" and "reset"
  for (i=0;i<theform.length;i++) {
   var tempobj=theform.elements[i];
   
  }
 }
}



function askConfirm (libelle, url) {
  from = ""+top.location+"";
  from = urlencode(from);
  if(confirm(libelle))
//    top.location = url;
    top.location = url+"&from=" + from;
}  

function click_photo (image, width, height, maxi) {
	var img = parent.getRef ("img_preview");
	if (img) {
		img.src = image;
		if (width>maxi || height>maxi) {
			if (width/maxi > height/maxi) {		// Trop large !
				img.style.width = (width*maxi/width)+"px";
				img.style.height = (height*maxi/width)+"px";
			} else {
				img.style.width = (width*maxi/height)+"px";
				img.style.height = (height*maxi/height)+"px";
			}			
		} else {
			img.style.width = width+"px";
			img.style.height = height+"px";
		}
		//img.style.width="200px";
	}
}

function contact (reference) {
  if (window.opener) {
    window.opener.location = "/contact.php?reference=" + reference+"#online";
    self.close();
  } else
    self.location = "/contact.php?reference=" + reference+"#online";
}

function popupSecteurs2 (field) {
  var obj = getRef (field);
	var url = "/secteurs.php?field="+field+"&secteur="+obj.value;
	var options = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=650,height=400";
	var name = "POPUP";
	var popWin = window.open(url, name, options);
	popWin.focus();
}
function selectPopupValSecteur (field, value, Lib) {
  var obj = window.opener.getRef (field);
  obj.value = value;
  var objLib = window.opener.getRef (field+"Lib");
  objLib.innerHTML = Lib;
	self.close();
	window.opener.focus();
}
function setPopupNo (fieldName) {
  var obj = getRef (fieldName);
  var objLib = getRef (fieldName+"Lib");
	if (obj) obj.value = "";
	if (objLib) objLib.innerHTML = "";
}


