function ifDomStyleOn(astyle,on){
 if(on)var noon='block';else var noon='none';
if(document.getElementById(astyle)){document.getElementById(astyle).style.display=noon; return true;}else return false; 
}
 //
function selectRegion(idReg){
var f_endroit=document.forms["search"].endroit;  
if(f_endroit)f_endroit.value=idReg;
}
//
function creatImg(im){
var ims=im.src;
ims=ims.substring(0,ims.indexOf('&wmax'));        
return ims+'&wmax=600&hmax=450'; 
}
//
function makeImage(im,id,mona){ 
if(im){
ajaxer('SE/ajax_resp.php','&idFoto='+id+'&mona'+mona,'foto');                   
if(document.getElementById('g_img_'+id) && document.images["imgOne_"+id]){      
if(document.getElementById('legOne_'+id)) document.getElementById('legOne_'+id).innerHTML=im.title;  
if(document.images["imgOne_"+id]){
var srci=creatImg(im);              
document.images["imgOne_"+id].src=srci;
}}}
}
//
function retourList(){  if(cetInt){clearTimeout(cetInt); cetInt=null; }
ifDomStyleOn('pageFirst',1);
   ifDomStyleOn('gestionres3'); 
   ifDomStyleOn('gestionres',1);
   ifDomStyleOn('barre_bas',1);
   ifDomStyleOn('annonce'); 
   ifDomStyleOn('z_top',1);
if(trouve<=1){ 
if(divBeg)divBeg.innerHTML='';
if(divBarre_bas)divBarre_bas.innerHTML='';
if(isMapOn || !ifDomStyleOn('promoannonce')) initializeMaps(2); else altererPromo(); 
}
else   if(divGrAnnonce[ididixa])divGrAnnonce[ididixa].style.display='block';   
}
//
function messRab(){
var nvu=go+1;
var nextVu='<td >&nbsp; &nbsp;</td >';
var precVu='<td >&nbsp; &nbsp;</td >';
var goprec=id_ixa_page[go-1];
var gosuiv=id_ixa_page[go+1];
if((go-1)>=0)precVu="<td >&nbsp; &nbsp;<div onclick=\"showAnnonce('"+goprec+"')\" class='retourback'>-</div>&nbsp; &nbsp;</td >";
if((go+1)<ididixa)nextVu="<td >&nbsp; &nbsp;<div onclick=\"showAnnonce('"+gosuiv+"')\" class='retourback'>+</div>&nbsp; &nbsp;</td >";
var messAnnonc='<table cellspacing="0" cellpadding="0"><tr><td ><div onclick="retourList()" class="retourback">&nbsp;  &lt;&lt;'+messRetour+'&nbsp; &nbsp; </div></td><td>|</td> '+precVu+'<td>'+cestle+' '+nvu+' '+vuInfoOut(nvu)+'</td>'+nextVu+'</tr></table>';
return messAnnonc;
}
//
function reMakeAnnonce(goh){ clearTimeout(tret); 
go=goh;
ifDomStyleOn('pageFirst');
   ifDomStyleOn('gestionres');
   ifDomStyleOn('barre_bas');
   ifDomStyleOn('annonce',1); 
   ifDomStyleOn('z_top');
if(document.getElementById('gestionres3')){
document.getElementById('gestionres3').innerHTML=messRab();
document.getElementById('gestionres3').style.display='block';
}
rollAnnoncesVu(go);         
}
//
function pInfoOut(trv){
 trv=parseInt(trv);
 trouve=parseInt(trouve); 
if(trouve || trv){
var quant=trouve;
if(!quant)quant=trv;
if(!quant)return false;
var pag_out='';   
if(quant==1)return pages1;else{ if(quant>=5)pag_out=pages5;else if(!quant)pag_out='';}
var fstr=quant.toString(); 
var len= fstr.length-2;
fstr=fstr.substr(len);
if(fstr>9)var fstr0=fstr.substr(1,1);
 else var fstr0=fstr.substr(0,1); 
var fstr2=fstr.substr(0,2); 
if(fstr0==1)pag_out=pages1;   
if(fstr0>1 && fstr0<5)pag_out=pages234;
// 11,12,13,14 etc
if(fstr2>4 && fstr2<21)pag_out=pages5;   
return pag_out;
}
}
//
function vuInfoOut(trv){
var quant=trv;
var pag_out='';   
if(quant==1)pag_out=messAnnVu;else pag_out=messAnnVus;  
return pag_out;
}
//

/*function detectEvtOn(evt){   // p:261
if(evt){  
    var elem=(evt.target)?evt.target:((evt.srcElement)?evt.srcElement:null);
 
    if(elem.nodeType==3){  
        elem=elem.parentNode;
    }
    if(elem){      alert("event :"+elem);
        //operation ici
    }
}
} */
//document.onmousedown=detectMouseEvt;    
/*function detectMouseEvt(evt){
evt=(evt)?evt:((window.event)?event:null);
if(evt){  
    var rButt=false;
    if((typeof evt.button!="undefined" && evt.button==2) || (evt.which && evt.which==3)){
        rButt=true;    
    }              
    if(rButt){  
        // clic droit
    }else{      
        //autre clic
    }
}
}*/
/*
document.onmousewheel=detectOnwheel;
function detectOnwheel(){
if(go>0){     toText(document.onmousewheel.value);
if(ididixa>go)go++; else go=0;
rollAnnoncesVu(go);
}
}  */ 


/*  
document.onkeyup=function (evt){
var ch=false;
evt= (evt) ? evt : ((window.event) ? event : null);
var ch=(evt.charCode) ? evt.charCode:((evt.which)?evt.which:evt.keyCode);      
if(MAC && ch==3 || ch==13){
  actions(1);
}
}*/


