var last_idclient = 10; 

var timm = 0;

function gestionClic(id,ref)
{                  
    document.getElementById("contenue_fen_superpose_1").innerHTML = '';       
    gest_div_black();     
    var url = 'http://'+window.location.host+'/requette_selection.php';
    var myAjax = new Ajax.Updater('contenue_fen_superpose_1', url, {method: 'get',parameters:'idannonce='+id});                          
    //gest_div_black()  
}                    
function gest_div_black()
{
    displaySubs('fen_superpose_1'); 
}
    
function gestionReponse_selection(xhr)
{
    if (xhr.status == 200)     
        $('resultat').innerHTML = xhr.responseText;   
    else                                              
        $('resultat').innerHTML = xhr.status;          
}

function div_vider()
{                                                   
    //new Effect.BlindUp('zone_annonceur_contenue'); 
    Effect.toggle('zone_annonceur_contenue', 'blind', {duration:0.3});         
    //document.getElementById("zone_annonceur_contenue").innerHTML = ''; 
    last_idclient =  0; 
}  
function getHTML(id,ref,idclient)
{           
        document.getElementById("contenue_fen_superpose_1").innerHTML = ''; 
		var url = url_site+'contact_annonceur.php';  
        var myAjax = new Ajax.Updater('contenue_fen_superpose_1', url, {method: 'get',parameters:'id='+id+'&ref_annonce='+ref+'&idclient='+idclient});        
}                                                                   
function getHTML_annonceur(idclient)
{       
    if(last_idclient == 0) 
        new Effect.BlindDown('zone_annonceur_contenue', {duration:0.3});                                            
    if(idclient > 0 && (last_idclient != idclient))
    {                                                                   
        var url = 'http://'+window.location.host+'/div_annonceur_droit.php';  
        var myAjax = new Ajax.Updater('zone_annonceur_contenue', url, {method: 'get',parameters:'idclient='+idclient});  
    }          
    clearTimeout(timm);timm = setTimeout('div_vider()', 15000);     
    last_idclient =  idclient;                                                                              
}                                                                                 
function getHTML_mem_recherche(idannonces_recherche,type_recherche,nom_recherche)
{     
	document.getElementById("contenue_fen_superpose_1").innerHTML = '';
    var url = 'http://'+window.location.host+'/memoriser_recherche.php';  
    var myAjax = new Ajax.Updater('contenue_fen_superpose_1', url, {method: 'get',parameters:'idannonces_recherche='+idannonces_recherche+'&type_alert_mail='+type_recherche+'&nom_alert_mail='+nom_recherche});                                                                                 
}
function submitForm_email_ami()
{    
    var pars = Form.serialize(document.form_contact_email_ami);   
	document.getElementById("contenue_fen_superpose_1").innerHTML = '';   
	var url = 'http://'+window.location.host+'/signal_ami.php';
    var myAjax = new Ajax.Updater('contenue_fen_superpose_1', url, {method: 'post',parameters:pars});     
}     
          

function submitF()
{                                                                                        
    var pars = Form.serialize(document.form_contact_annonceur); 
    var url = 'http://'+window.location.host+'/contact_annonceur.php';
    var myAjax = new Ajax.Updater('contenue_fen_superpose_1', url, {method: 'post',parameters:pars});     
}     
                     
function refresh_self() 
{
    window.location.replace("http://"+window.location.hostname+window.location.pathname); 

}   
function div_presensation_agence(id,localisation,no_div)
{                           
    document.getElementById("contenue_fen_superpose_1").innerHTML = '';
	var url = 'http://'+window.location.host+'/div_presensation_agence.php';  
    var myAjax = new Ajax.Updater('contenue_fen_superpose_1', url, {method: 'get',parameters:'idclient='+id+'&localisation='+localisation});  
       
	if(no_div == 1)
        displaySubs('fen_superpose_1');
}   
function pre_div_presensation_agence(id,localisation,no_div,time)
{
    if(time > 0)
    {
	    var url = 'http://'+window.location.host+'/div_presensation_agence_reload.php';  
        var myAjax = new Ajax.Updater('contenue_fen_superpose_1', url, {method: 'get',parameters:'idclient='+id+'&localisation='+localisation}); 
    }
    else
        document.getElementById("contenue_fen_superpose_1").innerHTML = '';   
}                               
function aller_lien_annonce(url)
{
  window.location.href = url;       
}                              
function div_charge_annonce(urldestination,time)
{                                                                                     
    displaySubs('fen_superpose_1');  
    if(document.getElementById("contenue_fen_superpose_1").innerHTML != '')                  
        setTimeout("aller_lien_annonce('"+urldestination+"');",2000);
    else              
    {
        document.getElementById("contenue_fen_superpose_1").innerHTML = '';                  
        aller_lien_annonce(urldestination); 
    }                                          
}
		           
  

