SIA.BetDetailsExpander=function(){this.attachFetchBetDetailsHandlers(document.getElementsByClassName("showBet"),"betID");this.attachFetchBetDetailsHandlers(document.getElementsByClassName("showSystemBet"),"systemBetID")};SIA.BetDetailsExpander.prototype.attachFetchBetDetailsHandlers=function(A,D){var C;for(var B=0;B<A.length;B++){A[B].onclick=this.fetchBetDetails.bindAsEventListener(this,D);C=A[B].up("td");A[B].style.marginTop=(C.getHeight()-32)+"px"}};SIA.BetDetailsExpander.prototype.fetchBetDetails=function(C,F){var B=Event.findElement(C,"a");var D="cfcName=BetcardFacade&functionName=showBet&"+F+"="+B.id.substr(7);var E=document.createElement("span");E.className="betDetailsLoadingIcon";E.style.marginTop=B.style.marginTop;B.hide();B.parentNode.appendChild(E);var A=new Ajax.Request(SIA.facadeURL,{method:"get",parameters:D,onComplete:this.fetchBetDetailsResponse.bindAsEventListener(this,B)})};SIA.BetDetailsExpander.prototype.fetchBetDetailsResponse=function(E,I){I.parentNode.removeChild(I.parentNode.lastChild);I.show();var C=E.responseText.evalJSON();var M=I.up("tr");var N=0;var K=M.childElements();for(var G=0;G<K.length;G++){N+=K[G].colSpan}new Insertion.After(M,'<tr class="'+M.className+'"><td colspan="'+N+'" ><div  id="'+I.id+'Details" style="display:none;">'+C.html+"</div></td></tr>");if(C.systembetlist){var A=document.createElement("div");A=$(A);A.className="fullListWrapper";A.innerHTML=C.systembetlist;A.hide();M.down("ul").parentNode.appendChild(A);var H=M.down("ul").childElements();var B=[];var J;var G,D;for(G=0;G<H.length;G++){listItemClassNames=$w(H[G].className);for(D=0;D<listItemClassNames.length;D++){if(listItemClassNames[D].startsWith("runner")){B.push(listItemClassNames[D]);break}}}var F=A.down("ul").childElements();var L;for(G=0;G<F.length;G++){L=false;for(D=0;D<B.length;D++){if(F[G].hasClassName(B[D])){L=true;break}}if(!L){F[G].addClassName("disabled")}}}this.showBetDetails(I)};SIA.BetDetailsExpander.prototype.showBetDetailsEventHandler=function(B){var A=Event.findElement(B,"a");this.showBetDetails(A)};SIA.BetDetailsExpander.prototype.showBetDetails=function(B){var A=B.up("tr").down(".fullListWrapper");if(A){B.up("tr").down("ul").hide();A.show()}Effect.BlindDown(B.id+"Details",{duration:0.5,afterFinish:function(){B.onclick=this.hideBetDetails.bindAsEventListener(this);B.down("span").innerHTML=SIA.sharedStrings.less;B.down("img").src=B.down("img").src.gsub("more_icon","less_icon")}.bindAsEventListener(this)})};SIA.BetDetailsExpander.prototype.hideBetDetails=function(C){var B=Event.findElement(C,"a");var A=B.up("tr").down(".fullListWrapper");if(A){B.up("tr").down("ul").show();A.hide()}Effect.BlindUp(B.id+"Details",{duration:0.5,afterFinish:function(){B.onclick=this.showBetDetailsEventHandler.bindAsEventListener(this);B.down("span").innerHTML=SIA.sharedStrings.more;B.down("img").src=B.down("img").src.gsub("less_icon","more_icon")}.bindAsEventListener(this)})};SIA.initHook=function(){var A=new SIA.BetDetailsExpander()};
