// JavaScript Document
function envoi(){	
document.getElementById("choix").submit()
}
function envoi2(){	
document.getElementById("panier").submit()
}

function favoris() {
if ( navigator.appName != 'Microsoft Internet Explorer' )
{ window.sidebar.addPanel("ERA GIP IMMOBILER","http://http://www.gip-immobilier.com",""); }
else { window.external.AddFavorite("http://www.gip-immobilier.com/","ERA GIP IMMOBILER"); } }


function printMe(quoi) {

	print_win = window.open("print-"+quoi+".html","popinfo",'width=730,height=800,directories=no,status=no,location=no,toolbar=no,scrollbars=yes,resize=no,menubar=no,copyhistory=no');
	print_win.focus();
	
}





//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

// pour requete
var  type="";
var  bd_min="";
var bd_max="";
var url="";
var VILLE_INTERNET="";

var NB_PIECES="";
var DATE_MODIF="";

function type_bien()
{
	
  type=document.getElementById("TYPE_OFFRE").value;
  


	if( type >0)
	{
	col();
	}
	else
	{
	type="";
	col();
	}
	


}


function nb_pieces()
{
	 NB_PIECES=document.getElementById("NB_PIECES").value;
	 if( NB_PIECES >0)
	{
	col();
	}
	else
	{
	NB_PIECES="";
	col();
	}
}


function bud_mini()
{
  bd_min=document.getElementById("prixmin").value;
  if(  bd_min==-1)
	{
	 bd_min="";
	}
}




function bud_maxi()
{ 
bd_max=document.getElementById("prixmax").value;

	if( bd_min=="" || bd_min>bd_max )
	{
		alert ("Le budget maximum ne peut être inférieur au budget minimum");
		q.prixmin.options[0].selected = true;
		q.prixmax.options[0].selected = true;
		
	}
	else
	{
		 if( bd_max >0)
			{
			col();
			}
		else
			{
			bd_max="";
			col();
			}
	}
	
}
function zone()
{
	VILLE_INTERNET=document.getElementById("VILLE_INTERNET").value;
	if(VILLE_INTERNET  !=-1)
	{
	col();
	}
	else
	{
	VILLE_INTERNET="";
	col();
	}



}



function coche_date()
{
	
	if(document.getElementById("DATE_MODIF").checked==1)
	{
	DATE_MODIF=document.getElementById("DATE_MODIF").value;
	col();
	}
	else
	{
	DATE_MODIF="";
	col();	
	}
	
	
	
}




function col()
{
url="aj/req.php?TYPE_OFFRE=" +type +"&NB_PIECES="+ NB_PIECES + "&min="+ bd_min +"&maxi="+ bd_max +"&VILLE_INTERNET="+ VILLE_INTERNET+"&DATE_MODIF="+DATE_MODIF;
/*alert(url);*/

getInfosClient();
clignote();	
}
/////////////////////////////////////////////////////////////


var nbclign = 4;
var v_nbclign=0;
var v_timer1 = null;

function clignGo(){
//	alert("ClignOn "+v_nbclign+" / "+nbclign);
	var MyObj = document.getElementById("cadre_resultat_recherche");
	if(MyObj.className=="cadre_resultat_recherche"){
		MyObj.className="cadre_resultat_recherche_hover";
		v_nbclign++;
	}else{
		MyObj.className="cadre_resultat_recherche";
	}
	if(v_nbclign >= nbclign){
		clearInterval(v_timer1);
		MyObj.className="cadre_resultat_recherche";
	}
//	alert("ClignOn "+v_nbclign+" / "+nbclign);
}

function clignote(){
//	alert("Lancement clignote");
	clearTimeout(v_timer1);
	v_timer1=null;
	v_nbclign=0;
	v_timer1 = setInterval("clignGo()",180);
}



/////////////////////////////////////////////////////////
   var requete = null;

   try {
     requete = new XMLHttpRequest();
   } catch (essaimicrosoft) {
     try {
       requete = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (autremicrosoft) {
       try {
         requete = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (echec) {
         requete = null;
       }
     }
   }
   
    if (requete == null)
     alert("Impossible de créer l'objet requête!");

   function getInfosClient() {
     //var infos = document.getElementById("num_carte").value;
     //var url = "inc/requete1.php?infos=" +
              // escape(infos);
     requete.open("GET", url, true);
     requete.onreadystatechange = affiche_res;
     requete.send(null);
	 
   }

   function affiche_res() {
     if (requete.readyState == 4) {
       /* Obtenir la réponse du serveur */
       var adresseClient = requete.responseText;

       /* Mettre à jour le formulaire */
/*       document.getElementById("fam").value =adresseClient;
*/
  
document.getElementById("resu").innerHTML=adresseClient;
	
//clignote();	
     }
	 }
	 
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////





	 
 