var ToolTip=new Class({currentOptions:undefined,options:{wrapperClass:"",className:"tooltip",fixed:false,offsets:{x:0,y:0},closerElement:{tag:"img",className:"tooltipCloser",attributes:{src:js_contextPath+"/auto/img/help_button.gif",alt:"Fermer"}},text:"",drawTitle:true,beforeRender:null,afterRender:null,beforeHide:null,afterHide:null},initialize:function(b){this.currentOptions={};this.options=$merge(this.options,b);this.currentOptions=$H(this.options).extend(b).obj;if(document.getElementById("tooltip")){this.tooltip=$("tooltip")}else{this.tooltip=new Element("div");this.tooltip.className=this.currentOptions.className+" "+this.currentOptions.wrapperClass;this.tooltip.style.position="absolute";this.tooltipHeader=document.createElement("div");this.tooltipHeader.className=this.currentOptions.className+"_header";this.tooltipHeader.innerHTML="&nbsp;";this.tooltip.appendChild(this.tooltipHeader);this.tooltipBody=document.createElement("div");this.tooltipBody.className=this.currentOptions.className+"_body";this.tooltipTitle=document.createElement("div");this.tooltipTitle.className=this.currentOptions.className+"_title";this.closer=document.createElement(this.currentOptions.closerElement.tag);this.closer.className=this.currentOptions.closerElement.className;for(var a in this.currentOptions.closerElement.attributes){this.closer.setAttribute(a,this.currentOptions.closerElement.attributes[a])}this.tooltipText=document.createElement("div");this.tooltipText.className=this.currentOptions.className+"_text";this.tooltipText.innerHTML=this.currentOptions.text;if(this.currentOptions.drawTitle){this.tooltipTitle.appendChild(this.closer);this.tooltipBody.appendChild(this.tooltipTitle)}else{$(this.closer).addClass("floatR");this.tooltipText.insertBefore(this.closer,this.tooltipText.firstChild)}this.tooltipBody.appendChild(this.tooltipText);this.tooltip.appendChild(this.tooltipBody);this.tooltipFooter=document.createElement("div");this.tooltipFooter.className=this.currentOptions.className+"_footer";this.tooltipFooter.innerHTML="&nbsp;";this.tooltip.appendChild(this.tooltipFooter)}},display:function(h,j){h=new Event(h);this.initialize(j);if(typeof(this.currentOptions.beforeRender)=="function"){this.currentOptions.beforeRender()}var f=h.page.x;var e=h.page.y;if(this.currentOptions.fixed){e=h.target.getPosition().y;f=h.target.getPosition().x}f+=this.currentOptions.offsets.x;e+=this.currentOptions.offsets.y;this.tooltip.style.top=e+"px";this.tooltip.style.left=f+"px";document.body.appendChild(this.tooltip);this.tooltip.addEvent("mouseleave",(function(){this.hide()}).bind(this));if(typeof(this.currentOptions.afterRender)=="function"){this.currentOptions.afterRender()}if(window.ie6){$ES("select",$("main_container")).each(function(k){k.addClass("js_notHidden");k.addClass("hide")})}var i=this.tooltip.getSize().size.x;var g=this.tooltip.getSize().size.y;var b=0,c=0;if(typeof(window.pageYOffset)=="number"){b=window.pageYOffset;c=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){b=document.body.scrollTop;c=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){b=document.documentElement.scrollTop;c=document.documentElement.scrollLeft}}}var d=0,a=0;if(window.firefox){d=window.innerWidth;a=window.innerHeight}else{if(window.ie7||window.ie6){d=document.documentElement.clientWidth;a=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){d=document.body.clientWidth;a=document.body.clientHeight}}}if(((e+g)-(b+a))>0){if(g<e){this.tooltip.style.top=(e-g+30)+"px"}}},hide:function(){if(typeof(this.currentOptions.beforeHide)=="function"){this.currentOptions.beforeHide()}document.body.removeChild(this.tooltip);if(typeof(this.currentOptions.afterHide)=="function"){this.currentOptions.afterHide()}if(window.ie6){$ES("select",$("main_container")).each(function(a){if(a.hasClass("js_notHidden")){a.removeClass("js_notHidden");a.removeClass("hide")}})}}});