window.addEvent('domready',function(){$$('#note-etoiles').addEvents({mouseout:function(){$('note-etoiles').set('class','etoiles etoiles-0');}});$$('#note-etoiles li').addEvents({mouseover:function(ev){$('note-etoiles').set('class','etoiles etoiles-'+$(ev.target).get('value'));},click:function(ev){$$('#note-etoiles li').removeEvents('mouseover');$('note-etoiles').removeEvents('mouseout');$('note-etoiles').set('class','etoiles etoiles-'+$(ev.target).get('value'));$('note').set('value',$(ev.target).get('value'));}});});;var setPanier,setComment,timerComment,addComment;window.addEvent('domready',function(){addComment=new Array();setPanier=function(panier,annonces_id){new Request({url:'/ajax/panier-set.php',link:'cancel',onSuccess:function(html){if($('annonce_'+annonces_id)){if(panier){$('annonce_'+annonces_id).addClass('panier');}else{$('annonce_'+annonces_id).removeClass('panier');}}
if($('menu_detail_annonce')){if(panier){$('menu_detail_annonce').addClass('panier');}else{$('menu_detail_annonce').removeClass('panier');}}
if(!panier&&window.location.pathname.substring(0,8)=='/panier/')
window.location.reload();}}).post({panier:panier,annonces_id:annonces_id});};setComment=function(){var annonces_id=this.id.replace('commentaire_','');if(addComment[annonces_id]!=this.value){new Request({url:'/ajax/commentaire-set.php',link:'cancel',onSuccess:function(html){}}).post({annonces_id:annonces_id,commentaire:this.value});addComment[annonces_id]=this.value;}};$$('.annonce').each(function(el){var id=el.id.replace('annonce_','');var comment=$('commentaire_'+id);if(!comment)
return;var bloc=$('bloc_commentaire_'+id);if(!comment.get('text')){bloc.hide();}
el.getElements('.commenter a[href="/noscript"]')[0].addEvent('click',function(){bloc.toggle();return false;});comment.addEvents({focus:function(){timerComment=setComment.periodical(650,comment);},blur:function(){(setComment.bind(comment))();$clear(timerComment);}});});$$('#menu_detail_annonce textarea').each(function(comment){comment.addEvents({focus:function(){timerComment=setComment.periodical(650,comment);},blur:function(){(setComment.bind(comment))();$clear(timerComment);}});});});;window.addEvent('domready',function(){$$('#galerie-photo img').each(function(thumb){thumb.addEvent('click',function(){el=$('galerie-photo-viewer');el.set('width',thumb.get('realwidth'));el.set('height',thumb.get('realheight'));el.set('src',thumb.get('src'));});});if($('map_container')&&GBrowserIsCompatible()){$('map_container').show();window.addEvent('unload',GUnload);var map=new GMap2($('map'));map.setCenter(new GLatLng(parseFloat($('map').get('lat')),parseFloat($('map').get('lng'))),parseInt($('map').get('zoom')));var customUI=map.getDefaultUI();customUI.zoom.scrollwheel=false;map.setUI(customUI);map.setMapType(G_HYBRID_MAP);map.addOverlay(new GMarker(map.getCenter()));}
if($('mouselabel')){$('carte').erase('alt');$$('area').each(function(el){el.mouselabel=el.get('alt');el.erase('alt');el.erase('title');});$$('area').addEvents({mousemove:function(e){$('mouselabel').position({x:e.page.x+15,y:e.page.y+20});},mouseover:function(){$('mouselabel').set('html',this.mouselabel);$('mouselabel').style.display='block';},mouseout:function(){$('mouselabel').style.display='none';}});}
if($('carte')&&$('bouton-carte')){var fx=new Fx.Slide($('carte'),{transition:Fx.Transitions.Quart.easeInOut,link:'chain'});$('carte').setStyle('margin','0 auto');$('bouton-carte').setStyles({background:"url(/images/boutons/zoom-out.gif) no-repeat 0% 85%",'padding-left':"18px"});$('bouton-carte').addEvent('click',function(){fx.toggle();if($('bouton-carte').getStyle('background-image')=="url(/images/boutons/zoom-out.gif)"){$('bouton-carte').setStyles({'background-image':"url(/images/boutons/zoom-in.gif)","color":"#357930"});}else{$('bouton-carte').setStyles({'background-image':"url(/images/boutons/zoom-out.gif)","color":"#CC0000"});}});if($$('.nb_resultats strong').length>0){var nb_annonces=$$('.nb_resultats strong').get('text');for(var i=0;i<nb_annonces.length;i++){nb_annonces=parseInt(nb_annonces[i].replace(/ annonces| annonce/g,''));}
if(nb_annonces<100){fx.hide();$('bouton-carte').setStyles({'background-image':"url(/images/boutons/zoom-in.gif)","color":"#357930"});}
else{}}}
$$('input[name="geo_objet"]').each(function(el){new Autocompleter.Ajax.Json(el.id,'/ajax/localisation.php',{postVar:'q',type:'recherche'});});if($('alerte_calendrier'))
{$$('#alerte_calendrier a.click').addEvent('click',function(){$$('#alerte_calendrier p.confirmation').toggle();return false;});$$('#alerte_calendrier p.confirmation a').addEvent('click',function(){new Request.HTML({url:'/ajax/alerte-calendrier.php',onSuccess:function(html){$('alerte_calendrier').set('text','');$('alerte_calendrier').adopt(html);}}).send('id='+this.get('rel'));return false;});}});