function xhide(n) {
	document.getElementById(n).style.display = 'none';
}

function xshow(m) {
	document.getElementById(m).style.display = '';
}

function confirmation(message) {
		return confirm(message);
}

function load_ajax(area, url) 
{
	var XHR = new XHRConnection();
	document.getElementById(area).innerHTML = "...";
	XHR.setRefreshArea(area);
	XHR.sendAndLoad(url, "GET");
	return true;
}


function js_pwgen (nb_chars)
{
    var keylist = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    var password = '';

    for(var i = 0 ; i < parseInt(nb_chars); i++)
    {
        password += keylist.charAt(Math.floor(Math.random()*keylist.length));       
    }
    return password;
}

function fill_password (nb_chars)
{
    var form = document.form_utilisateur; // à remplacer par le bon nom de formualire
    form.pwd.value = js_pwgen(nb_chars); // à remplacer par le bon nom de champ
}


//popup
var newWin = null;
function closeWin(){
	if (newWin != null){
		if(!newWin.closed)
			newWin.close();
	}
}

function popUp(strURL,strType,strHeight,strWidth) {
	closeWin();
	var strOptions="";
	if (strType=="console") strOptions="resizable,scrollbars,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
}

var ie_fix = 0;
function send_form(poststr, div, url)	{
        document.getElementById(div).innerHTML='<div style=""><!-- --></div>';
				xmlHttp=GetXmlHttpObject();
				if (xmlHttp==null)
				{
					alert ("Browser does not support HTTP Request");
					return;
				}
				xmlHttp.onreadystatechange=function ()
					{
						if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
							{
								document.getElementById(div).innerHTML=xmlHttp.responseText;
								
								if(ie_fix==0)
								{
								window.scrollBy(0,1);
								ie_fix = 1;
								 }
								else {window.scrollBy(0,-1); ie_fix = 0;} 
							} 
					}

				xmlHttp.open('POST', url, true);
				xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				xmlHttp.setRequestHeader("Content-length", poststr.length);
				xmlHttp.setRequestHeader("Connection", "close");
				xmlHttp.send(poststr);
			}
      
function GetXmlHttpObject()
  { 
    var objXMLHttp=null
    if (window.XMLHttpRequest)
			{
        objXMLHttp=new XMLHttpRequest()
      }
			else if (window.ActiveXObject)
			{
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
			}
      return objXMLHttp
  }
  
  function do_form_moteur_recherche(obj,x) {
	transaction=document.getElementById(obj).ddl_transaction.value;
	bien=document.getElementById(obj).ddl_bien.value;
	prix=document.getElementById(obj).ddl_prix.value;
	lieu=document.getElementById(obj).ddl_lieu.value;
	if(x == 1)
	{
		bien = "";
		prix = "";
		lieu = "";
	}
	if(x == 2)
	{
		prix = "";
		lieu = "";
	}
	if(x == 3)
	{
		lieu = "";
	}
	var poststr = "transaction="+ transaction +"&bien="+ bien +"&prix=" + prix+"&lieu=" + lieu;
	send_form(poststr,'recherche', 'ajax/recherche.php');
  
  }
  
  function submit_recherche(page,orderby,classement)
  {
	document.getElementById('form_recherche').index_page.value = page;
	document.getElementById('form_recherche').orderby.value = orderby;
	document.getElementById('form_recherche').classement.value = classement;
	document.form_recherche.submit();
  }

  function check_all(x)
  {
  }
  
