var glossaire=new Class({options:{offsets:{x:16,y:16}},initialize:function(){this.width=417;this.tooltip=this.definitionRequest=null;this.ajaxUrl="http://www.tasset.com/glossaireAjaxInterface.php";if(document.location.toString().indexOf("https://")!=0)this.ajaxUrl=this.ajaxUrl.replace("https://","http://");this.words=$ES(".tassetLexical");if(this.words.length<1)return!1;this.words.each(function(a){a.title!==void 0&&a.removeProperty("title");a.addClass("tassetLexicalActivated");a.addEvents({mouseenter:function(a){a=
new Event(a);a.stop();this.timeoutRefClose!==null&&$clear(this.timeoutRefClose);this.closeToolTip();this.createTooltip(a.target.innerHTML,'<center style="margin-top:100px"><img src="https://www.tasset.com/images/loader-1.gif"/></center>');this.fetchDefinition(a.target.innerHTML)}.bind(this),mouseleave:function(a){(new Event(a)).stop();this.timeoutRefClose=function(){this.closeToolTip()}.delay(600,this)}.bind(this)})}.bind(this));this.definitions=[]},fetchDefinition:function(a){if(this.definitions[a]!==
void 0)this.updateTooltip(a,this.definitions[a]);else{if(this.definitionRequest!==null)this.definitionRequest=null;this.definitionRequest=(new XHR({method:"post",onRequest:function(){}.bind(this),onSuccess:function(){this.definitionRequest.response!==void 0&&this.definitionRequest.response.text!=="error"?(this.definitions[a]=this.definitionRequest.response.text,this.updateTooltip(a,this.definitionRequest.response.text)):this.updateTooltip("error",'<center style="margin-top:20px;text-align:center;border:1px solid red;color:red;">error type 1</center>')}.bind(this),
onFailure:function(){this.updateTooltip("error",'<center style="margin-top:20px;text-align:center;border:1px solid red;color:red;">error type 2</center>')}.bind(this)})).send(this.ajaxUrl+"?word="+escape(a))}},locate:function(a){if(this.toolTip!==null){var c={x:window.getWidth(),y:window.getHeight()},g={x:window.getScrollLeft(),y:window.getScrollTop()},e={x:this.toolTip.offsetWidth,y:this.toolTip.offsetHeight},f={x:"left",y:"top"},b;for(b in f){var d=a.page[b]+this.options.offsets[b];d+e[b]-g[b]>
c[b]&&(d=a.page[b]-this.options.offsets[b]-e[b]);this.toolTip.setStyle(f[b],d)}}},createTooltip:function(a,c){this.closeToolTip();this.toolTip=new Element("div",{id:"glossaireTooltip","class":"G-toolTip"});this.toolTip.setStyles({opacity:0,width:this.width}).setHTML('<h3 class="G-toolTip-title">'+a+'</h3><div class="G-toolTip-text">'+c+"</div>").injectInside(document.body);window.document.addEvent("mousemove",function(a){this.locate(new Event(a))}.bind(this));this.fadeIn(this.toolTip,1)},updateTooltip:function(a,
c){this.toolTip.setHTML('<h3 class="G-toolTip-title">'+a+'</h3><div class="G-toolTip-text">'+c+"</div>")},closeToolTip:function(){if(this.toolTip!==void 0&&this.toolTip!==null)this.toolTip.remove(),this.toolTip=null,window.document.removeEvents("mousemove")},fadeOut:function(a){(new Fx.Styles($(a),{duration:400,onComplete:function(){a.remove();a=null}})).start({opacity:0})},fadeIn:function(a,c){(new Fx.Styles($(a),{duration:400})).start({opacity:c})}});window.addEvent("domready",function(){new glossaire});
