var PlayerDetails =new Class({Implements:[Options],options:{templateDetails:'<div id="match-summary-player">{content}</div>'},initialize:function(a,b){this.elements=a,this.setOptions(b),this.bindEvents()},bindEvents:function(){this.elements.addEvent("mouseover",this.showDetails.bind(this)),this.elements.addEvent("mouseout",this.hideDetails.bind(this))},showDetails:function(a){var b=document.id(a.stop().target).getParent("li.vcard");b||(b=document.id(a.target));var c=b.getCoordinates();this.details=(new Elements.from(this.options.templateDetails.substitute({content:b.get("html")})))[0].setStyles({left:c.left+c.width+"px",top:c.top-46+"px"}),this.details.inject(document.body)},hideDetails:function(){this.details&&this.details.destroy(),delete this.details,delete this.destroy}}),Countdown=new Class({Implements:[Options,Events],options:{end:null,displayZero:!1,zeroise:!0,templateMain:"<span>{day}{hour}{minute}{seconde}</span>",templateD:"{day} : ",templateH:"{hour} : ",templateM:"{minute} : ",templateS:"{seconde}",onDFinish:function(){},onHFinish:function(){},onMFinish:function(){},onFinish:function(){}},initialize:function(a,b){this.element=document.id(a),this.setOptions(b),this.construct()},toElement:function(){return this.element},construct:function(){this.now=new Date;var a=this.options.end;this.zeroise=this.options.zeroise?2:1,this.s=a%60,a=(a-this.s)/60,this.m=a%60,a=(a-this.m)/60,this.h=a%24,this.d=(a-this.h)/24,this.interval=this.update.periodical(1e3,this),this.update()},update:function(){this.s--,this.s<0&&(this.s=59,this.m--,this.m<0&&(this.m=59,this.h--,this.h<0&&(this.h=23,this.d--)));if(this.d<0)return this.stop();(new Elements.from(this.options.templateMain.substitute({day:this.d==0&&!this.options.displayZero?"":this.options.templateD.substitute({day:this.d.toString().zeroise(this.zeroise)}),hour:this.d+this.h==0&&!this.options.displayZero?"":this.options.templateH.substitute({hour:this.h.toString().zeroise(this.zeroise)}),minute:this.d+this.h+this.m==0&&!this.options.displayZero?"":this.options.templateM.substitute({minute:this.m.toString().zeroise(this.zeroise)}),seconde:this.options.templateS.substitute({seconde:this.s.toString().zeroise(this.zeroise)})}))).inject(this.element.empty()),this.d==0&&this.fireEvent("onDFinish"),this.d+this.h==0&&this.fireEvent("onHFinish"),this.d+this.h+this.m==0&&this.fireEvent("onMFinish")},stop:function(){this.fireEvent("onFinish"),clearInterval(this.interval),this.d=this.h=this.m=this.s=0}});document.addEvent("domready",function(){var a=document.getElements("ul.club-holder li.vcard");a.combine(document.getElements("ul.opponent-holder li.vcard")),a.combine(document.getElements(".club-substitute ul li.vcard")),a.combine(document.getElements(".opponent-substitute ul li.vcard")),new PlayerDetails(a),(new Elements.from('<div id="countdown"></div>'))[0].inject(document.id("match-summary-inner"),"before");var b=document.getElement("p.infos3").get("text");b>0&&new Countdown(document.id("countdown"),{end:b,displayZero:!1,templateMain:"<div> "+Locale.get("Countdown.in")+" <span>{day}{hour}{minute}{seconde}</span></div>",templateD:"{day} "+Locale.get("Countdown.Day-abbr")+" ",templateH:"{hour} "+Locale.get("Countdown.Hour-abbr")+" ",templateM:"{minute} "+Locale.get("Countdown.Minute-abbr2")+" ",templateS:"{seconde} "+Locale.get("Countdown.Seconde-abbr")})})
