
var MooTools={'version':'1.2.4','build':'0d9113241a90b9cd5643b926795852a2026710d4'};var Native=function(options){options=options||{};var name=options.name;var legacy=options.legacy;var protect=options.protect;var methods=options.implement;var generics=options.generics;var initialize=options.initialize;var afterImplement=options.afterImplement||function(){};var object=initialize||legacy;generics=generics!==false;object.constructor=Native;object.$family={name:'native'};if(legacy&&initialize)object.prototype=legacy.prototype;object.prototype.constructor=object;if(name){var family=name.toLowerCase();object.prototype.$family={name:family};Native.typize(object,family);}
var add=function(obj,name,method,force){if(!protect||force||!obj.prototype[name])obj.prototype[name]=method;if(generics)Native.genericize(obj,name,protect);afterImplement.call(obj,name,method);return obj;};object.alias=function(a1,a2,a3){if(typeof a1=='string'){var pa1=this.prototype[a1];if((a1=pa1))return add(this,a2,a1,a3);}
for(var a in a1)this.alias(a,a1[a],a2);return this;};object.implement=function(a1,a2,a3){if(typeof a1=='string')return add(this,a1,a2,a3);for(var p in a1)add(this,p,a1[p],a2);return this;};if(methods)object.implement(methods);return object;};Native.genericize=function(object,property,check){if((!check||!object[property])&&typeof object.prototype[property]=='function')object[property]=function(){var args=Array.prototype.slice.call(arguments);return object.prototype[property].apply(args.shift(),args);};};Native.implement=function(objects,properties){for(var i=0,l=objects.length;i<l;i++)objects[i].implement(properties);};Native.typize=function(object,family){if(!object.type)object.type=function(item){return($type(item)===family);};};(function(){var natives={'Array':Array,'Date':Date,'Function':Function,'Number':Number,'RegExp':RegExp,'String':String};for(var n in natives)new Native({name:n,initialize:natives[n],protect:true});var types={'boolean':Boolean,'native':Native,'object':Object};for(var t in types)Native.typize(types[t],t);var generics={'Array':["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],'String':["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]};for(var g in generics){for(var i=generics[g].length;i--;)Native.genericize(natives[g],generics[g][i],true);}})();var Hash=new Native({name:'Hash',initialize:function(object){if($type(object)=='hash')object=$unlink(object.getClean());for(var key in object)this[key]=object[key];return this;}});Hash.implement({forEach:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key))fn.call(bind,this[key],key,this);}},getClean:function(){var clean={};for(var key in this){if(this.hasOwnProperty(key))clean[key]=this[key];}
return clean;},getLength:function(){var length=0;for(var key in this){if(this.hasOwnProperty(key))length++;}
return length;}});Hash.alias('forEach','each');Array.implement({forEach:function(fn,bind){for(var i=0,l=this.length;i<l;i++)fn.call(bind,this[i],i,this);}});Array.alias('forEach','each');function $A(iterable){if(iterable.item){var l=iterable.length,array=new Array(l);while(l--)array[l]=iterable[l];return array;}
return Array.prototype.slice.call(iterable);};function $arguments(i){return function(){return arguments[i];};};function $chk(obj){return!!(obj||obj===0);};function $clear(timer){clearTimeout(timer);clearInterval(timer);return null;};function $defined(obj){return(obj!=undefined);};function $each(iterable,fn,bind){var type=$type(iterable);((type=='arguments'||type=='collection'||type=='array')?Array:Hash).each(iterable,fn,bind);};function $empty(){};function $extend(original,extended){for(var key in(extended||{}))original[key]=extended[key];return original;};function $H(object){return new Hash(object);};function $lambda(value){return($type(value)=='function')?value:function(){return value;};};function $merge(){var args=Array.slice(arguments);args.unshift({});return $mixin.apply(null,args);};function $mixin(mix){for(var i=1,l=arguments.length;i<l;i++){var object=arguments[i];if($type(object)!='object')continue;for(var key in object){var op=object[key],mp=mix[key];mix[key]=(mp&&$type(op)=='object'&&$type(mp)=='object')?$mixin(mp,op):$unlink(op);}}
return mix;};function $pick(){for(var i=0,l=arguments.length;i<l;i++){if(arguments[i]!=undefined)return arguments[i];}
return null;};function $random(min,max){return Math.floor(Math.random()*(max-min+1)+min);};function $splat(obj){var type=$type(obj);return(type)?((type!='array'&&type!='arguments')?[obj]:obj):[];};var $time=Date.now||function(){return+new Date;};function $try(){for(var i=0,l=arguments.length;i<l;i++){try{return arguments[i]();}catch(e){}}
return null;};function $type(obj){if(obj==undefined)return false;if(obj.$family)return(obj.$family.name=='number'&&!isFinite(obj))?false:obj.$family.name;if(obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}else if(typeof obj.length=='number'){if(obj.callee)return'arguments';else if(obj.item)return'collection';}
return typeof obj;};function $unlink(object){var unlinked;switch($type(object)){case'object':unlinked={};for(var p in object)unlinked[p]=$unlink(object[p]);break;case'hash':unlinked=new Hash(object);break;case'array':unlinked=[];for(var i=0,l=object.length;i<l;i++)unlinked[i]=$unlink(object[i]);break;default:return object;}
return unlinked;};var Browser=$merge({Engine:{name:'unknown',version:0},Platform:{name:(window.orientation!=undefined)?'ipod':(navigator.platform.match(/mac|win|linux/i)||['other'])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925));},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?((document.querySelectorAll)?6:5):4);},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419);},gecko:function(){return(!document.getBoxObjectFor&&window.mozInnerScreenX==null)?false:((document.getElementsByClassName)?19:18);}}},Browser||{});Browser.Platform[Browser.Platform.name]=true;Browser.detect=function(){for(var engine in this.Engines){var version=this.Engines[engine]();if(version){this.Engine={name:engine,version:version};this.Engine[engine]=this.Engine[engine+version]=true;break;}}
return{name:engine,version:version};};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject('MSXML2.XMLHTTP');},function(){return new ActiveXObject('Microsoft.XMLHTTP');});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var version=($try(function(){return navigator.plugins['Shockwave Flash'].description;},function(){return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');})||'0 r0').match(/\d+/g);return{version:parseInt(version[0]||0+'.'+version[1],10)||0,build:parseInt(version[2],10)||0};})();function $exec(text){if(!text)return text;if(window.execScript){window.execScript(text);}else{var script=document.createElement('script');script.setAttribute('type','text/javascript');script[(Browser.Engine.webkit&&Browser.Engine.version<420)?'innerText':'text']=text;document.head.appendChild(script);document.head.removeChild(script);}
return text;};Native.UID=1;var $uid=(Browser.Engine.trident)?function(item){return(item.uid||(item.uid=[Native.UID++]))[0];}:function(item){return item.uid||(item.uid=Native.UID++);};var Window=new Native({name:'Window',legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(win){$uid(win);if(!win.Element){win.Element=$empty;if(Browser.Engine.webkit)win.document.createElement("iframe");win.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{};}
win.document.window=win;return $extend(win,Window.Prototype);},afterImplement:function(property,value){window[property]=Window.Prototype[property]=value;}});Window.Prototype={$family:{name:'window'}};new Window(window);var Document=new Native({name:'Document',legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(doc){$uid(doc);doc.head=doc.getElementsByTagName('head')[0];doc.html=doc.getElementsByTagName('html')[0];if(Browser.Engine.trident&&Browser.Engine.version<=4)$try(function(){doc.execCommand("BackgroundImageCache",false,true);});if(Browser.Engine.trident)doc.window.attachEvent('onunload',function(){doc.window.detachEvent('onunload',arguments.callee);doc.head=doc.html=doc.window=null;});return $extend(doc,Document.Prototype);},afterImplement:function(property,value){document[property]=Document.Prototype[property]=value;}});Document.Prototype={$family:{name:'document'}};new Document(document);Array.implement({every:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(!fn.call(bind,this[i],i,this))return false;}
return true;},filter:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))results.push(this[i]);}
return results;},clean:function(){return this.filter($defined);},indexOf:function(item,from){var len=this.length;for(var i=(from<0)?Math.max(0,len+from):from||0;i<len;i++){if(this[i]===item)return i;}
return-1;},map:function(fn,bind){var results=[];for(var i=0,l=this.length;i<l;i++)results[i]=fn.call(bind,this[i],i,this);return results;},some:function(fn,bind){for(var i=0,l=this.length;i<l;i++){if(fn.call(bind,this[i],i,this))return true;}
return false;},associate:function(keys){var obj={},length=Math.min(this.length,keys.length);for(var i=0;i<length;i++)obj[keys[i]]=this[i];return obj;},link:function(object){var result={};for(var i=0,l=this.length;i<l;i++){for(var key in object){if(object[key](this[i])){result[key]=this[i];delete object[key];break;}}}
return result;},contains:function(item,from){return this.indexOf(item,from)!=-1;},extend:function(array){for(var i=0,j=array.length;i<j;i++)this.push(array[i]);return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null;},include:function(item){if(!this.contains(item))this.push(item);return this;},combine:function(array){for(var i=0,l=array.length;i<l;i++)this.include(array[i]);return this;},erase:function(item){for(var i=this.length;i--;i){if(this[i]===item)this.splice(i,1);}
return this;},empty:function(){this.length=0;return this;},flatten:function(){var array=[];for(var i=0,l=this.length;i<l;i++){var type=$type(this[i]);if(!type)continue;array=array.concat((type=='array'||type=='collection'||type=='arguments')?Array.flatten(this[i]):this[i]);}
return array;},hexToRgb:function(array){if(this.length!=3)return null;var rgb=this.map(function(value){if(value.length==1)value+=value;return value.toInt(16);});return(array)?rgb:'rgb('+rgb+')';},rgbToHex:function(array){if(this.length<3)return null;if(this.length==4&&this[3]==0&&!array)return'transparent';var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?'0'+bit:bit);}
return(array)?hex:'#'+hex.join('');}});Function.implement({extend:function(properties){for(var property in properties)this[property]=properties[property];return this;},create:function(options){var self=this;options=options||{};return function(event){var args=options.arguments;args=(args!=undefined)?$splat(args):Array.slice(arguments,(options.event)?1:0);if(options.event)args=[event||window.event].extend(args);var returns=function(){return self.apply(options.bind||null,args);};if(options.delay)return setTimeout(returns,options.delay);if(options.periodical)return setInterval(returns,options.periodical);if(options.attempt)return $try(returns);return returns();};},run:function(args,bind){return this.apply(bind,$splat(args));},pass:function(args,bind){return this.create({bind:bind,arguments:args});},bind:function(bind,args){return this.create({bind:bind,arguments:args});},bindWithEvent:function(bind,args){return this.create({bind:bind,arguments:args,event:true});},attempt:function(args,bind){return this.create({bind:bind,arguments:args,attempt:true})();},delay:function(delay,bind,args){return this.create({bind:bind,arguments:args,delay:delay})();},periodical:function(periodical,bind,args){return this.create({bind:bind,arguments:args,periodical:periodical})();}});Number.implement({limit:function(min,max){return Math.min(max,Math.max(min,this));},round:function(precision){precision=Math.pow(10,precision||0);return Math.round(this*precision)/precision;},times:function(fn,bind){for(var i=0;i<this;i++)fn.call(bind,i,this);},toFloat:function(){return parseFloat(this);},toInt:function(base){return parseInt(this,base||10);}});Number.alias('times','each');(function(math){var methods={};math.each(function(name){if(!Number[name])methods[name]=function(){return Math[name].apply(null,[this].concat($A(arguments)));};});Number.implement(methods);})(['abs','acos','asin','atan','atan2','ceil','cos','exp','floor','log','max','min','pow','sin','sqrt','tan']);String.implement({test:function(regex,params){return((typeof regex=='string')?new RegExp(regex,params):regex).test(this);},contains:function(string,separator){return(separator)?(separator+this+separator).indexOf(separator+string+separator)>-1:this.indexOf(string)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,'');},clean:function(){return this.replace(/\s+/g,' ').trim();},camelCase:function(){return this.replace(/-\D/g,function(match){return match.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(match){return('-'+match.charAt(0).toLowerCase());});},capitalize:function(){return this.replace(/\b[a-z]/g,function(match){return match.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,'\\$1');},toInt:function(base){return parseInt(this,base||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(array){var hex=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(hex)?hex.slice(1).hexToRgb(array):null;},rgbToHex:function(array){var rgb=this.match(/\d{1,3}/g);return(rgb)?rgb.rgbToHex(array):null;},stripScripts:function(option){var scripts='';var text=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){scripts+=arguments[1]+'\n';return'';});if(option===true)$exec(scripts);else if($type(option)=='function')option(scripts,text);return text;},substitute:function(object,regexp){return this.replace(regexp||(/\\?\{([^{}]+)\}/g),function(match,name){if(match.charAt(0)=='\\')return match.slice(1);return(object[name]!=undefined)?object[name]:'';});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(value){for(var key in this){if(this.hasOwnProperty(key)&&this[key]===value)return key;}
return null;},hasValue:function(value){return(Hash.keyOf(this,value)!==null);},extend:function(properties){Hash.each(properties||{},function(value,key){Hash.set(this,key,value);},this);return this;},combine:function(properties){Hash.each(properties||{},function(value,key){Hash.include(this,key,value);},this);return this;},erase:function(key){if(this.hasOwnProperty(key))delete this[key];return this;},get:function(key){return(this.hasOwnProperty(key))?this[key]:null;},set:function(key,value){if(!this[key]||this.hasOwnProperty(key))this[key]=value;return this;},empty:function(){Hash.each(this,function(value,key){delete this[key];},this);return this;},include:function(key,value){if(this[key]==undefined)this[key]=value;return this;},map:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){results.set(key,fn.call(bind,value,key,this));},this);return results;},filter:function(fn,bind){var results=new Hash;Hash.each(this,function(value,key){if(fn.call(bind,value,key,this))results.set(key,value);},this);return results;},every:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&!fn.call(bind,this[key],key))return false;}
return true;},some:function(fn,bind){for(var key in this){if(this.hasOwnProperty(key)&&fn.call(bind,this[key],key))return true;}
return false;},getKeys:function(){var keys=[];Hash.each(this,function(value,key){keys.push(key);});return keys;},getValues:function(){var values=[];Hash.each(this,function(value){values.push(value);});return values;},toQueryString:function(base){var queryString=[];Hash.each(this,function(value,key){if(base)key=base+'['+key+']';var result;switch($type(value)){case'object':result=Hash.toQueryString(value,key);break;case'array':var qs={};value.each(function(val,i){qs[i]=val;});result=Hash.toQueryString(qs,key);break;default:result=key+'='+encodeURIComponent(value);}
if(value!=undefined)queryString.push(result);});return queryString.join('&');}});Hash.alias({keyOf:'indexOf',hasValue:'contains'});var Event=new Native({name:'Event',initialize:function(event,win){win=win||window;var doc=win.document;event=event||win.event;if(event.$extended)return event;this.$extended=true;var type=event.type;var target=event.target||event.srcElement;while(target&&target.nodeType==3)target=target.parentNode;if(type.test(/key/)){var code=event.which||event.keyCode;var key=Event.Keys.keyOf(code);if(type=='keydown'){var fKey=code-111;if(fKey>0&&fKey<13)key='f'+fKey;}
key=key||String.fromCharCode(code).toLowerCase();}else if(type.match(/(click|mouse|menu)/i)){doc=(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;var page={x:event.pageX||event.clientX+doc.scrollLeft,y:event.pageY||event.clientY+doc.scrollTop};var client={x:(event.pageX)?event.pageX-win.pageXOffset:event.clientX,y:(event.pageY)?event.pageY-win.pageYOffset:event.clientY};if(type.match(/DOMMouseScroll|mousewheel/)){var wheel=(event.wheelDelta)?event.wheelDelta/120:-(event.detail||0)/3;}
var rightClick=(event.which==3)||(event.button==2);var related=null;if(type.match(/over|out/)){switch(type){case'mouseover':related=event.relatedTarget||event.fromElement;break;case'mouseout':related=event.relatedTarget||event.toElement;}
if(!(function(){while(related&&related.nodeType==3)related=related.parentNode;return true;}).create({attempt:Browser.Engine.gecko})())related=false;}}
return $extend(this,{event:event,type:type,page:page,client:client,rightClick:rightClick,wheel:wheel,relatedTarget:related,target:target,code:code,key:key,shift:event.shiftKey,control:event.ctrlKey,alt:event.altKey,meta:event.metaKey});}});Event.Keys=new Hash({'enter':13,'up':38,'down':40,'left':37,'right':39,'esc':27,'space':32,'backspace':8,'tab':9,'delete':46});Event.implement({stop:function(){return this.stopPropagation().preventDefault();},stopPropagation:function(){if(this.event.stopPropagation)this.event.stopPropagation();else this.event.cancelBubble=true;return this;},preventDefault:function(){if(this.event.preventDefault)this.event.preventDefault();else this.event.returnValue=false;return this;}});function Class(params){if(params instanceof Function)params={initialize:params};var newClass=function(){Object.reset(this);if(newClass._prototyping)return this;this._current=$empty;var value=(this.initialize)?this.initialize.apply(this,arguments):this;delete this._current;delete this.caller;return value;}.extend(this);newClass.implement(params);newClass.constructor=Class;newClass.prototype.constructor=newClass;return newClass;};Function.prototype.protect=function(){this._protected=true;return this;};Object.reset=function(object,key){if(key==null){for(var p in object)Object.reset(object,p);return object;}
delete object[key];switch($type(object[key])){case'object':var F=function(){};F.prototype=object[key];var i=new F;object[key]=Object.reset(i);break;case'array':object[key]=$unlink(object[key]);break;}
return object;};new Native({name:'Class',initialize:Class}).extend({instantiate:function(F){F._prototyping=true;var proto=new F;delete F._prototyping;return proto;},wrap:function(self,key,method){if(method._origin)method=method._origin;return function(){if(method._protected&&this._current==null)throw new Error('The method "'+key+'" cannot be called.');var caller=this.caller,current=this._current;this.caller=current;this._current=arguments.callee;var result=method.apply(this,arguments);this._current=current;this.caller=caller;return result;}.extend({_owner:self,_origin:method,_name:key});}});Class.implement({implement:function(key,value){if($type(key)=='object'){for(var p in key)this.implement(p,key[p]);return this;}
var mutator=Class.Mutators[key];if(mutator){value=mutator.call(this,value);if(value==null)return this;}
var proto=this.prototype;switch($type(value)){case'function':if(value._hidden)return this;proto[key]=Class.wrap(this,key,value);break;case'object':var previous=proto[key];if($type(previous)=='object')$mixin(previous,value);else proto[key]=$unlink(value);break;case'array':proto[key]=$unlink(value);break;default:proto[key]=value;}
return this;}});Class.Mutators={Extends:function(parent){this.parent=parent;this.prototype=Class.instantiate(parent);this.implement('parent',function(){var name=this.caller._name,previous=this.caller._owner.parent.prototype[name];if(!previous)throw new Error('The method "'+name+'" has no parent.');return previous.apply(this,arguments);}.protect());},Implements:function(items){$splat(items).each(function(item){if(item instanceof Function)item=Class.instantiate(item);this.implement(item);},this);}};var Chain=new Class({$chain:[],chain:function(){this.$chain.extend(Array.flatten(arguments));return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){this.$chain.empty();return this;}});var Events=new Class({$events:{},addEvent:function(type,fn,internal){type=Events.removeOn(type);if(fn!=$empty){this.$events[type]=this.$events[type]||[];this.$events[type].include(fn);if(internal)fn.internal=true;}
return this;},addEvents:function(events){for(var type in events)this.addEvent(type,events[type]);return this;},fireEvent:function(type,args,delay){type=Events.removeOn(type);if(!this.$events||!this.$events[type])return this;this.$events[type].each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},removeEvent:function(type,fn){type=Events.removeOn(type);if(!this.$events[type])return this;if(!fn.internal)this.$events[type].erase(fn);return this;},removeEvents:function(events){var type;if($type(events)=='object'){for(type in events)this.removeEvent(type,events[type]);return this;}
if(events)events=Events.removeOn(events);for(type in this.$events){if(events&&events!=type)continue;var fns=this.$events[type];for(var i=fns.length;i--;i)this.removeEvent(type,fns[i]);}
return this;}});Events.removeOn=function(string){return string.replace(/^on([A-Z])/,function(full,first){return first.toLowerCase();});};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments));if(!this.addEvent)return this;for(var option in this.options){if($type(this.options[option])!='function'||!(/^on[A-Z]/).test(option))continue;this.addEvent(option,this.options[option]);delete this.options[option];}
return this;}});var Element=new Native({name:'Element',legacy:window.Element,initialize:function(tag,props){var konstructor=Element.Constructors.get(tag);if(konstructor)return konstructor(props);if(typeof tag=='string')return document.newElement(tag,props);return document.id(tag).set(props);},afterImplement:function(key,value){Element.Prototype[key]=value;if(Array[key])return;Elements.implement(key,function(){var items=[],elements=true;for(var i=0,j=this.length;i<j;i++){var returns=this[i][key].apply(this[i],arguments);items.push(returns);if(elements)elements=($type(returns)=='element');}
return(elements)?new Elements(items):items;});}});Element.Prototype={$family:{name:'element'}};Element.Constructors=new Hash;var IFrame=new Native({name:'IFrame',generics:false,initialize:function(){var params=Array.link(arguments,{properties:Object.type,iframe:$defined});var props=params.properties||{};var iframe=document.id(params.iframe);var onload=props.onload||$empty;delete props.onload;props.id=props.name=$pick(props.id,props.name,iframe?(iframe.id||iframe.name):'IFrame_'+$time());iframe=new Element(iframe||'iframe',props);var onFrameLoad=function(){var host=$try(function(){return iframe.contentWindow.location.host;});if(host&&host==window.location.host){if(host&&host==window.location.host||!host){var win=new Window(iframe.contentWindow);new Document(iframe.contentWindow.document);$extend(win.Element.prototype,Element.Prototype);}}
try{onload.call(iframe.contentWindow,iframe.contentWindow.document);}catch(err){};};var contentWindow=$try(function(){return iframe.contentWindow;});((contentWindow&&contentWindow.document.body)||window.frames[props.id])?onFrameLoad():iframe.addListener('load',onFrameLoad);return iframe;}});var Elements=new Native({initialize:function(elements,options){options=$extend({ddup:true,cash:true},options);elements=elements||[];if(options.ddup||options.cash){var uniques={},returned=[];for(var i=0,l=elements.length;i<l;i++){var el=document.id(elements[i],!options.cash);if(options.ddup){if(uniques[el.uid])continue;uniques[el.uid]=true;}
if(el)returned.push(el);}
elements=returned;}
return(options.cash)?$extend(elements,this):elements;}});Elements.implement({filter:function(filter,bind){if(!filter)return this;return new Elements(Array.filter(this,(typeof filter=='string')?function(item){return item.match(filter);}:filter,bind));}});Document.implement({newElement:function(tag,props){if(Browser.Engine.trident&&props){['name','type','checked'].each(function(attribute){if(!props[attribute])return;tag+=' '+attribute+'="'+props[attribute]+'"';if(attribute!='checked')delete props[attribute];});tag='<'+tag+'>';}
return document.id(this.createElement(tag)).set(props);},newTextNode:function(text){return this.createTextNode(text);},getDocument:function(){return this;},getWindow:function(){return this.window;},id:(function(){var types={string:function(id,nocash,doc){id=doc.getElementById(id);return(id)?types.element(id,nocash):null;},element:function(el,nocash){$uid(el);if(!nocash&&!el.$family&&!(/^object|embed$/i).test(el.tagName)){var proto=Element.Prototype;for(var p in proto)el[p]=proto[p];};return el;},object:function(obj,nocash,doc){if(obj.toElement)return types.element(obj.toElement(doc),nocash);return null;}};types.textnode=types.whitespace=types.window=types.document=$arguments(0);return function(el,nocash,doc){if(el&&el.$family&&el.uid)return el;var type=$type(el);return(types[type])?types[type](el,nocash,doc||document):null;};})()});if(window.$==null)Window.implement({$:function(el,nc){return document.id(el,nc,this.document);}});Window.implement({$$:function(selector){if(arguments.length==1&&typeof selector=='string')return this.document.getElements(selector);var elements=[];var args=Array.flatten(arguments);for(var i=0,l=args.length;i<l;i++){var item=args[i];switch($type(item)){case'element':elements.push(item);break;case'string':elements.extend(this.document.getElements(item,true));}}
return new Elements(elements);},getDocument:function(){return this.document;},getWindow:function(){return this;}});Native.implement([Element,Document],{getElement:function(selector,nocash){return document.id(this.getElements(selector,true)[0]||null,nocash);},getElements:function(tags,nocash){tags=tags.split(',');var elements=[];var ddup=(tags.length>1);tags.each(function(tag){var partial=this.getElementsByTagName(tag.trim());(ddup)?elements.extend(partial):elements=partial;},this);return new Elements(elements,{ddup:ddup,cash:!nocash});}});var collected={},storage={};var props={input:'checked',option:'selected',textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?'innerHTML':'value'};var get=function(uid){return(storage[uid]||(storage[uid]={}));};var clean=function(item,retain){if(!item)return;var uid=item.uid;if(Browser.Engine.trident){if(item.clearAttributes){var clone=retain&&item.cloneNode(false);item.clearAttributes();if(clone)item.mergeAttributes(clone);}else if(item.removeEvents){item.removeEvents();}
if((/object/i).test(item.tagName)){for(var p in item){if(typeof item[p]=='function')item[p]=$empty;}
Element.dispose(item);}}
if(!uid)return;collected[uid]=storage[uid]=null;};var clean12=function(item,retain){if(!item)return;var uid=item.uid;if(collected[uid]==window)
return;if(!$defined(collected[uid]))
return;if(!(collected[uid].nodeType==1&&collected[uid].getParent('div#content')!=null))
return;if(Browser.Engine.trident){if(item.clearAttributes){var clone=retain&&item.cloneNode(false);item.clearAttributes();if(clone)item.mergeAttributes(clone);}else if(item.removeEvents){item.removeEvents();}
if((/object/i).test(item.tagName)){for(var p in item){if(typeof item[p]=='function')item[p]=$empty;}
Element.dispose(item);}}
if(!uid)return;collected[uid]=storage[uid]=null;};var purge=function(){Hash.each(collected,clean);if(Browser.Engine.trident)$A(document.getElementsByTagName('object')).each(clean);if(window.CollectGarbage)CollectGarbage();collected=storage=null;};function purgeAjax(){Hash.each(collected,clean12);}
var walk=function(element,walk,start,match,all,nocash){var el=element[start||walk];var elements=[];while(el){if(el.nodeType==1&&(!match||Element.match(el,match))){if(!all)return document.id(el,nocash);elements.push(el);}
el=el[walk];}
return(all)?new Elements(elements,{ddup:false,cash:!nocash}):null;};var attributes={'html':'innerHTML','class':'className','for':'htmlFor','defaultValue':'defaultValue','text':(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?'innerText':'textContent'};var bools=['compact','nowrap','ismap','declare','noshade','checked','disabled','readonly','multiple','selected','noresize','defer'];var camels=['value','type','defaultValue','accessKey','cellPadding','cellSpacing','colSpan','frameBorder','maxLength','readOnly','rowSpan','tabIndex','useMap'];bools=bools.associate(bools);Hash.extend(attributes,bools);Hash.extend(attributes,camels.associate(camels.map(String.toLowerCase)));var inserters={before:function(context,element){if(element.parentNode)element.parentNode.insertBefore(context,element);},after:function(context,element){if(!element.parentNode)return;var next=element.nextSibling;(next)?element.parentNode.insertBefore(context,next):element.parentNode.appendChild(context);},bottom:function(context,element){element.appendChild(context);},top:function(context,element){var first=element.firstChild;(first)?element.insertBefore(context,first):element.appendChild(context);}};inserters.inside=inserters.bottom;Hash.each(inserters,function(inserter,where){where=where.capitalize();Element.implement('inject'+where,function(el){inserter(this,document.id(el,true));return this;});Element.implement('grab'+where,function(el){inserter(document.id(el,true),this);return this;});});Element.implement({set:function(prop,value){switch($type(prop)){case'object':for(var p in prop)this.set(p,prop[p]);break;case'string':var property=Element.Properties.get(prop);(property&&property.set)?property.set.apply(this,Array.slice(arguments,1)):this.setProperty(prop,value);}
return this;},get:function(prop){var property=Element.Properties.get(prop);return(property&&property.get)?property.get.apply(this,Array.slice(arguments,1)):this.getProperty(prop);},erase:function(prop){var property=Element.Properties.get(prop);(property&&property.erase)?property.erase.apply(this):this.removeProperty(prop);return this;},setProperty:function(attribute,value){var key=attributes[attribute];if(value==undefined)return this.removeProperty(attribute);if(key&&bools[attribute])value=!!value;(key)?this[key]=value:this.setAttribute(attribute,''+value);return this;},setProperties:function(attributes){for(var attribute in attributes)this.setProperty(attribute,attributes[attribute]);return this;},getProperty:function(attribute){var key=attributes[attribute];var value=(key)?this[key]:this.getAttribute(attribute,2);return(bools[attribute])?!!value:(key)?value:value||null;},getProperties:function(){var args=$A(arguments);return args.map(this.getProperty,this).associate(args);},removeProperty:function(attribute){var key=attributes[attribute];(key)?this[key]=(key&&bools[attribute])?false:'':this.removeAttribute(attribute);return this;},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;},hasClass:function(className){return this.className.contains(className,' ');},addClass:function(className){if(!this.hasClass(className))this.className=(this.className+' '+className).clean();return this;},removeClass:function(className){this.className=this.className.replace(new RegExp('(^|\\s)'+className+'(?:\\s|$)'),'$1');return this;},toggleClass:function(className){return this.hasClass(className)?this.removeClass(className):this.addClass(className);},adopt:function(){Array.flatten(arguments).each(function(element){element=document.id(element,true);if(element)this.appendChild(element);},this);return this;},appendText:function(text,where){return this.grab(this.getDocument().newTextNode(text),where);},grab:function(el,where){inserters[where||'bottom'](document.id(el,true),this);return this;},inject:function(el,where){inserters[where||'bottom'](this,document.id(el,true));return this;},replaces:function(el){el=document.id(el,true);el.parentNode.replaceChild(this,el);return this;},wraps:function(el,where){el=document.id(el,true);return this.replaces(el).grab(el,where);},getPrevious:function(match,nocash){return walk(this,'previousSibling',null,match,false,nocash);},getAllPrevious:function(match,nocash){return walk(this,'previousSibling',null,match,true,nocash);},getNext:function(match,nocash){return walk(this,'nextSibling',null,match,false,nocash);},getAllNext:function(match,nocash){return walk(this,'nextSibling',null,match,true,nocash);},getFirst:function(match,nocash){return walk(this,'nextSibling','firstChild',match,false,nocash);},getLast:function(match,nocash){return walk(this,'previousSibling','lastChild',match,false,nocash);},getParent:function(match,nocash){return walk(this,'parentNode',null,match,false,nocash);},getParents:function(match,nocash){return walk(this,'parentNode',null,match,true,nocash);},getSiblings:function(match,nocash){return this.getParent().getChildren(match,nocash).erase(this);},getChildren:function(match,nocash){return walk(this,'nextSibling','firstChild',match,true,nocash);},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument;},getElementById:function(id,nocash){var el=this.ownerDocument.getElementById(id);if(!el)return null;for(var parent=el.parentNode;parent!=this;parent=parent.parentNode){if(!parent)return null;}
return document.id(el,nocash);},getSelected:function(){return new Elements($A(this.options).filter(function(option){return option.selected;}));},getComputedStyle:function(property){if(this.currentStyle)return this.currentStyle[property.camelCase()];var computed=this.getDocument().defaultView.getComputedStyle(this,null);return(computed)?computed.getPropertyValue([property.hyphenate()]):null;},toQueryString:function(){var queryString=[];this.getElements('input, select, textarea',true).each(function(el){if(!el.name||el.disabled||el.type=='submit'||el.type=='reset'||el.type=='file')return;var value=(el.tagName.toLowerCase()=='select')?Element.getSelected(el).map(function(opt){return opt.value;}):((el.type=='radio'||el.type=='checkbox')&&!el.checked)?null:el.value;$splat(value).each(function(val){if(typeof val!='undefined')queryString.push(el.name+'='+encodeURIComponent(val));});});return queryString.join('&');},clone:function(contents,keepid){contents=contents!==false;var clone=this.cloneNode(contents);var clean=function(node,element){if(!keepid)node.removeAttribute('id');if(Browser.Engine.trident){node.clearAttributes();node.mergeAttributes(element);node.removeAttribute('uid');if(node.options){var no=node.options,eo=element.options;for(var j=no.length;j--;)no[j].selected=eo[j].selected;}}
var prop=props[element.tagName.toLowerCase()];if(prop&&element[prop])node[prop]=element[prop];};if(contents){var ce=clone.getElementsByTagName('*'),te=this.getElementsByTagName('*');for(var i=ce.length;i--;)clean(ce[i],te[i]);}
clean(clone,this);return document.id(clone);},destroy:function(){Element.empty(this);Element.dispose(this);clean(this,true);return null;},empty:function(){$A(this.childNodes).each(function(node){Element.destroy(node);});return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},hasChild:function(el){el=document.id(el,true);if(!el)return false;if(Browser.Engine.webkit&&Browser.Engine.version<420)return $A(this.getElementsByTagName(el.tagName)).contains(el);return(this.contains)?(this!=el&&this.contains(el)):!!(this.compareDocumentPosition(el)&16);},match:function(tag){return(!tag||(tag==this)||(Element.get(this,'tag')==tag));}});Native.implement([Element,Window,Document],{addListener:function(type,fn){if(type=='unload'){var old=fn,self=this;fn=function(){self.removeListener('unload',fn);old();};}else{collected[this.uid]=this;}
if(this.addEventListener)this.addEventListener(type,fn,false);else this.attachEvent('on'+type,fn);return this;},removeListener:function(type,fn){if(this.removeEventListener)this.removeEventListener(type,fn,false);else this.detachEvent('on'+type,fn);return this;},retrieve:function(property,dflt){var storage=get(this.uid),prop=storage[property];if(dflt!=undefined&&prop==undefined)prop=storage[property]=dflt;return $pick(prop);},store:function(property,value){var storage=get(this.uid);storage[property]=value;return this;},eliminate:function(property){var storage=get(this.uid);delete storage[property];return this;}});window.addListener('unload',purge);Element.Properties=new Hash;Element.Properties.style={set:function(style){this.style.cssText=style;},get:function(){return this.style.cssText;},erase:function(){this.style.cssText='';}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase();}};Element.Properties.html=(function(){var wrapper=document.createElement('div');var translations={table:[1,'<table>','</table>'],select:[1,'<select>','</select>'],tbody:[2,'<table><tbody>','</tbody></table>'],tr:[3,'<table><tbody><tr>','</tr></tbody></table>']};translations.thead=translations.tfoot=translations.tbody;var html={set:function(){var html=Array.flatten(arguments).join('');var wrap=Browser.Engine.trident&&translations[this.get('tag')];if(wrap){var first=wrapper;first.innerHTML=wrap[1]+html+wrap[2];for(var i=wrap[0];i--;)first=first.firstChild;this.empty().adopt(first.childNodes);}else{this.innerHTML=html;}}};html.erase=html.set;return html;})();if(Browser.Engine.webkit&&Browser.Engine.version<420)Element.Properties.text={get:function(){if(this.innerText)return this.innerText;var temp=this.ownerDocument.newElement('div',{html:this.innerHTML}).inject(this.ownerDocument.body);var text=temp.innerText;temp.destroy();return text;}};Element.Properties.events={set:function(events){this.addEvents(events);}};Native.implement([Element,Window,Document],{addEvent:function(type,fn){var events=this.retrieve('events',{});events[type]=events[type]||{'keys':[],'values':[]};if(events[type].keys.contains(fn))return this;events[type].keys.push(fn);var realType=type,custom=Element.Events.get(type),condition=fn,self=this;if(custom){if(custom.onAdd)custom.onAdd.call(this,fn);if(custom.condition){condition=function(event){if(custom.condition.call(this,event))return fn.call(this,event);return true;};}
realType=custom.base||realType;}
var defn=function(){return fn.call(self);};var nativeEvent=Element.NativeEvents[realType];if(nativeEvent){if(nativeEvent==2){defn=function(event){event=new Event(event,self.getWindow());if(condition.call(self,event)===false)event.stop();};}
this.addListener(realType,defn);}
events[type].values.push(defn);return this;},removeEvent:function(type,fn){var events=this.retrieve('events');if(!events||!events[type])return this;var pos=events[type].keys.indexOf(fn);if(pos==-1)return this;events[type].keys.splice(pos,1);var value=events[type].values.splice(pos,1)[0];var custom=Element.Events.get(type);if(custom){if(custom.onRemove)custom.onRemove.call(this,fn);type=custom.base||type;}
return(Element.NativeEvents[type])?this.removeListener(type,value):this;},addEvents:function(events){for(var event in events)this.addEvent(event,events[event]);return this;},removeEvents:function(events){var type;if($type(events)=='object'){for(type in events)this.removeEvent(type,events[type]);return this;}
var attached=this.retrieve('events');if(!attached)return this;if(!events){for(type in attached)this.removeEvents(type);this.eliminate('events');}else if(attached[events]){while(attached[events].keys[0])this.removeEvent(events,attached[events].keys[0]);attached[events]=null;}
return this;},fireEvent:function(type,args,delay){var events=this.retrieve('events');if(!events||!events[type])return this;events[type].keys.each(function(fn){fn.create({'bind':this,'delay':delay,'arguments':args})();},this);return this;},cloneEvents:function(from,type){from=document.id(from);var fevents=from.retrieve('events');if(!fevents)return this;if(!type){for(var evType in fevents)this.cloneEvents(from,evType);}else if(fevents[type]){fevents[type].keys.each(function(fn){this.addEvent(type,fn);},this);}
return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1};(function(){var $check=function(event){var related=event.relatedTarget;if(related==undefined)return true;if(related===false)return false;return($type(this)!='document'&&related!=this&&related.prefix!='xul'&&!this.hasChild(related));};Element.Events=new Hash({mouseenter:{base:'mouseover',condition:$check},mouseleave:{base:'mouseout',condition:$check},mousewheel:{base:(Browser.Engine.gecko)?'DOMMouseScroll':'mousewheel'}});})();Element.Properties.styles={set:function(styles){this.setStyles(styles);}};Element.Properties.opacity={set:function(opacity,novisibility){if(!novisibility){if(opacity==0){if(this.style.visibility!='hidden')this.style.visibility='hidden';}else{if(this.style.visibility!='visible')this.style.visibility='visible';}}
if(!this.currentStyle||!this.currentStyle.hasLayout)this.style.zoom=1;if(Browser.Engine.trident)this.style.filter=(opacity==1)?'':'alpha(opacity='+opacity*100+')';this.style.opacity=opacity;this.store('opacity',opacity);},get:function(){return this.retrieve('opacity',1);}};Element.implement({setOpacity:function(value){return this.set('opacity',value,true);},getOpacity:function(){return this.get('opacity');},setStyle:function(property,value){switch(property){case'opacity':return this.set('opacity',parseFloat(value));case'float':property=(Browser.Engine.trident)?'styleFloat':'cssFloat';}
property=property.camelCase();if($type(value)!='string'){var map=(Element.Styles.get(property)||'@').split(' ');value=$splat(value).map(function(val,i){if(!map[i])return'';return($type(val)=='number')?map[i].replace('@',Math.round(val)):val;}).join(' ');}else if(value==String(Number(value))){value=Math.round(value);}
this.style[property]=value;return this;},getStyle:function(property){switch(property){case'opacity':return this.get('opacity');case'float':property=(Browser.Engine.trident)?'styleFloat':'cssFloat';}
property=property.camelCase();var result=this.style[property];if(!$chk(result)){result=[];for(var style in Element.ShortStyles){if(property!=style)continue;for(var s in Element.ShortStyles[style])result.push(this.getStyle(s));return result.join(' ');}
result=this.getComputedStyle(property);}
if(result){result=String(result);var color=result.match(/rgba?\([\d\s,]+\)/);if(color)result=result.replace(color[0],color[0].rgbToHex());}
if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(result,10)))){if(property.test(/^(height|width)$/)){var values=(property=='width')?['left','right']:['top','bottom'],size=0;values.each(function(value){size+=this.getStyle('border-'+value+'-width').toInt()+this.getStyle('padding-'+value).toInt();},this);return this['offset'+property.capitalize()]-size+'px';}
if((Browser.Engine.presto)&&String(result).test('px'))return result;if(property.test(/(border(.+)Width|margin|padding)/))return'0px';}
return result;},setStyles:function(styles){for(var style in styles)this.setStyle(style,styles[style]);return this;},getStyles:function(){var result={};Array.flatten(arguments).each(function(key){result[key]=this.getStyle(key);},this);return result;}});Element.Styles=new Hash({left:'@px',top:'@px',bottom:'@px',right:'@px',width:'@px',height:'@px',maxWidth:'@px',maxHeight:'@px',minWidth:'@px',minHeight:'@px',backgroundColor:'rgb(@, @, @)',backgroundPosition:'@px @px',color:'rgb(@, @, @)',fontSize:'@px',letterSpacing:'@px',lineHeight:'@px',clip:'rect(@px @px @px @px)',margin:'@px @px @px @px',padding:'@px @px @px @px',border:'@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)',borderWidth:'@px @px @px @px',borderStyle:'@ @ @ @',borderColor:'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)',zIndex:'@','zoom':'@',fontWeight:'@',textIndent:'@px',opacity:'@'});Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};['Top','Right','Bottom','Left'].each(function(direction){var Short=Element.ShortStyles;var All=Element.Styles;['margin','padding'].each(function(style){var sd=style+direction;Short[style][sd]=All[sd]='@px';});var bd='border'+direction;Short.border[bd]=All[bd]='@px @ rgb(@, @, @)';var bdw=bd+'Width',bds=bd+'Style',bdc=bd+'Color';Short[bd]={};Short.borderWidth[bdw]=Short[bd][bdw]=All[bdw]='@px';Short.borderStyle[bds]=Short[bd][bds]=All[bds]='@';Short.borderColor[bdc]=Short[bd][bdc]=All[bdc]='rgb(@, @, @)';});(function(){Element.implement({scrollTo:function(x,y){if(isBody(this)){this.getWindow().scrollTo(x,y);}else{this.scrollLeft=x;this.scrollTop=y;}
return this;},getSize:function(){if(isBody(this))return this.getWindow().getSize();return{x:this.offsetWidth,y:this.offsetHeight};},getScrollSize:function(){if(isBody(this))return this.getWindow().getScrollSize();return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(isBody(this))return this.getWindow().getScroll();return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var element=this,position={x:0,y:0};while(element&&!isBody(element)){position.x+=element.scrollLeft;position.y+=element.scrollTop;element=element.parentNode;}
return position;},getOffsetParent:function(){var element=this;if(isBody(element))return null;if(!Browser.Engine.trident)return element.offsetParent;while((element=element.parentNode)&&!isBody(element)){if(styleString(element,'position')!='static')return element;}
return null;},getOffsets:function(){if(this.getBoundingClientRect){var bound=this.getBoundingClientRect(),html=document.id(this.getDocument().documentElement),htmlScroll=html.getScroll(),elemScrolls=this.getScrolls(),elemScroll=this.getScroll(),isFixed=(styleString(this,'position')=='fixed');return{x:bound.left.toInt()+elemScrolls.x-elemScroll.x+((isFixed)?0:htmlScroll.x)-html.clientLeft,y:bound.top.toInt()+elemScrolls.y-elemScroll.y+((isFixed)?0:htmlScroll.y)-html.clientTop};}
var element=this,position={x:0,y:0};if(isBody(this))return position;while(element&&!isBody(element)){position.x+=element.offsetLeft;position.y+=element.offsetTop;if(Browser.Engine.gecko){if(!borderBox(element)){position.x+=leftBorder(element);position.y+=topBorder(element);}
var parent=element.parentNode;if(parent&&styleString(parent,'overflow')!='visible'){position.x+=leftBorder(parent);position.y+=topBorder(parent);}}else if(element!=this&&Browser.Engine.webkit){position.x+=leftBorder(element);position.y+=topBorder(element);}
element=element.offsetParent;}
if(Browser.Engine.gecko&&!borderBox(this)){position.x-=leftBorder(this);position.y-=topBorder(this);}
return position;},getPosition:function(relative){if(isBody(this))return{x:0,y:0};var offset=this.getOffsets(),scroll=this.getScrolls();var position={x:offset.x-scroll.x,y:offset.y-scroll.y};var relativePosition=(relative&&(relative=document.id(relative)))?relative.getPosition():{x:0,y:0};return{x:position.x-relativePosition.x,y:position.y-relativePosition.y};},getCoordinates:function(element){if(isBody(this))return this.getWindow().getCoordinates();var position=this.getPosition(element),size=this.getSize();var obj={left:position.x,top:position.y,width:size.x,height:size.y};obj.right=obj.left+obj.width;obj.bottom=obj.top+obj.height;return obj;},computePosition:function(obj){return{left:obj.x-styleNumber(this,'margin-left'),top:obj.y-styleNumber(this,'margin-top')};},setPosition:function(obj){return this.setStyles(this.computePosition(obj));}});Native.implement([Document,Window],{getSize:function(){if(Browser.Engine.presto||Browser.Engine.webkit){var win=this.getWindow();return{x:win.innerWidth,y:win.innerHeight};}
var doc=getCompatElement(this);return{x:doc.clientWidth,y:doc.clientHeight};},getScroll:function(){var win=this.getWindow(),doc=getCompatElement(this);return{x:win.pageXOffset||doc.scrollLeft,y:win.pageYOffset||doc.scrollTop};},getScrollSize:function(){var doc=getCompatElement(this),min=this.getSize();return{x:Math.max(doc.scrollWidth,min.x),y:Math.max(doc.scrollHeight,min.y)};},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var size=this.getSize();return{top:0,left:0,bottom:size.y,right:size.x,height:size.y,width:size.x};}});var styleString=Element.getComputedStyle;function styleNumber(element,style){return styleString(element,style).toInt()||0;};function borderBox(element){return styleString(element,'-moz-box-sizing')=='border-box';};function topBorder(element){return styleNumber(element,'border-top-width');};function leftBorder(element){return styleNumber(element,'border-left-width');};function isBody(element){return(/^(?:body|html)$/i).test(element.tagName);};function getCompatElement(element){var doc=element.getDocument();return(!doc.compatMode||doc.compatMode=='CSS1Compat')?doc.html:doc.body;};})();Element.alias('setPosition','position');Native.implement([Window,Document,Element],{getHeight:function(){return this.getSize().y;},getWidth:function(){return this.getSize().x;},getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x;},getScrollHeight:function(){return this.getScrollSize().y;},getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y;},getLeft:function(){return this.getPosition().x;}});Native.implement([Document,Element],{getElements:function(expression,nocash){expression=expression.split(',');var items,local={};for(var i=0,l=expression.length;i<l;i++){var selector=expression[i],elements=Selectors.Utils.search(this,selector,local);if(i!=0&&elements.item)elements=$A(elements);items=(i==0)?elements:(items.item)?$A(items).concat(elements):items.concat(elements);}
return new Elements(items,{ddup:(expression.length>1),cash:!nocash});}});Element.implement({match:function(selector){if(!selector||(selector==this))return true;var tagid=Selectors.Utils.parseTagAndID(selector);var tag=tagid[0],id=tagid[1];if(!Selectors.Filters.byID(this,id)||!Selectors.Filters.byTag(this,tag))return false;var parsed=Selectors.Utils.parseSelector(selector);return(parsed)?Selectors.Utils.filter(this,parsed,{}):true;}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)};Selectors.Utils={chk:function(item,uniques){if(!uniques)return true;var uid=$uid(item);if(!uniques[uid])return uniques[uid]=true;return false;},parseNthArgument:function(argument){if(Selectors.Cache.nth[argument])return Selectors.Cache.nth[argument];var parsed=argument.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!parsed)return false;var inta=parseInt(parsed[1],10);var a=(inta||inta===0)?inta:1;var special=parsed[2]||false;var b=parseInt(parsed[3],10)||0;if(a!=0){b--;while(b<1)b+=a;while(b>=a)b-=a;}else{a=b;special='index';}
switch(special){case'n':parsed={a:a,b:b,special:'n'};break;case'odd':parsed={a:2,b:0,special:'n'};break;case'even':parsed={a:2,b:1,special:'n'};break;case'first':parsed={a:0,special:'index'};break;case'last':parsed={special:'last-child'};break;case'only':parsed={special:'only-child'};break;default:parsed={a:(a-1),special:'index'};}
return Selectors.Cache.nth[argument]=parsed;},parseSelector:function(selector){if(Selectors.Cache.parsed[selector])return Selectors.Cache.parsed[selector];var m,parsed={classes:[],pseudos:[],attributes:[]};while((m=Selectors.RegExps.combined.exec(selector))){var cn=m[1],an=m[2],ao=m[3],av=m[5],pn=m[6],pa=m[7];if(cn){parsed.classes.push(cn);}else if(pn){var parser=Selectors.Pseudo.get(pn);if(parser)parsed.pseudos.push({parser:parser,argument:pa});else parsed.attributes.push({name:pn,operator:'=',value:pa});}else if(an){parsed.attributes.push({name:an,operator:ao,value:av});}}
if(!parsed.classes.length)delete parsed.classes;if(!parsed.attributes.length)delete parsed.attributes;if(!parsed.pseudos.length)delete parsed.pseudos;if(!parsed.classes&&!parsed.attributes&&!parsed.pseudos)parsed=null;return Selectors.Cache.parsed[selector]=parsed;},parseTagAndID:function(selector){var tag=selector.match(Selectors.RegExps.tag);var id=selector.match(Selectors.RegExps.id);return[(tag)?tag[1]:'*',(id)?id[1]:false];},filter:function(item,parsed,local){var i;if(parsed.classes){for(i=parsed.classes.length;i--;i){var cn=parsed.classes[i];if(!Selectors.Filters.byClass(item,cn))return false;}}
if(parsed.attributes){for(i=parsed.attributes.length;i--;i){var att=parsed.attributes[i];if(!Selectors.Filters.byAttribute(item,att.name,att.operator,att.value))return false;}}
if(parsed.pseudos){for(i=parsed.pseudos.length;i--;i){var psd=parsed.pseudos[i];if(!Selectors.Filters.byPseudo(item,psd.parser,psd.argument,local))return false;}}
return true;},getByTagAndID:function(ctx,tag,id){if(id){var item=(ctx.getElementById)?ctx.getElementById(id,true):Element.getElementById(ctx,id,true);return(item&&Selectors.Filters.byTag(item,tag))?[item]:[];}else{return ctx.getElementsByTagName(tag);}},search:function(self,expression,local){var splitters=[];var selectors=expression.trim().replace(Selectors.RegExps.splitter,function(m0,m1,m2){splitters.push(m1);return':)'+m2;}).split(':)');var items,filtered,item;for(var i=0,l=selectors.length;i<l;i++){var selector=selectors[i];if(i==0&&Selectors.RegExps.quick.test(selector)){items=self.getElementsByTagName(selector);continue;}
var splitter=splitters[i-1];var tagid=Selectors.Utils.parseTagAndID(selector);var tag=tagid[0],id=tagid[1];if(i==0){items=Selectors.Utils.getByTagAndID(self,tag,id);}else{var uniques={},found=[];for(var j=0,k=items.length;j<k;j++)found=Selectors.Getters[splitter](found,items[j],tag,id,uniques);items=found;}
var parsed=Selectors.Utils.parseSelector(selector);if(parsed){filtered=[];for(var m=0,n=items.length;m<n;m++){item=items[m];if(Selectors.Utils.filter(item,parsed,local))filtered.push(item);}
items=filtered;}}
return items;}};Selectors.Getters={' ':function(found,self,tag,id,uniques){var items=Selectors.Utils.getByTagAndID(self,tag,id);for(var i=0,l=items.length;i<l;i++){var item=items[i];if(Selectors.Utils.chk(item,uniques))found.push(item);}
return found;},'>':function(found,self,tag,id,uniques){var children=Selectors.Utils.getByTagAndID(self,tag,id);for(var i=0,l=children.length;i<l;i++){var child=children[i];if(child.parentNode==self&&Selectors.Utils.chk(child,uniques))found.push(child);}
return found;},'+':function(found,self,tag,id,uniques){while((self=self.nextSibling)){if(self.nodeType==1){if(Selectors.Utils.chk(self,uniques)&&Selectors.Filters.byTag(self,tag)&&Selectors.Filters.byID(self,id))found.push(self);break;}}
return found;},'~':function(found,self,tag,id,uniques){while((self=self.nextSibling)){if(self.nodeType==1){if(!Selectors.Utils.chk(self,uniques))break;if(Selectors.Filters.byTag(self,tag)&&Selectors.Filters.byID(self,id))found.push(self);}}
return found;}};Selectors.Filters={byTag:function(self,tag){return(tag=='*'||(self.tagName&&self.tagName.toLowerCase()==tag));},byID:function(self,id){return(!id||(self.id&&self.id==id));},byClass:function(self,klass){return(self.className&&self.className.contains&&self.className.contains(klass,' '));},byPseudo:function(self,parser,argument,local){return parser.call(self,argument,local);},byAttribute:function(self,name,operator,value){var result=Element.prototype.getProperty.call(self,name);if(!result)return(operator=='!=');if(!operator||value==undefined)return true;switch(operator){case'=':return(result==value);case'*=':return(result.contains(value));case'^=':return(result.substr(0,value.length)==value);case'$=':return(result.substr(result.length-value.length)==value);case'!=':return(result!=value);case'~=':return result.contains(value,' ');case'|=':return result.contains(value,'-');}
return false;}};Selectors.Pseudo=new Hash({checked:function(){return this.checked;},empty:function(){return!(this.innerText||this.textContent||'').length;},not:function(selector){return!Element.match(this,selector);},contains:function(text){return(this.innerText||this.textContent||'').contains(text);},'first-child':function(){return Selectors.Pseudo.index.call(this,0);},'last-child':function(){var element=this;while((element=element.nextSibling)){if(element.nodeType==1)return false;}
return true;},'only-child':function(){var prev=this;while((prev=prev.previousSibling)){if(prev.nodeType==1)return false;}
var next=this;while((next=next.nextSibling)){if(next.nodeType==1)return false;}
return true;},'nth-child':function(argument,local){argument=(argument==undefined)?'n':argument;var parsed=Selectors.Utils.parseNthArgument(argument);if(parsed.special!='n')return Selectors.Pseudo[parsed.special].call(this,parsed.a,local);var count=0;local.positions=local.positions||{};var uid=$uid(this);if(!local.positions[uid]){var self=this;while((self=self.previousSibling)){if(self.nodeType!=1)continue;count++;var position=local.positions[$uid(self)];if(position!=undefined){count=position+count;break;}}
local.positions[uid]=count;}
return(local.positions[uid]%parsed.a==parsed.b);},index:function(index){var element=this,count=0;while((element=element.previousSibling)){if(element.nodeType==1&&++count>index)return false;}
return(count==index);},even:function(argument,local){return Selectors.Pseudo['nth-child'].call(this,'2n+1',local);},odd:function(argument,local){return Selectors.Pseudo['nth-child'].call(this,'2n',local);},selected:function(){return this.selected;},enabled:function(){return(this.disabled===false);}});Element.Events.domready={onAdd:function(fn){if(Browser.loaded)fn.call(this);}};(function(){var domready=function(){if(Browser.loaded)return;Browser.loaded=true;window.fireEvent('domready');document.fireEvent('domready');};window.addEvent('load',domready);if(Browser.Engine.trident){var temp=document.createElement('div');(function(){($try(function(){temp.doScroll();return document.id(temp).inject(document.body).set('html','temp').dispose();}))?domready():arguments.callee.delay(50);})();}else if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(['loaded','complete'].contains(document.readyState))?domready():arguments.callee.delay(50);})();}else{document.addEvent('DOMContentLoaded',domready);}})();var JSON=new Hash(this.JSON&&{stringify:JSON.stringify,parse:JSON.parse}).extend({$specialChars:{'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},$replaceChars:function(chr){return JSON.$specialChars[chr]||'\\u00'+Math.floor(chr.charCodeAt()/16).toString(16)+(chr.charCodeAt()%16).toString(16);},encode:function(obj){switch($type(obj)){case'string':return'"'+obj.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case'array':return'['+String(obj.map(JSON.encode).clean())+']';case'object':case'hash':var string=[];Hash.each(obj,function(value,key){var json=JSON.encode(value);if(json)string.push(JSON.encode(key)+':'+json);});return'{'+string+'}';case'number':case'boolean':return String(obj);case false:return'null';}
return null;},decode:function(string,secure){if($type(string)!='string'||!string.length)return null;if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'')))return null;return eval('('+string+')');}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(key,options){this.key=key;this.setOptions(options);},write:function(value){value=encodeURIComponent(value);if(this.options.domain)value+='; domain='+this.options.domain;if(this.options.path)value+='; path='+this.options.path;if(this.options.duration){var date=new Date();date.setTime(date.getTime()+this.options.duration*24*60*60*1000);value+='; expires='+date.toGMTString();}
if(this.options.secure)value+='; secure';this.options.document.cookie=this.key+'='+value;return this;},read:function(){var value=this.options.document.cookie.match('(?:^|;)\\s*'+this.key.escapeRegExp()+'=([^;]*)');return(value)?decodeURIComponent(value[1]):null;},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write('');return this;}});Cookie.write=function(key,value,options){return new Cookie(key,options).write(value);};Cookie.read=function(key){return new Cookie(key).read();};Cookie.dispose=function(key,options){return new Cookie(key,options).dispose();};var Swiff=new Class({Implements:[Options],options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:'high',allowScriptAccess:'always',wMode:'transparent',swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object;},initialize:function(path,options){this.instance='Swiff_'+$time();this.setOptions(options);options=this.options;var id=this.id=options.id||this.instance;var container=document.id(options.container);Swiff.CallBacks[this.instance]={};var params=options.params,vars=options.vars,callBacks=options.callBacks;var properties=$extend({height:options.height,width:options.width},options.properties);var self=this;for(var callBack in callBacks){Swiff.CallBacks[this.instance][callBack]=(function(option){return function(){return option.apply(self.object,arguments);};})(callBacks[callBack]);vars[callBack]='Swiff.CallBacks.'+this.instance+'.'+callBack;}
params.flashVars=Hash.toQueryString(vars);if(Browser.Engine.trident){properties.classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';params.movie=path;}else{properties.type='application/x-shockwave-flash';properties.data=path;}
var build='<object id="'+id+'"';for(var property in properties)build+=' '+property+'="'+properties[property]+'"';build+='>';for(var param in params){if(params[param])build+='<param name="'+param+'" value="'+params[param]+'" />';}
build+='</object>';this.object=((container)?container.empty():new Element('div')).set('html',build).firstChild;},replaces:function(element){element=document.id(element,true);element.parentNode.replaceChild(this.toElement(),element);return this;},inject:function(element){document.id(element,true).appendChild(this.toElement());return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].extend(arguments));}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+'</invoke>');return eval(rs);};var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:'ignore'},initialize:function(options){this.subject=this.subject||this;this.setOptions(options);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var wait=this.options.wait;if(wait===false)this.options.link='cancel';},getTransition:function(){return function(p){return-(Math.cos(Math.PI*p)-1)/2;};},step:function(){var time=$time();if(time<this.time+this.options.duration){var delta=this.transition((time-this.time)/this.options.duration);this.set(this.compute(this.from,this.to,delta));}else{this.set(this.compute(this.from,this.to,1));this.complete();}},set:function(now){return now;},compute:function(from,to,delta){return Fx.compute(from,to,delta);},check:function(){if(!this.timer)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(this.caller.bind(this,arguments));return false;}
return false;},start:function(from,to){if(!this.check(from,to))return this;this.from=from;this.to=to;this.time=0;this.transition=this.getTransition();this.startTimer();this.onStart();return this;},complete:function(){if(this.stopTimer())this.onComplete();return this;},cancel:function(){if(this.stopTimer())this.onCancel();return this;},onStart:function(){this.fireEvent('start',this.subject);},onComplete:function(){this.fireEvent('complete',this.subject);if(!this.callChain())this.fireEvent('chainComplete',this.subject);},onCancel:function(){this.fireEvent('cancel',this.subject).clearChain();},pause:function(){this.stopTimer();return this;},resume:function(){this.startTimer();return this;},stopTimer:function(){if(!this.timer)return false;this.time=$time()-this.time;this.timer=$clear(this.timer);return true;},startTimer:function(){if(this.timer)return false;this.time=$time()-this.time;this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);return true;}});Fx.compute=function(from,to,delta){return(to-from)*delta+from;};Fx.Durations={'short':250,'normal':500,'long':1000};Fx.CSS=new Class({Extends:Fx,prepare:function(element,property,values){values=$splat(values);var values1=values[1];if(!$chk(values1)){values[1]=values[0];values[0]=element.getStyle(property);}
var parsed=values.map(this.parse);return{from:parsed[0],to:parsed[1]};},parse:function(value){value=$lambda(value)();value=(typeof value=='string')?value.split(' '):$splat(value);return value.map(function(val){val=String(val);var found=false;Fx.CSS.Parsers.each(function(parser,key){if(found)return;var parsed=parser.parse(val);if($chk(parsed))found={value:parsed,parser:parser};});found=found||{value:val,parser:Fx.CSS.Parsers.String};return found;});},compute:function(from,to,delta){var computed=[];(Math.min(from.length,to.length)).times(function(i){computed.push({value:from[i].parser.compute(from[i].value,to[i].value,delta),parser:from[i].parser});});computed.$family={name:'fx:css:value'};return computed;},serve:function(value,unit){if($type(value)!='fx:css:value')value=this.parse(value);var returned=[];value.each(function(bit){returned=returned.concat(bit.parser.serve(bit.value,unit));});return returned;},render:function(element,property,value,unit){element.setStyle(property,this.serve(value,unit));},search:function(selector){if(Fx.CSS.Cache[selector])return Fx.CSS.Cache[selector];var to={};Array.each(document.styleSheets,function(sheet,j){var href=sheet.href;if(href&&href.contains('://')&&!href.contains(document.domain))return;var rules=sheet.rules||sheet.cssRules;Array.each(rules,function(rule,i){if(!rule.style)return;var selectorText=(rule.selectorText)?rule.selectorText.replace(/^\w+/,function(m){return m.toLowerCase();}):null;if(!selectorText||!selectorText.test('^'+selector+'$'))return;Element.Styles.each(function(value,style){if(!rule.style[style]||Element.ShortStyles[style])return;value=String(rule.style[style]);to[style]=(value.test(/^rgb/))?value.rgbToHex():value;});});});return Fx.CSS.Cache[selector]=to;}});Fx.CSS.Cache={};Fx.CSS.Parsers=new Hash({Color:{parse:function(value){if(value.match(/^#[0-9a-f]{3,6}$/i))return value.hexToRgb(true);return((value=value.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[value[1],value[2],value[3]]:false;},compute:function(from,to,delta){return from.map(function(value,i){return Math.round(Fx.compute(from[i],to[i],delta));});},serve:function(value){return value.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(value,unit){return(unit)?value+unit:value;}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}});Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(element,options){this.element=this.subject=document.id(element);this.parent(options);},set:function(property,now){if(arguments.length==1){now=property;property=this.property||this.options.property;}
this.render(this.element,property,now,this.options.unit);return this;},start:function(property,from,to){if(!this.check(property,from,to))return this;var args=Array.flatten(arguments);this.property=this.options.property||args.shift();var parsed=this.prepare(this.element,this.property,args);return this.parent(parsed.from,parsed.to);}});Element.Properties.tween={set:function(options){var tween=this.retrieve('tween');if(tween)tween.cancel();return this.eliminate('tween').store('tween:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('tween')){if(options||!this.retrieve('tween:options'))this.set('tween',options);this.store('tween',new Fx.Tween(this,this.retrieve('tween:options')));}
return this.retrieve('tween');}};Element.implement({tween:function(property,from,to){this.get('tween').start(arguments);return this;},fade:function(how){var fade=this.get('tween'),o='opacity',toggle;how=$pick(how,'toggle');switch(how){case'in':fade.start(o,1);break;case'out':fade.start(o,0);break;case'show':fade.set(o,1);break;case'hide':fade.set(o,0);break;case'toggle':var flag=this.retrieve('fade:flag',this.get('opacity')==1);fade.start(o,(flag)?0:1);this.store('fade:flag',!flag);toggle=true;break;default:fade.start(o,arguments);}
if(!toggle)this.eliminate('fade:flag');return this;},highlight:function(start,end){if(!end){end=this.retrieve('highlight:original',this.getStyle('background-color'));end=(end=='transparent')?'#fff':end;}
var tween=this.get('tween');tween.start('background-color',start||'#ffff88',end).chain(function(){this.setStyle('background-color',this.retrieve('highlight:original'));tween.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(element,options){this.element=this.subject=document.id(element);this.parent(options);},set:function(now){if(typeof now=='string')now=this.search(now);for(var p in now)this.render(this.element,p,now[p],this.options.unit);return this;},compute:function(from,to,delta){var now={};for(var p in from)now[p]=this.parent(from[p],to[p],delta);return now;},start:function(properties){if(!this.check(properties))return this;if(typeof properties=='string')properties=this.search(properties);var from={},to={};for(var p in properties){var parsed=this.prepare(this.element,p,properties[p]);from[p]=parsed.from;to[p]=parsed.to;}
return this.parent(from,to);}});Element.Properties.morph={set:function(options){var morph=this.retrieve('morph');if(morph)morph.cancel();return this.eliminate('morph').store('morph:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('morph')){if(options||!this.retrieve('morph:options'))this.set('morph',options);this.store('morph',new Fx.Morph(this,this.retrieve('morph:options')));}
return this.retrieve('morph');}};Element.implement({morph:function(props){this.get('morph').start(props);return this;}});Fx.implement({getTransition:function(){var trans=this.options.transition||Fx.Transitions.Sine.easeInOut;if(typeof trans=='string'){var data=trans.split(':');trans=Fx.Transitions;trans=trans[data[0]]||trans[data[0].capitalize()];if(data[1])trans=trans['ease'+data[1].capitalize()+(data[2]?data[2].capitalize():'')];}
return trans;}});Fx.Transition=function(transition,params){params=$splat(params);return $extend(transition,{easeIn:function(pos){return transition(pos,params);},easeOut:function(pos){return 1-transition(1-pos,params);},easeInOut:function(pos){return(pos<=0.5)?transition(2*pos,params)/2:(2-transition(2*(1-pos),params))/2;}});};Fx.Transitions=new Hash({linear:$arguments(0)});Fx.Transitions.extend=function(transitions){for(var transition in transitions)Fx.Transitions[transition]=new Fx.Transition(transitions[transition]);};Fx.Transitions.extend({Pow:function(p,x){return Math.pow(p,x[0]||6);},Expo:function(p){return Math.pow(2,8*(p-1));},Circ:function(p){return 1-Math.sin(Math.acos(p));},Sine:function(p){return 1-Math.sin((1-p)*Math.PI/2);},Back:function(p,x){x=x[0]||1.618;return Math.pow(p,2)*((x+1)*p-x);},Bounce:function(p){var value;for(var a=0,b=1;1;a+=b,b/=2){if(p>=(7-4*a)/11){value=b*b-Math.pow((11-6*a-11*p)/4,2);break;}}
return value;},Elastic:function(p,x){return Math.pow(2,10*--p)*Math.cos(20*p*Math.PI*(x[0]||1)/3);}});['Quad','Cubic','Quart','Quint'].each(function(transition,i){Fx.Transitions[transition]=new Fx.Transition(function(p){return Math.pow(p,[i+2]);});});var Request=new Class({Implements:[Chain,Events,Options],options:{url:'',data:'',headers:{'X-Requested-With':'XMLHttpRequest','Accept':'text/javascript, text/html, application/xml, text/xml, */*'},async:true,format:false,method:'post',link:'ignore',isSuccess:null,emulation:true,urlEncoded:true,encoding:'utf-8',evalScripts:false,evalResponse:false,noCache:false},initialize:function(options){this.xhr=new Browser.Request();this.setOptions(options);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers);},onStateChange:function(){if(this.xhr.readyState!=4||!this.running)return;this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;}.bind(this));this.xhr.onreadystatechange=$empty;if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}},isSuccess:function(){return((this.status>=200)&&(this.status<300));},processScripts:function(text){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader('Content-type')))return $exec(text);return text.stripScripts(this.options.evalScripts);},success:function(text,xml){this.onSuccess(this.processScripts(text),xml);},onSuccess:function(){this.fireEvent('complete',arguments).fireEvent('success',arguments).callChain();},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent('complete').fireEvent('failure',this.xhr);},setHeader:function(name,value){this.headers.set(name,value);return this;},getHeader:function(name){return $try(function(){return this.xhr.getResponseHeader(name);}.bind(this));},check:function(){if(!this.running)return true;switch(this.options.link){case'cancel':this.cancel();return true;case'chain':this.chain(this.caller.bind(this,arguments));return false;}
return false;},send:function(options){if(!this.check(options))return this;this.running=true;var type=$type(options);if(type=='string'||type=='element')options={data:options};var old=this.options;options=$extend({data:old.data,url:old.url,method:old.method},options);var data=options.data,url=String(options.url),method=options.method.toLowerCase();switch($type(data)){case'element':data=document.id(data).toQueryString();break;case'object':case'hash':data=Hash.toQueryString(data);}
if(this.options.format){var format='format='+this.options.format;data=(data)?format+'&'+data:format;}
if(this.options.emulation&&!['get','post'].contains(method)){var _method='_method='+method;data=(data)?_method+'&'+data:_method;method='post';}
if(this.options.urlEncoded&&method=='post'){var encoding=(this.options.encoding)?'; charset='+this.options.encoding:'';this.headers.set('Content-type','application/x-www-form-urlencoded'+encoding);}
if(this.options.noCache){var noCache='noCache='+new Date().getTime();data=(data)?noCache+'&'+data:noCache;}
var trimPosition=url.lastIndexOf('/');if(trimPosition>-1&&(trimPosition=url.indexOf('#'))>-1)url=url.substr(0,trimPosition);if(data&&method=='get'){url=url+(url.contains('?')?'&':'?')+data;data=null;}
this.xhr.open(method.toUpperCase(),url,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(value,key){try{this.xhr.setRequestHeader(key,value);}catch(e){this.fireEvent('exception',[key,value]);}},this);this.fireEvent('request');this.xhr.send(data);if(!this.options.async)this.onStateChange();return this;},cancel:function(){if(!this.running)return this;this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=new Browser.Request();this.fireEvent('cancel');return this;}});(function(){var methods={};['get','post','put','delete','GET','POST','PUT','DELETE'].each(function(method){methods[method]=function(){var params=Array.link(arguments,{url:String.type,data:$defined});return this.send($extend(params,{method:method}));};});Request.implement(methods);})();Element.Properties.send={set:function(options){var send=this.retrieve('send');if(send)send.cancel();return this.eliminate('send').store('send:options',$extend({data:this,link:'cancel',method:this.get('method')||'post',url:this.get('action')},options));},get:function(options){if(options||!this.retrieve('send')){if(options||!this.retrieve('send:options'))this.set('send',options);this.store('send',new Request(this.retrieve('send:options')));}
return this.retrieve('send');}};Element.implement({send:function(url){var sender=this.get('send');sender.send({data:this,url:url||sender.options.url});return this;}});Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false},processHTML:function(text){var match=text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);text=(match)?match[1]:text;var container=new Element('div');if(text.trim()==""){return container.set('html',text.trim());}
return $try(function(){var root='<root>'+text+'</root>',doc;if(Browser.Engine.trident){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async=false;doc.loadXML(root);}else{doc=new DOMParser().parseFromString(root,'text/xml');}
root=doc.getElementsByTagName('root')[0];if(!root)return null;for(var i=0,k=root.childNodes.length;i<k;i++){var child=Element.clone(root.childNodes[i],true,true);if(child)container.grab(child);}
return container;})||container.set('html',text);},success:function(text){var options=this.options,response=this.response;response.html=text.stripScripts(function(script){response.javascript=script;});var temp=this.processHTML(response.html);response.tree=temp.childNodes;response.elements=temp.getElements('*');if(options.filter)response.tree=response.elements.filter(options.filter);if(options.update)document.id(options.update).empty().set('html',response.html);else if(options.append)document.id(options.append).adopt(temp.getChildren());if(options.evalScripts)$exec(response.javascript);this.onSuccess(response.tree,response.elements,response.html,response.javascript);}});Element.Properties.load={set:function(options){var load=this.retrieve('load');if(load)load.cancel();return this.eliminate('load').store('load:options',$extend({data:this,link:'cancel',update:this,method:'get'},options));},get:function(options){if(options||!this.retrieve('load')){if(options||!this.retrieve('load:options'))this.set('load',options);this.store('load',new Request.HTML(this.retrieve('load:options')));}
return this.retrieve('load');}};Element.implement({load:function(){this.get('load').send(Array.link(arguments,{data:Object.type,url:String.type}));return this;}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(options){this.parent(options);this.headers.extend({'Accept':'application/json','X-Request':'JSON'});},success:function(text){this.response.json=JSON.decode(text,this.options.secure);this.onSuccess(this.response.json,text);}});Class.Mutators.Binds=function(binds){return binds;};Class.Mutators.initialize=function(initialize){return function(){$splat(this.Binds).each(function(name){var original=this[name];if(original)this[name]=original.bind(this);},this);return initialize.apply(this,arguments);};};Element.implement({measure:function(fn){var vis=function(el){return!!(!el||el.offsetHeight||el.offsetWidth);};if(vis(this))return fn.apply(this);var parent=this.getParent(),restorers=[],toMeasure=[];while(!vis(parent)&&parent!=document.body){toMeasure.push(parent.expose());parent=parent.getParent();}
var restore=this.expose();var result=fn.apply(this);restore();toMeasure.each(function(restore){restore();});return result;},expose:function(){if(this.getStyle('display')!='none')return $empty;var before=this.style.cssText;this.setStyles({display:'block',position:'absolute',visibility:'hidden'});return function(){this.style.cssText=before;}.bind(this);},getDimensions:function(options){options=$merge({computeSize:false},options);var dim={};var getSize=function(el,options){return(options.computeSize)?el.getComputedSize(options):el.getSize();};var parent=this.getParent('body');if(parent&&this.getStyle('display')=='none'){dim=this.measure(function(){return getSize(this,options);});}else if(parent){try{dim=getSize(this,options);}catch(e){}}else{dim={x:0,y:0};}
return $chk(dim.x)?$extend(dim,{width:dim.x,height:dim.y}):$extend(dim,{x:dim.width,y:dim.height});},getComputedSize:function(options){options=$merge({styles:['padding','border'],plains:{height:['top','bottom'],width:['left','right']},mode:'both'},options);var size={width:0,height:0};switch(options.mode){case'vertical':delete size.width;delete options.plains.width;break;case'horizontal':delete size.height;delete options.plains.height;break;}
var getStyles=[];$each(options.plains,function(plain,key){plain.each(function(edge){options.styles.each(function(style){getStyles.push((style=='border')?style+'-'+edge+'-'+'width':style+'-'+edge);});});});var styles={};getStyles.each(function(style){styles[style]=this.getComputedStyle(style);},this);var subtracted=[];$each(options.plains,function(plain,key){var capitalized=key.capitalize();size['total'+capitalized]=size['computed'+capitalized]=0;plain.each(function(edge){size['computed'+edge.capitalize()]=0;getStyles.each(function(style,i){if(style.test(edge)){styles[style]=styles[style].toInt()||0;size['total'+capitalized]=size['total'+capitalized]+styles[style];size['computed'+edge.capitalize()]=size['computed'+edge.capitalize()]+styles[style];}
if(style.test(edge)&&key!=style&&(style.test('border')||style.test('padding'))&&!subtracted.contains(style)){subtracted.push(style);size['computed'+capitalized]=size['computed'+capitalized]-styles[style];}});});});['Width','Height'].each(function(value){var lower=value.toLowerCase();if(!$chk(size[lower]))return;size[lower]=size[lower]+this['offset'+value]+size['computed'+value];size['total'+value]=size[lower]+size['total'+value];delete size['computed'+value];},this);return $extend(styles,size);}});Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(elements,options){this.elements=this.subject=$$(elements);this.parent(options);},compute:function(from,to,delta){var now={};for(var i in from){var iFrom=from[i],iTo=to[i],iNow=now[i]={};for(var p in iFrom)iNow[p]=this.parent(iFrom[p],iTo[p],delta);}
return now;},set:function(now){for(var i in now){var iNow=now[i];for(var p in iNow)this.render(this.elements[i],p,iNow[p],this.options.unit);}
return this;},start:function(obj){if(!this.check(obj))return this;var from={},to={};for(var i in obj){var iProps=obj[i],iFrom=from[i]={},iTo=to[i]={};for(var p in iProps){var parsed=this.prepare(this.elements[i],p,iProps[p]);iFrom[p]=parsed.from;iTo[p]=parsed.to;}}
return this.parent(from,to);}});var Accordion=Fx.Accordion=new Class({Extends:Fx.Elements,options:{display:0,show:false,height:true,width:false,opacity:true,alwaysHide:false,trigger:'click',initialDisplayFx:true,returnHeightToAuto:true},initialize:function(){var params=Array.link(arguments,{'container':Element.type,'options':Object.type,'togglers':$defined,'elements':$defined});this.parent(params.elements,params.options);this.togglers=$$(params.togglers);this.container=document.id(params.container);this.previous=-1;this.internalChain=new Chain();if(this.options.alwaysHide)this.options.wait=true;if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show;}
if(this.options.start){this.options.display=false;this.options.show=false;}
this.effects={};if(this.options.opacity)this.effects.opacity='fullOpacity';if(this.options.width)this.effects.width=this.options.fixedWidth?'fullWidth':'offsetWidth';if(this.options.height)this.effects.height=this.options.fixedHeight?'fullHeight':'scrollHeight';for(var i=0,l=this.togglers.length;i<l;i++)this.addSection(this.togglers[i],this.elements[i]);this.elements.each(function(el,i){if(this.options.show===i){this.fireEvent('active',[this.togglers[i],el]);}else{for(var fx in this.effects)el.setStyle(fx,0);}},this);if($chk(this.options.display))this.display(this.options.display,this.options.initialDisplayFx);this.addEvent('complete',this.internalChain.callChain.bind(this.internalChain));},addSection:function(toggler,element){toggler=document.id(toggler);element=document.id(element);var test=this.togglers.contains(toggler);this.togglers.include(toggler);this.elements.include(element);var idx=this.togglers.indexOf(toggler);var displayer=this.display.bind(this,idx);toggler.store('accordion:display',displayer);toggler.addEvent(this.options.trigger,displayer);if(this.options.height)element.setStyles({'padding-top':0,'border-top':'none','padding-bottom':0,'border-bottom':'none'});if(this.options.width)element.setStyles({'padding-left':0,'border-left':'none','padding-right':0,'border-right':'none'});element.fullOpacity=1;if(this.options.fixedWidth)element.fullWidth=this.options.fixedWidth;if(this.options.fixedHeight)element.fullHeight=this.options.fixedHeight;element.setStyle('overflow','hidden');if(!test){for(var fx in this.effects)element.setStyle(fx,0);}
return this;},detach:function(){this.togglers.each(function(toggler){toggler.removeEvent(this.options.trigger,toggler.retrieve('accordion:display'));},this);},display:function(index,useFx){if(!this.check(index,useFx))return this;useFx=$pick(useFx,true);if(this.options.returnHeightToAuto){var prev=this.elements[this.previous];if(prev&&!this.selfHidden){for(var fx in this.effects){prev.setStyle(fx,prev[this.effects[fx]]);}}}
index=($type(index)=='element')?this.elements.indexOf(index):index;if((this.timer&&this.options.wait)||(index===this.previous&&!this.options.alwaysHide))return this;this.previous=index;var obj={};this.elements.each(function(el,i){obj[i]={};var hide;if(i!=index){hide=true;}else if(this.options.alwaysHide&&((el.offsetHeight>0&&this.options.height)||el.offsetWidth>0&&this.options.width)){hide=true;this.selfHidden=true;}
this.fireEvent(hide?'background':'active',[this.togglers[i],el]);for(var fx in this.effects)obj[i][fx]=hide?0:el[this.effects[fx]];},this);this.internalChain.chain(function(){if(this.options.returnHeightToAuto&&!this.selfHidden){var el=this.elements[index];if(el)el.setStyle('height','auto');};}.bind(this));return useFx?this.start(obj):this.set(obj);}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(element,options){this.element=this.subject=document.id(element);this.parent(options);var cancel=this.cancel.bind(this,false);if($type(this.element)!='element')this.element=document.id(this.element.getDocument().body);var stopper=this.element;if(this.options.wheelStops){this.addEvent('start',function(){stopper.addEvent('mousewheel',cancel);},true);this.addEvent('complete',function(){stopper.removeEvent('mousewheel',cancel);},true);}},set:function(){var now=Array.flatten(arguments);if(Browser.Engine.gecko)now=[Math.round(now[0]),Math.round(now[1])];this.element.scrollTo(now[0],now[1]);},compute:function(from,to,delta){return[0,1].map(function(i){return Fx.compute(from[i],to[i],delta);});},start:function(x,y){if(!this.check(x,y))return this;var scrollSize=this.element.getScrollSize(),scroll=this.element.getScroll(),values={x:x,y:y};for(var z in values){var max=scrollSize[z];if($chk(values[z]))values[z]=($type(values[z])=='number')?values[z]:max;else values[z]=scroll[z];values[z]+=this.options.offset[z];}
return this.parent([scroll.x,scroll.y],[values.x,values.y]);},toTop:function(){return this.start(false,0);},toLeft:function(){return this.start(0,false);},toRight:function(){return this.start('right',false);},toBottom:function(){return this.start(false,'bottom');},toElement:function(el){var position=document.id(el).getPosition(this.element);return this.start(position.x,position.y);},scrollIntoView:function(el,axes,offset){axes=axes?$splat(axes):['x','y'];var to={};el=document.id(el);var pos=el.getPosition(this.element);var size=el.getSize();var scroll=this.element.getScroll();var containerSize=this.element.getSize();var edge={x:pos.x+size.x,y:pos.y+size.y};['x','y'].each(function(axis){if(axes.contains(axis)){if(edge[axis]>scroll[axis]+containerSize[axis])to[axis]=edge[axis]-containerSize[axis];if(pos[axis]<scroll[axis])to[axis]=pos[axis];}
if(to[axis]==null)to[axis]=scroll[axis];if(offset&&offset[axis])to[axis]=to[axis]+offset[axis];},this);if(to.x!=scroll.x||to.y!=scroll.y)this.start(to.x,to.y);return this;},scrollToCenter:function(el,axes,offset){axes=axes?$splat(axes):['x','y'];el=$(el);var to={},pos=el.getPosition(this.element),size=el.getSize(),scroll=this.element.getScroll(),containerSize=this.element.getSize(),edge={x:pos.x+size.x,y:pos.y+size.y};['x','y'].each(function(axis){if(axes.contains(axis)){to[axis]=pos[axis]-(containerSize[axis]-size[axis])/2;}
if(to[axis]==null)to[axis]=scroll[axis];if(offset&&offset[axis])to[axis]=to[axis]+offset[axis];},this);if(to.x!=scroll.x||to.y!=scroll.y)this.start(to.x,to.y);return this;}});Fx.Slide=new Class({Extends:Fx,options:{mode:'vertical',hideOverflow:true},initialize:function(element,options){this.addEvent('complete',function(){this.open=(this.wrapper['offset'+this.layout.capitalize()]!=0);if(this.open&&Browser.Engine.webkit419)this.element.dispose().inject(this.wrapper);},true);this.element=this.subject=document.id(element);this.parent(options);var wrapper=this.element.retrieve('wrapper');var styles=this.element.getStyles('margin','position','overflow');if(this.options.hideOverflow)styles=$extend(styles,{overflow:'hidden'});this.wrapper=wrapper||new Element('div',{styles:styles}).wraps(this.element);this.element.store('wrapper',this.wrapper).setStyle('margin',0);this.now=[];this.open=true;},vertical:function(){this.margin='margin-top';this.layout='height';this.offset=this.element.offsetHeight;},horizontal:function(){this.margin='margin-left';this.layout='width';this.offset=this.element.offsetWidth;},set:function(now){this.element.setStyle(this.margin,now[0]);this.wrapper.setStyle(this.layout,now[1]);return this;},compute:function(from,to,delta){return[0,1].map(function(i){return Fx.compute(from[i],to[i],delta);});},start:function(how,mode){if(!this.check(how,mode))return this;this[mode||this.options.mode]();var margin=this.element.getStyle(this.margin).toInt();var layout=this.wrapper.getStyle(this.layout).toInt();var caseIn=[[margin,layout],[0,this.offset]];var caseOut=[[margin,layout],[-this.offset,0]];var start;switch(how){case'in':start=caseIn;break;case'out':start=caseOut;break;case'toggle':start=(layout==0)?caseIn:caseOut;}
return this.parent(start[0],start[1]);},slideIn:function(mode){return this.start('in',mode);},slideOut:function(mode){return this.start('out',mode);},hide:function(mode){this[mode||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(mode){this[mode||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(mode){return this.start('toggle',mode);}});Element.Properties.slide={set:function(options){var slide=this.retrieve('slide');if(slide)slide.cancel();return this.eliminate('slide').store('slide:options',$extend({link:'cancel'},options));},get:function(options){if(options||!this.retrieve('slide')){if(options||!this.retrieve('slide:options'))this.set('slide',options);this.store('slide',new Fx.Slide(this,this.retrieve('slide:options')));}
return this.retrieve('slide');}};Element.implement({slide:function(how,mode){how=how||'toggle';var slide=this.get('slide'),toggle;switch(how){case'hide':slide.hide(mode);break;case'show':slide.show(mode);break;case'toggle':var flag=this.retrieve('slide:flag',slide.open);slide[flag?'slideOut':'slideIn'](mode);this.store('slide:flag',!flag);toggle=true;break;default:slide.start(how,mode);}
if(!toggle)this.eliminate('slide:flag');return this;}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:'px',grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:'left',y:'top'}},initialize:function(){var params=Array.link(arguments,{'options':Object.type,'element':$defined});this.element=document.id(params.element);this.document=this.element.getDocument();this.setOptions(params.options||{});var htype=$type(this.options.handle);this.handles=((htype=='array'||htype=='collection')?$$(this.options.handle):document.id(this.options.handle))||this.element;this.mouse={'now':{},'pos':{}};this.value={'start':{},'now':{}};this.selection=(Browser.Engine.trident)?'selectstart':'mousedown';this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};this.attach();},attach:function(){this.handles.addEvent('mousedown',this.bound.start);return this;},detach:function(){this.handles.removeEvent('mousedown',this.bound.start);return this;},start:function(event){if(event.rightClick)return;if(this.options.preventDefault)event.preventDefault();if(this.options.stopPropagation)event.stopPropagation();this.mouse.start=event.page;this.fireEvent('beforeStart',this.element);var limit=this.options.limit;this.limit={x:[],y:[]};for(var z in this.options.modifiers){if(!this.options.modifiers[z])continue;if(this.options.style)this.value.now[z]=this.element.getStyle(this.options.modifiers[z]).toInt();else this.value.now[z]=this.element[this.options.modifiers[z]];if(this.options.invert)this.value.now[z]*=-1;this.mouse.pos[z]=event.page[z]-this.value.now[z];if(limit&&limit[z]){for(var i=2;i--;i){if($chk(limit[z][i]))this.limit[z][i]=$lambda(limit[z][i])();}}}
if($type(this.options.grid)=='number')this.options.grid={x:this.options.grid,y:this.options.grid};this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop);},check:function(event){if(this.options.preventDefault)event.preventDefault();var distance=Math.round(Math.sqrt(Math.pow(event.page.x-this.mouse.start.x,2)+Math.pow(event.page.y-this.mouse.start.y,2)));if(distance>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent('start',[this.element,event]).fireEvent('snap',this.element);}},drag:function(event){if(this.options.preventDefault)event.preventDefault();this.mouse.now=event.page;for(var z in this.options.modifiers){if(!this.options.modifiers[z])continue;this.value.now[z]=this.mouse.now[z]-this.mouse.pos[z];if(this.options.invert)this.value.now[z]*=-1;if(this.options.limit&&this.limit[z]){if($chk(this.limit[z][1])&&(this.value.now[z]>this.limit[z][1])){this.value.now[z]=this.limit[z][1];}else if($chk(this.limit[z][0])&&(this.value.now[z]<this.limit[z][0])){this.value.now[z]=this.limit[z][0];}}
if(this.options.grid[z])this.value.now[z]-=((this.value.now[z]-(this.limit[z][0]||0))%this.options.grid[z]);if(this.options.style){this.element.setStyle(this.options.modifiers[z],this.value.now[z]+this.options.unit);}else{this.element[this.options.modifiers[z]]=this.value.now[z];}}
this.fireEvent('drag',[this.element,event]);},cancel:function(event){this.document.removeEvent('mousemove',this.bound.check);this.document.removeEvent('mouseup',this.bound.cancel);if(event){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent('cancel',this.element);}},stop:function(event){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent('mousemove',this.bound.drag);this.document.removeEvent('mouseup',this.bound.stop);if(event)this.fireEvent('complete',[this.element,event]);}});Element.implement({makeResizable:function(options){var drag=new Drag(this,$merge({modifiers:{x:'width',y:'height'}},options));this.store('resizer',drag);return drag.addEvent('drag',function(){this.fireEvent('resize',drag);}.bind(this));}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(element,options){this.parent(element,options);element=this.element;this.droppables=$$(this.options.droppables);this.container=document.id(this.options.container);if(this.container&&$type(this.container)!='element')
this.container=document.id(this.container.getDocument().body);var styles=element.getStyles('left','right','position');if(styles.left=='auto'||styles.top=='auto')
element.setPosition(element.getPosition(element.getOffsetParent()));if(styles.position=='static')
element.setStyle('position','absolute');this.addEvent('start',this.checkDroppables,true);this.overed=null;},start:function(event){if(this.container)this.options.limit=this.calculateLimit();if(this.options.precalculate){this.positions=this.droppables.map(function(el){return el.getCoordinates();});}
this.parent(event);},calculateLimit:function(){var offsetParent=this.element.getOffsetParent(),containerCoordinates=this.container.getCoordinates(offsetParent),containerBorder={},elementMargin={},elementBorder={},containerMargin={},offsetParentPadding={};['top','right','bottom','left'].each(function(pad){containerBorder[pad]=this.container.getStyle('border-'+pad).toInt();elementBorder[pad]=this.element.getStyle('border-'+pad).toInt();elementMargin[pad]=this.element.getStyle('margin-'+pad).toInt();containerMargin[pad]=this.container.getStyle('margin-'+pad).toInt();offsetParentPadding[pad]=offsetParent.getStyle('padding-'+pad).toInt();},this);var width=this.element.offsetWidth+elementMargin.left+elementMargin.right,height=this.element.offsetHeight+elementMargin.top+elementMargin.bottom,left=0,top=0,right=containerCoordinates.right-containerBorder.right-width,bottom=containerCoordinates.bottom-containerBorder.bottom-height;if(this.options.includeMargins){left+=elementMargin.left;top+=elementMargin.top;}else{right+=elementMargin.right;bottom+=elementMargin.bottom;}
if(this.element.getStyle('position')=='relative'){var coords=this.element.getCoordinates(offsetParent);coords.left-=this.element.getStyle('left').toInt();coords.top-=this.element.getStyle('top').toInt();left+=containerBorder.left-coords.left;top+=containerBorder.top-coords.top;right+=elementMargin.left-coords.left;bottom+=elementMargin.top-coords.top;if(this.container!=offsetParent){left+=containerMargin.left+offsetParentPadding.left;top+=(Browser.Engine.trident4?0:containerMargin.top)+offsetParentPadding.top;}}else{left-=elementMargin.left;top-=elementMargin.top;if(this.container==offsetParent){right-=containerBorder.left;bottom-=containerBorder.top;}else{left+=containerCoordinates.left+containerBorder.left;top+=containerCoordinates.top+containerBorder.top;}}
return{x:[left,right],y:[top,bottom]};},checkAgainst:function(el,i){el=(this.positions)?this.positions[i]:el.getCoordinates();var now=this.mouse.now;return(now.x>el.left&&now.x<el.right&&now.y<el.bottom&&now.y>el.top);},checkDroppables:function(){var overed=this.droppables.filter(this.checkAgainst,this).getLast();if(this.overed!=overed){if(this.overed)this.fireEvent('leave',[this.element,this.overed]);if(overed)this.fireEvent('enter',[this.element,overed]);this.overed=overed;}},drag:function(event){this.parent(event);if(this.options.checkDroppables&&this.droppables.length)this.checkDroppables();},stop:function(event){this.checkDroppables();this.fireEvent('drop',[this.element,this.overed,event]);this.overed=null;return this.parent(event);}});Element.implement({makeDraggable:function(options){var drag=new Drag.Move(this,options);this.store('dragger',drag);return drag;}});var Slider=new Class({Implements:[Events,Options],Binds:['clickedElement','draggedKnob','scrolledElement'],options:{onTick:function(position){if(this.options.snap)position=this.toPosition(this.step);this.knob.setStyle(this.property,position);},initialStep:0,snap:false,offset:0,range:false,wheel:false,steps:100,mode:'horizontal'},initialize:function(element,knob,options){this.setOptions(options);this.element=document.id(element);this.knob=document.id(knob);this.previousChange=this.previousEnd=this.step=-1;var offset,limit={},modifiers={'x':false,'y':false};switch(this.options.mode){case'vertical':this.axis='y';this.property='top';offset='offsetHeight';break;case'horizontal':this.axis='x';this.property='left';offset='offsetWidth';}
this.full=this.element.measure(function(){this.half=this.knob[offset]/2;return this.element[offset]-this.knob[offset]+(this.options.offset*2);}.bind(this));this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);this.knob.setStyle('position','relative').setStyle(this.property,this.options.initialStep?this.toPosition(this.options.initialStep):-this.options.offset);modifiers[this.axis]=this.property;limit[this.axis]=[-this.options.offset,this.full-this.options.offset];var dragOptions={snap:0,limit:limit,modifiers:modifiers,onDrag:this.draggedKnob,onStart:this.draggedKnob,onBeforeStart:(function(){this.isDragging=true;}).bind(this),onCancel:function(){this.isDragging=false;}.bind(this),onComplete:function(){this.isDragging=false;this.draggedKnob();this.end();}.bind(this)};if(this.options.snap){dragOptions.grid=Math.ceil(this.stepWidth);dragOptions.limit[this.axis][1]=this.full;}
this.drag=new Drag(this.knob,dragOptions);this.attach();},attach:function(){this.element.addEvent('mousedown',this.clickedElement);if(this.options.wheel)this.element.addEvent('mousewheel',this.scrolledElement);this.drag.attach();return this;},detach:function(){this.element.removeEvent('mousedown',this.clickedElement);this.element.removeEvent('mousewheel',this.scrolledElement);this.drag.detach();return this;},set:function(step){if(!((this.range>0)^(step<this.min)))step=this.min;if(!((this.range>0)^(step>this.max)))step=this.max;this.step=Math.round(step);this.checkStep();this.fireEvent('tick',this.toPosition(this.step));this.end();return this;},clickedElement:function(event){if(this.isDragging||event.target==this.knob)return;var dir=this.range<0?-1:1;var position=event.page[this.axis]-this.element.getPosition()[this.axis]-this.half;position=position.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+dir*this.toStep(position));this.checkStep();this.fireEvent('tick',position);this.end();},scrolledElement:function(event){var mode=(this.options.mode=='horizontal')?(event.wheel<0):(event.wheel>0);this.set(mode?this.step-this.stepSize:this.step+this.stepSize);event.stop();},draggedKnob:function(){var dir=this.range<0?-1:1;var position=this.drag.value.now[this.axis];position=position.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+dir*this.toStep(position));this.checkStep();},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent('change',this.step);}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent('complete',this.step+'');}},toStep:function(position){var step=(position+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(step-=step%this.stepSize):step;},toPosition:function(step){return(this.full*Math.abs(this.min-step))/(this.steps*this.stepSize)-this.options.offset;}});var Asset={javascript:function(source,properties){properties=$extend({onload:$empty,document:document,check:$lambda(true)},properties);var script=new Element('script',{src:source,type:'text/javascript'});var load=properties.onload.bind(script),check=properties.check,doc=properties.document;delete properties.onload;delete properties.check;delete properties.document;script.addEvents({load:load,readystatechange:function(){if(['loaded','complete'].contains(this.readyState))load();}}).set(properties);if(Browser.Engine.webkit419)var checker=(function(){if(!$try(check))return;$clear(checker);load();}).periodical(50);return script.inject(doc.head);},css:function(source,properties){return new Element('link',$merge({rel:'stylesheet',media:'screen',type:'text/css',href:source},properties)).inject(document.head);},image:function(source,properties){properties=$merge({onload:$empty,onabort:$empty,onerror:$empty},properties);var image=new Image();var element=document.id(image)||new Element('img');['load','abort','error'].each(function(name){var type='on'+name;var event=properties[type];delete properties[type];image[type]=function(){if(!image)return;if(!element.parentNode){element.width=image.width;element.height=image.height;}
image=image.onload=image.onabort=image.onerror=null;event.delay(1,element,element);element.fireEvent(name,element,1);};});image.src=element.src=source;if(image&&image.complete)image.onload.delay(1);return element.set(properties);},images:function(sources,options){options=$merge({onComplete:$empty,onProgress:$empty,onError:$empty,properties:{}},options);sources=$splat(sources);var images=[];var counter=0;return new Elements(sources.map(function(source){return Asset.image(source,$extend(options.properties,{onload:function(){options.onProgress.call(this,counter,sources.indexOf(source));counter++;if(counter==sources.length)options.onComplete();},onerror:function(){options.onError.call(this,counter,sources.indexOf(source));counter++;if(counter==sources.length)options.onComplete();}}));}));}};var Accordion=new Class({Extends:Fx.Elements,options:{display:0,show:false,height:true,width:false,opacity:true,fixedHeight:false,fixedWidth:false,wait:false,alwaysHide:false,allHidden:true},initialize:function(){var params=Array.link(arguments,{'container':Element.type,'options':Object.type,'togglers':$defined,'elements':$defined,'expandedElems':$defined});this.parent(params.elements,params.options);this.togglers=$$(params.togglers);this.container=$(params.container);this.previous=-1;if(this.options.alwaysHide)this.options.wait=true;if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show;}
if(this.options.start){this.options.display=false;this.options.show=false;}
this.effects={};if(this.options.opacity)this.effects.opacity='fullOpacity';if(this.options.width)this.effects.width=this.options.fixedWidth?'fullWidth':'offsetWidth';if(this.options.height)this.effects.height=this.options.fixedHeight?'fullHeight':'scrollHeight';for(var i=0,l=this.togglers.length;i<l;i++)this.addSection(this.togglers[i],this.elements[i]);this.elements.each(function(el,i){var visibleFromStart=false;if(params.expandedElems!=null&&params.expandedElems.length>0){for(var x=0;x<params.expandedElems.length;x++){if(params.expandedElems[x]==i)
visibleFromStart=true;}}
if(visibleFromStart){this.fireEvent('active',[this.togglers[i],el]);this.togglers[i].setStyle('background','transparent url('+bbGlobal.gfxServer+'/gfx/image/arrow_gray_down'+bbGlobal.imgSufix+'.gif) no-repeat scroll left center');}else if(this.options.show===i){if(this.options.allHidden==false)
this.fireEvent('active',[this.togglers[i],el]);}else{for(var fx in this.effects)el.setStyle(fx,0);}},this);},addSection:function(toggler,element,pos){toggler=$(toggler);element=$(element);var test=this.togglers.contains(toggler);var len=this.togglers.length;this.togglers.include(toggler);this.elements.include(element);if(len&&(!test||pos)){pos=$pick(pos,len-1);toggler.inject(this.togglers[pos],'before');element.inject(toggler,'after');}else if(this.container&&!test){toggler.inject(this.container);element.inject(this.container);}
var idx=this.togglers.indexOf(toggler);toggler.addEvent('click',this.display.bind(this,idx));if(this.options.height)element.setStyles({'padding-top':0,'border-top':'none','padding-bottom':0,'border-bottom':'none'});if(this.options.width)element.setStyles({'padding-left':0,'border-left':'none','padding-right':0,'border-right':'none'});element.fullOpacity=1;if(this.options.fixedWidth)element.fullWidth=this.options.fixedWidth;if(this.options.fixedHeight)element.fullHeight=this.options.fixedHeight;element.setStyle('overflow','hidden');if(!test){for(var fx in this.effects)element.setStyle(fx,0);}
return this;},display:function(index){index=($type(index)=='element')?this.elements.indexOf(index):index;if((this.timer&&this.options.wait)||(index===this.previous&&!this.options.alwaysHide))return this;this.previous=index;var obj={};this.elements.each(function(el,i){obj[i]={};var hide=(i!=index)||(this.options.alwaysHide&&(el.offsetHeight>0));this.fireEvent(hide?'background':'active',[this.togglers[i],el]);for(var fx in this.effects)obj[i][fx]=hide?0:el[this.effects[fx]];},this);return this.start(obj);}});var MultipleOpenAccordion=new Class({Extends:Accordion,options:{allowMultipleOpen:true,allHidden:false},initialize:function(togglers,togglees,expandedElems,options){this.parent(togglers,togglees,expandedElems,this.options);},display:function(index){index=($type(index)=='element')?this.elements.indexOf(index):index;if((this.timer&&this.options.wait)||(index===this.previous&&!this.options.alwaysHide))return this;var obj={};if(this.options.allowMultipleOpen){var el=this.elements[index];if($defined(el)){obj[index]={};var hide=(el.offsetHeight>0);if(hide)
this.togglers[index].setStyle('background','transparent url('+bbGlobal.gfxServer+'/gfx/image/arrow_gray_right_header'+bbGlobal.imgSufix+'.gif) no-repeat scroll left center');else
this.togglers[index].setStyle('background','transparent url('+bbGlobal.gfxServer+'/gfx/image/arrow_gray_down'+bbGlobal.imgSufix+'.gif) no-repeat scroll left center');this.fireEvent(hide?'onBackground':'onActive',[this.togglers[index],el]);for(var fx in this.effects)obj[index][fx]=hide?0:el[this.effects[fx]];}}else{this.previous=index;this.elements.each(function(el,i){obj[i]={};var hide=(i!=index)||(this.options.alwaysHide&&(el.offsetHeight>0));this.fireEvent(hide?'onBackground':'onActive',[this.togglers[i],el]);for(var fx in this.effects)obj[i][fx]=hide?0:el[this.effects[fx]];},this);}
return this.start(obj);}});var SimpleTabs=new Class({options:{mouseOutClass:'tournament_menu_mouseout',mouseOnClass:'tournament_menuon',mootabsClass:'mootabs',defaultItem:0,hasScroll:false},initialize:function(element,options){this.elid=element;this.options=options;var accounting=false;this.titles=$(this.elid).getElements('.'+this.options.mouseOutClass);if(this.titles.length<1)
return;if(!$defined(this.titles[this.options.defaultItem])){this.options.defaultItem=0;accounting=true;}
this.currentItem=this.options.defaultItem;this.titles[this.options.defaultItem].removeClass(this.options.mouseOutClass);this.titles[this.options.defaultItem].addClass(this.options.mouseOnClass);this.activeTitle=this.titles[this.options.defaultItem];this.panels=$(this.elid).getElements('.'+this.options.mootabsClass);if(accounting==true)
this.activePanel=this.panels[5];else
this.activePanel=this.panels[this.options.defaultItem];this.activePanel.removeClass('hidden');this.titles.each(function(item){item.addEvent('click',function(){this.activateAndClick(item);}.bind(this));item.addEvent('mouseover',function(){if(item!=this.activeTitle)
{item.removeClass(this.options.mouseOutClass);item.addClass(this.options.mouseOnClass);}}.bind(this));item.addEvent('mouseout',function(){if(item!=this.activeTitle)
{item.removeClass(this.options.mouseOnClass);item.addClass(this.options.mouseOutClass);}}.bind(this));}.bind(this));},getCurrentItem:function(){return this.currentItem;},activate:function(tab){if($type(tab)=='string')
{myTab=$(this.elid).getElements('li').filter(function(item,index){if(item.get('name')==tab)
return item;});tab=myTab[0];}
if($type(tab)=='element')
{var newTab=tab.getProperty('name');if(newTab=='leftMenuLive'){loadPage('/nextMatches/live1/');}else{this.activeTitle.removeClass(this.options.mouseOnClass);this.activeTitle.addClass(this.options.mouseOutClass);this.titles.removeClass('active');this.activeTitle=tab;this.activeTitle.addClass(this.options.mouseOnClass);this.activeTitle.removeClass(this.options.mouseOutClass);this.activePanel.addClass('hidden');this.activePanel=this.panels.filter(function(item,index){if(item.get('id')==newTab){this.currentItem=index;return true;}
return false;}.bind(this))[0];this.activePanel.removeClass('hidden');}}
else if($type(tab)=='number'){this.currentItem=tab;this.activePanel.addClass('hidden');this.activeTitle.removeClass(this.options.mouseOnClass);this.activeTitle.addClass(this.options.mouseOutClass);this.titles.removeClass('active');this.activeTitle=this.titles[tab];this.activeTitle.addClass(this.options.mouseOnClass);this.activeTitle.removeClass(this.options.mouseOutClass);this.activePanel=this.panels[tab];this.activePanel.removeClass('hidden');}
if(this.options.hasScroll){if(this.activeTitle.get('name')=='leftMenuContainer'||this.activeTitle.get('name')=='leftForumContainer'){if(!$defined(bbGlobal.leftMenuScrollBar))
bbGlobal.leftMenuScrollBar=new MooScroll({'selector':'.scrollLM'});}
else if(this.activeTitle.get('name')=='leftForumContainer'){if(!$defined(bbGlobal.leftMenuScrollBar))
bbGlobal.leftMenuScrollBar=new MooScroll({'selector':'.scrollLMF'});}
else if(this.activeTitle.get('name')=='leftMenuSurebets'||this.activeTitle.get('name')=='leftMenuValuebets'||this.activeTitle.get('name')=='leftMenuStats'){}
else{var selectorElm='';if(this.activeTitle.get('name')=='leftMenuMP')
selectorElm='#matchesMP';else if(this.activeTitle.get('name')=='leftMenuNM')
selectorElm='#nextMatchesBox';else if(this.activeTitle.get('name')=='leftMenuNews')
selectorElm='#newsFilter';else if(this.activeTitle.get('name')=='leftMenuCoupon')
selectorElm="#cuponBox";else
selectorElm='#'+this.activeTitle.get('name');if(!$defined(bbGlobal.scrolls.get(selectorElm))){bbGlobal.scrolls.set(selectorElm,new MooScroll({'selector':selectorElm}));}
else
bbGlobal.scrolls.get(selectorElm).refresh();}}},activateAndClick:function(tab){this.activate(tab);if(this.activeTitle.get('name')=='leftMenuSurebets'&&window.location.hash.indexOf('surebets')==-1)
loadPage('/surebets'+bbGlobal.userRoleLink+'/');if(this.activeTitle.get('name')=='leftMenuValuebets'&&window.location.hash.indexOf('valuebet')==-1)
loadPage('/valuebets'+bbGlobal.userRoleLink+'/');if(this.activeTitle.get('name')=='leftMenuNews'&&window.location.hash.indexOf('news')==-1)
loadPage('/news/');}});var MooScroll=new Class({Implements:Options,options:{selector:'.scroll',increment:30,upBtnClass:'upBtn',downBtnClass:'downBtn',scrollBarClass:'scrollBar',scrollHandleClass:'scrollHandle',scrollHandleBGClass:'scrollHandleBG',scrollHandleTopClass:'scrollHandleTop',scrollHandleMiddleClass:'scrollHandleMiddle',scrollHandleBottomClass:'scrollHandleBottom',scrollControlsYClass:'scrollControlsY',handleOpacity:1,handleActiveOpacity:0.85,disabledOpacity:0.5,fullWindowMode:false,smoothMooScroll:{toAnchor:false,toMooScrollArea:false},restrictedBrowsers:[Browser.Engine.presto925,Browser.Platform.ipod,Browser.Engine.webkit419]},initialize:function(options){this.setOptions(options);this.mooScrollAreas=[];$(document.body).getElements(this.options.selector).each(function(item,index){var scrollArea=new MooScrollArea(this.options,item,this.windowFxScroll);this.mooScrollAreas.include(scrollArea);if(this.options.smoothMooScroll.toAnchor||this.options.smoothMooScroll.toMooScrollArea){this.smoothMooScroll=new SmoothMooScroll({toAnchor:this.options.smoothMooScroll.toAnchor,toMooScrollArea:this.options.smoothMooScroll.toMooScrollArea},scrollArea.contentEl,this.windowFxScroll);}}.bind(this));},loadContent:function(content){this.mooScrollAreas.each(function(item,index){item.loadContent(content);});},refresh:function(){this.mooScrollAreas.each(function(item,index){item.refresh();});},setSlider:function(v){this.mooScrollAreas.each(function(item,index){item.setSlider(v);});}});var MooScrollArea=new Class({Implements:Options,initialize:function(options,parentEl,windowFxScroll){this.setOptions(options);this.parentEl=parentEl.setProperty('rel','MooScrollArea');this.viewPort={x:$(window).getSize().x,y:$(window).getSize().y};this.parentElPadding=this.parentEl.getStyles('padding-top','padding-right','padding-bottom','padding-left');this.paddingHeight=parseFloat(this.parentEl.getStyle('padding-top'))+parseFloat(this.parentEl.getStyle('padding-bottom'));this.paddingWidth=parseFloat(this.parentEl.getStyle('padding-left'))+parseFloat(this.parentEl.getStyle('padding-right'));this.contentEl=new Element('div',{'class':'contentEl'}).adopt(this.parentEl.getChildren()).inject(this.parentEl,'top');var maxHeight=parseFloat(this.parentEl.getStyle('max-height'));var pheight=parseFloat(this.parentEl.getStyle('height'));if(isNaN(maxHeight)||pheight+this.paddingHeight<maxHeight){maxHeight=pheight+this.paddingHeight;}
this.parentEl.setStyles({'overflow':'hidden','position':'relative','padding':0,'width':parseFloat(this.parentEl.getStyle('width'))+this.paddingWidth,'height':maxHeight});this.borderHeight=parseFloat(this.parentEl.getStyle('border-top-width'))+parseFloat(this.parentEl.getStyle('border-bottom-width'));this.contentEl.setStyles({'height':this.parentEl.getSize().y-this.borderHeight,overflow:'hidden','padding':0,'position':'relative'});this.paddingEl=new Element('div',{'class':'paddingEl'}).adopt(this.contentEl.getChildren()).inject(this.contentEl,'top').setStyles(this.parentElPadding);if(this.options.fullWindowMode){$(document).getElement('html').setStyle('overflow','hidden');this.parentEl.setStyles({'height':'100%','width':'100%','position':'absolute'});this.contentEl.setStyles({'height':'100%','width':'100%','position':'absolute'});}
if(Browser.Engine.trident4){var t=this.paddingEl.offsetHeight;}
this.scrollControlsYWrapper=new Element('div',{'class':this.options.scrollControlsYClass}).inject(this.parentEl,'bottom');this.upBtn=new Element('div',{'class':this.options.upBtnClass}).inject(this.scrollControlsYWrapper,'bottom');this.downBtn=new Element('div',{'class':this.options.downBtnClass}).inject(this.scrollControlsYWrapper,'bottom');this.scrollBar=new Element('div',{'class':this.options.scrollBarClass}).inject(this.scrollControlsYWrapper,'bottom');this.scrollHandle=new Element('div',{'class':this.options.scrollHandleClass}).inject(this.scrollBar,'inside');this.scrollHandleTop=new Element('div',{'class':this.options.scrollHandleTopClass}).inject(this.scrollHandle,'inside');this.scrollHandleBG=new Element('div',{'class':this.options.scrollHandleBGClass}).inject(this.scrollHandle,'inside');this.scrollHandleMiddle=new Element('div',{'class':this.options.scrollHandleMiddleClass}).inject(this.scrollHandle,'inside');this.scrollHandleBottom=new Element('div',{'class':this.options.scrollHandleBottomClass}).inject(this.scrollHandle,'inside');this.coverUp=new Element('div').inject(this.scrollControlsYWrapper,'bottom');this.parentEl.addEvents({'mousewheel':function(e){e=new Event(e).stop();if(e.wheel>0){this.scrollUp(true);}
else if(e.wheel<0){this.scrollDown(true);}}.bind(this),'keydown':function(e){if(e.key==='up'){e=new Event(e).stop();this.scrollUp(true);}
else if(e.key==='down'||e.key==='space'){e=new Event(e).stop();this.scrollDown(true);}}.bind(this),'click':function(e){this.hasFocus=true;this.hasFocusTimeout=(function(){$clear(this.hasFocusTimeout);this.hasFocus=true;}.bind(this)).delay(50);}.bind(this)});this.contentEl.addEvents({'scroll':function(e){this.slider.set(this.contentEl.getScroll().y);}.bind(this)})
this.scrollHandle.addEvents({'mouseover':function(e){this.scrollHandle.addClass(this.options.scrollHandleClass+'-Active').setStyle('opacity',this.options.handleActiveOpacity);}.bind(this),'mouseleave':function(e){this.scrollHandle.removeClass(this.options.scrollHandleClass+'-Active').setStyle('opacity',this.options.handleOpacity);}.bind(this)});document.addEvents({'mouseup':function(e){}.bind(this),'keydown':function(e){if((this.hasFocus||this.options.fullWindowMode)&&(e.key==='down'||e.key==='space'||e.key==='up')){this.parentEl.fireEvent('keydown',e);}}.bind(this),'click':function(e){this.hasFocus=false;}.bind(this)});window.addEvent('resize',function(){$clear(this.refreshTimeout);if(this.options.fullWindowMode){this.refreshTimeout=(function(){$clear(this.refreshTimeout);if(this.viewPort.x!=$(window).getSize().x||this.viewPort.y!=$(window).getSize().y){this.refresh();this.viewPort.x=$(window).getSize().x;this.viewPort.y=$(window).getSize().y;}}.bind(this)).delay(250);}}.bind(this));this.upBtn.addEvents({'mousedown':function(e){$clear(this.upInterval);$clear(this.downInterval);this.upInterval=this.scrollUp.periodical(10,this);}.bind(this),'mouseup':function(e){$clear(this.upInterval);$clear(this.downInterval);}.bind(this),'mouseout':function(e){$clear(this.upInterval);$clear(this.downInterval);}.bind(this)});this.downBtn.addEvents({'mousedown':function(e){$clear(this.upInterval);$clear(this.downInterval);this.downInterval=this.scrollDown.periodical(10,this);}.bind(this),'mouseup':function(e){$clear(this.upInterval);$clear(this.downInterval);}.bind(this),'mouseout':function(e){$clear(this.upInterval);$clear(this.downInterval);}.bind(this)});this.overHang=this.paddingEl.getSize().y-this.parentEl.getSize().y;this.fixIE6CSSbugs();this.setHandleHeight();this.initSlider();if(this.overHang<=0){this.greyOut();return;}},initSlider:function(){this.slider=new Slider(this.scrollBar,this.scrollHandle,{range:[0,Math.round(this.overHang)],mode:'vertical',onChange:function(step,e){this.contentEl.scrollTo(0,step);this.webKitKludge(step);}.bind(this)}).set(0);},webKitKludge:function(step){if(!Browser.Engine.webkit||BrowserDetect.browser=="Chrome"){return;}
if(this.step>step){this.step=step;return;}
$clear(this.sliderTimeout);this.sliderTimeout=(function(){$clear(this.sliderTimeout);var onePercent=(1*this.paddingEl.getSize().y)/100;if((onePercent+step)>=this.overHang){if(this.paddingElTopMargin==null){this.paddingElTopMargin=parseFloat(this.paddingEl.getStyle('margin-top'));}
this.paddingEl.setStyle('margin-top',this.paddingElTopMargin-onePercent);if(!this.scrollHandleTopMargin){this.scrollHandleTopMargin=parseFloat(this.scrollHandle.getStyle('margin-top'));}
this.scrollHandle.setStyle('margin-top',this.scrollHandleTopMargin+2);this.contentEl.scrollTo(0,this.overHang);this.step=this.overHang;}else{this.paddingEl.setStyle('margin-top',this.paddingElTopMargin);this.scrollHandle.setStyle('margin-top',this.scrollHandleTopMargin);this.contentEl.scrollTo(0,step);this.step=step;}}.bind(this)).delay(10);},scrollUp:function(scrollPageWhenDone){var target=this.contentEl.getScroll().y-30;this.slider.set(target);if(this.contentEl.getScroll().y<=0&&scrollPageWhenDone){document.window.scrollTo(0,document.window.getScroll().y-this.options.increment);}},scrollDown:function(scrollPageWhenDone){var target=this.contentEl.getScroll().y+this.options.increment;this.slider.set(target);var onePercent=(1*this.paddingEl.getSize().y)/100;var atBottom=(this.paddingEl.getSize().y-this.parentEl.getSize().y)<=(this.contentEl.getScroll().y+onePercent);if(atBottom&&scrollPageWhenDone){document.window.scrollTo(0,document.window.getScroll().y+this.options.increment);}},fixIE6CSSbugs:function(){if(Browser.Engine.trident4){this.parentEl.setStyle('height',this.parentEl.getStyle('height'));this.contentEl.setStyle('height',this.parentEl.getStyle('height'));var top=this.scrollBar.getStyle('top').toInt();var bottom=this.scrollBar.getStyle('bottom').toInt();var parentHeight=this.parentEl.getSize().y-this.borderHeight;this.scrollControlsYWrapper.setStyles({'height':parentHeight});if(parentHeight-top-bottom>0){this.scrollBar.setStyles({'height':parentHeight-top-bottom});this.downBtn.setStyles({'top':this.parentEl.getStyle('height').toInt()-this.upBtn.getStyle('height').toInt()});}
this.scrollControlsYWrapper.setStyle('height',this.parentEl.getSize().y);}},setHandleHeight:function(){var handleHeightPercent=(100-((this.overHang*100)/this.paddingEl.getSize().y));this.handleHeight=((handleHeightPercent*this.parentEl.getSize().y)/100)-(this.scrollHandleTop.getSize().y+this.scrollHandleBottom.getSize().y);if((this.handleHeight+this.scrollHandleTop.getSize().y+this.scrollHandleBottom.getSize().y)>=this.scrollBar.getSize().y){this.handleHeight-=(this.scrollHandleTop.getSize().y+this.scrollHandleBottom.getSize().y)*2;}
if(this.scrollHandle.getStyle('min-height')&&this.handleHeight<parseFloat(this.scrollHandle.getStyle('min-height'))){this.handleHeight=parseFloat(this.scrollHandle.getStyle('min-height'))+this.scrollHandleBottom.getSize().y+this.scrollHandleTop.getSize().y;}
this.scrollHandle.setStyles({'height':this.handleHeight});if(Browser.Engine.trident4){this.scrollHandleBG.setStyles({'height':this.handleHeight});}},greyOut:function(){this.scrollControlsYWrapper.setStyles({'display':'none'});this.paddingEl.setStyle('width',this.parentEl.getCoordinates().width);this.scrollHandle.setStyles({'display':'none'});this.upBtn.setStyles({'opacity':this.options.disabledOpacity});this.scrollControlsYWrapper.setStyles({opacity:this.options.disabledOpacity});this.downBtn.setStyles({'opacity':this.options.disabledOpacity});this.scrollBar.setStyles({'opacity':this.options.disabledOpacity});this.coverUp.setStyles({'display':'block','position':'absolute','background':'white','opacity':0.01,'right':'0','top':'0','width':'100%','height':this.scrollControlsYWrapper.getSize().y});},unGrey:function(){this.scrollControlsYWrapper.setStyles({'display':'block'});this.paddingEl.setStyle('width',this.parentEl.getCoordinates().width-this.scrollControlsYWrapper.getCoordinates().width);this.scrollHandle.setStyles({'display':'block','height':'auto'});this.scrollControlsYWrapper.setStyles({opacity:1});this.upBtn.setStyles({'opacity':1});this.downBtn.setStyles({'opacity':1});this.scrollBar.setStyles({'opacity':1});this.coverUp.setStyles({'display':'none','width':0,'height':0});this.setHandleHeight();},loadContent:function(content){this.paddingEl.empty().set('html',content);this.refresh();},refresh:function(){this.scrollHandle.removeEvents();this.contentEl.setStyles({'height':this.parentEl.getSize().y-this.borderHeight,overflow:'hidden','padding':0});this.slider.set(0);var scrollPercent=Math.round(((100*this.step)/this.overHang));if(this.options.fullWindowMode){var windowSize=$(window).getSize();this.parentEl.setStyles({width:'100%',height:'100%'});}
this.fixIE6CSSbugs();this.overHang=this.paddingEl.getSize().y-this.parentEl.getSize().y;this.setHandleHeight();if(this.overHang<=0){this.greyOut();return;}else{this.unGrey();}
var newStep=Math.round((scrollPercent*this.overHang)/100);this.initSlider();this.slider.set(newStep);this.scrollHandle.addEvents({'mouseover':function(e){this.scrollHandle.addClass(this.options.scrollHandleClass+'-Active').setStyle('opacity',this.options.handleActiveOpacity);}.bind(this),'mouseout':function(e){this.scrollHandle.removeClass(this.options.scrollHandleClass+'-Active').setStyle('opacity',this.options.handleOpacity);}.bind(this)});if(this.options.smoothMooScroll.toAnchor||this.options.smoothMooScroll.toMooScrollArea){this.smoothMooScroll=new SmoothMooScroll({toAnchor:this.options.smoothMooScroll.toAnchor,toMooScrollArea:this.options.smoothMooScroll.toMooScrollArea},this.contentEl,this.windowFxScroll);}},setSlider:function(v){if(v=='top'){this.slider.set(0);}else if(v=='bottom'){this.slider.set('100%');}else{this.slider.set(v);}}});var SmoothMooScroll=new Class({Extends:Fx.Scroll,initialize:function(options,context,windowFxScroll){this.setOptions(options);this.context=context;context=context||document;this.context=context;var doc=context.getDocument(),win=context.getWindow();this.parent(context,options);this.links=(this.options.links)?$$(this.options.links):$$(doc.links);var location=win.location.href.match(/^[^#]*/)[0]+'#';this.links.each(function(link){if(link.href.indexOf(location)!=0){return;}
var anchor=link.href.substr(location.length);if(anchor&&$(anchor)&&$(anchor).getParents().contains($(this.context))){this.useLink(link,anchor,true);}else if(anchor&&$(anchor)&&!this.inMooScrollArea($(anchor))){this.useLink(link,anchor,false);}},this);if(!Browser.Engine.webkit419)this.addEvent('complete',function(){win.location.hash=this.anchor;},true);},inMooScrollArea:function(el){return el.getParents().filter(function(item,index){return item.match('[rel=MooScrollArea]');}).length>0;},putAnchorInAddressBar:function(anchor){window.location.href="#"+anchor;},useLink:function(link,anchor,inThisMooScrollArea){link.removeEvents('click');link.addEvent('click',function(event){if(!anchor||!$(anchor)){return;}
this.anchor=anchor;if(inThisMooScrollArea){if(this.options.toMooScrollArea&&this.options.toAnchor){}else if(this.options.toMooScrollArea){}else if(this.options.toAnchor){this.toElement(anchor).chain(function(){this.putAnchorInAddressBar(anchor);}.bind(this));}}else{}
event.stop();}.bind(this));}});var HistoryManager=(function(){var HistoryManagerSingleton=new Class({initialize:function(){this._currentLocation=this._getHash();if(window.ie){this.addState=this._addStateIE;this._iframe=new Element('iframe',{src:"javascript:'<html></html>'",styles:{'position':'absolute','top':'-1000px'}}).inject(document.body).contentWindow;$justForIE=function(hash){this._getHash=function(){return hash;}
this._monitorDefault.call(this);location.hash=hash;}.bind(this);var waitForLoad=function waitForIframeLoad(){if(this._iframe&&this._iframe.document&&this._iframe.document.body){if(!this._iframe.document.body.innerHTML)
this.addState(this._currentLocation,true);$clear(waitForLoad);}}.periodical(50,this);}
else if(window.webkit419){this._form=new Element("form",{method:'get'}).inject(document.body);this._historyCounter=history.length;this._stateHistory=[];this._stateHistory[history.length]=this._getHash();this.addState=this._addStateSafari;this._monitorSafari.periodical(250,this);}
else if(window.opera&&navigator.appVersion.toFloat()<9.5){this.addState=this._addStateDefault;$justForOpera=this._monitorDefault.bind(this);new Element('img',{src:"javascript:location.href='javascript:$justForOpera();';",style:"position: absolute; top: -1000px;"}).inject(document.body);}
else{this.addState=this._addStateDefault;this._monitorDefault.periodical(250,this);}},getCurrentLocation:function(){return this._currentLocation;},getOldLocation:function(){return this._oldLocation;},_getHash:function(){return location.href.split('#')[1]||'';},_addStateIE:function(hash,override){if(this._currentLocation==hash&&!override)return;this._currentLocation=hash;this._iframe.document.write('<html><body onload="top.$justForIE(\'',hash.replace("'","\\'"),'\');">Loaded</body></html>');this._iframe.document.close();},_addStateSafari:function(hash){if(this._currentLocation==hash)return;this._form.setProperty('action','#'+hash).submit()
this._currentLocation=hash;this._stateHistory[history.length]=this._getHash();this._historyCounter=history.length;},_monitorSafari:function(){if(history.length!=this._historyCounter){this._historyCounter=history.length;this._currentLocation=this._stateHistory[history.length];this.fireEvent('onHistoryChange',[this._currentLocation]);}},_addStateDefault:function(hash){if(this._currentLocation==hash)return;location.hash='#'+hash;this._currentLocation=hash;},_monitorDefault:function(){var hash=this._getHash();if(hash!=this._currentLocation){this._oldLocation=this._currentLocation;this._currentLocation=hash;this.fireEvent('onHistoryChange',[hash]);}}});HistoryManagerSingleton.implement(new Events);var singleton;return function(){return singleton?singleton:singleton=new HistoryManagerSingleton();}})();var TimeRefresher=new Class({initialize:function(interval){this._events=new Hash();this.interval=interval;this._timer=this.runEvents.periodical(1000,this);},addEvent:function(data){this._events.erase(data.name);data.interval=parseInt(data.interval);data.timer=0;if(!$defined(data.nrOfRuns))
data.nrOfRuns=0;this._events.set(data.name,data);},deleteEvent:function(dataName){this._events.erase(dataName);},runEvents:function(){var time1=new Date();var eventsVal=this._events.getKeys();for(i=0;i<eventsVal.length;i++){var data=this._events.get(eventsVal[i]);if(data&&data.handler){data.timer++;if(data.timer==data.interval){data.timer=0;if($defined(data.args))
data.handler.run(data.args);else
data.handler.run();if(data.nrOfRuns==1)
this._events.erase(eventsVal[i]);}}}
var time2=new Date();}});Element.implement({smartDispose:function(removeCurrent){var rel=this.get("data-related");if($(rel)){$(rel).dispose();}
if(removeCurrent)
this.dispose();},dropShadow:function(options){var options=$merge({id:"dropShadow"+$random(100,1000),x:3,y:3,border:"5px solid #000",background:"#555",opacity:.7,zIndex:this.getStyle("z-index").toInt()-1},options);if(this.getStyle("position")!="absolute")
return this;var c=this.getCoordinates();new Element("div",{id:options.id,styles:{position:"absolute",left:c.left+options.x,top:c.top+options.y,width:c.width,height:c.height,background:options.background,zIndex:options.zIndex},opacity:0}).inject(this,'before').fade(0,options.opacity);this.set("data-related",options.id);return this;}});var Swiff=new Class({Implements:[Options],options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:'high',allowScriptAccess:'always',wMode:'transparent',swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object;},initialize:function(path,options){this.instance='Swiff_'+$time();this.setOptions(options);options=this.options;var id=this.id=options.id||this.instance;var container=$(options.container);Swiff.CallBacks[this.instance]={};var params=options.params,vars=options.vars,callBacks=options.callBacks;var properties=$extend({height:options.height,width:options.width},options.properties);var self=this;for(var callBack in callBacks){Swiff.CallBacks[this.instance][callBack]=(function(option){return function(){return option.apply(self.object,arguments);};})(callBacks[callBack]);vars[callBack]='Swiff.CallBacks.'+this.instance+'.'+callBack;}
params.flashVars=Hash.toQueryString(vars);if(Browser.Engine.trident){properties.classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';params.movie=path;}else{properties.type='application/x-shockwave-flash';properties.data=path;}
var build='<object id="'+id+'"';for(var property in properties)build+=' '+property+'="'+properties[property]+'"';build+='>';for(var param in params){if(params[param])build+='<param name="'+param+'" value="'+params[param]+'" />';}
build+='</object>';this.object=((container)?container.empty():new Element('div')).set('html',build).firstChild;},replaces:function(element){element=document.id(element,true);element.parentNode.replaceChild(this.toElement(),element);return this;},inject:function(element){document.id(element,true).appendChild(this.toElement());return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].extend(arguments));}});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+'</invoke>');return eval(rs);};var EventInfo=new Class({initialize:function(eventInfo){var strs=eventInfo.split('#');this.eventInfo=strs[0];if(strs.length>1)
this.betTypes=strs[1];if(strs.length>2)
this.generalLinks=strs[2];}});function addNewMatchMouseOverInfo(id,eventInfo){bbGlobal.matchMouseOver.set(id,new EventInfo(eventInfo));}
function hideBox(el,componentKey){var elem=$(el);var img=elem.getElement('img');if(img.get('src').indexOf("down")>-1){img.set('src',bbGlobal.gfxServer+'/gfx/image/arrow_gray_right_header'+bbGlobal.imgSufix+'.gif');}
else{img.set('src',bbGlobal.gfxServer+'/gfx/image/arrow_gray_down_header'+bbGlobal.imgSufix+'.gif');}
elem.getParent().getNext('tr').toggleClass('hidden');if(componentKey!=null&&componentKey.length>0){if(elem.getParent().getNext('tr').hasClass('hidden')){saveStateToDB(componentKey,'0');Cookie.write(componentKey,'0',{duration:30});}else{saveStateToDB(componentKey,'1');Cookie.write(componentKey,'1',{duration:30});}}
img=null;elem=null;}
function hideBoxNext(el,componentKey){var elem=$(el).getPrevious('th');hideBox(elem,componentKey);}
function saveStateToDB(compnentKey,stateValue){var paramsURL='cpk='+compnentKey+'&stv='+stateValue;new Request({method:'get',url:'/common/stateCcomponents.do?method=save',autoCancel:'true',onSuccess:function(req){},onFailure:function(xhr){}}).send(paramsURL);}
function openWin(helpId,portalId){windowname="helpWindow";width=500;height=350;screenwidth=screen.width;screenhight=screen.height;leftpos=(screenwidth-width)/2;toppos=(screenhight-height)/2;if(portalId==null)
portalId=0;var what="/infos/"+helpId+"/";window.open(what,windowname,"width="+width+",height="+height+",screenX="+leftpos+",screenY="+toppos+",top="+toppos+",left="+leftpos+",scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no");}
function contentSwitch(){if($defined($('contentTextDiv'))&&$defined($('contentTextDivHidden'))){var elementShow=$('contentTextDiv');var elementHidden=$('contentTextDivHidden');var contentTextTemp=elementShow.get('html');var contentText=elementHidden.get('html');elementShow.empty();elementShow.set('html',contentText);elementHidden.empty();elementHidden.set('html',contentTextTemp);}}
function revertCurrentHoveredElement(hoveredElement){if(!$defined(hoveredElement))
return;var level=hoveredElement.retrieve('level');if(hoveredElement.hasClass('hoverLContent')){hoveredElement.addClass('levelContent'+level).removeClass('hoverLContent');}
else if(hoveredElement.hasClass('hover3')){}
else
hoveredElement.addClass('level'+level);hoveredElement.removeClass('hover').removeClass('hover2').removeClass('hover3');}
function leftMenuOddsMouseOver(e){var ev=new Event(e);ev.stopPropagation();var element=null;var target=ev.target||ev.srcElement;if(target.className.indexOf('contentLM')>-1){element=target.getParent();}
else
element=target;if(!(element.tagName=='DIV'&&element.className.indexOf('scroll')>-1)){if($defined(bbGlobal.leftMenuToolTip)){bbGlobal.shouldStillDisplayLeftMenuToolTip=false;bbGlobal.leftMenuToolTip.addClass('hidden');bbGlobal.leftMenuToolTip.smartDispose(false);}}
if($defined(bbGlobal.betTypesToolTip)&&!bbGlobal.betTypesToolTip.hasClass('hidden')){bbGlobal.shouldStillDisplayLeftMenuToolTip=false;bbGlobal.betTypesToolTip.addClass('hidden');if($defined(bbGlobal.leftMenuToolTip))bbGlobal.leftMenuToolTip.smartDispose(false);}
if((!element.hasClass('level')&&!element.hasClass('currentLeftMenuItem')&&!element.hasClass('levelAuxiliar'))||element.hasClass('tabs'))
return;revertCurrentHoveredElement(this.hoveredElement);this.hoveredElement=element;var level=this.hoveredElement.retrieve('level');var id=this.hoveredElement.retrieve('id');if(level==1||level==2||(level==3&&element.hasHRParent)){if(id==-9999)
return;}
element=null;if(this.hoveredElement.hasClass('level4')||this.hoveredElement.hasClass('level5')){this.hoveredElement.addClass('hover2').removeClass('level'+level);}
else if(this.hoveredElement.hasClass('subTourn')||this.hoveredElement.hasClass('level4ContentWSubTourn'))
this.hoveredElement.addClass('hover3');else if(this.hoveredElement.className.indexOf('levelContent')>-1){this.hoveredElement.addClass('hoverLContent').removeClass('levelContent'+level);}
else{this.hoveredElement.addClass('hover').removeClass('level'+level);}
if(this.hoveredElement.className.indexOf('hoverLContent')>-1){return;}
if(!((window.location.pathname.indexOf('/scores')>-1&&window.location.hash=="")||window.location.hash.indexOf('/scores')>-1)){var elem=null;if(level<3){if($defined(bbGlobal.leftMenuToolTip)){bbGlobal.shouldStillDisplayLeftMenuToolTip=false;bbGlobal.leftMenuToolTip.addClass('hidden');bbGlobal.leftMenuToolTip.smartDispose(false);}
return;}
if($defined(id)&&$defined(level)){elem=this.getObjectForElementId(id,level);}
if($defined(elem)){var elemId=elem.id;var betTypeId=-1;if(elem.level==3&&elem.hasHRParent)
return;if(elem.level>=4&&elem.name.indexOf(' - ')==-1){if(elem.hasHRParent){betTypeId=7;elemId=elem.id;}
else{betTypeId=elem.id;elemId=elem.parent.id;}}
elem=null;showLeftMenuToolTip(elemId,betTypeId,this.hoveredElement.getLeft(),this.hoveredElement.getWidth(),this.hoveredElement.getTop());}}}
var LeftMenuItem=new Class({initialize:function(id,type,link,name,hits,level,parent,leftMenuTreeIndex,hasAuxiliar,isLive){this.id=id;this.hits=parseInt(hits);if(name.indexOf('#')>-1){var chunks=name.split('#');name=chunks[0];var idx=1;if(level>=4&&chunks.length>1)
this.startDate=chunks[1];}
else
this.title=name;this.name=name;this.hasAuxiliarItem=(hasAuxiliar==='true');this.isLive=isLive;this.link=link;this.type=parseInt(type);this.level=level;this.leftMenuTreeIndex=leftMenuTreeIndex;this.fixedPositionedAtTop=false;this.kids=[];this.kidsSorted=false;this.fixedTabPosition=false;this.expanded=false;this.hasTabs=false;if(!$defined(bbGlobal.leftMenuToolTip)){createLeftMenuToolTip();}
this.hasLinkToOddsDetail=false;this.isLiveHRRace=false;this.hasHRParent=false;if(parent==null){this.topPosition=0;this.hoveredElement=null;this.hoveredTab=null;this.path=new Hash();this.path.set(0,this);this.allSportsElement=new Element('div',{'class':'allsports'});this.allSportsElement.inject($('leftMenuContainer'));this.allSportsElement.store('id',-19);this.allSportsElement.store('level',this.level);this.allSportsElement.set('text',allSportsText);this.topPosition+=parseInt(this.allSportsElement.getStyle('height'))+
parseInt(this.allSportsElement.getStyle('padding-top'))+
parseInt(this.allSportsElement.getStyle('padding-bottom'));var scrollElm=new Element('div',{'class':'scrollLM'});scrollElm.inject($('leftMenuContainer'));this.topElement=new Element('div',{'class':'level'+this.level});this.topElement.inject(scrollElm);this.bound=leftMenuOddsMouseOver.bind(this);$('leftMenuContainer').addEvent('mouseover',this.bound);$('leftMenuContainer').addEvent('mouseleave',function(e){var ev=new Event(e);ev.stopPropagation();var element=ev.target;revertCurrentHoveredElement(this.hoveredElement);this.hoveredElement=null;}.bind(this));$('leftMenuContainer').addEvent('click',function(e){var ev=new Event(e);ev.stopPropagation();var element=null;if(ev.target.className.indexOf('contentLM')>-1)
element=ev.target.getParent();else
element=ev.target;if(element.className.indexOf('scroll')>-1||element.getParent().className.indexOf('scroll')>-1)
return;if(element.tagName.toLowerCase()=='li'){this.switchMatchesOutrightTabs(element,ev.client.x-element.getParent().getParent().getPosition().x);}
else{var posX=ev.client.x-element.getPosition().x;this.onClickHandler(element,posX);}
element=null;}.bind(this));}else{this.parent=parent;if(this.type==1&&this.parent.type==1)
this.parent.hasSubTourn=true;if(this.level==4){if(this.parent.parent.id!=9999&&this.parent.hasHRParent){this.isLiveHRRace=true;}
if(this.id.length<3||this.isLiveHRRace)
this.hasLinkToOddsDetail=true;}
if(this.level==1&&this.id==24)
this.hasHRParent=true;if(this.level>=2)
this.hasHRParent=this.parent.hasHRParent;parent.addKid(this);}},switchMatchesOutrightTabs:function(element,posX){element.removeClass('mouse_out');var parentEl=this.path.getValues()[this.path.getLength()-1];if($defined(parentEl.activeTab)){parentEl.activeTab.addClass('mouse_out').removeClass('active');}
parentEl.activeTab=element;parentEl.activeTab.addClass('active');this.onClickHandler(element.getParent().getParent(),posX);},onClickHandlerOnElem:function(elementId,posX,level){this.onClickHandler(this.getObjectForElementId(elementId,level).topElement,posX);},onClickHandler:function(element,posX){var elemId=element.retrieve('id');var level=element.retrieve('level');if(element.hasClass('auxiliarLink')){level=element.getParent().retrieve('level');elemId=element.getParent().retrieve('id');}
if((level==1||level==2||level==3)&&elemId==-9999){return;}
if((level==4||level==5)&&$defined(elemId)&&elemId==-9999){var matches=true;if(posX>70){matches=false;}
var parentEl=this.path.getValues()[this.path.getLength()-1];for(var i=0;i<parentEl.kids.length;i++){if(parentEl.kids[i].id==-9999)
continue;if(parentEl.kids[i].name.indexOf(' - ')==-1&&!matches)
parentEl.kids[i].topElement.removeClass('hidden');if(parentEl.kids[i].name.indexOf(' - ')>-1&&!matches)
parentEl.kids[i].topElement.addClass('hidden');if(parentEl.kids[i].name.indexOf(' - ')==-1&&matches)
parentEl.kids[i].topElement.addClass('hidden');if(parentEl.kids[i].name.indexOf(' - ')>-1&&matches)
parentEl.kids[i].topElement.removeClass('hidden');}
this.checkScrollable();return;}
if($defined(elemId)){if($defined(level)){if(level==4||level==5){var elementObject=this.getObjectForElementId(elemId,level);if(elementObject.type==2||elementObject.type==3){loadPage(elementObject.link);return;}}}
var elementObject=this.getObjectForElementId(elemId,level);if(element.hasClass('auxiliarLink')){if(elementObject.type==4){loadPage(elementObject.link);return;}
if(elementObject.type==5){loadPage(elementObject.link);return;}
if(elementObject.type==1){loadPage(elementObject.link);return;}}
var startT=new Date().getTime();if(this.path.has(elementObject.level)){var parent=elementObject;var parentElement=$$('.scrollLM')[0];if(elementObject.id==this.path.getValues()[this.path.getLength()-1].id){if(parent.level!=0)
parent=elementObject.parent;}
var selectedKidOfParent=this.path.get(parent.level+1);var selectedKids=[];while($defined(selectedKidOfParent)&&$defined(this.path.get(selectedKidOfParent.level))){selectedKids.unshift(selectedKidOfParent);selectedKidOfParent=this.path.get(selectedKidOfParent.level+1);}
selectedKidOfParent=null;for(var i=0;i<selectedKids.length;i++){this.path.erase(selectedKids[i].level);if(selectedKids[i].fixedPositionedAtTop){selectedKids[i].topElement.dispose();selectedKids[i].topElement.inject($$('.level0')[0],'top');selectedKids[i].parent.kidsSorted=false;selectedKids[i].topElement.removeClass('levelSelected');var elementHeight=parseInt(selectedKids[i].topElement.getStyle('height'))+
parseInt(selectedKids[i].topElement.getStyle('padding-top'))+
parseInt(selectedKids[i].topElement.getStyle('padding-bottom'))+
parseInt(selectedKids[i].topElement.getStyle('border-bottom-width'));selectedKids[i].fixedPositionedAtTop=false;if($defined(selectedKids[i].auxiliarContent)){selectedKids[i].auxiliarContent.removeClass('currentLeftMenuItem');}
parentElement.setStyle('height',(parseInt(parentElement.getStyle('height'))+
parseInt(parentElement.getStyle('padding-top'))+
parseInt(parentElement.getStyle('padding-bottom'))+
elementHeight)+'px');}
selectedKids[i].hideAllKids();}
selectedKids=null;parent.showAllKids();if($defined(parent.auxiliarContent)&&!parent.auxiliarContent.hasClass('hidden')){var elementAuxiliarHeight=parseInt(parent.auxiliarContent.getStyle('height'))+
parseInt(parent.auxiliarContent.getStyle('padding-top'))+
parseInt(parent.auxiliarContent.getStyle('padding-bottom'))+
parseInt(parent.auxiliarContent.getStyle('border-bottom-width'));parentElement.setStyle('height',(parseInt(parentElement.getStyle('height'))+
parseInt(parentElement.getStyle('padding-top'))+
parseInt(parentElement.getStyle('padding-bottom'))-
elementAuxiliarHeight)+'px');}
parentElement=null;}else{var parentElement=$$('div.scrollLM')[0];var upperLevelElement=this.path.get(level-1);if($defined(upperLevelElement.auxiliarContent)){var elementAuxiliarHeight1=parseInt(upperLevelElement.auxiliarContent.getStyle('height'))+
parseInt(upperLevelElement.auxiliarContent.getStyle('padding-top'))+
parseInt(upperLevelElement.auxiliarContent.getStyle('padding-bottom'))+
parseInt(upperLevelElement.auxiliarContent.getStyle('border-bottom-width'));parentElement.setStyle('height',(parseInt(parentElement.getStyle('height'))+
parseInt(parentElement.getStyle('padding-top'))+
parseInt(parentElement.getStyle('padding-bottom'))+
elementAuxiliarHeight1)+'px');}
this.path.set(level,elementObject);elementObject.showKids();elementObject.hideSiblings();elementObject.topElement.dispose();elementObject.topElement.removeClass('markerLine');elementObject.topElement.inject(parentElement,'before');elementObject.fixedPositionedAtTop=true;if($defined(elementObject.auxiliarContent)){}
else{elementObject.topElement.addClass('levelSelected');}
var elementHeight=parseInt(elementObject.topElement.getStyle('height'))+
parseInt(elementObject.topElement.getStyle('padding-top'))+
parseInt(elementObject.topElement.getStyle('padding-bottom'))+
parseInt(elementObject.topElement.getStyle('border-bottom-width'));var elementAuxiliarHeight=0;parentElement.setStyle('height',(parseInt(parentElement.getStyle('height'))+
parseInt(parentElement.getStyle('padding-top'))+
parseInt(parentElement.getStyle('padding-bottom'))-
elementHeight+elementAuxiliarHeight)+'px');parentElement=null;}
elementObject=null;}
this.checkScrollable();if(posX==-10&&(level+1==bbGlobal.initialSelectedLevel||(level==1&&bbGlobal.initialSelectedLevel==1))){var startT1=new Date().getTime();var shownParent=this.path.getValues()[this.path.getLength()-1];if(bbGlobal.initialSelectedLevel==1)
shownParent=this.path.getValues()[0];for(var i=0;i<shownParent.kids.length;i++){if(bbGlobal.viewedEventId==shownParent.kids[i].id||bbGlobal.eventBetType==shownParent.kids[i].id){bbGlobal.leftMenuContainer.currentLMI=shownParent.kids[i].topElement;if($defined(shownParent.kids[i].auxiliarContent))
shownParent.kids[i].auxiliarContent.addClass('currentLeftMenuItem');else
shownParent.kids[i].topElement.addClass('currentLeftMenuItem');if(bbGlobal.eventBetType==shownParent.kids[i].id&&this.hasTabs==true){this.switchMatchesOutrightTabs(shownParent.activeTab.getNext(),80);}
bbGlobal.initialSelect=0;shownParent.kids[i].scrollIntoView();break;}}
shownParent=null;}
if(posX==-10){var startTT=new Date().getTime();if(level==1){var obj2=this.getObjectForElementId(this.initialSportId,1);startTT=new Date().getTime();if(!this.path.has(obj2.level))
this.onClickHandler(obj2.topElement,-10);else if(this.initialRegionCode!=null){var obj3=this.getObjectForElementId(this.initialRegionCode,2);if(!this.path.has(obj3.level))
this.onClickHandler(obj3.topElement,-10);obj3=null;}
obj2=null;}
if(level==2&&this.initialTournamentId!=null){var obj3=this.getObjectForElementId(this.initialTournamentId,3);startTT=new Date().getTime();if(!this.path.has(obj3.level)){if(obj3.topElement.hasClass('level3WithTabs')){if(obj3.topElement.getFirst().hasClass('levelAuxiliar'))
this.onClickHandler(obj3.topElement.getFirst().getFirst(),-10);else
this.onClickHandler(obj3.topElement.getFirst(),-10);}
else if(obj3.topElement.hasClass('levelAuxiliar'))
this.onClickHandler(obj3.topElement.getFirst(),-10);else
this.onClickHandler(obj3.topElement,-10);}
obj3=null;}
if(level==3&&this.initialSubtournamentId!=null){var obj3=this.getObjectForElementId(this.initialSubtournamentId,4);startTT=new Date().getTime();if(!this.path.has(obj3.level)){if(obj3.topElement.hasClass('level3WithTabs')){if(obj3.topElement.getFirst().hasClass('levelAuxiliar'))
this.onClickHandler(obj3.topElement.getFirst().getFirst(),-10);else
this.onClickHandler(obj3.topElement.getFirst(),-10);}
else if(obj3.topElement.hasClass('levelAuxiliar'))
this.onClickHandler(obj3.topElement.getFirst(),-10);else
this.onClickHandler(obj3.topElement,-10);}
obj3=null;}}},getWhereToInsert:function(element){return $$('div.scrollLM')[0];},initialSelect:function(sportId,regionCode,tournamentId,subtournamentId){this.initialSportId=sportId;this.initialRegionCode=regionCode;this.initialTournamentId=tournamentId;this.initialSubtournamentId=subtournamentId;if(sportId!=null){this.onClickHandler(this.getObjectForElementId(sportId,1).topElement,-10);}},scrollIntoView:function(){var topLevelCoordinates=bbGlobal.leftMenuContainer.topElement.getParent().getParent().getCoordinates();var diff=this.topElement.getCoordinates().top-
topLevelCoordinates.top-
topLevelCoordinates.height/2;if(diff>0){bbGlobal.leftMenuScrollBar.setSlider(diff);}},checkScrollable:function(){if(!$defined(bbGlobal.leftMenuScrollBar))
bbGlobal.leftMenuScrollBar=new MooScroll({selector:'.scrollLM'});if($defined(bbGlobal.leftMenuScrollBar)){bbGlobal.leftMenuScrollBar.refresh();}},getLastElement:function(){if(this.kids.length<=1)
return this.topElement;else
return this.kids[this.kids.length-2].topElement;},incarnate:function(){if(this.id!=-9999){if(this.hasAuxiliarItem){var auxiliarElement=new Element('div',{'class':'auxiliarLink level hidden levelContent'+(this.level+1)});var auxiliarContent=new Element('div',{'class':'contentLM'});if(this.level==2){auxiliarContent.set('text','All '+this.parent.name+' '+this.name);auxiliarElement.setAttribute('title','Check all '+this.parent.name+' competitions from '+this.name);}
else{auxiliarContent.set('text','All '+this.name);auxiliarElement.setAttribute('title','Go to the '+this.name+' overview page');}
auxiliarElement.appendChild(auxiliarContent);this.adiacentElement=new Element('div',{'class':'level level'+this.level});if(this.type==1&&this.level==4)
this.adiacentElement.addClass('subTourn').removeClass('level4');if(this.level==1)
this.adiacentElement.set('title',compareFromText+' '+this.name);adiacentContent=new Element('div',{'class':'contentLM'});adiacentContent.set('text',this.name);this.adiacentElement.appendChild(adiacentContent);this.topElement=new Element('div',{'class':' level'+this.level});if(this.type==1&&this.level==4)
this.topElement.addClass('level4SubTourn').removeClass('level4');if(this.parent.hasSubTourn){this.parent.auxiliarContent.removeClass('levelContent'+this.level).addClass('level4ContentWSubTourn');}
this.topElement.appendChild(this.adiacentElement);this.topElement.appendChild(auxiliarElement);this.auxiliarContent=auxiliarElement;this.topElement.store('id',this.id);this.topElement.store('level',this.level);auxiliarElement.store('level',this.level+1);this.adiacentElement.store('level',this.level);this.adiacentElement.store('id',this.id);}
else{this.topElement=new Element('div',{'class':'level level'+this.level});this.topElement.store('id',this.id);this.topElement.store('level',this.level);this.adiacentElement=new Element('div',{'class':'contentLM'});this.adiacentElement.set('text',this.name);this.topElement.appendChild(this.adiacentElement);if(this.isLive=='true'||this.isLive==true){this.adiacentElement.setStyles({'width':'135px','margin':0,'float':'left'});var liveText=new Element('div',{'style':'color:red; width:30px; display:block;float:left;padding-left:5px;'});liveText.set('text',bbGlobal.txtLIVE+'!');this.topElement.appendChild(liveText);}}
if(this.parent.level>0)
this.topElement.inject(this.parent.getLastElement(),'after');else
this.topElement.inject(this.parent.topElement);}
else if(this.level==4||this.level==5){this.hasTabs=true;this.topElement=new Element('div',{'class':'tabs level level'+this.level});var ul=new Element('ul',{'class':'leftMenutabs'});var li=new Element('li',{'class':'mouse_out'});li.set('html',bbGlobal.matchestxt);li.addEvents({'mouseover':function(e){onMouseOverTab(this,this);},'mouseout':function(e){onMouseOutTab(this,this);}});this.parent.activeTab=li;ul.appendChild(li);var li=new Element('li',{'class':'mouse_out outright'});li.set('html',bbGlobal.leaguestxt);li.addEvents({'mouseover':function(e){onMouseOverTab(this,this);},'mouseout':function(e){onMouseOutTab(this,this);}});if(bbGlobal.viewedEventId==this.parent.id)
this.parent.activeTab=li;ul.appendChild(li);this.topElement.appendChild(ul);this.topElement.store('id',this.id);this.topElement.store('level',this.level);var newParentTopElement=new Element('div',{'class':'level3WithTabs'});newParentTopElement.appendChild(this.parent.topElement);newParentTopElement.appendChild(this.topElement);this.parent.topElement=newParentTopElement;this.parent.hasTabs=true;this.parent.activeTab.removeClass('mouse_out');this.parent.activeTab.addClass('active');}
else if(this.level==1||this.level==2||(this.level==3&&this.hasHRParent)){this.topElement=new Element('div',{'class':'level level'+this.level});this.topElement.store('id',this.id);this.topElement.store('level',this.level);this.adiacentElement=new Element('div',{'class':'contentLM'});if(this.level==1)
this.topElement.addClass('otherSports');else
this.topElement.addClass('otherCountries');this.adiacentElement.set('text',this.name);this.topElement.appendChild(this.adiacentElement);}},hideSiblings:function(){this.parent.hideBrothersButMe(this.id);bbGlobal.leftMenuContainer.checkScrollable();},hideBrothersButMe:function(selectedKidId){for(var i=0;i<this.kids.length;i++){if(this.kids[i].id!=selectedKidId)
this.kids[i].hide();}
if($defined(this.auxiliarContent)){this.auxiliarContent.addClass('hidden');this.auxiliarContent.removeClass('currentLeftMenuItem');}},show:function(){this.topElement.removeClass('hidden');},hide:function(){this.topElement.addClass('hidden');},hideAllKids:function(){if($defined(this.auxiliarContent))
this.auxiliarContent.addClass('hidden');for(var i=0;i<this.kids.length;i++)
this.kids[i].hide();},showAllKids:function(){for(var i=0;i<this.kids.length;i++)
this.kids[i].show();this.reArrangeKidsInOrder();},addKid:function(kid){this.kids.push(kid);kid.incarnate();this.kidsSorted=false;},getObjectForElementId:function(elemId,level){if(level==0&&elemId==-19)
return bbGlobal.leftMenuContainer;return this.path.get(level-1).getKidById(elemId);},getKidById:function(kidId){var kid=null;for(var i=0;i<this.kids.length;i++){if(this.kids[i].id==kidId){kid=this.kids[i];break;}}
return kid;},showKids:function(){if(this.leftMenuTreeIndex<0){var level=this.level;var superParent=this;while(level>=1){superParent=superParent.parent;level=superParent.level;}
superParent.sendForKids(this);superParent=null;return;}
if(this.kids.length==0){if(this.level<2||((this.level==2||this.level==3)&&this.hasHRParent)){this.getKids();this.reArrangeKidsInOrder();}
else{var level=this.level;var superParent=this;while(level>=1){superParent=superParent.parent;level=superParent.level;}
superParent.sendForKids(this);superParent=null;return;}}
else{for(var i=0;i<this.kids.length;i++){this.kids[i].show();}
this.kidsSorted=false;this.reArrangeKidsInOrder();}},getKids:function(){if(this.level==1){var kids=leftMenuTree[this.leftMenuTreeIndex].kids;if(!kids)
leftMenuTree[this.leftMenuTreeIndex].kids=[];for(var i=0;i<kids.length;i++){var elo=new LeftMenuItem(kids[i].id,kids[i].type,kids[i].link,kids[i].name,kids[i].hits,this.level+1,this,i,kids[i].hasAuxiliar,kids[i].isLive);}
if($defined(this.auxiliarContent)){this.auxiliarContent.removeClass('hidden');}}
if(this.level==2){var kids=leftMenuTree[this.parent.leftMenuTreeIndex].kids[this.leftMenuTreeIndex].kids;if(!kids)
leftMenuTree[this.parent.leftMenuTreeIndex].kids[this.leftMenuTreeIndex].kids=[];for(var i=0;i<kids.length;i++){var elo=new LeftMenuItem(kids[i].id,kids[i].type,kids[i].link,kids[i].name,kids[i].hits,this.level+1,this,i,kids[i].hasAuxiliar,kids[i].isLive);}
if($defined(this.auxiliarContent)){this.auxiliarContent.removeClass('hidden');}}
if(this.level==3){var kids=leftMenuTree[this.parent.parent.leftMenuTreeIndex].kids[this.parent.leftMenuTreeIndex].kids[this.leftMenuTreeIndex].kids;if(!kids)
leftMenuTree[this.parent.parent.leftMenuTreeIndex].kids[this.parent.leftMenuTreeIndex].kids[this.leftMenuTreeIndex].kids=[];for(var i=0;i<kids.length;i++){var elo=new LeftMenuItem(kids[i].id,kids[i].type,kids[i].link,kids[i].name,0,this.level+1,this,i,kids[i].hasAuxiliar,kids[i].isLive);}
if($defined(this.auxiliarContent)){this.auxiliarContent.removeClass('hidden');}}
this.kidsSorted=false;},sendForKids:function(expandedElement){if(this.level>=1){debugger;return;}
var url='/leftMenuInfo?';if(expandedElement.level==1){url=url+'disc='+expandedElement.id
if(expandedElement.kids.length>0)
url=url+'&kids=';for(var i=0;i<expandedElement.kids.length;i++){if(expandedElement.kids[i].id!=-9999)
url+="'"+expandedElement.kids[i].id+"',";}
if(expandedElement.kids.length>0)
url=url.substr(0,url.length-1);}
if(expandedElement.level==2){var disciplineSelected=expandedElement.parent;url=url+'disc='+disciplineSelected.id+'&region='+expandedElement.id;if(expandedElement.kids.length>0)
url=url+'&kids=';for(var i=0;i<expandedElement.kids.length;i++){if(expandedElement.kids[i].id!=-9999)
url+=expandedElement.kids[i].id+',';}
if(expandedElement.kids.length>0)
url=url.substr(0,url.length-1);}
if(expandedElement.level==3||(expandedElement.level==4&&!expandedElement.hasHRParent)){url=url+'tourId='+expandedElement.id;var matches='&matches=';var outrights='&outrights='
for(var i=0;i<expandedElement.kids.length;i++){if(expandedElement.kids[i].id==-9999)
continue;if(expandedElement.kids[i].id.length>=4)
matches+=expandedElement.kids[i].id+',';else
outrights+=expandedElement.kids[i].id+',';}
if(matches.length>10){matches=matches.substr(0,matches.length-1);url+=matches;}
if(outrights.length>12){outrights=outrights.substr(0,matches.length-1);url+=outrights;}}
if(!$defined(this.channel))
this.channel=new Request({'url':url,'method':'get','async':false,'autoCancel':'true',onSuccess:function(response){var expandedElement=this.path.getValues()[this.path.getLength()-1];var startT=new Date().getTime();expandedElement.addKidsFromServer(response);this.checkScrollable();}.bind(this),onFailure:function(){}});this.channel.setOptions({'url':url});this.channel.send();},addKidsFromServer:function(kidsString){kidsString=kidsString.substr(1,kidsString.length-2);var parts=kidsString.split('),(');for(var i=0;i<parts.length;i++){var kidParts=parts[i].split('`');var serverKid=new LeftMenuItem(kidParts[0],kidParts[1],kidParts[2],kidParts[3],kidParts[4],this.level+1,this,-1,kidParts[5],kidParts[6]);}
if(this.leftMenuTreeIndex<0)
this.leftMenuTreeIndex=leftMenuTree.length+1;this.kidsSorted=false;this.reArrangeKidsInOrder();},sortKids:function(item1,item2){if(item1.level==3||(item1.level==4&&item1.hasHRParent)){if(item1.hits==item2.hits){var name1=item1.name.toLowerCase();var name2=item2.name.toLowerCase();if(name1==name2)return 0;if(name1<name2)return-1;return 1;}
return item2.hits-item1.hits;}
if(item1.level==1){if(item1.id==-9999){if(item2.hits>0)
return 1;if(item2.hits==0)
return-1;}
if(item2.id==-9999&&item1.hits==0)
return 1;if(item1.hits==item2.hits){var name1=item1.name.toLowerCase();var name2=item2.name.toLowerCase();if(name1==name2)return 0;if(name1<name2)return-1;return 1;}
return item2.hits-item1.hits;}
if(item1.level==2&&item1.hasHRParent){return item1.hits-item2.hits;}
if(item1.level==2||(item1.level==3&&item1.hasHRParent)){if(item1.id==-9999){if(item2.hits==0)
return-1;return 1;}
if(item2.id==-9999){if(item1.hits==0)
return 1;return-1;}
if(item1.hits-item2.hits!=0&&(item1.hits==0||item2.hits==0))
return item2.hits-item1.hits;var name1=item1.name.toLowerCase();var name2=item2.name.toLowerCase();if(name1==name2)return 0;if(name1<name2)return-1;return 1;}
if(item1.level>=4){if(item1.id==-9999)
return-1;if(item2.id==-9999)
return 1;if(item1.type==item2.type&&item1.type==1){var name1=item1.name.toLowerCase();var name2=item2.name.toLowerCase();if(name1==name2)return 0;if(name1<name2)return-1;return 1;}
if(item1.type==item2.type&&item1.type==2){var date1=item1.startDate;var date2=item2.startDate;if(date1==date2){var name1=item1.name.toLowerCase();var name2=item2.name.toLowerCase();if(name1==name2)
return 0;if(name1<name2)
return-1;return 1;}
if(date1<date2)return-1;return 1;}
if(item1.type==item2.type&&item1.type==3){if(item1.hits==item2.hits){var name1=item1.name.toLowerCase();var name2=item2.name.toLowerCase();if(name1==name2)return 0;if(name1<name2)return-1;return 1;}
return item2.hits-item1.hits;}
if(item1.type==1){if(item2.type==3)
return-1;else if(item2.type==2)
return-1;return 1;}
else if(item1.type==2){if(item2.type==1)
return 1;else if(item2.type==3)
return 1;return 1;}
else if(item1.type==3){if(item2.type==1)
return 1;else if(item2.type==2)
return-1;return 1;}}
return 1;},reArrangeKidsInOrder:function(){if($defined(this.auxiliarContent)){this.auxiliarContent.removeClass('hidden');}
if(this.kidsSorted)
return;this.kids.sort(this.sortKids);for(var i=0;i<this.kids.length;i++){if(this.kids[i].id==-9999&&this.level==3){continue;}
bbGlobal.leftMenuContainer.topElement.appendChild(this.kids[i].topElement);}
for(var i=0;i<this.kids.length-1;i++){if(this.kids[i].id==-9999&&this.level==3){continue;}
if(this.kids[i].type!=this.kids[i+1].type)
this.kids[i].topElement.addClass('markerLine');}
this.kidsSorted=true;}});function onMouseOverTab(parentElement,element){if($defined(parentElement.hoveredTab)){parentElement.hoveredTab.removeClass('mouse_on').addClass('mouse_out');}
parentElement.hoveredTab=element;parentElement.hoveredTab.removeClass('mouse_out').addClass('mouse_on');}
function onMouseOutTab(parentElement,element){if($defined(parentElement.hoveredTab)){parentElement.hoveredTab.removeClass('mouse_on').addClass('mouse_out');}
parentElement.hoveredTab=element;parentElement.hoveredTab.removeClass('mouse_on').addClass('mouse_out');}
var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}
else if(dataProp)
return data[i].identity;}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();var bbGlobal={};bbGlobal.visibleSubMenuTable=null;bbGlobal.visibleFilterMenuTable=null;bbGlobal.loginUsernameDefault=null;bbGlobal.loginPasswordDefault=null;bbGlobal.searchBoxDefault=null;bbGlobal.leftMenuToolTip=null;bbGlobal.oddsDetailToolTip=null;bbGlobal.selectedTabIndex=new Hash();bbGlobal.promoofferIndexSet=new Hash();bbGlobal.promooffer=-9999;bbGlobal.menuFolded=false;bbGlobal.defaultLeftMenuItem=0;bbGlobal.isFocusFlagDrop=false;bbGlobal.portalId=null;bbGlobal.server=document.domain;bbGlobal.gfxServer=null;bbGlobal.cssServer=null;bbGlobal.jsServer=null;bbGlobal.imgSufix='';bbGlobal.ajaxLeftMenuFlagOpened=[];bbGlobal.leftMenuTimeout=140;window.addEvent('domready',domReady);window.addEvent('scroll',scrollNews);var urlParts=window.location.href.split('/');bbGlobal.scrolls=new Hash();bbGlobal.leftMenuScrollBar=null;bbGlobal.scrollCupon=null;bbGlobal.isOddsDetailPage=false;bbGlobal.bookieHeaderScrollBarSlider=null;bbGlobal.optionHeaderScrollBarSlider=null;bbGlobal.matchMouseOver=new Hash();bbGlobal.tournamentNumber=0;bbGlobal.generalClock=null;var nextMatchesGlobal={};nextMatchesGlobal.loading=false;nextMatchesGlobal.curPage=1;nextMatchesGlobal.visEvents=false;nextMatchesGlobal.eventId=9999;var newsGlobal={};newsGlobal.isLoading=false;newsGlobal.lineId=9999;newsGlobal.showsHiddenRows=false;newsGlobal.page=null;newsGlobal.match='';newsGlobal.participant='';newsGlobal.tourSet='';bbGlobal.initialLMAccounting=null;bbGlobal.accessDenied=false;bbGlobal.mainTabs=null;bbGlobal.tabsSurebets=null;bbGlobal.leftMenuHoverElement=null;var surebetTableModel=null,removedBoTable=null;bbGlobal.offsetTime=null;bbGlobal.clockUpdater=null;bbGlobal.totalNbrOfPosition=null;bbGlobal.uacct=null;bbGlobal.disableDirectBettingLinks=0;bbGlobal.userRoleLink=null;var surebetSessionSocket=null;bbGlobal.innerHtmlTopBanner='';function buildLeftMenu(){if($defined(leftMenuTree)&&leftMenuTree.length>0){bbGlobal.leftMenuContainer=new LeftMenuItem(-1,-1,'','',0,0,null,-1,'false',false);for(var i=0;i<leftMenuTree.length;i++){var elo=new LeftMenuItem(leftMenuTree[i].id,leftMenuTree[i].type,leftMenuTree[i].link,leftMenuTree[i].name,leftMenuTree[i].hits,1,bbGlobal.leftMenuContainer,i,'true',leftMenuTree[i].isLive);}
bbGlobal.initialSelect=1;bbGlobal.leftMenuContainer.reArrangeKidsInOrder();}}
function getEncodedUrl(urlToEncode){while(urlToEncode.indexOf(':')>-1||urlToEncode.indexOf('/')>-1||urlToEncode.indexOf('?')>-1||urlToEncode.indexOf('&')>-1||urlToEncode.indexOf('+')>-1||urlToEncode.indexOf('=')>-1||urlToEncode.indexOf(',')>-1||urlToEncode.indexOf('$')>-1){urlToEncode=urlToEncode.replace(':','%3A');urlToEncode=urlToEncode.replace('/','%2F');urlToEncode=urlToEncode.replace('?','%3F');urlToEncode=urlToEncode.replace('&','%26');urlToEncode=urlToEncode.replace(',','%2C');urlToEncode=urlToEncode.replace('$','%24');urlToEncode=urlToEncode.replace('+','%2B');urlToEncode=urlToEncode.replace('=','%3D');}
return urlToEncode;}
function init(){synchronizeClock();if($defined($('topBanner'))){var bannerDivContent=$('topBanner').innerHTML;if(bannerDivContent.trim()!=''&&bannerDivContent.indexOf('blank.jpg')==-1&&bannerDivContent.indexOf('c95732bc88967fe9ab7ec40426b6e70b.jpg')==-1)
$('topBanner').style.display="block";bannerDivContent=null;}
buildLeftMenu();if($defined($('leftMenuAccount'))&&$defined(leftMenuAccounting)&&leftMenuAccounting.length>0){bbGlobal.leftMenuAccounting=new LeftMenuAccItem(-1,'','',0,null,-1);for(var i=0;i<leftMenuAccounting.length;i++){var elo=new LeftMenuAccItem(leftMenuAccounting[i].id,leftMenuAccounting[i].name,leftMenuAccounting[i].link,1,bbGlobal.leftMenuAccounting,i);}}
if(bbGlobal.eventType=='tn'||bbGlobal.eventType=='ev'||bbGlobal.eventType=='sportId'||urlParts[urlParts.length-8]=='eventId'){bbGlobal.defaultLeftMenuItem=0;}
if(urlParts[3]=='scores'){bbGlobal.defaultLeftMenuItem=4;}
if(window.location.pathname.indexOf('surebets')>-1)
bbGlobal.defaultLeftMenuItem=6;if(window.location.pathname.indexOf('valuebets')>-1)
bbGlobal.defaultLeftMenuItem=7;if(window.location.pathname.indexOf('news')>-1&&bbGlobal.isBOV)
bbGlobal.defaultLeftMenuItem=8;if(window.location.pathname.indexOf('news')>-1&&!bbGlobal.isBOV)
bbGlobal.defaultLeftMenuItem=5;var tabsMP=new SimpleTabs('leftMenuMP',{mouseOutClass:'leftmenuMP_mouse_out',mouseOnClass:'leftmenuMP_mouse_on',mootabsClass:'mootabsMostPopular',defaultItem:0,hasScroll:true});bbGlobal.mainTabs=new SimpleTabs('menuBody',{mouseOutClass:'leftmenu_mouse_out',mouseOnClass:'leftmenu_on',mootabsClass:'mootabsLeftMenu',defaultItem:bbGlobal.defaultLeftMenuItem,hasScroll:true});if($defined($('leftMenuSurebets'))){bbGlobal.tabsSurebets=new SimpleTabs('leftMenuSurebets',{mouseOutClass:'leftmenuMP_mouse_out',mouseOnClass:'leftmenuMP_mouse_on',mootabsClass:'mootabsMostPopular',defaultItem:0,hasScroll:true});}
bbGlobal.mainTabs.activate(bbGlobal.defaultLeftMenuItem);tabsMP.activate(0);if($defined($('divLanguage'))){$('divLanguage').addEvent('mouseleave',function(e){$('tableLanguage').setStyle('display','none');if($defined($('topBanner')))
$('topBanner').innerHTML=bbGlobal.innerHtmlTopBanner;});$('divLanguage').addEvent('mouseover',function(){$('tableLanguage').setStyle('display','block');if($defined($('topBanner')))
$('topBanner').innerHTML='';});}
if($defined($('loginUsername'))){$('loginUsername').addEvents({'focus':function(){if(bbGlobal.loginUsernameDefault==null){bbGlobal.loginUsernameDefault=this.value;this.value='';}
else if(this.value==bbGlobal.loginUsernameDefault)
this.value='';},'blur':function(){if(this.value=='')
this.value=bbGlobal.loginUsernameDefault;}});$('loginPassword').addEvents({'focus':function(){if(bbGlobal.loginPasswordDefault==null)
bbGlobal.loginPasswordDefault=this.value;var usernameEl=$('loginUsername');if(usernameEl.value==bbGlobal.loginUsernameDefault||usernameEl.value=='')
usernameEl.value=bbGlobal.loginUsernameDefault;this.value='';},'blur':function(){var usernameEl=$('loginUsername');if(this.value==''&&(usernameEl.value==bbGlobal.loginUsernameDefault||usernameEl.value==''))
this.value=bbGlobal.loginPasswordDefault;}});$('rememberMeCheckBox').addEvents({'click':function(){var imgSrc=this.src;if(imgSrc.indexOf('uncheck.gif')>-1){$('rememberMe').value=true;if(bbGlobal.isBOV)
this.src=bbGlobal.gfxServer+'/gfx/image/checkBOV.gif';else
this.src=bbGlobal.gfxServer+'/gfx/image/checkBB.gif';}
else{$('rememberMe').value=false;this.src=bbGlobal.gfxServer+'/gfx/image/uncheck.gif';}}});}
if($defined($('searchBox'))){$('searchBox').addEvents({'focus':function(){if(bbGlobal.searchBoxDefault==null)
bbGlobal.searchBoxDefault=this.value;this.set('value','');},'blur':function(){if(this.value=='')
this.set('value',bbGlobal.searchBoxDefault);}});}
if($defined($('timeZoneSelect'))){$('timeZoneHandler').addEvent('mouseover',function(e){$('timeZoneSetup').removeClass('hidden');if($defined($('topBanner')))
$('topBanner').innerHTML='';$('timeZoneSelect').focus();});$('timeZoneHandler').addEvent('mouseleave',function(e){$('timeZoneSetup').addClass('hidden');if($defined($('topBanner')))
$('topBanner').innerHTML=bbGlobal.innerHtmlTopBanner;});}
if(window.location.href.indexOf('scores')==-1)
addMouseOverEvent($('menuBody'));addEfectsForLeftMenuHandler();if(bbGlobal.accessDenied)
return;applyFilterEvents();if($defined($('leftMenuStats'))){if(urlParts[3]=='scores'){bbGlobal.defaultLeftMenuItem=5;$('leftMenuStats').removeClass('hidden');}}
if(window.location.pathname.match(bbGlobal.infoPagePattern)!=null||window.location.pathname.indexOf('/promo-offers')>-1){applyEventsForInfoPages();}
if(window.location.pathname.match(bbGlobal.matchPattern)!=null||window.location.pathname.match(bbGlobal.matchPatternOld)!=null){applyEventsForMatchPage();}
if(window.location.pathname.match(bbGlobal.tournamentPattern)!=null||window.location.pathname.match(bbGlobal.countryPattern)!=null||window.location.pathname.match(bbGlobal.tournamentPatternOld)!=null){applyEventsForTournamentPage();}
if(window.location.pathname.match(bbGlobal.sportPattern)!=null||window.location.pathname.match(bbGlobal.sportPatternOld)!=null){applyEventsForSportPage();}
if(window.location.pathname.indexOf('oddsDetail')>-1||window.location.pathname.indexOf('match-odds')>-1||window.location.pathname.indexOf('league-odds')>-1){applyEventsForOddsDetailPage();}
if($defined($('rightSkyscrapper'))&&$defined($('rightSkyscrapperFake'))){$('rightSkyscrapper').set('html',$('rightSkyscrapperFake').get('html'));$('rightSkyscrapperFake').dispose();$('rightSkyscrapper').removeClass('hidden');}
if($defined(bbGlobal.offsetTime)&&$defined($('clock')))
bbGlobal.clockUpdater=setInterval(setTime,500);window.status='';window.defaultStatus='BetBrain';if(bbGlobal.initialLMAccounting!=null){if(bbGlobal.mainTabs.currentItem!=5)
bbGlobal.mainTabs.activate(5);bbGlobal.leftMenuAccounting.initialSelect();}}
function addMouseOverEvent(parentNode){if(parentNode==null)
return;$(document.body).getElements('div.mootabsLeftMenu').each(function(item){item.addEvent('mouseout',function(e){var target=e.target||e.srcElement;var ev=new Event(e);if(target.tagName=='BODY'){target=null;return;}
target=null;var rel=(ev.relatedTarget)?ev.relatedTarget:ev.toElement;rel=$(rel);if(rel==null)
return;if(rel.getParent('span#oddsToolTip')==bbGlobal.leftMenuToolTip||rel==bbGlobal.leftMenuToolTip||rel.tagName=='LI'||(rel.tagName=='DIV'&&rel.className.indexOf('scroll')>-1)){rel=null;return;}
rel=null;if($defined(bbGlobal.leftMenuToolTip)){bbGlobal.shouldStillDisplayLeftMenuToolTip=false;if(!bbGlobal.leftMenuToolTip.hasClass('hidden')){bbGlobal.leftMenuToolTip.addClass('hidden');bbGlobal.leftMenuToolTip.smartDispose(false);}}})});parentNode.getElements('.tooltipTable').each(function(item){item.addEvents({'mouseover':function(e){var ev=new Event(e);ev.stopPropagation();var element=$(ev.target);var tagName=element.tagName.toLowerCase();if(element.getParent('div#removedBO')!=null){if(tagName=="ul"){element=null;return;}
createLeftMenuToolTip();if(tagName!="li")
element=element.getParent('li');showLeftMenuToolTip('surebet_'+element.getAttribute('evId'),-1,element.getLeft(),element.getWidth(),element.getTop());element=null;return;}
if(Browser.Engine.trident4){if(element.getParent('div#leftMenuMP')!=null||element.getParent('div#leftMenuCoupon')!=null||element.getParent('div#nextMatchesBox')!=null||element.getParent('div#leftMenuStats')!=null){var element2=element;if(tagName!="li")
element2=element.getParent('li');if(element2==null)
return;if($defined(bbGlobal.leftMenuHoverElement))
bbGlobal.leftMenuHoverElement.removeClass('hover');bbGlobal.leftMenuHoverElement=element2;element2.addClass('hover');element2=null;}}
if(tagName=='a'||tagName=='img'||tagName=='span'){createLeftMenuToolTip();if(element.getParent('div.mootabsLeftMenu')!=null&&element.getParent('div#leftMenuContainer')==null){if(tagName=='a'){var offset=0;if(element.getParent('div#cuponBox')!=null){offset=10;evId=element.get('cupon');element=element.getParent('div');}
else{evId=element.get('href').split('/')[4];element=element.getParent('li');evId=element.id;}
showLeftMenuToolTip(evId,-1,element.getLeft(),element.getWidth()+offset,element.getTop());}else if(tagName=='img'){bbGlobal.leftMenuToolTip.set('html',element.get('hoverTitle'));var top=element.getParent().getTop();top-=1;bbGlobal.leftMenuToolTip.setStyles({'top':top,'left':element.getLeft()+element.getWidth()});bbGlobal.leftMenuToolTip.removeClass('hidden');}}}
element=null;},'mouseleave':function(e){if($defined(bbGlobal.leftMenuHoverElement))
bbGlobal.leftMenuHoverElement.removeClass('hover');}});});}
function createLeftMenuToolTip(){if($defined(bbGlobal.leftMenuToolTip)){bbGlobal.leftMenuToolTip.smartDispose(false);}
if(!$defined(bbGlobal.leftMenuToolTip)){bbGlobal.leftMenuToolTip=new Element('span',{'class':'tooltipDiv hidden','id':'oddsToolTip'});bbGlobal.leftMenuToolTip.inject(document.body);bbGlobal.leftMenuToolTip.addEvent('mouseleave',function(e){if($defined(bbGlobal.leftMenuToolTip)){bbGlobal.leftMenuToolTip.addClass('hidden');bbGlobal.leftMenuToolTip.smartDispose(false);}});}}
function createOddsDetailToolTip(){if(!$defined(bbGlobal.oddsDetailToolTip)){bbGlobal.oddsDetailToolTip=new Element('span',{'class':'tooltipDiv hidden','id':'outcomeToolTip'});bbGlobal.oddsDetailToolTip.inject(document.body);}else{bbGlobal.oddsDetailToolTip.addClass("hidden");bbGlobal.oddsDetailToolTip.smartDispose(false);}}
function displayOddsDetailToolTip(htmlToolTip,linkId){if(!$defined(bbGlobal.oddsDetailToolTip)){bbGlobal.oddsDetailToolTip=new Element('span',{'class':'tooltipDiv hidden','id':'outcomeToolTip'});bbGlobal.oddsDetailToolTip.inject(document.body);}
var linkElement=document.getElementById(linkId);if(!$defined(linkElement)||linkElement==null)
return;var elemWidth=25;var elemLeft=linkElement.getLeft();var elemTop=linkElement.getTop();bbGlobal.oddsDetailToolTip.smartDispose(false);bbGlobal.oddsDetailToolTip.set('html',htmlToolTip);bbGlobal.oddsDetailToolTip.removeClass('hidden');bbGlobal.oddsDetailToolTip.setStyles({'top':elemTop+27,'left':elemLeft+elemWidth,'text-align':'center'});bbGlobal.oddsDetailToolTip.dropShadow();}
window.onbeforeunload=function(){}
function showLeftMenuToolTip(evId,betTypeId,elemLeft,elemWidth,elemTop){bbGlobal.shouldStillDisplayLeftMenuToolTip=true;elemId=evId;if(betTypeId!=-1)
elemId=evId+''+betTypeId;for(var i=0;i<bbGlobal.ajaxLeftMenuFlagOpened.length;i++){clearTimeout(bbGlobal.ajaxLeftMenuFlagOpened[i]);$('loadingLeftMenu').setStyles({'display':'none'});}
bbGlobal.ajaxLeftMenuFlagOpened=[];if(bbGlobal.matchMouseOver.get(elemId)==null||bbGlobal.matchMouseOver.get(elemId).eventInfo.indexOf('exists')>-1){bbGlobal.ajaxLeftMenuFlagOpened.push(setTimeout(function(){getMatchDetails(evId,betTypeId,elemLeft,elemWidth,elemTop)},bbGlobal.leftMenuTimeout));}
else
displayLeftMenuToolTip(elemId,elemLeft,elemWidth,elemTop);}
function displayLeftMenuToolTip(elemId,elemLeft,elemWidth,elemTop){if(bbGlobal.shouldStillDisplayLeftMenuToolTip){bbGlobal.leftMenuToolTip.smartDispose(false);bbGlobal.leftMenuToolTip.set('html',bbGlobal.matchMouseOver.get(elemId).eventInfo);if(bbGlobal.matchMouseOver.get(elemId).betTypes!=null){var span=new Element('span',{'class':'lineSpace'});span.set('html',bbGlobal.matchMouseOver.get(elemId).betTypes);span.inject(bbGlobal.leftMenuToolTip);span=null;}
if(bbGlobal.matchMouseOver.get(elemId).generalLinks!=null){var span=new Element('span',{'class':'lineSpace'});span.set('html',bbGlobal.matchMouseOver.get(elemId).generalLinks);span.inject(bbGlobal.leftMenuToolTip);span=null;}
bbGlobal.leftMenuToolTip.removeClass('hidden');bbGlobal.leftMenuToolTip.setStyles({'top':elemTop-1,'left':elemLeft+191});bbGlobal.leftMenuToolTip.dropShadow();}}
var mouseOverAjaxCaller=null;function getMatchDetails(evId,betTypeId,elemLeft,elemWidth,elemTop){elemWidth=191;$('loadingLeftMenu').setStyles({'display':'block','top':elemTop-1,'left':elemLeft+elemWidth});var elemId=evId;var evIdStr='evId='+evId;if(betTypeId!=-1){elemId=evId+''+betTypeId;evIdStr=evIdStr+'&betType='+betTypeId;}
if(!$defined(mouseOverAjaxCaller))
mouseOverAjaxCaller=new Request({'method':'get','async':true,'autoCancel':'true','url':'/leftMenuInfo?matchMouseOver=true&'+evIdStr,'onSuccess':function(req){bbGlobal.matchMouseOver.set(this.options.elemId,new EventInfo(req));displayLeftMenuToolTip(this.options.elemId,this.options.elemLeft,this.options.elemWidth,this.options.elemTop);},'onComplete':function(){$('loadingLeftMenu').setStyles({'display':'none'});}});mouseOverAjaxCaller.setOptions({'url':'/leftMenuInfo?matchMouseOver=true&'+evIdStr,'elemId':elemId,'elemWidth':elemWidth,'elemLeft':elemLeft,'elemTop':elemTop});mouseOverAjaxCaller.send();}
function createAllSlider()
{bbGlobal.bookieHeaderScrollBarSlider=createSlider('bookieHeaderScrollX');bbGlobal.exchangeHeaderScrollBarSlider=createSlider('exchangeHeaderScrollX');bbGlobal.optionHeaderScrollBarSlider=createSlider('optionHeaderScrollX');}
function createSlider(divName)
{el=$(divName);if(el!=null)
{child=el.getElement('.scrollHandleX');if(child!=null)
{el.removeChild(child);}
child=new Element('div',{'class':'scrollHandleX'});child.addEvents({'mousedown':function(e){this.addClass('scrollHandleX-Active').setStyle('opacity','0.85');}.bind(child),'mouseover':function(e){this.addClass('scrollHandleX-Active').setStyle('opacity','0.85');}.bind(child),'mouseleave':function(e){this.removeClass('scrollHandleX-Active').setStyle('opacity','1');}.bind(child)});child.inject(el);var oddsSlider=new Slider(el,child,{steps:rtfOddsDetail.constants.nrOfOddsColumns-rtfOddsDetail.constants.display,onChange:function(value){moveScrollSlider(value-rtfOddsDetail.constants.scrollBarCurrentIndex);}});el=null;return oddsSlider;}
return null;}
function popupslip(dealerId,width,height,bogId,isBack){var titleBogId=(''+bogId).replace(/-/,'m');windowname='a'+dealerId+titleBogId;screenwidth=screen.width;screenhight=screen.height;leftpos=(screenwidth-width)/2;toppos=(screenhight-height)/2;try{doit=window.open('/jsp/common/bslog.jsp?did='+dealerId+'&bogid='+bogId+'&isback='+isBack,windowname,'width='+width+',height='+height+',screenX='+leftpos+',screenY='+toppos+',top='+toppos+',left='+leftpos+',scrollbars=2,resizable=1,status=1,toolbar=0,menubar=1');}catch(e){alert("Error name: "+e.name+". \nError description: "+e.description+". \nError number: "+(e.number&0xffff)+". \nError message: "+e.message);}}
function loadFakeTopBanner(){if($defined($('topBanner'))&&$defined($('topBannerFake'))){$('topBanner').set('html',$('topBannerFake').get('html'));$('topBannerFake').dispose();}}
function loadFakeSponsorButtons(){if($defined($('leftMenuSponsorZone'))&&$defined($('leftMenuSponsorZoneFake'))){$('leftMenuSponsorZone').set('html',$('leftMenuSponsorZoneFake').get('html'));$('leftMenuSponsorZoneFake').dispose();$('leftMenuSponsorZone').removeClass('hidden');}}
function applyEventsForMatchPage(){if($defined($('content'))){$('content').getElements('img.expandable').each(function(item)
{item.addEvent('click',function(){if(this.get('src').indexOf("/gfx/image/more.gif")>-1){this.set('src',bbGlobal.gfxServer+'/gfx/image/hide.gif').set('title',bbGlobal.txtCollapse);this.getParent().getParent().getNext('tr').removeClass('hidden');}
else{this.set('src',bbGlobal.gfxServer+'/gfx/image/more.gif').set('title',bbGlobal.txtExpand);this.getParent().getParent().getNext('tr').addClass('hidden');}});});}
if(bbGlobal.mainTabs.currentItem!=0)
bbGlobal.mainTabs.activate(0);if($defined(bbGlobal.leftMenuContainer.currentLMI)){bbGlobal.leftMenuContainer.currentLMI.removeClass('currentLeftMenuItem');bbGlobal.leftMenuContainer.onClickHandler(bbGlobal.leftMenuContainer.allSportsElement,-10);}
bbGlobal.initialSelect=1;bbGlobal.leftMenuContainer.initialSelect(level1Sel,level2Sel,level3Sel,level4Sel);}
function applyEventsForInfoPages(){var divTogglers=$$('div.toggler');if(window.location.href.indexOf("infos/bbProducts")>-1)
return;if(divTogglers!=null&&divTogglers.length>0){myStretch=divTogglers;myStretcher=$$('div.accordion');var expandedElems=new Array();if(window.location.href.indexOf("infos/aboutOdds")>-1){for(var x=0;x<3;x++){expandedElems[x]=x;}}else if(window.location.href.indexOf("/promo-offers")>-1){}else{for(var x=0;x<divTogglers.length;x++){expandedElems[x]=x;}}
myAccordion=new MultipleOpenAccordion(myStretch,myStretcher,expandedElems,{opacity:false,alwaysHide:true});var expIndex=bbGlobal.promoofferIndexSet.get(bbGlobal.promooffer);if(expIndex!=null){myAccordion.display(expIndex);var scroll=new Fx.Scroll(window);var tagName='a'+bbGlobal.promooffer;scroll.toElement(tagName);}
var found=-1;$$('div.toggler a').each(function(link,i){if(window.location.hash.substring(1)==link.name)found=i;});if(found!=-1)
myAccordion.display(found);$$('div.infoText a').each(function(item,i){item.addEvent('click',function(e){var href=item.hash;var found=-1;$$('div.toggler a').each(function(link,i){if(href.substring(1)==link.name)found=i;});myAccordion.display(found);}.bind(item));});}}
function applyEventsForTournamentPage(){if(bbGlobal.tournamentNumber>0)
{$('content').getElements('span.moreBetTypesHandler').each(function(item){item.addEvent('click',function(e){var ev=new Event(e);ev.stopPropagation();var text=this.get('text');if(text.indexOf('+')>-1){text=text.replace('+','-');this.set('text',text).set('title',collapseText);var elId=this.get('name');$('content').getElementById(elId).removeClass('hidden');}
else{text=text.replace('-','+');this.set('text',text).set('title',expandText);var elId=this.get('name');$('content').getElementById(elId).addClass('hidden');}}.bind(item));});for(var i=0;i<bbGlobal.tournamentNumber;i++)
{var startT=new Date().getTime();if($defined($('tab-block'+i))){new SimpleTabs('tab-block'+i,{mouseOutClass:'tournament_menu_mouseout',mouseOnClass:'tournament_menuon',mootabsClass:'mootabs',defaultItem:bbGlobal.selectedTabIndex.get(i)});}}
if($defined($('content'))){$('content').getElements('img.expandable').each(function(item){item.addEvent('click',function(){var what=this.id.substring(this.id.indexOf("visitImg_")+9);if(this.get('src').indexOf("/gfx/image/more.gif")>-1){this.set('src',bbGlobal.gfxServer+'/gfx/image/hide.gif').set('title',bbGlobal.txtCollapse);this.getParent().getParent().getNext('tr[name='+what+']').removeClass('hidden');}
else{this.set('src',bbGlobal.gfxServer+'/gfx/image/more.gif').set('title',bbGlobal.txtExpand);this.getParent().getParent().getNext('tr[name='+what+']').addClass('hidden');}}.bind(item));});}
evTime=new Date().getTime();if(window.location.hash!=''){url2=window.location.hash.split('/');}
else{url2=window.location.href.split('/');}
if(bbGlobal.mainTabs.currentItem!=0)
bbGlobal.mainTabs.activate(0);if($defined(bbGlobal.leftMenuContainer.currentLMI)){bbGlobal.leftMenuContainer.currentLMI.removeClass('currentLeftMenuItem');bbGlobal.leftMenuContainer.onClickHandler(bbGlobal.leftMenuContainer.allSportsElement,-10);}
bbGlobal.initialSelect=1;bbGlobal.leftMenuContainer.initialSelect(level1Sel,level2Sel,level3Sel,level4Sel);}}
function applyEventsForOddsDetailPage(){if($defined(bbGlobal.leftMenuContainer.selectedItem)&&bbGlobal.leftMenuContainer.selectedItem.id==constants.eventId)
return;if(bbGlobal.mainTabs.currentItem!=0)
bbGlobal.mainTabs.activate(0);bbGlobal.initialSelect=1;if($defined(bbGlobal.leftMenuContainer.currentLMI)){bbGlobal.leftMenuContainer.currentLMI.removeClass('currentLeftMenuItem');bbGlobal.leftMenuContainer.onClickHandler(bbGlobal.leftMenuContainer.allSportsElement,-10);}
bbGlobal.leftMenuContainer.initialSelect(level1Sel,level2Sel,level3Sel,level4Sel);}
function applyEventsForSportPage(){if($defined($('detailedBets'))){$('content').getElements('img.expandable').each(function(item){item.addEvent('click',function(e){var id=this.id;if(id.indexOf('visitRegion_')>-1)
{var str=id.substring(12,id.length);if(this.get('src').indexOf('more')>-1){$('content').getElementById('region_'+str).removeClass('hidden');this.set('src',bbGlobal.gfxServer+'/gfx/image/hide.gif');this.set('title',bbGlobal.txtHideOdds);this.getParent().removeClass('unselectedBetType').addClass('selectedBetType');}
else if(this.get('src').indexOf('hide')>-1){$('content').getElementById('region_'+str).addClass('hidden');this.set('src',bbGlobal.gfxServer+'/gfx/image/more.gif');this.set('title',bbGlobal.txtShowOdds);this.getParent().removeClass('selectedBetType').addClass('unselectedBetType');}}
else if(id.indexOf('visitTournament_')>-1)
{var str=id.substring(16,id.length);if(this.get('src').indexOf('more')>-1)
{this.set('src',bbGlobal.gfxServer+'/gfx/image/hide.gif');this.set('title',bbGlobal.txtCollapse);$('content').getElementById(str).removeClass('hidden');}
else if(this.get('src').indexOf('hide')>-1)
{this.set('src',bbGlobal.gfxServer+'/gfx/image/more.gif');this.set('title',bbGlobal.txtExpand);$('content').getElementById(str).addClass('hidden');}}}.bind(item));});}
if($defined($('tableHorseRace'))){$('tableHorseRace').getElements('img.expandable').each(function(item){item.addEvent('click',function(){var what=this.id.substring(this.id.indexOf("visitImg_")+9);var p=this.getParent().getParent().getNext('tr[name='+what+']');if(!$defined(p))
p=this.getNext('p[name='+what+']');if(this.get('src').indexOf("/gfx/image/more.gif")>-1){this.set('src',bbGlobal.gfxServer+'/gfx/image/hide.gif');this.set('title',bbGlobal.txtCollapse);p.removeClass('hidden');}
else{this.set('src',bbGlobal.gfxServer+'/gfx/image/more.gif');this.set('title',bbGlobal.txtExpand);p.addClass('hidden');}
p=null;}.bind(item));});}
if(bbGlobal.mainTabs.currentItem!=0)
bbGlobal.mainTabs.activate(0);if($defined(bbGlobal.leftMenuContainer.currentLMI)){bbGlobal.leftMenuContainer.currentLMI.removeClass('currentLeftMenuItem');bbGlobal.leftMenuContainer.onClickHandler(bbGlobal.leftMenuContainer.allSportsElement,-10);}
bbGlobal.initialSelectedLevel=1;bbGlobal.initialSelect=1;bbGlobal.leftMenuContainer.initialSelect(level1Sel,null,null,null);}
function applyFilterEvents(){if($defined($('filter'))){$('filter').getElements('th.filterMenu').addEvents({'mouseover':function(el){if(bbGlobal.visibleFilterMenuTable!=null){bbGlobal.visibleFilterMenuTable.addClass('hidden');}
var tableSubMenu=$('table'+this.id);tableSubMenu.removeClass('hidden');bbGlobal.visibleFilterMenuTable=tableSubMenu;},'mouseleave':function(el){if(bbGlobal.visibleFilterMenuTable!=null){bbGlobal.visibleFilterMenuTable.addClass('hidden');}}});$('filter').getElements('ul.filterItem').addEvents({'mouseleave':function(el){if(bbGlobal.visibleFilterMenuTable!=null){bbGlobal.visibleFilterMenuTable.addClass('hidden');}}});}}
function setTextsForLeftMenuHandler(){if(window.location.pathname=='/'&&window.location.hash==''){$('collapseMe').set('title',bbGlobal.txtNOCollapse);}
else{$('collapseMe').set('title',bbGlobal.txtClickToCollapse);}}
function addEfectsForLeftMenuHandler(){var inaltimeaTDului=$('collapseContainer').getStyle('height').split('px')[0];$('collapseMe').setStyle('height',parseInt((inaltimeaTDului-10)/2+10)+'px');$('collapseMe').setStyle('padding',parseInt((inaltimeaTDului-10)/2)+'px 0 0 0');$('collapseMe').addEvent('click',function(){if(window.location.pathname=='/'&&window.location.hash=='')
return false;this.getParent().toggleClass('Active');$('menuBody').toggleClass('hidden');if(bbGlobal.menuFolded){if(bbGlobal.isOddsDetailPage)
{rtfOddsDetail.constants.display=rtfOddsDetail.constants.displayMin;}}
else{if(bbGlobal.isOddsDetailPage)
{rtfOddsDetail.constants.display=rtfOddsDetail.constants.displayMax;}}
var parent=$defined($('content'))?$('content'):$('infoPContent');if(!bbGlobal.menuFolded){if(bbGlobal.isBOV)
parent.setStyle('width','978px');else
parent.setStyle('width','988px');if(bbGlobal.isOddsDetailPage&&!bbGlobal.isBOV)
$('oddsDetailContainer').setStyle('width','858px');$('workArea').setStyle('left','15px');}else{if(bbGlobal.isBOV)
parent.setStyle('width','783px');else
parent.setStyle('width','793px');if(bbGlobal.isOddsDetailPage&&!bbGlobal.isBOV)
$('oddsDetailContainer').setStyle('width','663px');$('workArea').setStyle('left','210px');}
bbGlobal.menuFolded=!bbGlobal.menuFolded;parent=null;if(bbGlobal.isOddsDetailPage)
{resetNavContainerHeadAndData();createAllSlider();}
return false;});}
var moreNextMatchesChannel=null;function scroll(){if(!$defined($('nextTBL'))){return;}
if(nextMatchesGlobal.eventId==9999)
return;$("progressIndicator").style.display='block';$("navigationNext").style.display="none";if(!$defined(moreNextMatchesChannel))
moreNextMatchesChannel=new Request.HTML({'method':'get','async':true,'autoCancel':'true','evalScripts':true,'url':'/nextMatches.do?AJAX=true&evId='+nextMatchesGlobal.eventId,'onSuccess':function(responseTree,responseElements,responseHTML,responseJavaScript){$("progressIndicator").style.display='none';$("navigationNext").style.display="block";var tempBuffer=document.createDocumentFragment();for(var i=0;i<responseElements.length;i++){if(responseElements[i].tagName=='TR'){var node=responseElements[i];tempBuffer.appendChild(node);}}
node=null;responseElements=null;responseJavaScript=null;responseHTML=null;responseTree=null;$('nextTBL').getFirst().appendChild(tempBuffer);if($defined($('unVisAll'))){setVisibilityToAll($('unVisAll'),'vis');}
if($defined($('paramunVisAll'))){setVisibilityToAllParam($('paramunVisAll'),'vis');}
if(multiParam&&$defined($('paramvisAll'))){$('paramvisAll').setStyle('visibility','visible');}
if(multiBets&&$defined($('visAll'))){$('visAll').setStyle('visibility','visible');}
if(nextMatchesGlobal.eventId==9999)
$('navigationNext').style.display='none';},'timeout':1*60*1000});moreNextMatchesChannel.setOptions({'url':'/nextMatches.do?AJAX=true&evId='+nextMatchesGlobal.eventId});moreNextMatchesChannel.send();return false;}
function scrollNews(){var action=null;var param='';if(newsGlobal.page!=null&&newsGlobal.page=='oddsDetail')
action='/oddsDetailViewer.do';else if(newsGlobal.page!=null&&newsGlobal.page=='matchOverview'){action='/oddsOverview.do';param="ev="+newsGlobal.match;}else if(newsGlobal.page!=null&&newsGlobal.page=='partOverview'){action='/oddsOverview.do';param='pa='+newsGlobal.participant;}else if(newsGlobal.page!=null&&newsGlobal.page=='tourOverview'){action='/oddsOverview.do';param='tn='+newsGlobal.tourSet;}
if(!$defined($('newsTable'))||action==null){return;}
if(!newsGlobal.isLoading&&newsGlobal.showsHiddenRows&&this.getScrollHeight()-this.getScrollTop()-this.getHeight()<=$('footer').getHeight()+100){if(newsGlobal.lineId==9999||newsGlobal.lineId=='')
return;newsGlobal.isLoading=true;$("progressIndicator").style.display='block';channel=new Request.HTML({'method':'get','async':true,'autoCancel':'true','evalScripts':true,'url':action+'?isAjaxNews=true&newsId='+newsGlobal.lineId+'&'+param,'onSuccess':function(responseTree,responseElements,responseHTML,responseJavaScript){if(responseHTML!=null){var tempBuffer=document.createDocumentFragment();for(var i=0;i<responseElements.length;i++){if(responseElements[i].tagName=='TR'){var node=responseElements[i];tempBuffer.appendChild(node);}}
node=null;responseElements=null;responseHTML=null;responseTree=null;$('newsTable').getFirst().appendChild(tempBuffer);}
if(responseJavaScript!=null){newsGlobal.lineId=responseJavaScript.trim();}},'onComplete':function(){$("progressIndicator").style.display="none";newsGlobal.isLoading=false;},'timeout':1*60*1000});channel.send();}}
function domReady(){if(window.location.hash.length==0&&$defined($('workArea')))
$('workArea').setStyle('display','block');initHistory();var url=window.location.href;if(url.match(bbGlobal.infoPagePattern)!=null||url.indexOf('/bookieinfo')==0){loadAjaxEvents();}
else if(url.indexOf('/widgets')==0){loadAjaxEvents(p);}
loadFakeTopBanner();if($defined($('topBanner'))){bbGlobal.innerHtmlTopBanner=$('topBanner').innerHTML;}
setTimeout("effectsEnhancement()",500);}
function applyOddsFormatChange(){var url=window.location.pathname;if(window.location.hash!='')
url=window.location.hash.substring(1);if(url.indexOf('/match-odds')>-1||url.indexOf('/league-odds')>-1){reformatodds('',document.getElementById('oddsFormatType').options[document.getElementById('oddsFormatType').selectedIndex].value);}
else if($defined(window.surebetTableModel)){surebetReformatodds('',document.getElementById('oddsFormatType').options[document.getElementById('oddsFormatType').selectedIndex].value);}
else if(url.match(bbGlobal.matchPattern)!=null||url.match(bbGlobal.matchPatternOld)!=null||url.match(bbGlobal.tournamentPattern)!=null||url.match(bbGlobal.tournamentPatternOld)!=null||url.match(bbGlobal.infoPagePattern)!=null||url.match(bbGlobal.sportPattern)!=null||url.match(bbGlobal.sportPatternOld)!=null||url.match(bbGlobal.participantPattern)!=null||url.match(bbGlobal.participantPatternOld)!=null||url.match(bbGlobal.oddsDetailPattern)!=null||url.match(bbGlobal.oddsDetailPatternOld)!=null||url.match(bbGlobal.leagueOddsDetailPattern)!=null||url.match(bbGlobal.countryPattern)!=null||url.indexOf('/cupon')==0||url.indexOf('valuebets')>-1)
loadPage(cleanURL('oddsdisplay',url,true)+'oddsdisplay='+document.getElementById('oddsFormatType').options[document.getElementById('oddsFormatType').selectedIndex].value);else{window.location.href=cleanURL('oddsdisplay',url,true)+'oddsdisplay='+document.getElementById('oddsFormatType').options[document.getElementById('oddsFormatType').selectedIndex].value;}}
function applyShowExchange(){var url=window.location.pathname;if(window.location.hash!='')
url=window.location.hash.substring(1);document.showExchForm.showExchangeOdds.value=(document.showExchForm.showExchangeOdds.value==1?0:1);$('commissionFreeOddsSelector').setStyle('display',document.showExchForm.showExchangeOdds.value==1?'block':'none');if(url.match(bbGlobal.matchPattern)!=null||url.match(bbGlobal.matchPatternOld)!=null||url.match(bbGlobal.tournamentPattern)!=null||url.match(bbGlobal.tournamentPatternOld)!=null||url.match(bbGlobal.infoPagePattern)!=null||url.match(bbGlobal.sportPattern)!=null||url.match(bbGlobal.sportPatternOld)!=null||url.match(bbGlobal.participantPattern)!=null||url.match(bbGlobal.participantPatternOld)!=null||url.match(bbGlobal.oddsDetailPattern)!=null||url.match(bbGlobal.oddsDetailPatternOld)!=null||url.match(bbGlobal.leagueOddsDetailPattern)!=null||url.match(bbGlobal.countryPattern)!=null||url.indexOf('/cupon')==0||url.indexOf('surebets')>-1)
loadPage(cleanURL('showExchangeOdds',url,true)+'showExchangeOdds='+document.showExchForm.showExchangeOdds.value);else{if(url.indexOf('valuebets')==-1)
window.location.href=cleanURL('showExchangeOdds',url,true)+'showExchangeOdds='+document.showExchForm.showExchangeOdds.value;}}
function applyIncludeCommission(){var url=window.location.pathname;if(window.location.hash!='')
url=window.location.hash.substring(1);document.commissionFreeOddsSelector.withCommission.value=(document.commissionFreeOddsSelector.withCommission.value==1?0:1);if(url.indexOf('/match-odds')>-1||url.indexOf('/league-odds')>-1){changeCommission(document.commissionFreeOddsSelector.withCommission);}
else{if(url.match(bbGlobal.matchPattern)!=null||url.match(bbGlobal.matchPatternOld)!=null||url.match(bbGlobal.tournamentPattern)!=null||url.match(bbGlobal.tournamentPatternOld)!=null||url.match(bbGlobal.infoPagePattern)!=null||url.match(bbGlobal.sportPattern)!=null||url.match(bbGlobal.sportPatternOld)!=null||url.match(bbGlobal.participantPattern)!=null||url.match(bbGlobal.participantPatternOld)!=null||url.match(bbGlobal.oddsDetailPattern)!=null||url.match(bbGlobal.oddsDetailPatternOld)!=null||url.match(bbGlobal.leagueOddsDetailPattern)!=null||url.match(bbGlobal.countryPattern)!=null||url.indexOf('/cupon')==0||url.indexOf('surebets')>-1)
loadPage(cleanURL('withCommission',url,true)+'withCommission='+document.commissionFreeOddsSelector.withCommission.value);else{if(url.indexOf('valuebets')==-1)
window.location.href=cleanURL('withCommission',url,true)+'withCommission='+document.commissionFreeOddsSelector.withCommission.value;}}}
function cleanURL(requestParam,url,addParameters){var index=url.indexOf('?');if(index==-1){if(!addParameters)
return url;return url+"?";}
queryString=url.substring(index+1);url=url.substring(0,index);var cleanQueryString="";if(queryString!=null){qsParams=queryString.split("&");for(i=0;i<qsParams.length;i++){if(qsParams[i]!=""&&qsParams[i].indexOf(requestParam)==-1){cleanQueryString+=qsParams[i]+"&";}}}
if(!addParameters){if(cleanQueryString=="")
return url;return url+'?'+cleanQueryString.substring(0,cleanQueryString.length-1);}
return url+"?"+cleanQueryString;}
function changeClockSetting(param){var url=window.location.pathname;if(window.location.hash!='')
url=window.location.hash.substring(1);var cleanurl="/";if(url.indexOf("offset")>-1){urlparts=url.split("/");for(i=0;i<urlparts.length;i++){if(urlparts[i]!=""&&urlparts[i].indexOf("offset")==-1){cleanurl+=urlparts[i]+"/";}}}else{cleanurl=url;}
window.location.href=cleanurl+'offset'+param+'/';}
function submitSurebetForm(formId){submitForm(formId);}
function submitNewsForm(formId){submitForm(formId);}
function showSurebetMinOdds(val){if(val!=-9999)
$('surebetMinOdds').style.display='block';else
$('surebetMinOdds').style.display='none';if($defined(bbGlobal.scrolls)){if(!$defined(bbGlobal.scrolls.get('#surebetsFilter'))){bbGlobal.scrolls.set('#surebetsFilter',new MooScroll({selector:'#surebetsFilter'}));}
else
bbGlobal.scrolls.get('#surebetsFilter').refresh();}}
function setSoundAlertValue(checked){if(checked==true)
$('soundAlert').value='true';else
$('soundAlert').value='false';}
function translateHTMLSymbols(txt){if(txt.indexOf('&#37;')>-1)
txt=txt.replace('&#37;','%');if(txt.indexOf('&nbsp;')>-1)
txt=txt.replace('&nbsp;',' ');if(txt.indexOf('&euro;')>-1)
txt=txt.replace('&euro;','€');if(txt.indexOf('&pound;')>-1)
txt=txt.replace('&pound;','£');return txt;}
var soundPlayer=null;var DynaSound=new Class({initialize:function(url){this.flashWorking=false;this.mySwiff=new Swiff(url,{width:1,height:1,container:$('swfContainer'),swLiveConnect:true});},initSounds:function(){this.sound=this.mySwiff.toElement();if((!Browser.Engine.trident&&this.sound.data.indexOf('DynaSound.swf')!=-1)||(Browser.Engine.trident&&this.sound.innerHTML.indexOf('DynaSound.swf')!=-1))
this.flashWorking=true;Swiff.remote(this.sound,'loadSound','newSurebet',bbGlobal.jsServer+'/javascript/ding.mp3');Swiff.remote(this.sound,'loadSound','newGoal',bbGlobal.jsServer+'/javascript/goal.mp3');},playSound:function(soundName){if(this.flashWorking)
Swiff.remote(this.sound,'playSound',soundName);},setVolume:function(volume){if(volume<0||volume>100)
return;if(this.flashWorking){Swiff.remote(this.sound,'setVolume','newSurebet',volume/100);Swiff.remote(this.sound,'setVolume','newGoal',volume/100);}}});function flashLoadedHandler(){soundPlayer.setVolume(100);soundPlayer.initSounds();}
function initSound(){soundPlayer=new DynaSound('/DynaSound.swf');}
function setTime(){var time=new Date(new Date().getTime()-bbGlobal.offsetTime);if(!$defined(bbGlobal.userClock)||($defined(bbGlobal.userClock)&&Math.abs(time-bbGlobal.userClock)>900)){bbGlobal.userClock=time;var hours=time.getHours();hours=((hours<10)?"0":"")+hours;var minutes=time.getMinutes();minutes=((minutes<10)?"0":"")+minutes;var seconds=time.getSeconds();seconds=((seconds<10)?"0":"")+seconds;var clockV=hours+":"+minutes+":"+seconds;if($defined($('clock')))
$('clock').innerHTML=clockV;}}
function synchronizeClock(){var startT=new Date();new Request({'method':'GET','async':true,'autoCancel':true,'evalScripts':true,'url':'/clockSynchronize','onSuccess':function(req){var args=req.split("#");var now=new Date();var requestDurationTime=now.getTime()-startT.getTime();bbGlobal.offsetTime=now.getTime()-new Date(args[0],args[1],args[2],args[3],args[4],args[5],args[6]).getTime()-requestDurationTime;}}).send();}
var LiveBoxRefresher=null;function updateLiveNextMatchesBox(){var startT=new Date();new Request({'method':'GET','async':true,'autoCancel':true,'evalScripts':true,'url':'/updateLiveNextMatches.do?req=ajax','onSuccess':function(req){if($defined($('liveUpcommingBox'))){$('liveUpcommingBox').innerHTML=req;LiveBoxRefresher=setTimeout("updateLiveNextMatchesBox()",2*1000);}}}).send();}
function firstPagesBoxes(){for(var i=1;i<=bbGlobal.totalNbrOfPosition;i++){var totalWidth=0;if(!bbGlobal.isBOV)
totalWidth='663px';else
totalWidth='783px';var h1=0,h2=0,h3=0;var id1='1_'+i;var id2='2_'+i;var id3='3_'+i;if($defined($(id1))){h1=$(id1).offsetHeight;if(Browser.Engine.trident4){$(id1).setStyle('margin-right','0px');$(id1).setStyle('padding-right','10px');}
if(!$defined($(id3))&&!$defined($(id2))){$(id1).setStyle('width',totalWidth);}else if(!$defined($(id3))&&$defined($(id2))&&$(id2).hasClass('null')){$(id1).setStyle('width',totalWidth);}else if(!$defined($(id2))&&$defined($(id3))&&$(id3).hasClass('null')){$(id1).setStyle('width',totalWidth);}else if($defined($(id3))&&$defined($(id2))&&($(id2).hasClass('null')||$(id3).hasClass('null'))){$(id1).setStyle('width',totalWidth);}}
if($defined($(id2))){h2=$(id2).offsetHeight;if(Browser.Engine.trident4){$(id2).setStyle('margin-right','0px');$(id2).setStyle('padding-right','10px');}
if(!$defined($(id1))&&!$defined($(id3))){$(id2).setStyle('width',totalWidth);}else if(!$defined($(id1))&&$defined($(id3))&&$(id3).hasClass('null')){$(id2).setStyle('width',totalWidth);}else if(!$defined($(id3))&&$defined($(id1))&&$(id1).hasClass('null')){$(id2).setStyle('width',totalWidth);}else if($defined($(id1))&&$defined($(id3))&&($(id3).hasClass('null')||$(id1).hasClass('null'))){$(id2).setStyle('width',totalWidth);}}
if($defined($(id3))){h3=$(id3).offsetHeight;if(Browser.Engine.trident4){$(id3).setStyle('margin-right','0px');$(id3).setStyle('padding-right','10px');}
if(!$defined($(id1))&&!$defined($(id2))){$(id3).setStyle('width',totalWidth);}else if(!$defined($(id1))&&$defined($(id2))&&$(id2).hasClass('null')){$(id3).setStyle('width',totalWidth);}else if(!$defined($(id2))&&$defined($(id1))&&$(id1).hasClass('null')){$(id3).setStyle('width',totalWidth);}else if($defined($(id1))&&$defined($(id2))&&($(id2).hasClass('null')||$(id1).hasClass('null'))){$(id3).setStyle('width',totalWidth);}}
if(h1>=h2&&h1>=h3){if($defined($(id2))&&!$(id2).hasClass('null'))$(id2).setStyle('height',h1+'px');if($defined($(id3))&&!$(id3).hasClass('null'))$(id3).setStyle('height',h1+'px');if(h1>0&&h2>0&&h3>0){tableBorderTop=$(id3).getElements('table')[0].getStyle('border-top').split(' ');tableBorderBottom=$(id3).getElements('table')[0].getStyle('border-bottom').split(' ');tableHeight=h1-parseInt(tableBorderTop[0])-parseInt(tableBorderBottom[0]);$(id1).getElements('table')[0].setStyle('height',h1+'px');$(id2).getElements('table')[0].setStyle('height',h1+'px');$(id3).getElements('table')[0].setStyle('height',tableHeight+'px');paddingThTop=parseInt($(id3).getElements('table')[0].getElements('th')[0].getStyle('padding-top'));paddingThBottom=parseInt($(id3).getElements('table')[0].getElements('th')[0].getStyle('padding-bottom'));paddingTh=paddingThTop+paddingThBottom;paddingTdTop=parseInt($(id3).getElements('table')[0].getElements('td')[0].getStyle('padding-top'));paddingTdBottom=parseInt($(id3).getElements('table')[0].getElements('td')[0].getStyle('padding-bottom'));paddingTd=paddingTdTop+paddingTdBottom;if((BrowserDetect.browser=='Chrome')||(BrowserDetect.browser=='Explorer')||(BrowserDetect.browser=='Safari')){$(id3).getElements('table')[0].getElements('td')[0].setStyle('height',(tableHeight-25-paddingTh-paddingTd)+'px');}else{$(id3).getElements('table')[0].getElements('td')[0].setStyle('height',(tableHeight-25-paddingTd)+'px');}}}else if(h2>=h1&&h2>=h3){if($defined($(id1))&&!$(id1).hasClass('null'))$(id1).setStyle('height',h2+'px');if($defined($(id3))&&!$(id3).hasClass('null'))$(id3).setStyle('height',h2+'px');if(h1>0&&h2>0&&h3>0){tableBorderTop=$(id3).getElements('table')[0].getStyle('border-top').split(' ');tableBorderBottom=$(id3).getElements('table')[0].getStyle('border-bottom').split(' ');tableHeight=h2-parseInt(tableBorderTop[0])-parseInt(tableBorderBottom[0]);$(id1).getElements('table')[0].setStyle('height',h2+'px');$(id2).getElements('table')[0].setStyle('height',h2+'px');$(id3).getElements('table')[0].setStyle('height',tableHeight+'px');paddingThTop=parseInt($(id3).getElements('table')[0].getElements('th')[0].getStyle('padding-top'));paddingThBottom=parseInt($(id3).getElements('table')[0].getElements('th')[0].getStyle('padding-bottom'));paddingTh=paddingThTop+paddingThBottom;paddingTdTop=parseInt($(id3).getElements('table')[0].getElements('td')[0].getStyle('padding-top'));paddingTdBottom=parseInt($(id3).getElements('table')[0].getElements('td')[0].getStyle('padding-bottom'));paddingTd=paddingTdTop+paddingTdBottom;if((BrowserDetect.browser=='Chrome')||(BrowserDetect.browser=='Explorer')||(BrowserDetect.browser=='Safari')){$(id3).getElements('table')[0].getElements('td')[0].setStyle('height',(tableHeight-25-paddingTh-paddingTd)+'px');}else{$(id3).getElements('table')[0].getElements('td')[0].setStyle('height',(tableHeight-25-paddingTd)+'px');}}}else if(h3>=h2&&h3>=h1){if($defined($(id1))&&!$(id1).hasClass('null'))$(id1).setStyle('height',h3+'px');if($defined($(id2))&&!$(id2).hasClass('null'))$(id2).setStyle('height',h3+'px');if(h1>0&&h2>0&&h3>0){$(id1).getElements('table')[0].setStyle('height',h3+'px');$(id2).getElements('table')[0].setStyle('height',h3+'px');$(id3).getElements('table')[0].setStyle('height',h3+'px');}}}}
function effectsEnhancement(){if($defined($('closeGreeting'))&&$defined($('greeting'))){$('closeGreeting').addEvent('click',function(){$('greeting').setStyle('display','none');return false;});}
if($defined($('closeGreeting'))&&$defined($('greetingFP'))){$('closeGreeting').addEvent('click',function(){$('greetingFP').setStyle('display','none');return false;});}
if($defined($('newsAnchor'))){$('newsAnchor').addEvent('click',function(){if($defined($('newsTable'))){scrollTo($('newsTable').offsetLeft,$('newsTable').offsetTop);}
return false;});}}
var BetBrainUtil=new Class({initialize:function(){this.percentRex=/%/g;this.betweenParanthesesRex=/\(.+\)/;this.allTypesOfSpacesRex=/[ \t\n\r]+/;this.beginAndEndSpacesRex=/^\s+|\s+$/g;this.beginAndEndTabsRex=/^\t+|\t+$/g;this.firstMinus=/m/;},trimString:function(str){str=str.replace(this.beginAndEndSpacesRex,'');str=str.replace(this.beginAndEndTabsRex,'');return str;},sort:function(a,b){if(a==b)return 0;if(a<b)return-1;return 1;},sortByColumnIndex:function(a,b){return a.parentRow.columnIndex-b.parentRow.columnIndex;},sortDate:function(a,b){var dt1;var dt2;var yr;if(a.length==10){dt1=a.substr(6,4)+a.substr(3,2)+a.substr(0,2);}else{yr=a.substr(6,2);if(parseInt(yr)<50){yr='20'+yr;}else{yr='19'+yr;}
dt1=yr+a.substr(3,2)+a.substr(0,2);}
if(b.length==10){dt2=b.substr(6,4)+b.substr(3,2)+b.substr(0,2);}else{yr=b.substr(6,2);if(parseInt(yr)<50){yr='20'+yr;}else{yr='19'+yr;}
dt2=yr+b.substr(3,2)+b.substr(0,2);}
return sort(dt1,dt2);},sortNumeric:function(a,b){if(isNaN(a))
a=0;if(isNaN(b))
b=0;return a-b;},sortPercent:function(a,b){var val1=parseFloat(a.payoutValue);var val2=parseFloat(b.payoutValue);if(isNaN(val1))
val1=0;if(isNaN(val2))
val2=0;return val1-val2;},sortStringCaseinsensitive:function(a,b){var name1=a.providerName;var name2=b.providerName;name1=name1.toLowerCase();name2=name2.toLowerCase();if(name1==name2)return 0;if(name1<name2)return-1;return 1;},sortUKOdds:function(a,b){var odds1=0;var odds2=0;if(a!=""){var aa=a.split("/");odds1=aa[0]/aa[1];}else
odds1=0;if(b!=""){var bb=b.split("/");odds2=bb[0]/bb[1];}else
odds2=0;return sort(odds1,odds2);},sortOddsCells:function(c1,c2){return c1.oddsValue-c2.oddsValue;},computePayout:function(odds){var profit=0;for(var i=0;i<odds.length;i++){profit=profit+(1/odds[i]);}
var payout=Math.round(100*1/profit).toFixed(0);return payout;},getFormatedDate:function(millis){var changedDate=new Date();if(millis!=null){millis=parseFloat(millis)+(rtfOddsDetail.constants.serverOffset+changedDate.getTimezoneOffset()/60)*60*60*1000;;changedDate.setTime(millis);}
var day=changedDate.getDate();if(day<10)
day='0'+day;var month=changedDate.getMonth()+1;if(month<10)
month='0'+month;var hour=changedDate.getHours();if(hour<10)
hour='0'+hour;var minutes=changedDate.getMinutes();if(minutes<10)
minutes='0'+minutes;return day+'/'+month+' '+hour+':'+minutes;},getFormatedDateToolTip:function(millis){var now=new Date();now.setTime(now.getTime()-bbGlobal.offsetTime);var changedDate=new Date();if(millis!=null){millis=parseFloat(millis)+(rtfOddsDetail.constants.serverOffset+changedDate.getTimezoneOffset()/60)*60*60*1000;;changedDate.setTime(millis);}
var day=changedDate.getDate();var month=changedDate.getMonth()+1;var hour=changedDate.getHours();var minutes=changedDate.getMinutes();if(hour<10)
hour='0'+hour;if(minutes<10)
minutes='0'+minutes;var seconds=changedDate.getSeconds();if(seconds<10)
seconds='0'+seconds;if(day==now.getDate()&&month==now.getMonth()+1)
return hour+':'+minutes;if(day<10)
day='0'+day;if(month<10)
month='0'+month;return day+'/'+month+' '+hour+':'+minutes;},getFullFormatedDate:function(millis){var changedDate=new Date();if(millis!=null){millis=parseFloat(millis)+(rtfOddsDetail.constants.serverOffset+changedDate.getTimezoneOffset()/60)*60*60*1000;;changedDate.setTime(millis);}
var day=changedDate.getDate();if(day<10)
day='0'+day;var month=changedDate.getMonth()+1;if(month<10)
month='0'+month;var hour=changedDate.getHours();if(hour<10)
hour='0'+hour;var minutes=changedDate.getMinutes();if(minutes<10)
minutes='0'+minutes;var seconds=changedDate.getSeconds();if(seconds<10)
seconds='0'+seconds;return day+'/'+month+' '+hour+':'+minutes+':'+seconds;},getTextTimeDifference:function(millis){var now=new Date();now.setTime(now.getTime()-bbGlobal.offsetTime);var changedDate=new Date();if(millis!=null){millis=parseFloat(millis)+(rtfOddsDetail.constants.serverOffset+changedDate.getTimezoneOffset()/60)*60*60*1000;changedDate.setTime(millis);}
var difference=(now-changedDate)/1000;difference=parseInt(difference);var seconds=difference%60;var minutes=difference%3600;minutes=parseInt(minutes/60);var hours=parseInt(difference/3600);var text='';if(hours>0){return hours+':'+(minutes<10?'0'+minutes:minutes)+' hours';}
if(minutes>0)
return minutes+':'+(seconds<10?'0'+seconds:seconds)+' minutes';if(seconds>0)
return seconds+' seconds';return"less than 1 second";},getDifference:function(millis){if(millis==null)
return 0;var now=new Date();now.setTime(now.getTime()-bbGlobal.offsetTime);var changedDate=new Date();millis=parseFloat(millis)+(rtfOddsDetail.constants.serverOffset+changedDate.getTimezoneOffset()/60)*60*60*1000;changedDate.setTime(millis);var difference=0;if(bbGlobal.offsetTime!=null)
difference=parseInt((now-changedDate)/1000);return parseInt(difference);}});var bbUtil=new BetBrainUtil();var Constants=new Class({initialize:function(){this.BookmakerType=1;this.ExchangeType=2;this.OptionType=3;this.PoolType=4;this.even="EVEN";this.spanSortArrow=new Element('span',{'class':'sortarrow'});this.aInfo=document.createElement('a');this.aHide=document.createElement('a');this.aDollar=document.createElement('a');this.spacer=" ";this.imgSpacer=document.createElement('img');this.imgSpacer.className='spacer';this.imgSpacer.setAttribute('src',bbGlobal.gfxServer+'/gfx/icons/spc.gif');this.imgSpacer.setAttribute('width','13');this.imgSpacer.setAttribute('height','14');this.infoIcon=document.createElement('img');this.infoIcon.className='spacer';this.infoIcon.setAttribute('src',bbGlobal.gfxServer+'/gfx/icons/bookieinfo_icon.gif');this.infoIcon.setAttribute('width','13');this.infoIcon.setAttribute('height','16');this.infoDollarIcon=document.createElement('img');this.infoDollarIcon.className='spacer';this.infoDollarIcon.setAttribute('src',bbGlobal.gfxServer+'/gfx/icons/bookieinfo_icon_dollar.gif');this.infoDollarIcon.setAttribute('width','13');this.infoIcon.setAttribute('height','16');this.hideProvider=document.createElement('img');this.hideProvider.className='spacer';this.hideProvider.setAttribute('src',bbGlobal.gfxServer+'/gfx/icons/hidebookmaker.gif');this.hideProvider.setAttribute('width','13');this.hideProvider.setAttribute('height','16');this.htmlBR=document.createElement('br');this.nbspCell=new Element('td',{'class':'leftDashedBorder'});this.nbspCell.set('html','&nbsp;');this.downArrowImgSrc=bbGlobal.gfxServer+'/gfx/icons/down.gif';this.upArrowImgSrc=bbGlobal.gfxServer+'/gfx/icons/up.gif';this.spcArrowImgSrc=bbGlobal.gfxServer+'/gfx/icons/src.gif';this.downArrowImg=new Element('img',{'width':'10','src':bbGlobal.gfxServer+'/gfx/icons/down.gif','styles':{'margin-right':'2px'}});this.upArrowImg=new Element('img',{'width':'10','src':bbGlobal.gfxServer+'/gfx/icons/up.gif','styles':{'margin-right':'2px'}});this.spcArrowImg=new Element('img',{'width':'10','src':bbGlobal.gfxServer+'/gfx/icons/spc.gif','height':'10','styles':{'width':'10px','height':'10px'}});this.upSortArrowImg=new Asset.image(bbGlobal.gfxServer+'/gfx/icons/sort_icon_green_increase'+bbGlobal.imgSufix+'.gif',{'width':'8','height':'7','border':'0'});this.downSortArrowImg=new Asset.image(bbGlobal.gfxServer+'/gfx/icons/sort_icon_green_decrease'+bbGlobal.imgSufix+'.gif',{'width':'8','height':'7','border':'0'});this.oddsRow=new Element('tr');this.oddsCell=new Element('td');this.providerCell=new Element('td',{'class':'providerCell'});this.linkProviderHolder=new Element('a',{'target':'_blank'});this.showProviderLogo=false;this.iconLCT=new Element('img',{'class':'lastCTHeader','src':bbGlobal.gfxServer+'/gfx/image/clockLCT.png'});this.hideCell=new Element('img',{'class':'lastCTImg','src':bbGlobal.gfxServer+'/gfx/image/hide.png'});this.hideCellSrc=bbGlobal.gfxServer+'/gfx/image/hide.png';this.moreCell=new Element('img',{'class':'lastCTImg','src':bbGlobal.gfxServer+'/gfx/image/more.gif'});this.moreCellSrc=bbGlobal.gfxServer+'/gfx/image/more.gif';this.liveCoverageImg=new Element('img',{'src':bbGlobal.gfxServer+'/image/liveiri.gif','class':'liveCoverage'});this.greenIntervalLCTNonLive=2*60;this.redIntervalLCTNonLive=10*60;this.greenIntervalLCTLive=20;this.redIntervalLCTLive=2*60;this.greenBgColourLCT="greenlastCollectedTime";this.yellowBgColourLCT="yellowlastCollectedTime";this.redBgColourLCT="redlastCollectedTime";}});var globalBetbrain={currentHoverElem:null,currentHoverTAB:null,bigMaximized:false,okToHideToolTip:false,rtfEnabled:true,arrowCounter:1,optionsDiv:null,sorterDiv:null,interval:600000,checkSum:0,currentHoveredExchangeRow:null,lastCTCounter:0};var OddsTableModel=new Class({initialize:function(id){this.categories=[];this.nrOfValidCategories=0;this.topElement=$(id);if(this.topElement==null)
return;this.topElement.addEvent('mouseover',function(e){var ev=new Event(e);ev.stopPropagation();var element=ev.target;var tagName=element.tagName.toLowerCase();if(tagName=='div'&&element.hasClass('oddsHeadDiv')){if($defined(globalBetbrain.sorterDiv)){globalBetbrain.sorterDiv.smartDispose(true);globalBetbrain.sorterDiv.destroy();globalBetbrain.sorterDiv=null;}
var obj=element.retrieve('firstChild');if(!$defined(obj))
return;globalBetbrain.sorterDiv=new Element('span',{'id':'tooltipspan','class':'priceTooltip'});globalBetbrain.sorterDiv.addEvent('mouseleave',function(){if($defined(this)&&$defined(this.parentNode)){this.smartDispose(true);this.destroy();globalBetbrain.sorterDiv=null;}});globalBetbrain.sorterDiv.inject(document.body);var position=getAbsolutePosition(element);obj.tooltipspan=globalBetbrain.sorterDiv;if(obj.fillAndShowToolTip()){globalBetbrain.sorterDiv.setStyles({'top':position[0]+element.getSize().y-1,'left':position[1]-1,'z-index':11,'display':'block'});}
globalBetbrain.sorterDiv.dropShadow();}
if(tagName=='a'){if(element.getProperty('href').indexOf('tracking')!=-1){var bookieImage=element.getFirst('img');if($defined(bookieImage))
window.status=element.getFirst('img').get('title');else
window.status=element.get('text');}}
if(tagName=='td'||tagName=='th'){if($defined(globalBetbrain.optionsDiv)){globalBetbrain.optionsDiv.smartDispose(true);globalBetbrain.optionsDiv.destroy();globalBetbrain.optionsDiv=null;}}
if(tagName=='th'&&element.hasClass('lastCollectedTime')){globalBetbrain.optionsDiv=new Element('span',{'id':'tooltipspan','class':'priceTooltip'});globalBetbrain.optionsDiv.addEvent('mouseleave',function(){if($defined(this)&&$defined(this.parentNode)){this.smartDispose(true);this.destroy();globalBetbrain.optionsDiv=null;}});globalBetbrain.optionsDiv.inject(document.body);var position=getAbsolutePosition(element);var topLineSpan=new Element('span',{'styles':{'margin-bottom':'3px','display':'block'}});var html=$('colourExpl').get('html');topLineSpan.set('html',html);topLineSpan.injectInside(globalBetbrain.optionsDiv);globalBetbrain.optionsDiv.setStyles({'display':'block'});globalBetbrain.optionsDiv.setStyles({'top':position[0]+element.getSize().y-1,'left':position[1]-1-topLineSpan.getWidth(),'z-index':11,'display':'block'});globalBetbrain.optionsDiv.dropShadow();}
if(tagName=='td'){if(element.hasClass('odds')){var obj=element.retrieve('obj');if(!$defined(obj))
return;globalBetbrain.optionsDiv=new Element('span',{'id':'tooltipspan','class':'priceTooltip'});globalBetbrain.optionsDiv.addEvent('mouseleave',function(){if($defined(this)&&$defined(this.parentNode)){this.smartDispose(true);this.destroy();globalBetbrain.optionsDiv=null;}});globalBetbrain.optionsDiv.inject(document.body);var position=getAbsolutePosition(element);obj.tooltipspan=globalBetbrain.optionsDiv;if(obj.fillAndShowToolTip()){globalBetbrain.optionsDiv.setStyles({'top':position[0]+element.getSize().y-1,'left':position[1]-1,'z-index':11,'display':'block'});}
globalBetbrain.optionsDiv.dropShadow();}
if(element.hasClass('lastCollectedTime')){if(!rtfOddsDetail.constants.collapsedLCT)
return;var obj=element.retrieve('cellLCT');if(!$defined(obj))
return;globalBetbrain.optionsDiv=new Element('span',{'id':'tooltipspan','class':'priceTooltip'});globalBetbrain.optionsDiv.addEvent('mouseleave',function(){if($defined(this)&&$defined(this.parentNode)){this.smartDispose(true);this.destroy();globalBetbrain.optionsDiv=null;}});globalBetbrain.optionsDiv.inject(document.body);var position=getAbsolutePosition(element);obj.tooltipspan=globalBetbrain.optionsDiv;if(obj.fillAndShowToolTip()){globalBetbrain.optionsDiv.setStyles({'top':position[0]+element.getSize().y-1,'left':position[1]-1,'z-index':11,'display':'block'});}
globalBetbrain.optionsDiv.dropShadow();}
var parentRow=element.getParent('tr');if($defined(parentRow)){var obj=parentRow.retrieve('obj');if($defined(obj)){if(!element.hasClass('odds')&&!element.hasClass('lastCollectedTime')){if($defined(globalBetbrain.optionsDiv)){globalBetbrain.optionsDiv.smartDispose(true);globalBetbrain.optionsDiv.destroy();globalBetbrain.optionsDiv=null;}}
if(obj.id.indexOf('rtf_1_')!=-1)
parentRow.addClass('hover');if(obj.id.indexOf('rtf_2_')!=-1){if($defined(globalBetbrain.currentHoveredExchangeRow)&&globalBetbrain.currentHoveredExchangeRow!=obj){if($defined(globalBetbrain.currentHoveredExchangeRow.topElementBack)){globalBetbrain.currentHoveredExchangeRow.topElementBack.removeClass('hover');}
if($defined(globalBetbrain.currentHoveredExchangeRow.topElementLay)){globalBetbrain.currentHoveredExchangeRow.topElementLay.removeClass('hover');}}
globalBetbrain.currentHoveredExchangeRow=obj;if($defined(obj.topElementBack)){obj.topElementBack.addClass('hover');}
if($defined(obj.topElementLay)){obj.topElementLay.addClass('hover');}}}}}});this.topElement.addEvent('mouseout',function(e){var ev=new Event(e);ev.stopPropagation();var element=ev.target;var tagName=element.tagName.toLowerCase();if(tagName=='a'){if(element.getProperty('href').indexOf('tracking')!=-1)
window.status='';}
if(tagName=='td'){var parentRow=element.getParent('tr');if($defined(parentRow)){var obj=parentRow.retrieve('obj');if($defined(obj)){if(obj.id.indexOf('rtf_1_')!=-1)
parentRow.removeClass('hover')
if(obj.id.indexOf('rtf_2_')!=-1){if($defined(obj.topElementBack)){obj.topElementBack.removeClass('hover');}
if($defined(obj.topElementLay)){obj.topElementLay.removeClass('hover');}}}}}});this.topElement.addEvent('mouseleave',function(e){if($defined(globalBetbrain.sorterDiv)){globalBetbrain.sorterDiv.smartDispose(true);globalBetbrain.sorterDiv.destroy();globalBetbrain.sorterDiv=null;}});},setCategories:function(categories){this.categories=categories;},addCategory:function(category){this.nrOfValidCategories++;this.categories.push(category);if(category.type==rtfOddsDetail.constants.BookmakerType){this.bookieCateg=category;}else{if(category.type==rtfOddsDetail.constants.ExchangeType){this.exCateg=category;}else{this.optionCateg=category;}}},dumpToHTML:function(){for(var i=0;i<this.categories.length;i++){var tbodyCateg=new Element('tbody');tbodyCateg.setProperty('id','categ_'+this.categories[i].id);tbodyCateg.appendChild(this.categories[i].topElement);this.topElement.appendChild(tbodyCateg);this.categories[i].topElement=tbodyCateg;if(rtfOddsDetail.constants.hasPayout)
this.categories[i].computePayout();}
var couponDropDown=false;var categ=null;if($defined(this.bookieCateg)&&this.bookieCateg.sortedGroups.length>0)
{categ=this.bookieCateg;}
else if($defined(this.exCateg)&&this.exCateg.sortedGroups.length>0)
{categ=this.exCateg;}
if(rtfOddsDetail.constants.hasGroup&&(rtfOddsDetail.constants.hasCuponFirstDropDown||rtfOddsDetail.constants.hasCuponSecondDropDown)){if(categ!=null)
{var selectEl=new Element('select',{'name':'cuponFirstKey'});var formCoupon=document.forms['couponFormDetail'];selectEl.inject($(formCoupon),'top');couponDropDown=true;for(var i=0;i<categ.sortedGroups.length;i++){appendValueToCoupon(categ.sortedGroups[i].groupValue,false);}}}
if(categ!=null&&(rtfOddsDetail.constants.hasCuponFirstDropDown||rtfOddsDetail.constants.hasCuponSecondDropDown)){if(!couponDropDown){var selectEl=new Element('select',{'name':'cuponFirstKey'});var formCoupon=document.forms['couponFormDetail'];selectEl.inject($(formCoupon),'top');appendValueToCoupon('All',false);for(var i=0;i<categ.sortedColumns.length;i++){appendValueToCoupon(categ.sortedColumns[i].outcomeName,(rtfOddsDetail.constants.hasCuponFirstDropDown&&rtfOddsDetail.constants.hasCuponSecondDropDown)?true:false);}}else{if(rtfOddsDetail.constants.hasCuponFirstDropDown&&rtfOddsDetail.constants.hasCuponSecondDropDown){var selectEl=new Element('select',{'name':'cuponSecondKey'});var formCoupon=document.forms['couponFormDetail'];selectEl.inject($(formCoupon.elements['cuponFirstKey']),'after');appendValueToCoupon('All',true);for(var i=0;i<categ.sortedColumns.length;i++){appendValueToCoupon(categ.sortedColumns[i].outcomeName,(rtfOddsDetail.constants.hasCuponFirstDropDown&&rtfOddsDetail.constants.hasCuponSecondDropDown)?true:false);}}}}},reIndex:function(){for(var i=0;i<this.categories.length;i++){if($defined(this.categories[i]))
this.categories[i].reIndex();}},createCateg:function(tipCateg){for(var i=0;i<this.categories.length;i++){if(this.categories[i].type==tipCateg){this.categories[i].deleted=false;this.nrOfValidCategories++;return;}}
this.nrOfValidCategories++;var newCateg=new Category(tipCateg);var visibleCateg=this.categories[0];newCateg.setHasPayout(visibleCateg.hasPayout);newCateg.setHasGroup(visibleCateg.hasGroup);newCateg.setCategoryHeader(visibleCateg.categoryHeader.clone(tipCateg,newCateg));this.addCategory(newCateg);var tbodyCateg=new Element('tbody');tbodyCateg.setProperty('id','categ_'+newCateg.id);tbodyCateg.appendChild(newCateg.topElement);if(tipCateg==rtfOddsDetail.constants.ExchangeType)
this.topElement.appendChild(tbodyCateg);if(tipCateg==rtfOddsDetail.constants.BookmakerType)
tbodyCateg.inject(this.topElement,'top');if(tipCateg==rtfOddsDetail.constants.OptionType){if(this.categories[0].type==rtfOddsDetail.constants.BookmakerType)
tbodyCateg.inject(this.categories[0].topElement,'after');else
tbodyCateg.inject(this.categories[0].topElement,'before');}
newCateg.topElement=tbodyCateg;newCateg.moveFirst();newCateg.moveForward(visibleCateg.firstVisiblecolumnIndex);},removeCateg:function(tipCateg){this.nrOfValidCategories--;var idx=-1;for(var i=0;i<this.categories.length;i++){if(this.categories[i].type==tipCateg){idx=i;break;}}
if(idx!=-1)
this.categories.splice(idx,1);if(tipCateg==rtfOddsDetail.constants.BookmakerType){if($defined(this.bookieCateg))
this.bookieCateg.destroy();this.bookieCateg=null;}
if(tipCateg==rtfOddsDetail.constants.ExchangeType){if($defined(this.exCateg))
this.exCateg.destroy();this.exCateg=null;}
if(tipCateg==rtfOddsDetail.constants.OptionType){if($defined(this.optionCateg))
this.optionCateg.destroy();this.optionCateg=null;}},markDeletedCategory:function(tipCateg){this.nrOfValidCategories--;if(tipCateg==rtfOddsDetail.constants.BookmakerType){if($defined(this.bookieCateg))
this.bookieCateg.markDeleteCategory();this.bookieCateg.deleted=true;}
if(tipCateg==rtfOddsDetail.constants.ExchangeType){if($defined(this.exCateg))
this.exCateg.markDeleteCategory();this.exCateg.deleted=true;}
if(tipCateg==rtfOddsDetail.constants.OptionType){if($defined(this.optionCateg))
this.optionCateg.markDeleteCategory();this.optionCateg.deleted=true;}},deleteColumn:function(colId){for(var i=0;i<this.categories.length;i++){this.categories[i].deleteColumn(colId);}},createColumn:function(wholeLine){for(var i=0;i<this.categories.length;i++){this.categories[i].createColumn(wholeLine);}}});var BetbrainNode=new Class({initialize:function(id){this.id=id;},setTopElement:function(el){this.topElement=el;}});var Category=new Class({Extends:BetbrainNode,initialize:function(id){this.parent(id);this.type=id;var node=document.createDocumentFragment();node.id='categ_'+id;this.setTopElement(node);this.groups=new Hash();this.sortedGroups=[];this.columns=new Hash();this.sortedColumns=[];this.dirtyColumns=new Hash();this.dirtyGroups=new Hash();this.dirtyRows=new Hash();this.numberOfColumns=0;this.hasPayout=false;this.hasGroup=false;this.providerColumn=new Column(true,'provider');this.providerColumn.setCategory(this);if(rtfOddsDetail.constants.hasPayout){this.payoutColumn=new Column(true,'payout');this.payoutColumn.setCategory(this);}
this.sortedColumn=this.providerColumn;this.currentheaderSortArrowSpan=null;this.firstVisiblecolumnIndex=0;this.rowCreated=false;this.rowDeleted=false;this.validGroups=0;},getColumnPosition:function(colId){var colIdx=0;for(var i=0;i<this.sortedColumns.length;i++){if(this.sortedColumns[i].name==colId){colIdx=i;break;}}
return colIdx;},destroy:function(){var grVs=this.groups.getValues();for(var i=0;i<grVs.length;i++){grVs[i].destroy();this.validGroups--;grVs[i]=null;}
this.groups.empty();this.sortedGroups=null;this.providerColumn.destroy();if($defined(this.payoutColumn))
this.payoutColumn.destroy();this.sortedColumns=null;this.columns.empty();this.categoryHeader.destroy();this.categoryHeader=null;this.topElement.destroy();if(rtfOddsDetail.constants.hasGroup&&this.type==rtfOddsDetail.constants.BookmakerType){var couponForm=document.forms['couponFormDetail'];if($defined(couponForm)){couponForm.elements['cuponFirstKey'].options.length=0;if(rtfOddsDetail.constants.hasCuponFirstDropDown&&rtfOddsDetail.constants.hasCuponSecondDropDown)
couponForm.elements['cuponSecondKey'].options.length=0;}}},clearOddsGroups:function(){var grVs=this.groups.getValues();for(var i=0;i<grVs.length;i++){grVs[i].destroy();grVs[i]=null;}
this.groups.empty();this.columns.empty();},deleteColumn:function(colId){if(this.sortedColumn.name==colId)
this.sortedColumn=this.providerColumn;var column=this.columns.get(colId);if(this.type==rtfOddsDetail.constants.BookmakerType)
removeGroupFromGroupDropDown(column.outcomeName,(rtfOddsDetail.constants.hasCuponFirstDropDown&&rtfOddsDetail.constants.hasCuponSecondDropDown)?true:false);var wasVisible=column.visible;if(!Browser.Engine.name=='trident')
this.categoryHeader.hack();column.removeFromTable();this.columns.erase(colId);var colIdx=0;for(var i=0;i<this.sortedColumns.length;i++){if(this.sortedColumns[i].name==colId){colIdx=i;break;}}
this.sortedColumns.splice(colIdx,1);this.categoryHeader.reAdjust();for(var i=0;i<this.sortedGroups.length;i++){this.sortedGroups[i].decreaseColSpan();}
if(wasVisible){this.moveLast();this.moveFirst();}
if(!Browser.Engine.name=='trident')
this.categoryHeader.returnFromHack();this.numberOfColumns--;},createColumn:function(wholeLine){var parts=wholeLine.split('`');var colName='col_'+parts[1];var column=this.categoryHeader.addOutcomeHeaderCell(this,'centerAligned '+rtfOddsDetail.constants.oddsColumnCssClass,colName,parts[parts.length-1],($defined(this.categoryHeader.topElement2))?2:1);this.categoryHeader.reAdjust();if(this.type==rtfOddsDetail.constants.BookmakerType)
appendValueToCoupon(column.outcomeName,(rtfOddsDetail.constants.hasCuponFirstDropDown&&rtfOddsDetail.constants.hasCuponSecondDropDown)?true:false);var grVs=this.groups.getValues();for(var grpIdx=0;grpIdx<grVs.length;grpIdx++){var group=grVs[grpIdx];var rows=group.oddsRows.getValues();for(var i=0;i<rows.length;i++){var ids=rows[i].id.split('_');colName2=colName.split('_')[1];var rowId=rows[i].id;var shouldHaveSummary=false;if(i==0&&$defined(rows[i].oddsCells))
shouldHaveSummary=true;if($defined(rows[i].oddsCells)||$defined(rows[i].backOddsCells)){var isBack=true;var newOddsCell=new OddsCell(rowId+'_'+colName2+'_'+isBack,false,isBack,ids[1],false,false,colName,0,'odds');newOddsCell.init();group.insertLastOddsCellIntoRow(rowId,newOddsCell,column,shouldHaveSummary);this.addCellToColumn(newOddsCell,colName,group);}
var isBack=false;if($defined(rows[i].layOddsCells)){var newOddsCell=new OddsCell(rowId+'_'+colName2+'_'+isBack,false,isBack,ids[1],false,false,colName,0,'odds');newOddsCell.init();group.insertLastOddsCellIntoRow(rowId,newOddsCell,column,shouldHaveSummary);this.addCellToColumn(newOddsCell,colName,group);}}}},updateCell:function(idx,newOddsValue,newOddsDate,newStatusId,oldOddsValue,oldOddsDate,oldOddsStatusId,direction,boId,outSeId,wholeLine){var ids=idx.split('_');var groupId=ids[0]+'_'+ids[1]+'_'+ids[2];var rowId=groupId+'_'+ids[3];var group=this.groups.get(groupId);var row=group.oddsRows.get(rowId);var cell=null;if($defined(row.oddsCells))
cell=row.oddsCells.get(idx);else{if(ids[ids.length-1]=='true')
cell=row.backOddsCells.get(idx);else
cell=row.layOddsCells.get(idx);}
cell.updateCell(newOddsValue,newOddsDate,newStatusId,oldOddsValue,oldOddsDate,oldOddsStatusId,direction,boId,outSeId,wholeLine);if(!cell.isBack||this.type!=rtfOddsDetail.constants.BookmakerType)
return;if(!this.dirtyColumns.has(cell.colName)){this.dirtyColumns.set(cell.colName,this.columns.get(cell.colName));}
if(!this.dirtyGroups.has(groupId)){this.dirtyGroups.set(groupId,group);}
if(!this.dirtyRows.has(rowId)){this.dirtyRows.set(rowId,row);}},updateLastCollectedTimeCell:function(idx,dateTime){var ids=idx.split('_');var groupId=ids[0]+'_'+ids[1]+'_'+ids[2];var rowId=groupId+'_'+ids[3];var group=this.groups.get(groupId);if(group==null)
return;var row=group.oddsRows.get(rowId);if(row==null)
return;row.updateLastCollectedTimeCell(dateTime);},emptyCell:function(idx){var ids=idx.split('_');var groupId=ids[0]+'_'+ids[1]+'_'+ids[2];var rowId=groupId+'_'+ids[3];var group=this.groups.get(groupId);var row=group.oddsRows.get(rowId);var cell=null;if($defined(row.oddsCells))
cell=row.oddsCells.get(idx);else{if(ids[ids.length-1]=='true')
cell=row.backOddsCells.get(idx);else
cell=row.layOddsCells.get(idx);}
cell.empty(0);if(!cell.isBack)
return;if(!this.dirtyColumns.has(cell.colName)){this.dirtyColumns.set(cell.colName,this.columns.get(cell.colName));}
if(this.type!=1)
return;if(!this.dirtyGroups.has(groupId)){this.dirtyGroups.set(groupId,group);}
if(!this.dirtyRows.has(rowId)){this.dirtyRows.set(rowId,row);}},markDeleteCategory:function(){var grVs=this.groups.getValues();for(var j=0;j<grVs.length;j++){this.markDeletedGroup(grVs[j].id);if(grVs[j].validOddsRows!=0)
alert("nu e bine!!!");}
if(this.validGroups!=0)
alert("nici Acu");},markDeletedGroup:function(grpId){var group=this.groups.get(grpId);if(!$defined(group)||group.deleted)
return;group.deleted=true;this.validGroups--;var oddsRows=group.oddsRows.getValues();for(var i=0;i<oddsRows.length;i++){var row=oddsRows[i];this.markDeleteRow(row,group);}
var groupValue=group.groupValue;removeGroupFromGroupDropDown(groupValue,(rtfOddsDetail.constants.hasCuponFirstDropDown&&rtfOddsDetail.constants.hasCuponSecondDropDown)?true:false);},markDeleteLine:function(idx){var ids=idx.split('_');var groupId=ids[0]+'_'+ids[1]+'_'+ids[2];var rowId=groupId+'_'+ids[3];var exchangeType=-1;if(ids[4]=='true')
exchangeType=0;if(ids[4]=='false')
exchangeType=1;var group=this.groups.get(groupId);var row=group.oddsRows.get(rowId);this.markDeleteRow(row,group);},markDeleteRow:function(row,group){if(row.rowDeleted)
return;row.rowDeleted=true;this.rowDeleted=true;var backOddsCells=null;var layOddsCells=null;if($defined(row.oddsCells))
backOddsCells=row.oddsCells.getValues();else{backOddsCells=row.backOddsCells.getValues();layOddsCells=row.layOddsCells.getValues();}
if(backOddsCells!=null){for(var i=0;i<backOddsCells.length;i++){var column=this.columns.get(backOddsCells[i].colName);backOddsCells[i].empty(4);if(!this.dirtyColumns.has(backOddsCells[i].colName)){this.dirtyColumns.set(backOddsCells[i].colName,column);}}}
if(layOddsCells!=null){for(var i=0;i<layOddsCells.length;i++){var column=this.columns.get(layOddsCells[i].colName);layOddsCells[i].empty(4);}}
group.validOddsRows--;if(this.type!=1)
return;if(!this.dirtyGroups.has(group.id)){this.dirtyGroups.set(group.id,group);}
if(!this.dirtyRows.has(row.id)){this.dirtyRows.set(row.id,row);}},deleteRow:function(idx){var ids=idx.split('_');var groupId=ids[0]+'_'+ids[1]+'_'+ids[2];var rowId=groupId+'_'+ids[3];var exchangeType=-1;if(ids[4]=='true')
exchangeType=0;if(ids[4]=='false')
exchangeType=1;var group=this.groups.get(groupId);var row=group.oddsRows.get(rowId);if($defined(row.lastCollectedTimeCell.x))
clearTimeout(row.lastCollectedTimeCell.x);group.removeRow(row,exchangeType);var backOddsCells=null;var layOddsCells=null;if($defined(row.oddsCells)&&exchangeType!=1)
backOddsCells=row.oddsCells.getValues();else{backOddsCells=row.backOddsCells.getValues();layOddsCells=row.layOddsCells.getValues();}
if(backOddsCells!=null){for(var i=0;i<backOddsCells.length;i++){var column=this.columns.get(backOddsCells[i].colName);column.removeCell(backOddsCells[i],group);if(!this.dirtyColumns.has(backOddsCells[i].colName)){this.dirtyColumns.set(backOddsCells[i].colName,column);}}}
if(layOddsCells!=null){for(var i=0;i<layOddsCells.length;i++){var column=this.columns.get(layOddsCells[i].colName);column.removeCell(layOddsCells[i],group);}}
this.providerColumn.removeCell(row.providerCell,group);if($defined(this.payoutColumn))
this.payoutColumn.removeCell(row.payoutCell,group);row.empty(exchangeType);row.remove(exchangeType);this.rowDeleted=true;if(exchangeType==-1)
row=null;if(this.type!=1)
return;if(!this.dirtyGroups.has(groupId)){this.dirtyGroups.set(groupId,group);}},deleteGroup:function(idx){var group=this.groups.get(idx);group.deleted=true;var groupValue=group.groupValue;group.destroy();var groupIdx=0;for(var i=0;i<this.sortedGroups.length;i++){if(this.sortedGroups[i]==group){groupIdx=i;break;}}
this.sortedGroups.splice(groupIdx,1);this.groups.erase(idx);group=null;removeGroupFromGroupDropDown(groupValue,(rtfOddsDetail.constants.hasCuponFirstDropDown&&rtfOddsDetail.constants.hasCuponSecondDropDown)?true:false);this.settle();if(this.dirtyGroups.has(idx))
this.dirtyGroups.erase(idx);},createRow:function(idRow,rowLine){var ids=idRow.split('_');var groupId=ids[0]+'_'+ids[1]+'_'+ids[2];var rowId=groupId+'_'+ids[3];var group=this.groups.get(groupId);var row=group.createRow(idRow,rowLine);var colKeys=this.columns.getKeys();for(var i=0;i<colKeys.length;i++){this.dirtyColumns.set(colKeys[i],this.columns.get(colKeys[i]));}
this.rowCreated=true;if(!this.dirtyGroups.has(groupId)){this.dirtyGroups.set(groupId,group);}
if(this.type!=1)
return;if(!this.dirtyRows.has(rowId)){this.dirtyRows.set(rowId,row);}},createGroup:function(idGroup){this.validGroups++;if(this.groups.has(idGroup)){this.groups.get(idGroup).deleted=false;var group=this.groups.get(idGroup);if(this.type=='1')
addGroupToGroupDropDown(group.groupValue,group);return;}
var group=new Group(idGroup,this);var parts=idGroup.split('_');var groupValue=parts[2].replace(/p/g,'+');groupValue=groupValue.replace(/m/g,'-');groupValue=groupValue.replace(/d/,'.');groupValue=groupValue.replace(/c/,',');group.setGroupValue(groupValue);if(this.type=='1')
addGroupToGroupDropDown(group.groupValue,group);this.insertGroup(group);},makeRowsSortable:function(){},computePayout:function(){if(this.type=='1'){var grVs=this.groups.getValues();for(var i=0;i<grVs.length;i++){grVs[i].computePayout();}}},addGroup:function(group){this.validGroups++;this.groups.set(group.id,group);this.sortedGroups.push(group);group.setSepRow();this.settle();},insertGroup:function(group){this.groups.set(group.id,group);this.sortedGroups.push(group);this.sortedGroups.sort(this.sortGroupIds);group.setSepRow();this.settle();},addColumn:function(column){this.columns.set(column.name,column);this.sortedColumns.push(column);this.numberOfColumns++;column.setCategory(this);},setCategoryHeader:function(header){this.categoryHeader=header;this.type=header.type;this.topElement.appendChild(header.topElement);if($defined(header.topElement2))
this.topElement.appendChild(header.topElement2);},addCellToColumn:function(cell,nameColumn,group){this.columns.get(nameColumn).addCell(cell,group);},addProbCellToColumn:function(cell,nameColumn,group){this.columns.get(nameColumn).addProbCell(cell,group);},addCellToProviderColumn:function(cell,group){this.providerColumn.addCell(cell,group);},addCellToPayoutColumn:function(cell,group){this.payoutColumn.addCell(cell,group);},setHasPayout:function(hasPayout){this.hasPayout=hasPayout;},setHasGroup:function(hasGroup){this.hasGroup=hasGroup;},sortOddsColumn:function(columnName){var column=this.columns.get(columnName);column.resort();if($defined(this.currentheaderSortArrowSpan)){this.currentheaderSortArrowSpan.set('html','');var spacer=rtfOddsDetail.constants.imgSpacer.cloneNode(false);spacer.setAttribute('width','8');spacer.setAttribute('height','7');spacer.style.display='none';this.currentheaderSortArrowSpan.appendChild(spacer);}
this.providerColumn.resetSort();if($defined(this.payoutColumn))
this.payoutColumn.resetSort();var allColumns=this.columns.getValues();for(var i=0;i<allColumns.length;i++){if(allColumns[i].name!=columnName)
allColumns[i].resetSort();}
this.sortedColumn=column;var headerSortArrowSpan=this.categoryHeader.outcomeHeaderSortArrows.get(columnName);headerSortArrowSpan.set('html','');if(column.sortDirection==1)
rtfOddsDetail.constants.upSortArrowImg.cloneNode(false).inject(headerSortArrowSpan);else if(column.sortDirection==0)
rtfOddsDetail.constants.downSortArrowImg.cloneNode(false).inject(headerSortArrowSpan);this.currentheaderSortArrowSpan=headerSortArrowSpan;},sortPayoutColumn:function(){this.payoutColumn.resort();if($defined(this.currentheaderSortArrowSpan)){this.currentheaderSortArrowSpan.set('html','');var spacer=rtfOddsDetail.constants.imgSpacer.cloneNode(false);spacer.setAttribute('width','8');spacer.setAttribute('height','7');spacer.style.display='none';spacer.inject(this.currentheaderSortArrowSpan);}
this.providerColumn.resetSort();var allColumns=this.columns.getValues();for(var i=0;i<allColumns.length;i++){allColumns[i].resetSort();}
this.sortedColumn=this.payoutColumn;var headerSortArrowSpan=this.categoryHeader.payoutSortArrow;headerSortArrowSpan.set('html','');if(this.payoutColumn.sortDirection==1)
rtfOddsDetail.constants.upSortArrowImg.cloneNode(false).inject(headerSortArrowSpan);else if(this.payoutColumn.sortDirection==0)
rtfOddsDetail.constants.downSortArrowImg.cloneNode(false).inject(headerSortArrowSpan);this.currentheaderSortArrowSpan=headerSortArrowSpan;},sortProviderColumn:function(){this.providerColumn.resort();if($defined(this.currentheaderSortArrowSpan)){this.currentheaderSortArrowSpan.set('html','');var spacer=rtfOddsDetail.constants.imgSpacer.cloneNode(false);spacer.setAttribute('width','8');spacer.setAttribute('height','7');spacer.style.display='none';this.currentheaderSortArrowSpan.appendChild(spacer);}
if($defined(this.payoutColumn))
this.payoutColumn.resetSort();var allColumns=this.columns.getValues();for(var i=0;i<allColumns.length;i++){allColumns[i].resetSort();}
this.sortedColumn=this.providerColumn;var headerSortArrowSpan=this.categoryHeader.providerSortArrow;headerSortArrowSpan.set('html','');if(this.providerColumn.sortDirection==1)
rtfOddsDetail.constants.upSortArrowImg.cloneNode(false).inject(headerSortArrowSpan);else if(this.providerColumn.sortDirection==0)
rtfOddsDetail.constants.downSortArrowImg.cloneNode(false).inject(headerSortArrowSpan);this.currentheaderSortArrowSpan=headerSortArrowSpan;},maxit:function(){var allColumns=this.columns.getValues();for(var i=0;i<allColumns.length;i++){allColumns[i].maxit();}},formatOdds:function(){var groups=this.groups.getValues();var noGroups=groups.length;for(var i=0;i<noGroups;i++){var group=groups[i];var rows=group.oddsRows.getValues();for(var j=0;j<rows.length;j++){if(!$defined(rows[j].backOddsCells)){var cells=rows[j].oddsCells.getValues();for(var k=0;k<cells.length;k++)
cells[k].formatOdds();}else{var backcells=rows[j].backOddsCells.getValues();for(var k=0;k<backcells.length;k++)
backcells[k].formatOdds();var laycells=rows[j].layOddsCells.getValues();for(var k=0;k<laycells.length;k++)
laycells[k].formatOdds();}}}
if(this.type==1){var allColumns=this.columns.getValues();for(var i=0;i<allColumns.length;i++){allColumns[i].reFormatSummaryCells();}}},applyCommission:function(){if(this.type!=2)
return;var groups=this.groups.getValues();var noGroups=groups.length;for(var i=0;i<noGroups;i++){var group=groups[i];var rows=group.oddsRows.getValues();for(var j=0;j<rows.length;j++){var providerId=rows[j].id.split('_');var commissionObj=rtfOddsDetail.comProviderHash.get(providerId[3]);if(!$defined(rows[j].backOddsCells)){var cells=rows[j].oddsCells.getValues();for(var k=0;k<cells.length;k++)
cells[k].applyCommission(commissionObj.comission,commissionObj.commissionRule);}else{var backcells=rows[j].backOddsCells.getValues();for(var k=0;k<backcells.length;k++)
backcells[k].applyCommission(commissionObj.comission,commissionObj.commissionRule);var laycells=rows[j].layOddsCells.getValues();for(var k=0;k<laycells.length;k++)
laycells[k].applyCommission(commissionObj.comission,commissionObj.commissionRule);}}}},resetCommission:function(){if(this.type!=2)
return;var groups=this.groups.getValues();var noGroups=groups.length;for(var i=0;i<noGroups;i++){var group=groups[i];var rows=group.oddsRows.getValues();for(var j=0;j<rows.length;j++){var providerId=rows[j].id.split('_');var commissionObj=rtfOddsDetail.comProviderHash.get(providerId[3]);if(!$defined(rows[j].backOddsCells)){var cells=rows[j].oddsCells.getValues();for(var k=0;k<cells.length;k++)
cells[k].resetCommission(commissionObj.comission,commissionObj.commissionRule);}else{var backcells=rows[j].backOddsCells.getValues();for(var k=0;k<backcells.length;k++)
backcells[k].resetCommission(commissionObj.comission,commissionObj.commissionRule);var laycells=rows[j].layOddsCells.getValues();for(var k=0;k<laycells.length;k++)
laycells[k].resetCommission(commissionObj.comission,commissionObj.commissionRule);}}}},hideColumnWithName:function(colName){var col=this.columns.get(colName);col.makeHidden();},showColumnWithName:function(colName){var col=this.columns.get(colName);col.makeVisible();},moveBackward:function(noColumns){for(var i=0;i<noColumns;i++){var visibleIndex=this.firstVisiblecolumnIndex+rtfOddsDetail.constants.display-1;var hiddenIndex=this.firstVisiblecolumnIndex-1;var visibleColumn=this.sortedColumns[visibleIndex];var hiddenColumn=this.sortedColumns[hiddenIndex];if($defined(visibleColumn)&&$defined(hiddenColumn)){if(visibleColumn.visible==true)
visibleColumn.makeHidden();if(hiddenColumn.visible==false)
hiddenColumn.makeVisible();this.firstVisiblecolumnIndex--;}}},moveForward:function(noColumns){for(var i=0;i<noColumns;i++){var visibleIndex=this.firstVisiblecolumnIndex;var hiddenIndex=this.firstVisiblecolumnIndex+rtfOddsDetail.constants.display;var visibleColumn=this.sortedColumns[visibleIndex];var hiddenColumn=this.sortedColumns[hiddenIndex];if($defined(visibleColumn)&&$defined(hiddenColumn)){if(visibleColumn.visible==true)
visibleColumn.makeHidden();if(hiddenColumn.visible==false)
hiddenColumn.makeVisible();this.firstVisiblecolumnIndex++;}}},moveLast:function(){var startIndex=this.numberOfColumns-rtfOddsDetail.constants.display;var columns=this.columns.getValues();for(var i=0;i<columns.length;i++){var col=columns[i];if(i<startIndex){if(col.visible==true)
col.makeHidden();}
else{if(col.visible==false)
col.makeVisible();}}
this.firstVisiblecolumnIndex=startIndex;},moveFirst:function(){var columns=this.columns.getValues();for(var i=0;i<columns.length;i++){var col=columns[i];if(i<rtfOddsDetail.constants.display){if(col.visible==false)
col.makeVisible();}
else{if(col.visible==true)
col.makeHidden();}}
this.firstVisiblecolumnIndex=0;},refreshAndMoveFirst:function(){var columns=this.columns.getValues();for(var i=0;i<columns.length;i++){var col=columns[i];if(i<rtfOddsDetail.constants.display){if(col.visible==false)col.makeVisible();}
else{if(col.visible==true)col.makeHidden();}}
this.firstVisiblecolumnIndex=0;},reIndex:function(){var dirtyCols=this.dirtyColumns.getValues();for(var i=0;i<dirtyCols.length;i++){if(this.type==1)
dirtyCols[i].remaxit();if(dirtyCols[i]==this.sortedColumn)
this.sortedColumn.simpleSort();if(this.rowCreated&&this.sortedColumn.name=='provider'){this.sortedColumn.simpleSort();}
if((!this.rowCreated&&this.rowDeleted)&&this.sortedColumn.name=='provider'){this.sortedColumn.simpleSort();this.rowDeleted=false;}
if(this.rowCreated)
this.rowCreated=false;}
var dirtyGroups=this.dirtyGroups.getValues();for(var i=0;i<dirtyGroups.length;i++){if(this.type==1)
dirtyGroups[i].reDoSummary();}
var dirtyRows=this.dirtyRows.getValues();for(var i=0;i<dirtyRows.length;i++){if(this.type==1)
dirtyRows[i].computePayout(this,null);}
if(this.type==1&&this.sortedColumn.name=='payout'){this.sortedColumn.simpleSort();}
this.dirtyRows.empty();this.dirtyGroups.empty();this.dirtyColumns.empty();this.rowCreated=false;},settle:function(){this.sortedGroups.sort(this.sortGroupIds);for(var i=0;i<this.sortedGroups.length;i++){if(i==this.sortedGroups.length-1)
this.sortedGroups[i].lastSepRow.hideIt();else
this.sortedGroups[i].lastSepRow.showIt();}},sortGroupIds:function(groupA,groupB){return groupA.getGroupValue()-groupB.getGroupValue();},shouldBeOnTop:function(group){var groupBefore=null;if(this.sortedGroups.length>1){var idx=0;for(var i=0;i<this.sortedGroups.length;i++){if(this.sortedGroups[i].getGroupValue()>=group.getGroupValue())
break;else
idx++;}
if(idx==0){if($defined(this.sortedGroups[1].getTopMostRow()))
return this.sortedGroups[1].getTopMostRow().topElement;else
this.sortedGroups[1].lastSepRow.topElement;}else{return null;}}else
return null;},getProperRow:function(group){if(group.oddsRows.getLength()>0||this.sortedGroups.length<2)
return group.lastRow==null?this.topElement.lastChild:($defined(group.lastRow.topElementLay)?group.lastRow.topElementLay:group.lastRow.topElement);else{var groupBefore=null;for(var i=0;i<this.sortedGroups.length;i++){if(this.sortedGroups[i].getGroupValue()>=group.getGroupValue())
break;else
groupBefore=this.sortedGroups[i];}
if(groupBefore!=null)
return groupBefore.lastSepRow.topElement;else
return($defined(this.categoryHeader.topElement2)?this.categoryHeader.topElement2:this.categoryHeader.topElement);}}});var Group=new Class({Extends:BetbrainNode,initialize:function(id,parentCategory){this.parent(id);this.oddsRows=new Hash();this.lastRow=null;this.numberOfRows=0;this.parentCategory=parentCategory;this.alternateClassRowBgColor='odd';this.lastSepRow=null;this.validOddsRows=0;this.deleted=false;},decreaseColSpan:function(){this.colSpan--;if($defined(this.lastSepRow))
this.lastSepRow.setColspan(this.colSpan);if($defined(this.probSepRow))
this.probSepRow.setColspan(this.colSpan);if($defined(this.summarySepRow))
this.summarySepRow.setColspan(this.colSpan);},increaseColSpan:function(){this.colSpan++;if($defined(this.lastSepRow))
this.lastSepRow.setColspan(this.colSpan);if($defined(this.probSepRow))
this.probSepRow.setColspan(this.colSpan);if($defined(this.summarySepRow))
this.summarySepRow.setColspan(this.colSpan);},getTopMostRow:function(){var rows=this.oddsRows.getValues();var rowTablesIdx=9990;var topRow=null;for(var i=0;i<rows.length;i++){if(rows[i].topElement.rowIndex<rowTablesIdx){rowTablesIdx=rows[i].topElement.rowIndex;topRow=rows[i];}}
return topRow;},payoutAllowed:function(){if(!rtfOddsDetail.constants.hasPayout)
return false;else{if(rtfOddsDetail.constants.hasGroup==true){if(rtfOddsDetail.constants.betTypeId==8)
return true;if(this.id.indexOf('d5')!=-1&&this.id.indexOf('c')==-1)
return true;else
return false;}else{return true;}}},destroy:function(){var oddsRows=this.oddsRows.getValues();for(var i=0;i<oddsRows.length;i++){var row=oddsRows[i];this.removeRow(row,-1);var allColumns=this.parentCategory.columns.getValues();for(var j=0;j<allColumns.length;j++){allColumns[j].removeGroupById(this.id);}
this.parentCategory.providerColumn.removeGroupById(this.id);if($defined(this.parentCategory.payoutColumn))
this.parentCategory.payoutColumn.removeGroupById(this.id);row.empty(-1);row.remove(-1);row=null;}
this.oddsRows.empty();if($defined(this.probabilityRow)){this.probabilityRow.topElement.destroy();this.probabilityRow=null;this.probSepRow.topElement.destroy();this.probSepRow=null;}
if($defined(this.maxRow)&&$defined(this.avgRow)){this.maxRow.topElement.destroy();this.maxRow=null;this.avgRow.topElement.destroy();this.avgRow=null;this.summarySepRow.topElement.destroy();this.summarySepRow=null;}
this.lastRow=null;this.lastSepRow.topElement.destroy();this.lastSepRow=null;},getGroupValueFromId:function(){var groupValue=this.id.split('_')[2];if(groupValue.indexOf('c')!=-1){var parts=groupValue.split('c');parts[0]=parts[0].replace(/p/g,'+');parts[1]=parts[1].replace(/p/g,'+');parts[0]=parts[0].replace(/m/g,'-');parts[1]=parts[1].replace(/m/g,'-');parts[0]=parts[0].replace(/d/,'.');parts[1]=parts[1].replace(/d/,'.');groupValue=(parseFloat(parts[0])+parseFloat(parts[1]))/2;}else{groupValue=groupValue.replace(/p/g,'+');groupValue=groupValue.replace(/m/g,'-');groupValue=groupValue.replace(/d/,'.');groupValue=parseFloat(groupValue);}
return groupValue;},setSepRow:function(){if($defined(this.probabilityRow))
this.lastSepRow.topElement.inject(this.probabilityRow.topElement,'after');else{if($defined(this.maxRow))
this.lastSepRow.topElement.inject(this.maxRow.topElement,'after');else{if(this.oddsRows.getLength()>0)
this.lastSepRow.topElement.inject($defined(this.lastRow.topElementLay)?this.lastRow.topElementLay:this.lastRow.topElement,'after');else{if(this.lastSepRow==null)
this.lastSepRow=new SeparatorRow(this.colSpan);var rowAfter=this.parentCategory.shouldBeOnTop(this);if(rowAfter!=null)
this.lastSepRow.topElement.inject(rowAfter,'before');else
this.lastSepRow.topElement.inject(this.parentCategory.getProperRow(this),'after');}}}},getGroupValue:function(){if($defined(this.groupValue)){var result=0;if(this.groupValue.indexOf(',')!=-1){var parts=this.groupValue.split(',');result=(parseFloat(parts[0])+parseFloat(parts[1]))/2;}else{result=parseFloat(this.groupValue);}
return result;}
else
return this.getGroupValueFromId();},addRow:function(row){this.validOddsRows++;if(row.isOddsRow){if(rtfOddsDetail.initialDumpOver)
this.computeLastRow();this.oddsRows.set(row.id,row);}
if(this.numberOfRows==0)
this.colSpan=row.getColspan();this.numberOfRows++;if(!$defined(row.backOddsCells)){if(this.oddsRows.getLength()==1&&$defined(this.lastSepRow))
row.topElement.inject(this.lastSepRow.topElement,'before');else
row.topElement.inject(this.parentCategory.getProperRow(this),'after');if(row.topElement.hasClass('odd'))
this.alternateClassRowBgColor='odd';else
this.alternateClassRowBgColor='even';}else{if($defined(row.topElementBack)){if(this.oddsRows.getLength()==1&&$defined(this.lastSepRow))
row.topElement.inject(this.lastSepRow.topElement,'before');else
row.topElementBack.inject(this.parentCategory.getProperRow(this),'after');}
if($defined(row.topElementLay)){if(this.oddsRows.getLength()==1&&$defined(this.lastSepRow)&&!$defined(row.topElementBack))
row.topElement.inject(this.lastSepRow.topElement,'before');else{if($defined(row.topElementBack))
row.topElementLay.inject(row.topElementBack,'after');else
row.topElementLay.inject(this.parentCategory.getProperRow(this),'after');}}
if(row.className.indexOf('odd')!=-1)
this.alternateClassRowBgColor='odd';else
this.alternateClassRowBgColor='even';}
if(this.lastSepRow==null)
this.lastSepRow=new SeparatorRow(this.colSpan);else
this.lastSepRow.setColspan(this.colSpan);this.lastRow=row;},computeLastRow:function(){this.lastRow=null;var noRows=this.oddsRows.getLength();var rows=this.oddsRows.getValues();for(var i=0;i<noRows;i++){if(i==0)
this.lastRow=rows[i];else{if(this.lastRow.topElement.sectionRowIndex<rows[i].topElement.sectionRowIndex)
this.lastRow=rows[i];}}},removeRow:function(row,exchangeType){if(exchangeType==-1){this.oddsRows.erase(row.id);if(this.parentCategory.type==1){if(this.oddsRows.getLength()<2){if($defined(this.maxRow)){this.maxRow.topElement.destroy();this.avgRow.topElement.destroy();this.summarySepRow.topElement.destroy();var columns=this.parentCategory.columns.getValues();for(var i=0;i<columns.length;i++){columns[i].clearSummaryGroupCells(this.id);}
this.maxRow=null;this.avgRow=null;this.summarySepRow=null;if($defined(this.probabilityRow)){this.probSepRow.topElement.removeClass('hidden');}}}}
this.numberOfRows--;}
else{if(exchangeType==0){if(!$defined(row.topElementLay))
this.oddsRows.erase(row.id);}
if(exchangeType==1){if(!$defined(row.topElementBack))
this.oddsRows.erase(row.id);}}
this.validOddsRows--;this.computeLastRow();},createRow:function(idRow,rowLine){var parts=idRow.split('_');var idProvider=parts[3];var type=parts[1];var cellsInRow=rowLine.split('`');var idexist=parts[0]+'_'+parts[1]+'_'+parts[2]+'_'+parts[3];if(this.oddsRows.has(idexist)){if(type==1){var newRow=this.oddsRows.get(idexist);newRow.rowDeleted=false;this.validOddsRows++;newRow.updateLastCollectedTimeCell(cellsInRow[cellsInRow.length-1]);for(var i=2;i<cellsInRow.length-1;i++){if(newRow.oddsCells.get(cellsInRow[i])!=null)
continue;var cellStuff=cellsInRow[i].split('_');var colName='col_'+cellStuff[4].replace(bbUtil.firstMinus,'-');var newCell=new OddsCell(cellsInRow[i],false,true,1,false,false,colName,0,'odds');newCell.init();newRow.addOddsCell(newCell);this.parentCategory.addCellToColumn(newCell,colName,this);}
return newRow;}}
if(type==1){var newRow=new OddsRow(idRow,'odd',cellsInRow[cellsInRow.length-1]);var providerCell=new ProviderCell(1,rtfOddsDetail.comProviderHash.get(idProvider).showInfo,rtfOddsDetail.comProviderHash.get(idProvider).showPromoOffer,false,false,true,false,false,false,false,null,idProvider,rtfOddsDetail.comProviderHash.get(idProvider).name,rtfOddsDetail.comProviderHash.get(idProvider).nameLink,0);newRow.addProviderCell(providerCell);this.parentCategory.addCellToProviderColumn(providerCell,this);if(rtfOddsDetail.constants.hasGroup)
newRow.addCell(new GroupCell(this.groupValue));for(var i=2;i<cellsInRow.length-1;i++){var cellStuff=cellsInRow[i].split('_');var colName='col_'+cellStuff[4].replace(bbUtil.firstMinus,'-');var newCell=new OddsCell(cellsInRow[i],false,true,1,false,false,colName,0,'odds');newCell.init();newRow.addOddsCell(newCell);this.parentCategory.addCellToColumn(newCell,colName,this);}
if(rtfOddsDetail.constants.hasPayout){var payoutCell=new PayoutCell(-1);newRow.addCell(payoutCell);this.parentCategory.addCellToPayoutColumn(payoutCell,this);}
newRow.addCell(new OddsChangedCell('00.00.0000'));newRow.addCell(new OddsLastCollectedTimeCell(cellsInRow[cellsInRow.length-1],idRow,false));this.addRow(newRow);if(this.oddsRows.getLength()==2)
this.computeSummary();return newRow;}else{var idexist=parts[0]+'_'+parts[1]+'_'+parts[2]+'_'+parts[3];if(this.oddsRows.has(idexist)){var existingRow=this.oddsRows.get(idexist);existingRow.addSubRow(parts[4],rowLine,this);}else{var newRow=new BackAndLayOddsRow(idexist,'odd',cellsInRow[cellsInRow.length-1]);var providerCell=new ProviderCell(2,rtfOddsDetail.comProviderHash.get(idProvider).showInfo,rtfOddsDetail.comProviderHash.get(idProvider).showPromoOffer,false,false,true,false,false,true,true,'EUR',idProvider,rtfOddsDetail.comProviderHash.get(idProvider).name,rtfOddsDetail.comProviderHash.get(idProvider).nameLink,0);newRow.addProviderCell(providerCell);this.parentCategory.addCellToProviderColumn(providerCell,this);if(rtfOddsDetail.constants.hasGroup)
newRow.addCell(new GroupCell(this.groupValue));for(var i=2;i<cellsInRow.length-1;i++){var cellStuff=cellsInRow[i].split('_');var colName='col_'+cellStuff[4].replace(bbUtil.firstMinus,'-');var newCell=new OddsCell(cellsInRow[i],false,cellStuff[cellStuff.length-1]=='false'?false:true,parseInt(type),false,true,colName,0,'odds');newCell.init();newRow.addOddsCell(newCell);this.parentCategory.addCellToColumn(newCell,colName,this);}
newRow.setHasPayout(rtfOddsDetail.constants.hasPayout);newRow.addChangedCell(new OddsChangedCell('0'));newRow.addLastCollectedTimeCell(new OddsLastCollectedTimeCell(cellsInRow[cellsInRow.length-1],idRow,false));newRow.compact();this.addRow(newRow);}}},insertLastOddsCellIntoRow:function(rowId,lastOddsCell,column,withSummary){var row=this.oddsRows.get(rowId);row.insertLastOddsCellIntoRow(lastOddsCell);this.increaseColSpan();if(!withSummary)
return;if($defined(this.avgRow)){var avgCells=this.avgRow.topElement.getElements('td');var avgCell=new Element('td',{'class':'leftDashedBorder centerAligned'});if(!column.visible)
avgCell.addClass('hidden');avgCell.inject(avgCells[avgCells.length-2],'before');var maxCells=this.maxRow.topElement.getElements('td');var maxCell=new Element('td',{'class':'leftDashedBorder centerAligned'});if(!column.visible)
maxCell.addClass('hidden');maxCell.inject(maxCells[maxCells.length-2],'before');column.setSummaryCells(avgCell,maxCell,this.id);}},computePayout:function(){if(!this.payoutAllowed())
return;var iRows=this.oddsRows.getValues();for(var i=0;i<iRows.length;i++){iRows[i].computePayout(this.parentCategory,this);}},setGroupValue:function(groupValue){this.groupValue=groupValue;},addProbabilityRow:function(row){if(!$defined(this.probSepRow)){this.probSepRow=new SeparatorRow(this.colSpan);if($defined(this.avgRow)&&$defined(this.maxRow)){this.probSepRow.topElement.inject(this.maxRow.topElement,'after');this.probSepRow.topElement.addClass('hidden');}
else
this.probSepRow.topElement.inject(this.lastRow.topElement,'after');}
var alternateClass='even';if(this.alternateClassRowBgColor=='even')
alternateClass='odd';row.topElement.addClass(alternateClass);row.topElement.inject(this.probSepRow.topElement,'after');this.probabilityRow=row;var probCells=row.probCellIndex.getValues();for(var i=0;i<probCells.length;i++){this.parentCategory.addProbCellToColumn(probCells[i],probCells[i].columnHashName,this);}},updateProbability:function(colNameHash,probValue){if($defined(this.probabilityRow)){var probCell=this.probabilityRow.probCellIndex.get(colNameHash);probCell.updateValue(probValue);}},deleteProbabilityRow:function(){if($defined(this.probabilityRow)){this.probabilityRow.topElement.destroy();this.probSepRow.topElement.destroy();this.probabilityRow=null;this.probSepRow=null;}},computeSummary:function(){if(this.numberOfRows>1){this.summarySepRow=new SeparatorRow(this.colSpan);this.summarySepRow.topElement.inject(this.lastRow.topElement,'after');if($defined(this.probSepRow)){this.probSepRow.topElement.addClass('hidden');}
var alternateClassStart='even';if(this.alternateClassRowBgColor=='even')
alternateClassStart='odd';this.avgRow=new SummaryRow('avg_'+this.id,'sortbottom '+alternateClassStart);if(alternateClassStart=='even')
alternateClassStart='odd';this.alternateClassRowBgColor=alternateClassStart;this.maxRow=new SummaryRow('max_'+this.id,'sortbottom '+alternateClassStart);var avgTextCell=new Element('td',{'class':'summaryFirst providerCell','colSpan':2});avgTextCell.set('text',rtfOddsDetail.constants.avgText);avgTextCell.inject(this.avgRow.topElement);var maxTextCell=new Element('td',{'class':'leftAligned summaryFirst providerCell','colSpan':2});maxTextCell.set('text',rtfOddsDetail.constants.maxText);maxTextCell.inject(this.maxRow.topElement);if(this.parentCategory.hasGroup){if($defined(this.groupValue)){var groupCell=new GroupCell(this.groupValue);groupCell.topElement.addClass('centerAligned');groupCell.topElement.addClass('summaryFirst');groupCell.topElement.inject(this.avgRow.topElement);groupCell.topElement.cloneNode(true).inject(this.maxRow.topElement);}}
var columns=this.parentCategory.columns.getValues();var avgPayoutValues=new Array();var maxPayoutValues=new Array();for(var i=0;i<columns.length;i++){var summary=columns[i].computeSummaryForAGroup(this.id);var avgCell=new Element('td',{'class':'leftDashedBorder centerAligned'});var maxCell=new Element('td',{'class':'leftDashedBorder centerAligned'});if(!columns[i].visible){avgCell.addClass('hidden');maxCell.addClass('hidden');}
avgPayoutValues.push(summary.avg);if(summary.avg>0.9){avgCell.set('text',showOddsInProperCurrency(summary.avg));}
maxPayoutValues.push(summary.max);if(summary.max>0.9){maxCell.set('text',showOddsInProperCurrency(summary.max));}
avgCell.inject(this.avgRow.topElement);maxCell.inject(this.maxRow.topElement);columns[i].setSummaryCells(avgCell,maxCell,this.id);}
var payoutAvgValue=-1;var payoutMaxValue=-1;if(this.payoutAllowed()){payoutAvgValue=bbUtil.computePayout(avgPayoutValues);payoutMaxValue=bbUtil.computePayout(maxPayoutValues);}
if(this.parentCategory.hasPayout){var payoutCell=new PayoutCell(payoutAvgValue);payoutCell.topElement.addClass('summaryFirst');payoutCell.topElement.inject(this.avgRow.topElement);var maxPayoutCell=new PayoutCell(payoutMaxValue);maxPayoutCell.topElement.addClass('summaryFirst');maxPayoutCell.topElement.inject(this.maxRow.topElement);}
this.avgRow.addCell(new OddsChangedCell('00.00.0000'));this.avgRow.addCell(new OddsLastCollectedTimeCell('00.00.0000',1,true));this.maxRow.addCell(new OddsChangedCell('00.00.0000'));this.maxRow.addCell(new OddsLastCollectedTimeCell('00.00.0000',1,true));this.avgRow.topElement.injectAfter(this.summarySepRow.topElement);this.maxRow.topElement.injectAfter(this.avgRow.topElement);}},reDoSummary:function(){if(this.validOddsRows==0){this.deleteProbabilityRow();}
if($defined(this.avgRow)&&$defined(this.maxRow)&&this.numberOfRows>1){var columns=this.parentCategory.dirtyColumns.getValues();var avgPayoutValues=[];var maxPayoutValues=[];for(var i=0;i<columns.length;i++){var summary=columns[i].computeSummaryForAGroup(this.id);var summaryCells=columns[i].summaryGroups.get(this.id);var avgCell=summaryCells[0];var maxCell=summaryCells[1];if(summary.avg>0.9){avgCell.set('text',showOddsInProperCurrency(summary.avg));}else{avgCell.set('text','');}
if(summary.max>0.9){maxCell.set('text',showOddsInProperCurrency(summary.max));}else{maxCell.set('text','');}
avgPayoutValues.push(summary.avg);maxPayoutValues.push(summary.max);}
var allOddsColumns=this.parentCategory.columns.getValues();for(var i=0;i<allOddsColumns.length;i++){var alreadyComputed=false;for(var j=0;j<columns.length;j++){if(columns[j].name==allOddsColumns[i].name){alreadyComputed=true;break;}}
if(!alreadyComputed){avgPayoutValues.push(allOddsColumns[i].actualSummaryValues.avg);maxPayoutValues.push(allOddsColumns[i].actualSummaryValues.max);}}
if(this.payoutAllowed()){var payoutAvgValue=bbUtil.computePayout(avgPayoutValues);var payoutMaxValue=bbUtil.computePayout(maxPayoutValues);this.maxRow.setPayoutValue(payoutMaxValue);this.avgRow.setPayoutValue(payoutAvgValue);}}}});var Column=new Class({Extends:BetbrainNode,initialize:function(visible,name){this.visible=visible;this.groups=new Hash();this.maxGroups=new Hash();this.summaryGroups=new Hash();this.probCells=new Array();this.name=name;this.sortDirection=-1;this.layGroups=new Hash();this.actualSummaryValues=new Hash();},setOutcomeName:function(oName){this.outcomeName=oName;},destroy:function(){this.groups.empty();if($defined(this.maxGroups))
this.maxGroups.empty();if($defined(this.summaryGroups))
this.summaryGroups.empty();if($defined(this.layGroups))
this.layGroups.empty();this.actualSummaryValues.empty();},setCategory:function(categ){this.parentCategory=categ;},resetSort:function(){this.sortDirection=-1;var groupIds=this.groups.getKeys();for(var i=0;i<groupIds.length;i++){var groupCells=this.groups.get(groupIds[i]);groupCells.sort(bbUtil.sortByColumnIndex);}},setHeaderCell:function(cell){this.headerCell=cell;},addCell:function(td,group){if(!this.visible)
td.hideIt();if(td.isBack||this.name=='provider'||this.name=='payout'){if(!this.groups.has(group.id)){this.groups.set(group.id,new Array());}
var groupCells=this.groups.get(group.id);groupCells.push(td);if(this.name=='provider')
td.parentRow.setColumnIndex(groupCells.length-1);}
else{if(!this.layGroups.has(group.id)){this.layGroups.set(group.id,new Array());}
var layGroupCells=this.layGroups.get(group.id);layGroupCells.push(td);}},removeGroupById:function(idGroup){if(this.groups.has(idGroup)){this.groups.erase(idGroup);}
else{}},removeCell:function(cell,group){var cells=[];if(cell.isBack||this.name=='provider'||this.name=='payout'){cells=this.groups.get(group.id);}else{cells=this.layGroups.get(group.id);}
var idxCellToDel=0;if($defined(cells)){for(var i=0;i<cells.length;i++){if(cells[i]==cell){idxCellToDel=i;break;}}
cells.splice(idxCellToDel,1);}},computeSummaryForAGroup:function(groupId){var summary={'avg':0.00,'max':0.00};var groupCells=this.groups.get(groupId);var noGroupCells=groupCells.length;var toDel=0;for(var i=0;i<noGroupCells;i++){if(groupCells[i].oddsStatusId!=1){toDel++;continue;}
summary.avg+=groupCells[i].oddsValue;if(groupCells[i].oddsValue>summary.max)
summary.max=groupCells[i].oddsValue;}
if(summary.avg>0&&noGroupCells>toDel)
summary.avg=(summary.avg/(noGroupCells-toDel));this.actualSummaryValues=summary;return summary;},resort:function(){var groupIds=this.groups.getKeys();if(this.sortDirection==-1)
this.sortDirection=0;else
this.sortDirection=this.sortDirection==0?1:0;for(var i=0;i<groupIds.length;i++)
this.resortGroup(groupIds[i]);},simpleSort:function(){var groupIds=this.parentCategory.dirtyGroups.getKeys();for(var i=0;i<groupIds.length;i++)
this.resortGroup(groupIds[i]);},resortGroup:function(groupId){if(this.name=='payout'){var oddsRowsGroup=this.parentCategory.groups.get(groupId);if(!oddsRowsGroup.payoutAllowed())
return;}
var groupCells=this.groups.get(groupId);if(groupCells.length<2)
return;var beforeSortingArray=groupCells.filter(function(item,index){return true;});var firstRow=groupCells[0].getParentRow();if($defined(groupCells[0].parentRow.layOddsCells)){if(groupCells[0].parentRow.layOddsCells.getLength()>0&&groupCells[0].parentRow.backOddsCells.getLength()==0)
firstRow=groupCells[0].parentRow.topElementLay;}
if(this.name=='provider')
groupCells.sort(bbUtil.sortStringCaseinsensitive);if(this.name=='payout')
groupCells.sort(bbUtil.sortPercent);if(this.name!='provider'&&this.name!='payout')
groupCells.sort(bbUtil.sortOddsCells);if(this.name!='provider'){if(this.sortDirection==0)
groupCells.reverse();}
else if(this.sortDirection==1)
groupCells.reverse();var noOfGroupCells=groupCells.length;var classOddEven='even';for(var i=0;i<noOfGroupCells;i++){var rowObj=groupCells[i].parentRow;var row=groupCells[i].getParentRow();classOddEven=classOddEven=='odd'?'even':'odd';rowObj.setClassName(classOddEven);if(rowObj.columnIndex==i)
continue;else{if(i==0){row.inject(firstRow,'before');if($defined(rowObj.topElementLay))
rowObj.topElementLay.inject(row,'after');}
else{var afterRow=groupCells[i-1].getParentRow();if($defined(groupCells[i-1].parentRow.topElementLay))
afterRow=groupCells[i-1].parentRow.topElementLay;row.inject(afterRow,'after');if($defined(rowObj.topElementLay))
rowObj.topElementLay.inject(row,'after');}
for(var j=i;j<rowObj.columnIndex&&j<beforeSortingArray.length;j++){beforeSortingArray[j].parentRow.setColumnIndex(beforeSortingArray[j].parentRow.columnIndex++);}
rowObj.setColumnIndex(i);}}},setSummaryCells:function(avgCell,maxCell,groupId){var summaryCells=[];summaryCells[0]=avgCell;summaryCells[1]=maxCell;this.summaryGroups.set(groupId,summaryCells);},clearSummaryGroupCells:function(groupId){this.summaryGroups.erase(groupId);},addProbCell:function(cell,group){this.probCells.push(cell);},maxit:function(){var groupCells=this.groups.getValues();var groupKeys=this.groups.getKeys();for(var j=0;j<groupCells.length;j++){var cells=groupCells[j];var maxCells=[];var maxValue=0.0000001;for(var i=0;i<cells.length;i++){if(cells[i].oddsStatusId!=1)
continue;if(cells[i].oddsValue>maxValue){maxValue=cells[i].oddsValue;maxCells=null;maxCells=[];maxCells.push(cells[i]);}else if(cells[i].oddsValue==maxValue){maxCells.push(cells[i]);}}
if(maxCells.length>0){if(this.maxGroups.has(groupKeys[j])){var oldMaxCells=this.maxGroups.get(groupKeys[j]);for(var i=0;i<oldMaxCells.length;i++)
oldMaxCells[i].topElement.removeClass('max');}
for(var i=0;i<maxCells.length;i++)
maxCells[i].maxit();this.maxGroups.set(groupKeys[j],maxCells);}}},remaxit:function(){var dirtyGroups=this.parentCategory.dirtyGroups;var groupCells=this.groups.getValues();var groupKeys=this.groups.getKeys();for(var j=0;j<groupCells.length;j++){if(!dirtyGroups.has(groupKeys[j]))
continue;var cells=groupCells[j];var maxCells=[];var maxValue=0.0000001;for(var i=0;i<cells.length;i++){if(cells[i].oddsStatusId!=1)
continue;if(cells[i].oddsValue>maxValue){maxValue=cells[i].oddsValue;maxCells=null;maxCells=[];maxCells.push(cells[i]);}else if(cells[i].oddsValue==maxValue){maxCells.push(cells[i]);}}
if(maxCells.length>0){if(this.maxGroups.has(groupKeys[j])){var oldMaxCells=this.maxGroups.get(groupKeys[j]);for(var i=0;i<oldMaxCells.length;i++)
oldMaxCells[i].topElement.removeClass('max');}
for(var i=0;i<maxCells.length;i++)
maxCells[i].maxit();this.maxGroups.set(groupKeys[j],maxCells);}}},makeHidden:function(){this.visible=false;var groupKeys=this.groups.getKeys();for(var i=0;i<groupKeys.length;i++){var groupCells=this.groups.get(groupKeys[i]);for(var j=0;j<groupCells.length;j++)
groupCells[j].hideIt();}
var layGroupKeys=this.layGroups.getKeys();for(var i=0;i<layGroupKeys.length;i++){var layGroupCells=this.layGroups.get(layGroupKeys[i]);for(var j=0;j<layGroupCells.length;j++)
layGroupCells[j].hideIt();}
this.headerCell.addClass('hidden');var summaryKeys=this.summaryGroups.getKeys();if(summaryKeys.length>0){for(var i=0;i<summaryKeys.length;i++){var summaryCells=this.summaryGroups.get(summaryKeys[i]);summaryCells[0].addClass('hidden');summaryCells[1].addClass('hidden');}}
if(this.probCells.length>0){for(var i=0;i<this.probCells.length;i++){this.probCells[i].addClass('hidden');}}},removeFromTable:function(){this.visible=false;var groupKeys=this.groups.getKeys();for(var i=0;i<groupKeys.length;i++){var groupCells=this.groups.get(groupKeys[i]);for(var j=0;j<groupCells.length;j++)
groupCells[j].removeIt();}
var layGroupKeys=this.layGroups.getKeys();for(var i=0;i<layGroupKeys.length;i++){var layGroupCells=this.layGroups.get(layGroupKeys[i]);for(var j=0;j<layGroupCells.length;j++)
layGroupCells[j].removeIt();}
this.headerCell.destroy();this.parentCategory.categoryHeader.outcomeHeaderCells.erase(this.name);this.parentCategory.categoryHeader.outcomeHeaderSortArrows.erase(this.name);var summaryKeys=this.summaryGroups.getKeys();if(summaryKeys.length>0){for(var i=0;i<summaryKeys.length;i++){var summaryCells=this.summaryGroups.get(summaryKeys[i]);summaryCells[0].dispose();summaryCells[1].dispose();}}},reFormatSummaryCells:function(){var summaryKeys=this.summaryGroups.getKeys();if(summaryKeys.length>0){for(var i=0;i<summaryKeys.length;i++){var summaryCells=this.summaryGroups.get(summaryKeys[i]);var groupIds=this.groups.getKeys();var summaryEUValues=this.computeSummaryForAGroup(summaryKeys[i]);if(summaryEUValues.avg>0.9)
summaryCells[0].set('text',showOddsInProperCurrency(summaryEUValues.avg));else
summaryCells[0].set('text','');if(summaryEUValues.max>0.9)
summaryCells[1].set('text',showOddsInProperCurrency(summaryEUValues.max));else
summaryCells[1].set('text','');}}},makeVisible:function(){this.visible=true;var groupKeys=this.groups.getKeys();for(var i=0;i<groupKeys.length;i++){var groupCells=this.groups.get(groupKeys[i]);for(var j=0;j<groupCells.length;j++)
groupCells[j].showIt();}
var layGroupKeys=this.layGroups.getKeys();for(var i=0;i<layGroupKeys.length;i++){var layGroupCells=this.layGroups.get(layGroupKeys[i]);for(var j=0;j<layGroupCells.length;j++)
layGroupCells[j].showIt();}
this.headerCell.removeClass('hidden');var summaryKeys=this.summaryGroups.getKeys();if(summaryKeys.length>0){for(var i=0;i<summaryKeys.length;i++){var summaryCells=this.summaryGroups.get(summaryKeys[i]);summaryCells[0].removeClass('hidden');summaryCells[1].removeClass('hidden');}}
if(this.probCells.length>0){for(var i=0;i<this.probCells.length;i++){this.probCells[i].removeClass('hidden');}}}});var Row=new Class({Extends:BetbrainNode,initialize:function(id,className){this.parent(id);this.topElement=new Element('tr',{'id':id,'class':className});this.cells=new Array();this.isOddsRow=false;},setBgColor:function(color){this.topElement.setStyle('backgroundColor',color);},addCell:function(td){this.topElement.appendChild(td.topElement);td.setParentRowObject(this);this.cells.push(td);if(td.isLastCollectedTimeCell)
this.lastCollectedTimeCell=td;},remove:function(){this.topElement.destroy();}});var OddsRow=new Class({Extends:BetbrainNode,initialize:function(id,className,lastCollectedTime){this.id=id;this.topElement=rtfOddsDetail.constants.oddsRow.clone(false);this.topElement.className=className;this.cells=[];this.isOddsRow=true;this.oddsCells=new Hash();this.className=className;this.topElement.store("obj",this);this.lastCollectedTime=lastCollectedTime;this.rowDeleted=false;},getLastCollectedTime:function(){return this.lastCollectedTime;},updateLastCollectedTimeCell:function(dateTime){this.lastCollectedTimeCell.setDate(dateTime);this.lastCollectedTime=parseInt(dateTime);},removeCell:function(cell){this.oddsCells.erase(cell.id);var idx=-1;for(var i=0;i<this.cells.length;i++){if(this.cells[i].id==cell.id){idx=i;break;}}
if(idx!=-1){this.cells.splice(idx,1);}},addOddsCell:function(cell){if(cell.isHidden){cell.setParentRowObject(this);this.cells.push(cell);return;}
this.addCell(cell);if(cell.isOddsCell)
this.oddsCells.set(cell.id,cell);},addOddsExHiddenCell:function(td){td.topElement.inject(this.changedDateCell.topElement,'before');if(td.isOddsCell)
this.oddsCells.set(td.id,td);},insertLastOddsCellIntoRow:function(oddsCell){this.oddsCells.set(oddsCell.id,oddsCell);this.cells.splice(this.oddsCells.getLength(),0,oddsCell);oddsCell.setParentRowObject(this);if($defined(this.payoutCell))
oddsCell.topElement.inject(this.payoutCell.topElement,'before');else{if($defined(this.changedDateCell))
oddsCell.topElement.inject(this.changedDateCell.topElement,'before');else
oddsCell.topElement.inject(this.topElement);}},addProviderCell:function(cell){this.topElement.appendChild(cell.topElement);cell.setParentRowObject(this);this.cells.push(cell);this.providerCell=cell;},getColspan:function(){return this.cells.length+1;},setColumnIndex:function(idx){this.columnIndex=idx;},addCell:function(td){this.topElement.appendChild(td.topElement);td.setParentRowObject(this);this.cells.push(td);if(td.isPayoutCell)
this.payoutCell=td;if(td.isChangedDateCell)
this.changedDateCell=td;if(td.isGroupCell)
this.groupCell=td;if(td.isLastCollectedTimeCell)
this.lastCollectedTimeCell=td;},computePayout:function(category,group){if(!rtfOddsDetail.constants.hasPayout)
return;if(group!=null&&!group.payoutAllowed())
return;var groupIdFromRowId=this.id.substring(0,this.id.length-7);if(rtfOddsDetail.constants.betTypeId!=8&&rtfOddsDetail.constants.hasGroup==true&&!(groupIdFromRowId.indexOf('d5')!=-1&&groupIdFromRowId.indexOf('c')==-1))
return;var iCells=this.oddsCells.getValues();var payoutValues=[];var showEmpty=false;for(var i=0;i<iCells.length;i++){if(iCells[i].oddsStatusId!=1){showEmpty=true;break;}
payoutValues.push(iCells[i].oddsValue);}
if(!showEmpty){var payValue=bbUtil.computePayout(payoutValues);if($defined(this.payoutCell)){this.payoutCell.topElement.set('text',parseFloat(payValue).toFixed(0)+'%');this.payoutCell.payoutValue=parseFloat(payValue);}}else{this.payoutCell.topElement.set('text','');this.payoutCell.payoutValue=0;}
if(group!=null)
category.addCellToPayoutColumn(this.payoutCell,group);},empty:function(typeForExchange){for(var i=0;i<this.cells.length;i++){if(this.cells[i].isOddsCell){this.oddsCells.erase(this.cells[i].id);this.cells.splice(i,1);i--;}}},remove:function(typeForExchange){this.topElement.destroy();},setClassName:function(className){if(this.className==className)
return;this.className=className;if($defined(this.topElement))
this.topElement.className=className;if($defined(this.topElementBack))
this.topElementBack.className=className;if($defined(this.topElementLay))
this.topElementLay.className=className;}});var SummaryRow=new Class({Extends:Row,addCell:function(cell){this.cells.push(cell);this.topElement.appendChild(cell.topElement);},getSummaryCells:function(){return this.topElement.getElements('td.summary');},setPayoutValue:function(value){if(!$defined(this._payoutCell)){var summaryFirstCells=this.topElement.getElements('td.summaryFirst');var payoutCell=summaryFirstCells[summaryFirstCells.length-1];this._payoutCell=payoutCell;}
if(parseFloat(value)>0)
this._payoutCell.set('text',parseFloat(value).toFixed(0)+'%');else
this._payoutCell.set('text','');}});var ProbabilityRow=new Class({Extends:Row,initialize:function(id){this.parent(id,'sortbottom');this.probTextCell=new TextCell(rtfOddsDetail.constants.probabText);this.probTextCell.topElement.setProperty('colSpan',2);this.probTextCell.topElement.addClass('summaryFirst');this.probTextCell.topElement.addClass('providerCell');this.addCell(this.probTextCell);this.probCellsBeforeMeCell=new PayoutCell(0)
this.addCell(this.probCellsBeforeMeCell);this.addCell(new OddsChangedCell('00.00.0000'));this.addCell(new OddsLastCollectedTimeCell('00.00.0000',1,true));this.probCellIndex=new Hash();},addGroupCell:function(groupCell){groupCell.topElement.inject(this.probTextCell.topElement,'after');},addProbCell:function(probCell){probCell.topElement.setProperty('class','centerAligned');var probValue=probCell.value;probValue=(probValue*100).toFixed(0);if(probValue!=0)
probCell.topElement.set('text',probValue+'%');else
probCell.topElement.set('text','');probCell.topElement.inject(this.probCellsBeforeMeCell.topElement,'before');this.probCellIndex.set(probCell.columnHashName,probCell);}});var BackAndLayOddsRow=new Class({Extends:OddsRow,initialize:function(id,className,lastCollectedTime){this.id=id;this.className=className;this.lastCollectedTime=lastCollectedTime;this.backOddsCells=new Hash();this.layOddsCells=new Hash();this.providerCell=null;this.groupCell=null;this.backTextCell=null;this.layTextCell=null;this.payoutCell=null;this.changedDateCell=null;this.lastCollectedTimeCell=null;this.hasBack=false;this.hasLay=false;this.cells=[];this.isOddsRow=true;},addChangedCell:function(cell){this.changedDateCell=cell;},addLastCollectedTimeCell:function(cell){this.lastCollectedTimeCell=cell;},addProviderCell:function(cell){this.providerCell=cell;cell.setParentRowObject(this);},getColspan:function(){if(Browser.Engine.name=='trident')
return this.backOddsCells.getLength()>0?this.topElementBack.getChildren().length:this.topElementLay.getChildren().length;else
return this.backOddsCells.getLength()>0?this.topElementBack.cells.length:this.topElementLay.cells.length;},removeCell:function(cell){if(cell.isBack)
this.backOddsCells.erase(cell.id);else
this.layOddsCells.erase(cell.id);var idx=-1;for(var i=0;i<this.cells.length;i++){if(this.cells[i].id==cell.id){idx=i;break;}}
if(idx!=-1){this.cells.splice(idx,1);}},addCell:function(td){td.setParentRowObject(this);this.cells.push(td);if(td.isPayoutCell)
this.payoutCell=td;if(td.isChangedDateCell)
this.changedDateCell=td;if(td.isGroupCell)
this.groupCell=td;if(td.isLastCollectedTimeCell)
this.lastCollectedTimeCell=td;},addOddsCell:function(cell){if(cell.isBack){this.backOddsCells.set(cell.id,cell);if(!$defined(this.topElementBack))
this.topElementBack=this.createRow();this.hasBack=true;if(!$defined(this.backTextCell)){if(cell.isOption)
this.backTextCell=new TextCell(rtfOddsDetail.constants.buyText);if(cell.isExchange)
this.backTextCell=new BackOrLayTextCell(rtfOddsDetail.constants.backText);}}
else{this.layOddsCells.set(cell.id,cell);if(!$defined(this.topElementLay))
this.topElementLay=this.createRow();this.hasLay=true;if(!$defined(this.layTextCell)){if(cell.isOption)
this.layTextCell=new TextCell(rtfOddsDetail.constants.sellText);if(cell.isExchange)
this.layTextCell=new BackOrLayTextCell(rtfOddsDetail.constants.layText);}}},insertLastOddsCellIntoRow:function(oddsCell){if(oddsCell.isBack){this.backOddsCells.set(oddsCell.id,oddsCell);if(this.hasPayout)
oddsCell.topElement.inject(this.payoutCell,'before');else
oddsCell.topElement.inject(this.changedDateCell.topElement,'before');}else{this.layOddsCells.set(oddsCell.id,oddsCell);if(this.backOddsCells.getLength()>0&&this.layOddsCells.getLength()>0){oddsCell.topElement.inject(this.topElementLay);}else{if(this.hasPayout)
oddsCell.topElement.inject(this.payoutCell,'before');else
oddsCell.topElement.inject(this.changedDateCell.topElement,'before');}}},addNotLoadedCells:function(){if(this.backOddsCells.getLength()>0&&this.layOddsCells.getLength()>0){for(var i=0;i<this.backHiddenCells.length;i++){this.backHiddenCells[i].topElement.inject(this.changedDateCell.topElement,'before');this.backHiddenCells[i].unHide();}
for(var i=0;i<this.layHiddenCells.length;i++){this.layHiddenCells[i].topElement.inject(this.topElementLay);this.layHiddenCells[i].unHide();}}
if(this.backOddsCells.getLength()==0&&this.layOddsCells.getLength()>0){for(var i=0;i<this.layHiddenCells.length;i++){this.layHiddenCells[i].topElement.inject(this.changedDateCell.topElement,'before');this.layHiddenCells[i].unHide();}}
if(this.backOddsCells.getLength()>0&&this.layOddsCells.getLength()==0){for(var i=0;i<this.backHiddenCells.length;i++){this.backHiddenCells[i].topElement.inject(this.changedDateCell.topElement,'before');this.backHiddenCells[i].unHide();}}},compact:function(){if(!rtfOddsDetail.initialDumpOver){this.backHiddenCells=[];this.layHiddenCells=[];this.toBeLoadedWithHiddenCells=false;}
if(this.backOddsCells.getKeys().length>0&&this.layOddsCells.getKeys().length>0){this.providerCell.topElement.setProperty('rowSpan','2');this.providerCell.topElement.inject(this.topElementBack);this.providerCell.setParentRowObject(this);this.topElement=this.topElementBack;this.backTextCell.topElement.inject(this.topElementBack);this.layTextCell.topElement.inject(this.topElementLay);if($defined(this.groupCell)){this.groupCell.topElement.setProperty('rowSpan','2');this.groupCell.topElement.inject(this.topElementBack);}
var backCells=this.backOddsCells.getValues();for(var i=0;i<backCells.length;i++){if(!rtfOddsDetail.initialDumpOver&&backCells[i].isHidden){if(!this.toBeLoadedWithHiddenCells){this.toBeLoadedWithHiddenCells=true;rtfOddsDetail.exRowsWithNotLoadedCells.push(this);}
this.backHiddenCells.push(backCells[i]);}
else
backCells[i].topElement.inject(this.topElementBack);backCells[i].setParentRowObject(this);}
var layCells=this.layOddsCells.getValues();for(var i=0;i<layCells.length;i++){if(!rtfOddsDetail.initialDumpOver&&layCells[i].isHidden){if(!this.toBeLoadedWithHiddenCells){this.toBeLoadedWithHiddenCells=true;rtfOddsDetail.exRowsWithNotLoadedCells.push(this);}
this.layHiddenCells.push(layCells[i]);}
else
layCells[i].topElement.inject(this.topElementLay);layCells[i].setParentRowObject(this);}
if(this.hasPayout){var payoutCell=rtfOddsDetail.constants.nbspCell.clone(true);payoutCell.setProperty('rowSpan','2');payoutCell.inject(this.topElementBack);this.payoutCell=payoutCell;}
this.changedDateCell.topElement.setProperty('rowSpan','2');this.changedDateCell.topElement.inject(this.topElementBack);this.lastCollectedTimeCell.topElement.setProperty('rowSpan','2');this.lastCollectedTimeCell.topElement.inject(this.topElementBack);}
if(this.backOddsCells.getKeys().length==0&&this.layOddsCells.getKeys().length>0){this.providerCell.topElement.inject(this.topElementLay);this.providerCell.setParentRowObject(this);this.topElement=this.topElementLay;this.layTextCell.topElement.inject(this.topElementLay);if($defined(this.groupCell))
this.groupCell.topElement.inject(this.topElementLay);var layCells=this.layOddsCells.getValues();for(var i=0;i<layCells.length;i++){if(!rtfOddsDetail.initialDumpOver&&layCells[i].isHidden){if(!this.toBeLoadedWithHiddenCells){this.toBeLoadedWithHiddenCells=true;rtfOddsDetail.exRowsWithNotLoadedCells.push(this);}
this.layHiddenCells.push(layCells[i]);}
else
layCells[i].topElement.inject(this.topElementLay);layCells[i].setParentRowObject(this);}
if(this.hasPayout){var payoutCell=rtfOddsDetail.constants.nbspCell.clone(true);payoutCell.inject(this.topElementLay);this.payoutCell=payoutCell;}
this.changedDateCell.topElement.inject(this.topElementLay);this.lastCollectedTimeCell.topElement.inject(this.topElementLay);}
if(this.backOddsCells.getKeys().length>0&&this.layOddsCells.getKeys().length==0){this.providerCell.topElement.inject(this.topElementBack);this.providerCell.setParentRowObject(this);this.topElement=this.topElementBack;this.backTextCell.topElement.inject(this.topElementBack);if($defined(this.groupCell))
this.groupCell.topElement.inject(this.topElementBack);var backCells=this.backOddsCells.getValues();for(var i=0;i<backCells.length;i++){if(!rtfOddsDetail.initialDumpOver&&backCells[i].isHidden){if(!this.toBeLoadedWithHiddenCells){this.toBeLoadedWithHiddenCells=true;rtfOddsDetail.exRowsWithNotLoadedCells.push(this);}
this.backHiddenCells.push(backCells[i]);}
else
backCells[i].topElement.inject(this.topElementBack);backCells[i].setParentRowObject(this);}
if(this.hasPayout){var payoutCell=rtfOddsDetail.constants.nbspCell.clone(true);payoutCell.inject(this.topElementBack);this.payoutCell=payoutCell;}
this.changedDateCell.topElement.inject(this.topElementBack);this.lastCollectedTimeCell.topElement.inject(this.topElementBack);}},setHasPayout:function(hasPayout){this.hasPayout=hasPayout;},empty:function(typeForExchange){var backCells=null;var layCells=null;if(typeForExchange==0||typeForExchange==-1)
backCells=this.backOddsCells.getValues();if(typeForExchange==1||typeForExchange==-1)
layCells=this.layOddsCells.getValues();if(backCells!=null){for(var i=0;i<backCells.length;i++){this.backOddsCells.erase(backCells[i].id);}}
if(layCells!=null){for(var i=0;i<layCells.length;i++){this.layOddsCells.erase(layCells[i].id);}}},remove:function(typeForExchange){if(typeForExchange==0||typeForExchange==-1){if(this.topElementLay!=null){this.providerCell.topElement.setProperty('rowSpan','1');if($defined(this.groupCell))
this.groupCell.topElement.setProperty('rowSpan','1');this.changedDateCell.topElement.setProperty('rowSpan','1');this.lastCollectedTimeCell.topElement.setProperty('rowSpan','1');if($defined(this.payoutCell))
this.payoutCell.setProperty('rowSpan','1');this.providerCell.topElement.inject(this.topElementLay,'top');if($defined(this.groupCell))
this.groupCell.topElement.inject(this.layTextCell.topElement,'after');if($defined(this.payoutCell))
this.payoutCell.inject(this.topElementLay.getLast(),'after');this.changedDateCell.topElement.inject(this.topElementLay.getLast(),'after');this.lastCollectedTimeCell.topElement.inject(this.topElementLay.getLast(),'after');this.topElement=this.topElementLay;}else{this.topElement=null;}
if($defined(this.topElementBack))
this.topElementBack.destroy();this.topElementBack=null;}
if(typeForExchange==1||typeForExchange==-1){if($defined(this.topElementLay))
this.topElementLay.destroy();this.topElementLay=null;if(this.topElement!=null){this.providerCell.topElement.setProperty('rowSpan','1');if($defined(this.groupCell))
this.groupCell.topElement.setProperty('rowSpan','1');this.changedDateCell.topElement.setProperty('rowSpan','1');this.lastCollectedTimeCell.topElement.setProperty('rowSpan','1');if($defined(this.payoutCell))
this.payoutCell.setProperty('rowSpan','1');}}},createRow:function(){var row=new Element('tr',{'class':this.className});row.store("obj",this);return row;},addSubRow:function(isBack,rowLine,group){if(isBack=='true'){if(!$defined(this.topElementBack))
this.topElementBack=this.createRow();this.hasBack=true;if(!$defined(this.backTextCell)){this.backTextCell=new BackOrLayTextCell(rtfOddsDetail.constants.backText);}
this.providerCell.topElement.inject(this.topElementBack,'top');this.providerCell.topElement.setProperty('rowSpan','2');this.backTextCell.topElement.inject(this.topElementBack);if($defined(this.groupCell)){this.groupCell.topElement.setProperty('rowSpan','2');this.groupCell.topElement.inject(this.topElementBack);}
var parts=rowLine.split('`');for(var i=2;i<parts.length;i++){var cellId=parts[i];var cellChunks=parts[i].split('_');var newCell=new OddsCell(cellId,false,true,2,false,false,'col_'+cellChunks[4].replace(bbUtil.firstMinus,'-'),0,'odds');this.backOddsCells.set(cellId,newCell);newCell.topElement.inject(this.topElementBack);newCell.setParentRowObject(this);group.parentCategory.addCellToColumn(newCell,'col_'+cellChunks[4].replace(bbUtil.firstMinus,'-'),group);}
this.changedDateCell.topElement.setProperty('rowSpan','2');this.lastCollectedTimeCell.topElement.setProperty('rowSpan','2');if(this.hasPayout){this.payoutCell.setProperty('rowSpan','2');this.payoutCell.inject(this.topElementBack);}
this.changedDateCell.topElement.inject(this.topElementBack);this.lastCollectedTimeCell.topElement.inject(this.topElementBack);this.topElement=this.topElementBack;this.topElementBack.inject(this.topElementLay,'before');}else{if(!$defined(this.topElementLay))
this.topElementLay=this.createRow();this.hasLay=true;if(!$defined(this.layTextCell)){this.layTextCell=new BackOrLayTextCell(rtfOddsDetail.constants.layText);}
this.layTextCell.topElement.inject(this.topElementLay);this.providerCell.topElement.setProperty('rowSpan','2');if($defined(this.groupCell))
this.groupCell.topElement.setProperty('rowSpan','2');this.changedDateCell.topElement.setProperty('rowSpan','2');this.lastCollectedTimeCell.topElement.setProperty('rowSpan','2');if(this.hasPayout)
this.payoutCell.setProperty('rowSpan','2');var parts=rowLine.split('`');for(var i=2;i<parts.length;i++){var cellId=parts[i];var cellChunks=parts[i].split('_');var newCell=new OddsCell(cellId,false,false,2,false,false,'col_'+cellChunks[4].replace(bbUtil.firstMinus,'-'),0,'odds');this.layOddsCells.set(cellId,newCell);if(!group.parentCategory.columns.get('col_'+cellChunks[4].replace(bbUtil.firstMinus,'-')).visible)
newCell.hideIt();newCell.topElement.inject(this.topElementLay);newCell.setParentRowObject(this);}
this.topElementLay.inject(this.topElement,'after');}}});var SeparatorRow=new Class({Extends:Row,initialize:function(colSpan){this.topElement=new Element('tr',{'class':'groupSeparator'});this.cells=new Array();this.separatorCell=new Element('td',{'colSpan':colSpan,'class':'groupSeparator'});this.separatorCell.inject(this.topElement);},hideIt:function(){this.topElement.addClass('hidden');},showIt:function(){this.topElement.removeClass('hidden');},setColspan:function(colSpan){this.separatorCell.setProperty('colSpan',colSpan);}});var categoryHeaderRow=new Class({Extends:Row,initialize:function(type){this.type=type;this.outcomeHeaderCells=new Hash();this.outcomeHeaderSortArrows=new Hash();this.trId='bookieHeader';this.providerText=rtfOddsDetail.constants.bookiesText;if(this.type==3){this.trId='optionHeader';this.providerText=rtfOddsDetail.constants.optionsText;}
if(this.type==2){this.trId='exchangeHeader';this.providerText=rtfOddsDetail.constants.exchangesText;}},clone:function(tipCateg,category){var clonedHeader=new categoryHeaderRow(tipCateg);clonedHeader.addFirstRow();var rowSpan=1;var parentRowId=1;if($defined(this.topElement2)){clonedHeader.addSecondRow();rowSpan=2;parentRowId=2;}
clonedHeader.addProviderHeaderCell(2,rowSpan,category.type);if(rowSpan==2)
clonedHeader.addNavHeader(this.initialColSpan);if(rtfOddsDetail.constants.hasGroup){clonedHeader.addGroupHeaderCell(rowSpan,this.groupText);}
var cellNames=this.outcomeHeaderCells.getKeys();for(var i=0;i<cellNames.length;i++){var cell=this.outcomeHeaderCells.get(cellNames[i]);var outcomeName=cell.getElement('a').get('html');clonedHeader.addOutcomeHeaderCell(category,cell.className,cellNames[i],outcomeName,parentRowId);}
if(rtfOddsDetail.constants.hasPayout)
clonedHeader.addPayoutHeaderCell(rowSpan,this.payoutText,category.type);clonedHeader.addChangedDateHeaderCell(rowSpan,this.dateText);clonedHeader.addLastCollectedTimeHeaderCell(rowSpan,this.dateText);return clonedHeader;},hack:function(){if($defined(this.topElement2)){this.navContainer.setProperty('colSpan',this.topElement2.getElements('th').length);}},returnFromHack:function(){if($defined(this.topElement2)){this.navContainer.setProperty('colSpan',rtfOddsDetail.constants.display);}},reAdjust:function(){var nonOddsCellsNumber=3+(rtfOddsDetail.constants.hasGroup?1:0)+(rtfOddsDetail.constants.hasPayout?1:0);if($defined(this.topElement2)){if(this.topElement2.getElements('th').length-nonOddsCellsNumber<=rtfOddsDetail.constants.display){this.providerCell.setAttribute('rowSpan',1);this.providerCell.inject(this.topElement2,'top');if($defined(this.groupCell)){this.groupCell.setAttribute('rowSpan',1);this.groupCell.inject(this.providerCell,'after');}
this.dateCell.setAttribute('rowSpan',1);this.dateCell.inject(this.topElement2);this.dateLCTCell.setAttribute('rowSpan',1);this.dateLCTCell.inject(this.topElement2);this.topElement.destroy();this.topElement=this.topElement2;this.topElement2=null;}}else{var headerCellsNumber=this.topElement.getElements('th').length-nonOddsCellsNumber;if(headerCellsNumber>=rtfOddsDetail.constants.display){var newRow=new Element('tr',{'id':this.trId});this.providerCell.setAttribute('rowSpan',2);this.providerCell.inject(newRow,'top');if($defined(this.groupCell)){this.groupCell.setAttribute('rowSpan',2);this.groupCell.inject(this.providerCell,'after');}
this.createNavContainer(headerCellsNumber);this.navContainer.inject(newRow);this.dateCell.setAttribute('rowSpan',2);this.dateCell.inject(newRow);this.dateLCTCell.setAttribute('rowSpan',2);this.dateLCTCell.inject(newRow);newRow.inject(this.topElement,'before');this.topElement2=this.topElement;this.topElement=newRow;}}},destroy:function(){this.outcomeHeaderCells.empty();this.outcomeHeaderSortArrows.empty();this.topElement.destroy();if($defined(this.topElement2))
this.topElement2.destroy();},addProviderHeaderCell:function(colspan,rowspan,categoryType){var providerMouseOver='displayOddsDetailToolTip("'+rtfOddsDetail.constants.sortLinkTitle+'", "sortLink-'+categoryType+'-Provider");';this.providerCell=new Element('th',{'colSpan':colspan,'class':'providerCell','rowSpan':rowspan});if(Browser.Engine.name=='trident')
this.providerLink=new Element('a',{'id':'sortLink-'+categoryType+'-Provider','class':'green','href':'javascript:nothin();',events:{'click':function(){sortColumn(null,'provider');return false;},'mouseover':function(){displayOddsDetailToolTip(rtfOddsDetail.constants.sortLinkTitle,'sortLink-'+categoryType+'-Provider');},'mouseout':function(){createOddsDetailToolTip();}}});else
this.providerLink=new Element('a',{'id':'sortLink-'+categoryType+'-Provider','onmouseover':providerMouseOver,'onmouseout':'createOddsDetailToolTip();','class':'green','href':'javascript:void(0);',events:{'click':function(){sortColumn(null,'provider');return false;}}});this.providerLink.set('text',this.providerText);var spanSortArrow=rtfOddsDetail.constants.spanSortArrow.clone(false);var spacer=rtfOddsDetail.constants.imgSpacer.cloneNode(false);spacer.setAttribute('width','8');spacer.setAttribute('height','7');spacer.style.display='none';spanSortArrow.appendChild(spacer);this.providerSortArrow=spanSortArrow;this.providerLink.inject(this.providerCell);spanSortArrow.inject(this.providerCell);this.providerCell.inject(this.topElement);},addGroupHeaderCell:function(rowspan,groupText){this.groupCell=new Element('th',{'class':'leftDashedBorder centerAligned','rowSpan':rowspan});this.groupCell.set('text',groupText);this.groupText=groupText;this.groupCell.inject(this.topElement);},addOutcomeHeaderCell:function(category,className,nameValue,outcomeName,parentRowId,outcomeFullName){var visible=true;if(category.columns.getLength()>=rtfOddsDetail.constants.display){if(className.indexOf('hidden')==-1)
className+=' hidden';visible=false;}
className+=' leftDashedBorder';var column=new Column(visible,nameValue);column.setOutcomeName(outcomeName);category.addColumn(column);var outcomeCell=new Element('th',{'class':className});var headDiv=new Element('div',{'class':'oddsHeadDiv'});var outcomeLink=new Element('a',{'id':'sortLink-'+category.type+'-'+outcomeName,'href':'javascript:void(0)',events:{'click':function(){sortColumn(nameValue,'odds');return false;},'mouseover':function(){if(rtfOddsDetail.constants.betTypeId==7||rtfOddsDetail.constants.betTypeId==24||rtfOddsDetail.constants.betTypeId==25||rtfOddsDetail.constants.betTypeId==26||rtfOddsDetail.constants.betTypeId==27||rtfOddsDetail.constants.betTypeId==28||rtfOddsDetail.constants.betTypeId==29||rtfOddsDetail.constants.betTypeId==30||rtfOddsDetail.constants.betTypeId==65||rtfOddsDetail.constants.betTypeId==66||rtfOddsDetail.constants.betTypeId==67||rtfOddsDetail.constants.betTypeId==68||rtfOddsDetail.constants.betTypeId==57){displayOddsDetailToolTip(outcomeFullName+'<br/>'+rtfOddsDetail.constants.sortLinkTitle,'sortLink-'+category.type+'-'+outcomeName);}else{displayOddsDetailToolTip(rtfOddsDetail.constants.sortLinkTitle,'sortLink-'+category.type+'-'+outcomeName);}},'mouseout':function(){createOddsDetailToolTip();}},'class':'green'});var spanSortArrow=rtfOddsDetail.constants.spanSortArrow.clone(false);var spacer=rtfOddsDetail.constants.imgSpacer.cloneNode(false);spacer.setAttribute('width','8');spacer.setAttribute('height','7');spacer.style.display='none';spanSortArrow.appendChild(spacer);outcomeLink.set('text',outcomeName);outcomeLink.inject(headDiv);spanSortArrow.inject(headDiv);headDiv.inject(outcomeCell);this.outcomeHeaderCells.set(nameValue,outcomeCell);this.outcomeHeaderSortArrows.set(nameValue,spanSortArrow);if(parentRowId==1){if($defined(this.dateCell))
outcomeCell.inject(this.dateCell,'before');else
outcomeCell.inject(this.topElement);}
else
outcomeCell.inject(this.topElement2);column.setHeaderCell(outcomeCell);return column;},addPayoutHeaderCell:function(rowspan,payoutText,categoryType){var payoutCell=new Element('th',{'class':'leftDashedBorder centerAligned','rowSpan':rowspan});var payoutLink=new Element('a',{'id':'sortLink-'+categoryType+'-Payout','class':'green','href':'javascript:void(0)',events:{'click':function(){sortColumn(null,'payout');return false;},'mouseover':function(){displayOddsDetailToolTip(rtfOddsDetail.constants.sortLinkTitle,'sortLink-'+categoryType+'-Payout');},'mouseout':function(){createOddsDetailToolTip();}}});payoutLink.set('text',payoutText);this.payoutText=payoutText;var spanSortArrow=rtfOddsDetail.constants.spanSortArrow.clone(false);var spacer=rtfOddsDetail.constants.imgSpacer.cloneNode(false);spacer.setAttribute('width','8');spacer.setAttribute('height','7');spacer.style.display='none';spanSortArrow.appendChild(spacer);this.payoutSortArrow=spanSortArrow;payoutLink.inject(payoutCell);spanSortArrow.inject(payoutCell);payoutCell.inject(this.topElement);},addChangedDateHeaderCell:function(rowspan,dateText){this.dateCell=new Element('th',{'class':'leftDashedBorder centerAligned','rowSpan':rowspan});this.dateCell.set('html',dateText);this.dateText=dateText;this.dateCell.inject(this.topElement);},addLastCollectedTimeHeaderCell:function(rowspan,dateText){this.dateLCTCell=new Element('th',{'class':'leftDashedBorder centerAligned collapsed lastCollectedTime','rowSpan':rowspan});this.dateLCTDiv=new Element('div');this.dateLCTSpan=new Element('span');this.dateLCTSpan.inject(this.dateLCTDiv);this.dateLCTSpan.set('text',dateText);this.dateLCTIcon=rtfOddsDetail.constants.iconLCT.clone(true);if(rtfOddsDetail.constants.collapsedLCT)
this.dateLCTSpan.addClass('hidden');this.dateLCTDiv.appendChild(this.dateLCTIcon);this.dateLCTCell.appendChild(this.dateLCTDiv);this.imgLCT=rtfOddsDetail.constants.moreCell.clone(true);this.imgLCT.addEvent('click',toggleLastCollectedTimeCell);this.dateLCTCell.appendChild(this.imgLCT);this.dateLCTText=dateText;this.dateLCTCell.inject(this.topElement);},addNavHeader:function(colspan){this.createNavContainer(colspan);this.navContainer.inject(this.topElement);},createNavContainer:function(colspan){this.initialColSpan=colspan;this.navContainer=new Element('th',{'class':'navOverflow','colSpan':rtfOddsDetail.constants.display,'styles':{'height':'10px','padding':'0px','width':'410px'}});var navTable=new Element('table',{'class':'width100'});var navtbody=new Element('tbody');var row=new Element('tr');var leftCell=new Element('td',{'styles':{'height':'10px','width':'9px','padding':'0px','border-top':'0px'}});var leftBtnDiv=new Element('div',{'class':'leftBtn',events:{'click':function(){moveScrollSlider(-1);}}});leftBtnDiv.inject(leftCell);leftCell.inject(row);var centerCell=new Element('td',{'styles':{'height':'10px','padding':'0px','border':'0px'}});var scrollBarX=new Element('div',{'class':'scrollBarX','id':this.trId+'ScrollX'});scrollBarX.inject(centerCell);centerCell.inject(row);var rightCell=new Element('td',{'styles':{'height':'10px','width':'9px','padding':'0px','border':'0px'}});var rightBtnDiv=new Element('div',{'class':'rightBtn',events:{'click':function(){moveScrollSlider(1);}}});rightBtnDiv.inject(rightCell);rightCell.inject(row);row.inject(navtbody);navtbody.inject(navTable);navTable.inject(this.navContainer);},addFirstRow:function(){this.topElement=new Element('tr',{'id':this.trId});},addSecondRow:function(){this.topElement2=new Element('tr',{'id':this.trId+'1'});}});var Cell=new Class({Extends:BetbrainNode,initialize:function(id){this.id=id;this.isOddsCell=false;this.isPayoutCell=false;this.isChangeDateCell=false;},setBgColor:function(color){this.topElement.style.backgroundColor=color;},setRowSpan:function(rowSpan){this.topElement.rowSpan=rowSpan;},setParentRowObject:function(row){this.parentRow=row;},getParentRow:function(){if($defined(this.parentRow)){var topRow=this.parentRow.topElement;if(!$defined(topRow))
topRow=this.parentRow.topElementBack;if(!$defined(topRow))
topRow=this.parentRow.topElementLay;return topRow;}
else
return this.topElement.parentNode;},hideIt:function(){if(rtfOddsDetail.initialDumpOver)
this.topElement.setStyle('display','none');},removeIt:function(){if($defined(this.parentRow)){this.parentRow.removeCell(this);}
this.topElement.destroy();},showIt:function(){if(Browser.Engine.name=='trident')
this.topElement.setStyle('display','inline-block');else
this.topElement.setStyle('display','table-cell');}});var ProviderCell=new Class({Extends:Cell,initialize:function(type,showInfo,showPromoOffer,compact,hideLink,forceText,forceAllText,forceShowLogo,isPremium,showCurrency,currency,pId,pName,pNameLink,siteId){this.showInfo=showInfo;this.showPromoOffer=showPromoOffer;this.promoHeader=rtfOddsDetail.comProviderHash.get(pId).promoHeader;this.compact=compact;this.hideLink=hideLink;this.forceAllText=forceAllText;this.forceShowLogo=forceShowLogo;this.isPremium=isPremium;this.showCurrency=showCurrency;this.providerId=pId;this.providerName=pName;this.providerNameLink=pNameLink;this.colspan=1;if(type==1)
this.colspan=2;this.topElement=rtfOddsDetail.constants.providerCell.cloneNode(false);this.topElement.setProperty('colspan',this.colspan);this.topElement.setStyle('padding-top','4px');this.topElement.setStyle('padding-bottom','4px');var providerHolder=null;var divContainer=new Element('div');divContainer.setStyle('white-space','normal');var divHelper=new Element('div',{'class':'oddsDivBookie'});if(hideLink){providerHolder=new Element('span');if(compact)
providerHolder.addClass('padder5px');}else{providerHolder=rtfOddsDetail.constants.linkProviderHolder.clone(false);providerHolder.setProperty('href','/trackingLink.do?dealerId='+pId+'&site='+siteId);providerHolder.set('styles',{'padding-left':'0px'});if(compact)
providerHolder.addClass('padder5px');}
if(forceAllText)
providerHolder.set('text',pName);else if((rtfOddsDetail.constants.showProviderLogo&&rtfOddsDetail.initialDumpOver)||(!rtfOddsDetail.initialDumpOver&&(forceShowLogo||(!forceText&&isPremium)))){if(!rtfOddsDetail.initialDumpOver)
rtfOddsDetail.constants.showProviderLogo=true;var logo=new Element('img',{'src':bbGlobal.gfxServer+'/gfx/pics/bookielogos/'+pId+'.gif','title':bbGlobal.txtGoTo+' '+pName+'!','width':75,'height':16,events:{'error':function(){this.getParent().set('text',this.getAttribute('title'));}}});logo.inject(providerHolder);logo.setAttribute('align','left');}else
providerHolder.set('text',pName);if(pId==3000021&&!bbGlobal.isBOV){var aditionalImg=new Element('img',{'src':'http://serve.williamhill.com/promoRedirect?member=69462H&campaign=DEFAULT&channel=DEFAULT&zone=231721248&lp=0'});aditionalImg.setStyles({'display':'none'});aditionalImg.injectInside(providerHolder);}
providerHolder.inject(divHelper);divHelper.inject(divContainer);if(!compact){divHelper=new Element('div',{'class':'oddsDivHelper'});if(rtfOddsDetail.constants.isLoggedIn){var imgHideProvider=$(rtfOddsDetail.constants.hideProvider.cloneNode(false));if(bbGlobal.portalId!=0&&bbGlobal.portalId!=1162)
imgHideProvider.set('styles',{'padding-left':'3px','cursor':'pointer','display':'none'});else
imgHideProvider.set('styles',{'padding-left':'3px','cursor':'pointer'});imgHideProvider.setAttribute('title',rtfOddsDetail.constants.removeBookieFromList);if(rtfOddsDetail.constants.isBov)
imgHideProvider.setAttribute('align','right');var url=window.location.pathname;if(window.location.hash!='')
url=window.location.hash.substring(1);var index=url.indexOf('?');if(index>-1)
url=url.substring(0,index);imgHideProvider.addEvent('click',function(){loadPage(url+'?provhide='+pId)});divHelper.appendChild(imgHideProvider);}
if(showInfo){var aInfo=$(rtfOddsDetail.constants.aInfo.cloneNode(false));aInfo.setAttribute('href','/bookie-info/'+this.providerNameLink+'/');aInfo.setAttribute('title',rtfOddsDetail.constants.visitBookieInfo+this.providerName);aInfo.set('styles',{'padding-left':'0px'});var infoIcon=$(rtfOddsDetail.constants.infoIcon.cloneNode(false));infoIcon.set('styles',{'padding-left':'3px'});if(rtfOddsDetail.constants.isBov)infoIcon.setAttribute('align','right');aInfo.appendChild(infoIcon);divHelper.appendChild(aInfo);if(!rtfOddsDetail.constants.isBov&&this.showPromoOffer){var aDollar=$(rtfOddsDetail.constants.aDollar.cloneNode(false));aDollar.set('styles',{'padding-left':'0px'});var infoDollarIcon=$(rtfOddsDetail.constants.infoDollarIcon.cloneNode(false));urlPromoOffer='/promo-offers/';infoDollarIcon.set('styles',{'padding-left':'3px','cursor':'pointer'});infoDollarIcon.setAttribute('title',translateHTMLSymbols(this.promoHeader));infoDollarIcon.addEvent('click',function(e){bbGlobal.promooffer=pId;if(bbGlobal.portalId!=0&&bbGlobal.portalId!=1162)
popuppromo(pId,bbGlobal.portalId);else
loadPage(urlPromoOffer);});aDollar.appendChild(infoDollarIcon);divHelper.appendChild(aDollar);}}else{var imgSpacer=rtfOddsDetail.constants.imgSpacer.cloneNode(false);divHelper.appendChild(imgSpacer);}
if(rtfOddsDetail.constants.isBov)
divHelper.setStyle('float','right');divContainer.appendChild(divHelper);var providerFromHash=rtfOddsDetail.comProviderHash.get(pId);if(providerFromHash!=null){if(providerFromHash.hasLive==true&&rtfOddsDetail.constants.eventStatus!=2){var imgLive=rtfOddsDetail.constants.liveCoverageImg.clone(false);imgLive.setAttribute('title',translateHTMLSymbols(this.providerName+rtfOddsDetail.constants.liveTooltip));if(rtfOddsDetail.constants.isBov)
imgLive.inject(divHelper,'before');else
imgLive.inject(divHelper,'after');}}}
if(showCurrency){var currencyDiv=document.createElement('div');currencyDiv.className='exchangeCurrency';currencyDiv.innerHTML='('+currency+')';divContainer.appendChild(currencyDiv);}
divContainer.inject(this.topElement);},getProviderName:function(){return this.providerName;}});var GroupCell=new Class({Extends:Cell,initialize:function(groupText){this.topElement=new Element('td',{'class':'centerAligned leftDashedBorder'});this.topElement.appendText(groupText);this.groupValue=groupText;this.isGroupCell=true;}});var TextCell=new Class({Extends:Cell,initialize:function(text){this.topElement=new Element('td',{'class':'leftAligned'});this.topElement.appendText(text);this.textValue=text;},getText:function(){return this.textValue;}});var BackOrLayTextCell=new Class({Extends:Cell,initialize:function(text){this.topElement=new Element('td',{'class':'leftAligned'});this.topElement.setStyle('padding-left','6px');this.topElement.appendText(text);this.textValue=text;},getText:function(){return this.textValue;}});var ProbabilityCell=new Class({Extends:TextCell,initialize:function(text,columnHashName){this.parent(text);if(text=='')
text=0;this.value=parseFloat(text);this.columnHashName=columnHashName;},updateValue:function(probValue){probValue=(parseFloat(probValue)*100).toFixed(0);this.topElement.set('text',probValue+'%');this.value=parseFloat(probValue);}});var OddsCell=new Class({initialize:function(id,showHistory,isBack,providerType,isK5,showBetSlip,nameValue,direction,className,betOffId,outSEId){this.id=id;this.showHistory=showHistory;this.isBack=isBack;this.isOddsCell=true;this.isExchange=false;this.isOption=false;this.isBookmaker=false;this.betOffId=betOffId;this.outSEId=outSEId;if(!rtfOddsDetail.initialDumpOver){this.isHidden=false;if(className.indexOf('hidden')!=-1){this.isHidden=true;if(providerType==1)
rtfOddsDetail.notLoadedCells.push(this);}}
var idParts=id.split('_');var idPartsLen=idParts.length;this.providerId=idParts[idPartsLen-3];this.bogId=idParts[idPartsLen-4];switch(providerType){case 1:this.isBookmaker=true;break;case 2:this.isExchange=true;break;case 3:this.isOption=true;break;}
this.showBetSlip=showBetSlip;this.isK5=isK5;this.oddsValue=-0.01;this.oddsStatusId=0;this.slotEUValues=[];this.slotEUVolumes=[];this.colName=nameValue;this.topElement=rtfOddsDetail.constants.oddsCell.clone(false);this.topElement.className=className;this.arrowImg=null;this.arrowImgInjected=false;switch(direction){case-1:this.arrowImg=rtfOddsDetail.constants.downArrowImgSrc;this.classEffect='down';this.topElement.addClass("down");break;case 1:this.arrowImg=rtfOddsDetail.constants.upArrowImgSrc;this.classEffect='up';this.topElement.addClass("up");break;}
if(direction==-1||direction==1){var idArrow='arrow_'+globalBetbrain.arrowCounter;this.initialIdArrow=idArrow;this.topElement.setProperty('id',idArrow);globalBetbrain.arrowCounter+=1;}},setBgColor:function(color){this.topElement.style.backgroundColor=color;},setRowSpan:function(rowSpan){this.topElement.rowSpan=rowSpan;},setParentRowObject:function(row){this.parentRow=row;},getParentRow:function(){if($defined(this.parentRow)){var topRow=this.parentRow.topElement;if(!$defined(topRow))
topRow=this.parentRow.topElementBack;if(!$defined(topRow))
topRow=this.parentRow.topElementLay;return topRow;}
else
return this.topElement.parentNode;},hideIt:function(){if(rtfOddsDetail.initialDumpOver)
this.topElement.setStyle('display','none');},removeIt:function(){if($defined(this.parentRow)){this.parentRow.removeCell(this);}
this.topElement.destroy();},showIt:function(){if(Browser.Engine.name=='trident')
this.topElement.setStyle('display','inline-block');else
this.topElement.setStyle('display','table-cell');},sOCD:function(ocd,interval){this.oddsChangedDateLong=ocd;this.oddsChangedDate=bbUtil.getFormatedDateToolTip(this.oddsChangedDateLong);if(interval!=-1){setTimeout("hideArrow('"+this.initialIdArrow+"')",globalBetbrain.interval-interval);}},sO:function(oid){this.outcomeId=oid;},fillAndShowToolTip:function(){if(!$defined(this.tooltipspan)){window.status=this.id;return false;}
var noSlots=this.slotEUValues.length;if(this.oddsStatusId==0)
return false;var topLineSpan=new Element('span',{'styles':{'margin-bottom':'3px','display':'block'}});var netOdds=this.oddsValue;var commissionObj=rtfOddsDetail.comProviderHash.get(this.providerId);if(this.oddsStatusId==1){if(rtfOddsDetail.constants.isWithCommission)
netOdds=this.getNetOdds(parseFloat(this.oddsValue),commissionObj.comission,commissionObj.commissionRule);netOdds=showOddsInProperCurrency(netOdds);}
else if(this.oddsStatusId==2)
netOdds='SP';else if(this.oddsStatusId==3)
netOdds='NR';if(this.oddsStatusId!=4){topLineSpan.set('text','Odds '+netOdds+' valid '+bbUtil.getTextTimeDifference(this.parentRow.getLastCollectedTime())+' ago');var currentOddsText=rtfOddsDetail.constants.textLastValue+' '+netOdds+' since '+($defined(this.oddsChangedDate)?this.oddsChangedDate:bbUtil.getFormatedDateToolTip(this.oddsChangedDateLong));topLineSpan.appendChild(rtfOddsDetail.constants.htmlBR.cloneNode(false));topLineSpan.appendText(currentOddsText);}
else{topLineSpan.set('text','No odds, valid '+bbUtil.getTextTimeDifference(this.parentRow.getLastCollectedTime())+' ago');var currentOddsText='No odds since '+($defined(this.oddsChangedDate)?this.oddsChangedDate:bbUtil.getFormatedDateToolTip(this.oddsChangedDateLong));topLineSpan.appendChild(rtfOddsDetail.constants.htmlBR.cloneNode(false));topLineSpan.appendText(currentOddsText);}
if($defined(this.oldHistValue)){if(this.oldStatusId==1){var oldOddsText='';var oldNetVal=this.oldHistValue;if(oldNetVal!=-0.01){if(rtfOddsDetail.constants.isWithCommission)
oldNetVal=this.getNetOdds(parseFloat(this.oldHistValue),commissionObj.comission,commissionObj.commissionRule);oldOddsText=rtfOddsDetail.constants.oldOddsText+' '+showOddsInProperCurrency(parseFloat(oldNetVal))+(this.oddsStatusId==1?' since ':' until ')+this.oldHistDateText;topLineSpan.appendChild(rtfOddsDetail.constants.htmlBR.cloneNode(false));topLineSpan.appendText(oldOddsText);}}
else if(this.oldStatusId>1){var oldOddsTxt='';if(this.oldStatusId==2)
oldOddsTxt='SP';else if(this.oldStatusId==3)
oldOddsTxt='NR';else if(this.oldStatusId==4)
oldOddsText='-';oldOddsText=rtfOddsDetail.constants.oldOddsText+' '+oldOddsText+' since '+this.oldHistDateText;topLineSpan.appendChild(rtfOddsDetail.constants.htmlBR.cloneNode(false));topLineSpan.appendText(oldOddsText);}}
topLineSpan.injectInside(this.tooltipspan);if(this.oddsStatusId!=4&&this.showBetSlip&&bbGlobal.disableDirectBettingLinks!=1){var betSlipSpan=null;betSlipSpan=new Element('a',{'href':'javascript:void(0);'});betSlipSpan.set('text',rtfOddsDetail.constants.betsliplinktext);var parentSpan=new Element('span',{'styles':{'margin-bottom':'3px','display':'block'}});betSlipSpan.inject(parentSpan);parentSpan.inject(this.tooltipspan);betSlipSpan.addEvent('click',function(){popupslip(this.providerId,this.betSlipWindowWidth,this.betSlipWindowHeight,this.bogId,this.isBack);return false;}.bind(this));}
if($defined(this.outcomeId)&&rtfOddsDetail.comProviderHash.get(this.providerId).recordBet){var oddsValuePlace=null;var oddsValue=this.oddsValue.toFixed(2);if($defined(this.oddsValueSpan)){if(Browser.Engine.name=='trident')
oddsValue=this.oddsValueSpan.data;else
oddsValue=this.oddsValueSpan.textContent;if(oddsValue=='SP'){oddsValue=0.0;}
if(oddsValue=='NR'){oddsValue=0.0;}}
var rLink=null;var parameter='-999.888';if(rtfOddsDetail.constants.hasGroup){parameter=this.parentRow.groupCell.groupValue;parameter=parameter.replace(",","p");}
var betText=rtfOddsDetail.oddsTableModel.categories[0].columns.get(this.colName).outcomeName;rLink=new Element('a',{'href':'javascript:void(0);','events':{'click':function(){popuprecordbet(this.providerId,600,425,this.outcomeId,betText,(this.isBack?1:0),oddsValue,rtfOddsDetail.constants.recortBetBigText+parameter);return false;}.bind(this)}});rLink.set('text',rtfOddsDetail.constants.recordbet);var parentSpan=new Element('span',{'styles':{'margin-bottom':'3px','display':'block'}});rLink.inject(parentSpan);parentSpan.inject(this.tooltipspan);}
if(!this.isBookmaker&&noSlots>0){var textSlot=new Element('span');if(this.isBack)
textSlot.set('text',rtfOddsDetail.constants.availableToBack);else
textSlot.set('text',rtfOddsDetail.constants.availableToLay);textSlot.inject(this.tooltipspan);this.tooltipspan.appendChild(rtfOddsDetail.constants.htmlBR.cloneNode(false));if(this.oddsStatusId==1){for(var i=0;i<noSlots;i++){var slot=new Element('span');var netVal=this.slotEUValues[i];if(rtfOddsDetail.constants.isWithCommission){var netVal=this.getNetOdds(parseFloat(this.slotEUValues[i]),commissionObj.comission,commissionObj.commissionRule);}
if(parseFloat(this.slotEUVolumes[i])>0)
slot.set('text',showOddsInProperCurrency(parseFloat(netVal))+' ('+this.convert(this.slotEUVolumes[i])+')');else
slot.set('text',showOddsInProperCurrency(parseFloat(netVal)));slot.inject(this.tooltipspan);this.tooltipspan.appendChild(rtfOddsDetail.constants.htmlBR.cloneNode(false));}}else if(this.oddsStatusId>=2){var slot=new Element('span');var netVal='';if(this.oddsStatusId==2)
netVal='SP';else if(this.oddsStatusId==3)
netVal='NR';slot.set('text',netVal);slot.inject(this.tooltipspan);this.tooltipspan.appendChild(rtfOddsDetail.constants.htmlBR.cloneNode(false));}}
if($defined(this.betOffId)&&this.betOffId!=null&&this.betOffId!=''){var parentBetSpan=new Element('span',{'styles':{'margin-bottom':'3px','display':'block','color':'#70705A'}});parentBetSpan.set('text',"BettingOffer: "+this.betOffId);parentBetSpan.inject(this.tooltipspan);}
if($defined(this.outSEId)&&this.outSEId!=null&&this.outSEId!=''){var parentBetSpan=new Element('span',{'styles':{'margin-bottom':'3px','display':'block','color':'#70705A'}});parentBetSpan.set('text',"Outcome: "+this.outSEId);parentBetSpan.inject(this.tooltipspan);}
return true;},setHistory:function(oldOddsValue,oldDate,oldStatusId){this.oldStatusId=oldStatusId;this.oldHistValue=oldOddsValue;this.oldHistDateText=oldDate;},addSlot:function(slotValue,slotVolume){this.slotEUValues.push(slotValue);this.slotEUVolumes.push(slotVolume);},initBetSlip:function(providerId,width,height,bogId){this.providerId=providerId;this.betSlipWindowWidth=width;this.betSlipWindowHeight=height;this.bogId=bogId;},convert:function(volume){var c1Rate=rtfOddsDetail.exRateHash.get(this.currency);var usercurrency=rtfOddsDetail.comProviderHash.get(this.providerId).userCurrency;var c2Rate=rtfOddsDetail.exRateHash.get(usercurrency);var rez=(parseFloat(volume)*(parseFloat(c2Rate)/parseFloat(c1Rate))).toFixed(0);if(rez>=1000&&rez<10000)
rez=rez.charAt(0)+rtfOddsDetail.constants.groupSeparatorChar+rez.substr(1);if(rez>=10000&&rez<100000)
rez=rez.substr(0,2)+rtfOddsDetail.constants.groupSeparatorChar+rez.substr(2);if(rez>=100000&&rez<1000000)
rez=rez.substr(0,3)+rtfOddsDetail.constants.groupSeparatorChar+rez.substr(3);if(rez>=1000000)
rez=rez.substr(0,3)+rtfOddsDetail.constants.groupSeparatorChar+rez.substr(3,3)+rtfOddsDetail.constants.groupSeparatorChar+rez.substr(6);return rez;},setOddsVolumeSpan:function(){this.volumeSpan=new Element('span',{'class':'exchVolume'});this.volumeSpan.set('text','('+this.volume+')');this.volumeBR=rtfOddsDetail.constants.htmlBR.cloneNode(false);this.topElement.appendChild(this.volumeBR);this.topElement.appendChild(this.volumeSpan);},sV:function(volume,currency){if(!this.isK5){this.currency=currency;this.volume=this.convert(volume);if(!this.isHidden&&this.oddsStatusId==1){this.setOddsVolumeSpan();}}},maxit:function(){this.topElement.addClass('max');},init:function(){if($defined(this.oddsValueSpan)){if($defined(this.volumeSpan)){this.topElement.insertBefore(this.oddsValueSpan,this.volumeBR);}else
this.topElement.appendChild(this.oddsValueSpan);if(this.showBetSlip||$defined(this.oldHistValue)||(!this.isBookmaker&&this.slotEUValues.length>=0)||($defined(this.outcomeId)&&rtfOddsDetail.comProviderHash.get(this.providerId).recordBet))
this.topElement.addClass('betslip');else{if(rtfOddsDetail.initialDumpOver)
this.topElement.removeClass('betslip');}}
this.topElement.store('obj',this);},sOV:function(oddsValue,oddsStatusId){this.oddsStatusId=oddsStatusId;if(!this.isHidden)
this.oddsValueSpan=document.createTextNode('');if(oddsStatusId!=1){oddsValue=0;this.setOddsValueSpan(oddsValue,oddsStatusId);this.oddsValue=0.0;}
else{if($defined(oddsValue)){var netOdds=oddsValue;if(rtfOddsDetail.constants.isWithCommission){var commissionObj=rtfOddsDetail.comProviderHash.get(this.providerId);netOdds=this.getNetOdds(parseFloat(oddsValue),commissionObj.comission,commissionObj.commissionRule);}
if(!this.isHidden)
this.setOddsValueSpan(netOdds,oddsStatusId);this.oddsValue=parseFloat(oddsValue);}}},setOddsValueSpan:function(oddsValue,oddsStatusId){if(!$defined(this.oddsValueSpan))
return;if(oddsStatusId==1&&oddsValue!=0.0){if(Browser.Engine.name=='trident')
this.oddsValueSpan.data=showOddsInProperCurrency(oddsValue);else
this.oddsValueSpan.textContent=showOddsInProperCurrency(oddsValue);}else{var text='';if(oddsStatusId==2)
text='SP';else if(oddsStatusId==3)
text='NR';else if(oddsStatusId==4)
text='-';if(Browser.Engine.name=='trident')
this.oddsValueSpan.data=text;else
this.oddsValueSpan.textContent=text;}},unHide:function(){this.isHidden=false;this.oddsValueSpan=document.createTextNode('');if(this.oddsStatusId==1){var netOdds=this.oddsValue;if(rtfOddsDetail.constants.isWithCommission){var commissionObj=rtfOddsDetail.comProviderHash.get(this.providerId);netOdds=this.getNetOdds(parseFloat(this.oddsValue),commissionObj.comission,commissionObj.commissionRule);}
this.setOddsValueSpan(netOdds,this.oddsStatusId);}
else
this.setOddsValueSpan(this.oddsValue,this.oddsStatusId);if($defined(this.volume)&&!this.isBookmaker&&this.oddsStatusId==1){this.setOddsVolumeSpan();}
this.init();},updateOddsValue:function(oddsValue,oddsStatusId){if(!$defined(this.oddsValueSpan)){this.oddsValueSpan=document.createTextNode('');this.topElement.appendChild(this.oddsValueSpan);}
this.setOddsValueSpan(oddsValue,oddsStatusId);},formatOdds:function(){if(!$defined(this.oddsValueSpan))
return;this.updateOddsValue(this.oddsValue,this.oddsStatusId);},applyCommission:function(commission,commissionRule){if(!this.isExchange)
return;if(this.oddsStatusId!=1)
return;if(!$defined(this.oddsValueSpan)&&this.oddsStatusId!=1)
return;var netOdds=this.getNetOdds(this.oddsValue,commission,commissionRule);this.updateOddsValue(netOdds,this.oddsStatusId);rtfOddsDetail.constants.isWithCommission=true;this.commission=commission;this.commissionRule=commissionRule;},getNetOdds:function(oddsValue,commission,commissionRule){if(oddsValue<=1)
return;var netOdds=oddsValue;if(commissionRule==0){if(this.isBack){netOdds=1+(oddsValue-1)*(1-commission);}else{netOdds=(oddsValue-commission)/(1-commission);}}
if(commissionRule==1)
netOdds=oddsValue*(1-commission);return netOdds;},resetCommission:function(){if(!this.isExchange)
return;if(this.oddsStatusId!=1)
return;if(!$defined(this.oddsValueSpan)&&this.oddsValue<1)
return;this.updateOddsValue(this.oddsValue,this.oddsStatusId);rtfOddsDetail.constants.isWithCommission=false;},updateCell:function(newOddsValue,newOddsDate,newStatusId,oldOddsValue,oldOddsDate,oldOddsStatusId,direction,boId,outSeId,wholeLine){this.parentRow.changedDateCell.setDate(newOddsDate);this.effeCounter=100;if($defined(this.arrowEffect)){this.arrowEffect.set('background-image','url('+this.arrowImg+')');}
if($defined(this.blinkOddsValue)){}
this.oddsValue=parseFloat(newOddsValue);this.oddsStatusId=newStatusId;var netOdds=this.oddsValue;var netOldOdds=oldOddsValue;var commissionObj=null;if(rtfOddsDetail.constants.isWithCommission){var commissionObj=rtfOddsDetail.comProviderHash.get(this.providerId);if(newStatusId==1)
netOdds=this.getNetOdds(parseFloat(netOdds),commissionObj.comission,commissionObj.commissionRule);}
newOddsDate=bbUtil.getFormatedDateToolTip(newOddsDate);this.oddsChangedDate=newOddsDate;var hasOdds=true;if(!$defined(this.oddsValueSpan)&&this.oddsStatusId!=1)
hasOdds=false;var parts=wholeLine.split('`');this.showBetSlip=parts[15]=='true'?true:false;this.betOffId=boId;this.outSEId=outSeId;this.outcomeId=parts[16];if(oldOddsValue.length>1&&oldOddsDate.length>2)
this.setHistory(netOldOdds,bbUtil.getFormatedDateToolTip(oldOddsDate),oldOddsStatusId);if(!hasOdds){this.oddsValueSpan=document.createTextNode('');this.setOddsValueSpan(netOdds,this.oddsStatusId);if(this.showBetSlip){if($defined(parts[17])&&parts[17].length>5){var betSlipParts=parts[17].split('_');this.initBetSlip(this.providerId,betSlipParts[1],betSlipParts[2],betSlipParts[0]);}}
this.init();if(direction==-1){if(!$defined(this.arrowImg))
this.arrowImg=rtfOddsDetail.constants.spcArrowImgSrc;this.arrowImg=rtfOddsDetail.constants.downArrowImgSrc;var idArrow='arrow_'+globalBetbrain.arrowCounter;this.topElement.setProperty('id',idArrow);globalBetbrain.arrowCounter+=1;setTimeout("hideArrow('"+idArrow+"')",globalBetbrain.interval);this.topElement.addClass("down");this.topElement.removeClass("up");}
else if(direction==1){if(!$defined(this.arrowImg))
this.arrowImg=rtfOddsDetail.constants.spcArrowImgSrc;this.arrowImg=rtfOddsDetail.constants.upArrowImgSrc;var idArrow='arrow_'+globalBetbrain.arrowCounter;this.topElement.setProperty('id',idArrow);globalBetbrain.arrowCounter+=1;setTimeout("hideArrow('"+idArrow+"')",globalBetbrain.interval);this.topElement.removeClass("down");this.topElement.addClass("up");}
else{if(!$defined(this.arrowImg))
this.arrowImg=rtfOddsDetail.constants.spcArrowImgSrc;this.arrowImg=rtfOddsDetail.constants.spcArrowImgSrc;this.topElement.removeClass("down");this.topElement.removeClass("up");}}else{this.updateOddsValue(netOdds,this.oddsStatusId);if(direction==-1){if(!$defined(this.arrowImg))
this.arrowImg=rtfOddsDetail.constants.spcArrowImgSrc;this.arrowImg=rtfOddsDetail.constants.downArrowImgSrc;var idArrow='arrow_'+globalBetbrain.arrowCounter;this.topElement.setProperty('id',idArrow);globalBetbrain.arrowCounter+=1;setTimeout("hideArrow('"+idArrow+"')",globalBetbrain.interval);this.topElement.addClass("down");this.topElement.removeClass("up");}
else if(direction==1){if(!$defined(this.arrowImg))
this.arrowImg=rtfOddsDetail.constants.spcArrowImgSrc;this.arrowImg=rtfOddsDetail.constants.upArrowImgSrc;var idArrow='arrow_'+globalBetbrain.arrowCounter;this.topElement.setProperty('id',idArrow);globalBetbrain.arrowCounter+=1;setTimeout("hideArrow('"+idArrow+"')",globalBetbrain.interval);this.topElement.removeClass("down");this.topElement.addClass("up");}
else{if(!$defined(this.arrowImg))
this.arrowImg=rtfOddsDetail.constants.spcArrowImgSrc;this.arrowImg=rtfOddsDetail.constants.spcArrowImgSrc;this.topElement.removeClass("down");this.topElement.removeClass("up");}
if($defined(this.oddsValueSpan)&&this.oddsStatusId==1){if(this.showBetSlip||$defined(this.oldHistValue)||(!this.isBookmaker&&this.slotEUValues.length>0)||($defined(this.outcomeId)&&rtfOddsDetail.comProviderHash.get(this.providerId).recordBet))
this.topElement.addClass('betslip');else
this.topElement.removeClass('betslip');}}
if(this.isExchange){this.currency=parts[14];if(parseFloat(parts[9])>0){if(!$defined(this.volumeSpan)){this.sV(parts[9],parts[14]);}else{if(Browser.Engine.name=='trident')
this.volumeSpan.data='('+this.convert(parts[9])+')';else
this.volumeSpan.textContent='('+this.convert(parts[9])+')';}}
var numberOfSlotsFromServer=0;if(parts[8].length>1)
numberOfSlotsFromServer++;if(parts[10].length>1)
numberOfSlotsFromServer++;if(parts[12].length>1)
numberOfSlotsFromServer++;for(var i=0;i<this.slotEUValues.length;i++){if(parts[i*2+7+1].length<2)
this.slotEUValues[i]=999.44;else{this.slotEUValues[i]=parseFloat(parts[i*2+7+1]);this.slotEUVolumes[i]=parseFloat(parts[i*2+7+1+1]);}}
for(var i=this.slotEUVolumes.length;i<numberOfSlotsFromServer;i++){this.addSlot(parts[i*2+7+1],parts[i*2+7+1+1]);}}
if(direction==-1||direction==1){this.effeCounter=0;this.applyBlinks();}
if(this.oldStatusId==4){this.applyOddsBlinks();}},applyOddsBlinks:function(){this.myFxOdds=new Fx.Tween(this.topElement,{duration:500});var on=function(){this.myFxOdds.start('color','#ffffff','#000000')}.bind(this);var off=function(){this.myFxOdds.start('color','#000000','#ffffff')}.bind(this);this.myFxOdds.start('color','#000000','#ffffff').chain(on).chain(off).chain(on).chain(off).chain(on).chain(off).chain(on).chain(off).chain(on);},applyBlinks:function(){if(!$defined(this.arrowEffect)){this.effeInterval=300;this.effeFlag=true;this.effeCounter=0;this.arrowEffect=new Fx.Tween(this.topElement,{property:'background-image',duration:this.effeInterval});this.arrowEffect.addEvent('onComplete',function(){if(this.effeCounter<=50){this.applyBlinks();this.effeCounter++;this.effeFlag=this.effeFlag?false:true;}else{this.effeCounter=0;this.arrowEffect.set('background-image','url('+this.arrowImg+')');}}.bind(this));}
if(this.effeFlag){this.arrowEffect.start('background-image','url('+this.arrowImg+')','url('+rtfOddsDetail.constants.spcArrowImgSrc+')');}else{this.arrowEffect.start('background-image','url('+rtfOddsDetail.constants.spcArrowImgSrc+')','url('+this.arrowImg+')');}},empty:function(newStatusId){if(newStatusId==0&&$defined(this.oddsValueSpan)&&this.oddsStatusId==1){this.topElement.removeClass('betslip');}
this.topElement.setStyle('color','#000000');if($defined(this.oddsValueSpan)){if(Browser.Engine.name=='trident'){if(newStatusId==4)
this.oddsValueSpan.data='-';else
this.oddsValueSpan.data='';}
else{if(newStatusId==4)
this.oddsValueSpan.textContent='-';else
this.oddsValueSpan.textContent='';}}
if($defined(this.volumeSpan)){if(Browser.Engine.name=='trident')
this.volumeSpan.data='';else
this.volumeSpan.textContent='';}
if(this.isExchange){this.slotEUValues=[];this.slotEUVolumes=[];}
this.topElement.removeClass('max');if(!$defined(this.arrowImg))
this.arrowImg=rtfOddsDetail.constants.spcArrowImgSrc;this.arrowImg=rtfOddsDetail.constants.spcArrowImg.src;this.topElement.setStyle('background','');this.topElement.removeClass("up");this.topElement.removeClass("down");if(newStatusId==4){this.setHistory(this.oddsValue,this.oddsChangedDate,this.oddsStatusId);this.oddsValue=0;}
this.oddsStatusId=newStatusId;}});var PayoutCell=new Class({Extends:Cell,initialize:function(payoutValue){this.topElement=new Element('td',{'class':'payout'});if($defined(payoutValue)&&parseFloat(payoutValue)>0){this.topElement.set('text',parseFloat(payoutValue).toFixed(0)+'%');this.payoutValue=payoutValue;}else{this.topElement.set('text','');this.payoutValue=0;}
this.isPayoutCell=true;},setText:function(value){this.payoutValue=parseFloat(value);this.topElement.set('text',value);}});var OddsChangedCell=new Class({Extends:Cell,initialize:function(dateTime){this.topElement=new Element('td',{'class':'lastChange'});if(dateTime=='00.00.0000'){this.dateTime=0;this.topElement.set('text','');}else{this.dateTime=dateTime;this.topElement.set('text',bbUtil.getFormatedDate(this.dateTime));}
this.isChangedDateCell=true;},setDateFormatted:function(dateTime){this.topElement.set('text',dateTime);},setDate:function(dateTime){this.dateTime=dateTime;this.topElement.set('text',bbUtil.getFormatedDate(this.dateTime));}});var OddsLastCollectedTimeCell=new Class({Extends:Cell,initialize:function(dateTime,jsRowId,isFake){this.topElement=new Element('td',{'class':'lastCollectedTime','id':jsRowId});this.isFake=isFake;this.jsRowId=jsRowId;this.topElement.store('cellLCT',this);this.text='';if(dateTime=='00.00.0000'){this.dateTime=0;if(!rtfOddsDetail.constants.collapsedLCT)
this.text='';}else if(dateTime=='-'){this.dateTime=0;if(!rtfOddsDetail.constants.collapsedLCT)
this.text='-';}
else{this.dateTime=dateTime;this.text=bbUtil.getFullFormatedDate(this.dateTime);}
if(!rtfOddsDetail.constants.collapsedLCT)
this.topElement.set('text',this.text);else
this.topElement.set('text','');this.isLastCollectedTimeCell=true;this.updateCellColour();},setDate:function(dateTime){if($defined(this.x))
$clear(this.x);if(dateTime=='-'){this.dateTime=0;this.text='-';this.topElement.removeClass(rtfOddsDetail.constants.yellowBgColourLCT).removeClass(rtfOddsDetail.constants.redBgColourLCT).removeClass(rtfOddsDetail.constants.greenBgColourLCT);return;}
else{this.dateTime=dateTime;this.text=bbUtil.getFullFormatedDate(this.dateTime);}
if(!rtfOddsDetail.constants.collapsedLCT){this.topElement.set('text',this.text);}
var difference=bbUtil.getDifference(this.dateTime);greenPoint=rtfOddsDetail.constants.greenIntervalLCTNonLive;redPoint=rtfOddsDetail.constants.redIntervalLCTNonLive;if(rtfOddsDetail.constants.eventStatus==2){greenPoint=rtfOddsDetail.constants.greenIntervalLCTLive;redPoint=rtfOddsDetail.constants.redIntervalLCTLive;}
this.topElement.removeClass(rtfOddsDetail.constants.yellowBgColourLCT).removeClass(rtfOddsDetail.constants.redBgColourLCT).addClass(rtfOddsDetail.constants.greenBgColourLCT);this.x=setTimeout("updateLastCollectedTime('"+this.jsRowId+"')",(greenPoint-difference)*1000);globalBetbrain.lastCTCounter+=1;},toggleText:function(){if(!rtfOddsDetail.constants.collapsedLCT)
this.topElement.set('text',this.text);else
this.topElement.set('text','');},updateCellColour:function(){if(this.isFake)
return;if($defined(this.x))
$clear(this.x);greenPoint=rtfOddsDetail.constants.greenIntervalLCTNonLive;redPoint=rtfOddsDetail.constants.redIntervalLCTNonLive;if(rtfOddsDetail.constants.eventStatus==2){greenPoint=rtfOddsDetail.constants.greenIntervalLCTLive;redPoint=rtfOddsDetail.constants.redIntervalLCTLive;}
if(!rtfOddsDetail.constants.collapsedLCT){this.topElement.set('text',this.text);}
var difference=bbUtil.getDifference(this.dateTime);this.topElement.removeClass(rtfOddsDetail.constants.greenBgColourLCT).removeClass(rtfOddsDetail.constants.yellowBgColourLCT).removeClass(rtfOddsDetail.constants.redBgColourLCT);if(difference<greenPoint){this.topElement.addClass(rtfOddsDetail.constants.greenBgColourLCT);this.x=setTimeout("updateLastCollectedTime('"+this.jsRowId+"')",(greenPoint-difference)*1000);}
else if(difference<redPoint){this.topElement.addClass(rtfOddsDetail.constants.yellowBgColourLCT);this.x=setTimeout("updateLastCollectedTime('"+this.jsRowId+"')",(redPoint-difference)*1000);}
else{this.topElement.addClass(rtfOddsDetail.constants.redBgColourLCT);}
globalBetbrain.lastCTCounter+=1;},fillAndShowToolTip:function(){if(!$defined(this.tooltipspan)){return false;}
if(this.isFake)
return false;var topLineSpan=new Element('span',{'styles':{'margin-bottom':'3px','display':'block'}});topLineSpan.appendText(this.text);topLineSpan.injectInside(this.tooltipspan);return true;}});function updateLastCollectedTime(lastCTCellId){var td=$(lastCTCellId);if($defined(td)){var lastCollectedTimeCell=td.retrieve('cellLCT');lastCollectedTimeCell.updateCellColour();}}
var CommunicationHandler1=new Class({initialize:function(url){this.url=url;},sendRequest:function(params){if($defined(this.channel)){this.channel.cancel();this.channel=null;}
if(this.url.indexOf('ajaxOtherBets')!=-1)
this.channel=new Request({url:this.url,method:'post',onSuccess:function(responseText,responseXML){fillOtherOutcomes(responseText);},onFailure:function(xhr){processFailure();}});else
this.channel=new Request({url:this.url,method:'post',autoCancel:'true',onSuccess:function(responseText,responseXML){},onFailure:function(xhr){}});this.channel.send(params+'&x='+(Math.random()*100));},cancel:function(){if($defined(this.channel))
this.channel.cancel();this.channel=null;}});var changeOddsFormatSocket=new CommunicationHandler1('http://'+document.domain+(window.location.port!=''?':'+window.location.port:'')+'/ajaxChangeOdds.do');var otherOutcomesSocket=new CommunicationHandler1('http://'+document.domain+(window.location.port!=''?':'+window.location.port:'')+'/ajaxOtherBets.do');var closeSessionSocket=new CommunicationHandler1('http://'+document.domain+'/rtfOddsDetailPage.do');var errReporterSessionSocket=new CommunicationHandler1('http://'+document.domain+'/ajaxMailer');var changeCommissionSocket=new CommunicationHandler1('http://'+document.domain+(window.location.port!=''?':'+window.location.port:'')+'/ajaxChangeCommission.do');function sortColumn(columnName,type){var categs=rtfOddsDetail.oddsTableModel.categories;var noCategs=categs.length;for(var i=0;i<noCategs;i++){if(type=='odds'){categs[i].sortOddsColumn(columnName);}
if(type=='provider'){categs[i].sortProviderColumn();}
if(type=='payout'){categs[i].sortPayoutColumn();}}}
function reformatodds(ignore_remove,format){rtfOddsDetail.constants.curentFormat=format;var categs=rtfOddsDetail.oddsTableModel.categories;var noCategs=categs.length;if(format!=0)
rtfOddsDetail.constants.groupSeparatorChar=',';else
rtfOddsDetail.constants.groupSeparatorChar='.';for(var i=0;i<noCategs;i++){categs[i].formatOdds();}
try{changeOddsTypeServerNotification('oddsdisplay='+format);}catch(e){}}
function changeFormatEuToUs(oddsValue){if(oddsValue==rtfOddsDetail.constants.even)
return(2).toFixed(2);else{oddsValue=parseFloat(oddsValue);oddsValue-=1.0;if((Math.round(oddsValue*100.0)/100.0)==1.00)
return rtfOddsDetail.constants.even;else if(oddsValue>1.00)
return""+Math.round(oddsValue*100);else
return"-"+Math.round(100/oddsValue);}}
function changeFormatEuToUk(odds){var even="Evens";if(odds<1.01)
odds=1.01;var oddsStr="";if((Math.round(odds*100.0)/100.0)==2.00)
oddsStr=even;else if(odds<20.0){oddsStr=approximateOdds(odds);}else
oddsStr=new Fraction(Math.round(odds)-1,1).fractionToString();if(oddsStr.substr(oddsStr.length-2)==("/1")&&oddsStr.length>3)
oddsStr=oddsStr.substring(0,oddsStr.length-2);return oddsStr;}
function changeFormatEuToMa(oddsValue){var malayOdds=oddsValue-1;if(oddsValue>1.9999999){if(oddsValue==2)
malayOdds=1;else
malayOdds=1/(1-oddsValue);}
return malayOdds.toFixed(2);}
function changeFormatEuToIn(oddsValue){var inOdds=oddsValue-1;if(oddsValue<=1.9999999){inOdds=1/(1-oddsValue);}
return inOdds.toFixed(2);}
function showOddsInProperCurrency(oddsValue){if(rtfOddsDetail.constants.curentFormat==0)
return oddsValue.toFixed(2);if(rtfOddsDetail.constants.curentFormat==1)
return changeFormatEuToUk(oddsValue);if(rtfOddsDetail.constants.curentFormat==3)
return changeFormatEuToUs(oddsValue);if(rtfOddsDetail.constants.curentFormat==4)
return changeFormatEuToMa(oddsValue);if(rtfOddsDetail.constants.curentFormat==5)
return changeFormatEuToIn(oddsValue);if(rtfOddsDetail.constants.curentFormat==6)
return(oddsValue-1).toFixed(2);}
function approximateOdds(odds){odds=odds-1.00;if(odds<validFractions[0].fractionToDouble())
return validFractions[0].fractionToString();var diff=0;var diffBefore=0;var fractionsNo=validFractions.length;for(var i=1;i<fractionsNo;i++){if(odds>validFractions[i].fractionToDouble())
continue;diff=validFractions[i].fractionToDouble()-odds;diffBefore=odds-validFractions[i-1].fractionToDouble();if(diff<diffBefore)
return validFractions[i].fractionToString();else
return validFractions[i-1].fractionToString();}
return"";}
function hideto1(){var categs=rtfOddsDetail.oddsTableModel.categories;var noCategs=categs.length;for(var i=0;i<noCategs;i++){categs[i].moveFirst();}}
function hide(numberOfColumns){var categs=rtfOddsDetail.oddsTableModel.categories;var noCategs=categs.length;for(var i=0;i<noCategs;i++){categs[i].moveBackward(numberOfColumns);}}
function show(numberOfColumns){var categs=rtfOddsDetail.oddsTableModel.categories;var noCategs=categs.length;for(var i=0;i<noCategs;i++){categs[i].moveForward(numberOfColumns);}}
function showlast(){var categs=rtfOddsDetail.oddsTableModel.categories;var noCategs=categs.length;for(var i=0;i<noCategs;i++){categs[i].moveLast();}}
function resetNavContainerHeadAndData(){var categs=rtfOddsDetail.oddsTableModel.categories;var noCategs=categs.length;for(var i=0;i<noCategs;i++){if($defined(categs[i].categoryHeader.navContainer)){categs[i].categoryHeader.navContainer.setAttribute('colSpan',rtfOddsDetail.constants.display);categs[i].refreshAndMoveFirst();}}}
function moveScrollSlider(step){if(rtfOddsDetail.constants.scrollBarCurrentIndex+step>rtfOddsDetail.constants.nrOfOddsColumns-rtfOddsDetail.constants.display)
{return;}
else if(rtfOddsDetail.constants.scrollBarCurrentIndex+step<0)
{return;}
if($defined(bbGlobal.bookieHeaderScrollBarSlider)||$defined(bbGlobal.exchangeHeaderScrollBarSlider)||$defined(bbGlobal.optionHeaderScrollX))
{if(step>0)
{show(step);}
else if(step<0)
{hide(-step);}
rtfOddsDetail.constants.scrollBarCurrentIndex+=step;if($defined(bbGlobal.bookieHeaderScrollBarSlider))
{bbGlobal.bookieHeaderScrollBarSlider.set(rtfOddsDetail.constants.scrollBarCurrentIndex);}
if($defined(bbGlobal.exchangeHeaderScrollBarSlider))
{bbGlobal.exchangeHeaderScrollBarSlider.set(rtfOddsDetail.constants.scrollBarCurrentIndex);}
if($defined(bbGlobal.optionHeaderScrollX))
{bbGlobal.optionHeaderScrollX.set(rtfOddsDetail.constants.scrollBarCurrentIndex);}}}
function getAbsolutePosition(el){var absoluteTop=el.getTop();var absoluteLeft=el.getLeft();return[absoluteTop,absoluteLeft];}
function processFailure(){}
function processUpdate(chunk){if(rtfOddsDetail.constants.rtfEnabled==false)
return-1;if(chunk.indexOf('reloadOddsTable')!=-1){reloadPage();return-1;}
if(chunk.length<2)
return 0;var items=chunk.split("\n");var isRTFMessage=false;try{for(var i=0;i<items.length;i++){if(items[i].length>0){items[i]=bbUtil.trimString(items[i]);var tokens=items[i].split('`');if(tokens[0].indexOf('checkSum')!=-1){globalBetbrain.checkSum=items[i].replace(/checkSum/,'');isRTFMessage=true;}
if(tokens[0]=='eventStatus'){rtfOddsDetail.constants.eventStatus=tokens[1];if(rtfOddsDetail.constants.eventStatus==2&&$defined($('liveHeader')))
$('liveHeader').innerHTML=rtfOddsDetail.constants.liveHeader;if(rtfOddsDetail.constants.eventStatus==2&&$defined($('liveCoverageTxt')))
$('liveCoverageTxt').set('html','');}
if(tokens[0]=='newScore'){var oldTimeAndScore=$('eventScore').innerHTML.trim();if(oldTimeAndScore=="")
continue;oldTimeAndScore=oldTimeAndScore.substring(oldTimeAndScore.indexOf('('),oldTimeAndScore.length);var newTimeAndScore=tokens[1].trim();$('eventScore').innerHTML=newTimeAndScore;newTimeAndScore=newTimeAndScore.substring(newTimeAndScore.indexOf('('),newTimeAndScore.length);if(oldTimeAndScore!=newTimeAndScore){soundPlayer.playSound('newGoal');}}
if(tokens[0]=='bogU'){updateBOCell(tokens[1],tokens[2],tokens[3],tokens[4],tokens[5],tokens[6],tokens[7],tokens[8],tokens[tokens.length-2],tokens[tokens.length-1],items[i]);}
if(tokens[0]=='lineLCTU'){updateLastCollectedTimeCell(tokens[1],tokens[2]);}
if(tokens[0]=='bogD'){emptyBOCell(tokens[1]);}
if(tokens[0]=='lineD'){if(rtfOddsDetail.constants.eventStatus==2)
markDeletedOddsRow(tokens[1]);else
deleteOddsRow(tokens[1]);}
if(tokens[0]=='lineC'){createOddsRow(tokens[1],items[i]);}
if(tokens[0]=='groupC'){createOddsGroup(tokens[1]);}
if(tokens[0]=='groupD'){if(rtfOddsDetail.constants.eventStatus==2)
markDeletedGroup(tokens[1]);else
deleteOddsGroup(tokens[1]);}
if(tokens[0]=='categoryC'){if(rtfOddsDetail.oddsTableModel.categories.length==0){reloadPage();return-1;}
createCategory(tokens[1]);}
if(tokens[0]=='categoryD'){if(rtfOddsDetail.constants.eventStatus==2)
markDeletedCategory(tokens[1]);else
deleteCategory(tokens[1]);}
if(tokens[0]=='opU'){updateProbability(tokens[1],tokens[2],tokens[3]);}
if(tokens[0]=='opDeleteRow'){deleteProbability(tokens[1]);}
if(tokens[0]=='opCreateRow'){createProbabilityRow(tokens[1],items[i]);}
if(tokens[0]=='columnD'){deleteColumn(tokens[1]);}
if(tokens[0]=='columnC'){createColumn(items[i]);}}}
if(!isRTFMessage){reloadPage();return-1;}
rtfOddsDetail.oddsTableModel.reIndex();var cc=computeCheckSum();if(globalBetbrain.checkSum!=cc){errReporterSessionSocket.sendRequest('mess=reqId::'+requestId+'~~jSessionId::'+jSessionId+'~~'+window.navigator.userAgent+'~~'+window.location.href+'~~'+globalBetbrain.checkSum+'~~~comp = '+cc+'--------'+chunk);reloadPage();return-1;}}catch(e){var errmsg='';if(Browser.Engine.name=='trident'){errmsg="Error name: "+e.name+". \nError description: "+e.description+". \nError number: "+(e.number&0xffff)+". \nError message: "+e.message;}
else{errmsg='<b>'+e+' at line '+e.lineNumber+'; in file '+e.fileName+'</b> '+e.stack;}
errReporterSessionSocket.sendRequest('mess=reqId::'+requestId+'~~jSessionId::'+jSessionId+'~~'+window.navigator.userAgent+'~~'+window.location.href+'~~'+errmsg);reloadPage();return-1;}
return 0;}
function createColumn(wholeLine){rtfOddsDetail.oddsTableModel.createColumn(wholeLine);}
function deleteColumn(columnId){rtfOddsDetail.oddsTableModel.deleteColumn('col_'+columnId);}
function updateProbability(idGroup,colNameHash,probValue){var bookieCateg=rtfOddsDetail.oddsTableModel.bookieCateg;if($defined(bookieCateg)){var group=bookieCateg.groups.get(idGroup);if($defined(group)){group.updateProbability('col_'+colNameHash,probValue);}}}
function deleteProbability(idGroup){var bookieCateg=rtfOddsDetail.oddsTableModel.bookieCateg;if($defined(bookieCateg)){var group=bookieCateg.groups.get(idGroup);if($defined(group)){group.deleteProbabilityRow();}}}
function createProbabilityRow(idGroup,wholeLine){var bookieCateg=rtfOddsDetail.oddsTableModel.bookieCateg;if(!$defined(bookieCateg))
return;var group=bookieCateg.groups.get(idGroup);if(!$defined(group))
return;if($defined(group.probabilityRow))
return;var probRow=new ProbabilityRow('pr_'+idGroup);if(rtfOddsDetail.constants.hasGroup){var groupCell=new GroupCell(group.getGroupValue());probRow.addGroupCell(groupCell);}
if($defined(group)){var parts=wholeLine.split('`');for(var i=2;i<parts.length;i++){probRow.addProbCell(new ProbabilityCell('','col_'+parts[i]));}
group.addProbabilityRow(probRow);}}
function updateBOCell(idCell,oldOdds,oldDate,oldOddsStatusId,changedDate,direction,statusId,odds,boId,outSeId,wholeLine){var parts=idCell.split('_');if(parts[1]=="1")
rtfOddsDetail.oddsTableModel.bookieCateg.updateCell(idCell,odds,changedDate,statusId,oldOdds,oldDate,oldOddsStatusId,direction,boId,outSeId,wholeLine);if(parts[1]=="2")
rtfOddsDetail.oddsTableModel.exCateg.updateCell(idCell,odds,changedDate,statusId,oldOdds,oldDate,oldOddsStatusId,direction,boId,outSeId,wholeLine);if(parts[1]=="3")
rtfOddsDetail.oddsTableModel.optionCateg.updateCell(idCell,odds,changedDate,statusId,oldOdds,oldDate,oldOddsStatusId,direction,boId,outSeId,wholeLine);}
function updateLastCollectedTimeCell(idCell,dateTime){var parts=idCell.split('_');if(parts[1]=="1"){if($defined(rtfOddsDetail.oddsTableModel.bookieCateg))
rtfOddsDetail.oddsTableModel.bookieCateg.updateLastCollectedTimeCell(idCell,dateTime);}
if(parts[1]=="2"){if($defined(rtfOddsDetail.oddsTableModel.exCateg))
rtfOddsDetail.oddsTableModel.exCateg.updateLastCollectedTimeCell(idCell,dateTime);}
if(parts[1]=="3"){if($defined(rtfOddsDetail.oddsTableModel.optionCateg))
rtfOddsDetail.oddsTableModel.optionCateg.updateLastCollectedTimeCell(idCell,dateTime);}}
function emptyBOCell(idCell){var parts=idCell.split('_');if(parts[1]=="1")
rtfOddsDetail.oddsTableModel.bookieCateg.emptyCell(idCell);if(parts[1]=="2")
rtfOddsDetail.oddsTableModel.exCateg.emptyCell(idCell);if(parts[1]=="3")
rtfOddsDetail.oddsTableModel.optionCateg.emptyCell(idCell);}
function deleteOddsRow(idRow){var parts=idRow.split('_');if(parts[1]=="1")
rtfOddsDetail.oddsTableModel.bookieCateg.deleteRow(idRow);if(parts[1]=="2")
rtfOddsDetail.oddsTableModel.exCateg.deleteRow(idRow);if(parts[1]=="3")
rtfOddsDetail.oddsTableModel.optionCateg.deleteRow(idRow);}
function markDeletedOddsRow(idRow){var parts=idRow.split('_');if(parts[1]=="1")
rtfOddsDetail.oddsTableModel.bookieCateg.markDeleteLine(idRow);if(parts[1]=="2")
rtfOddsDetail.oddsTableModel.exCateg.markDeleteLine(idRow);if(parts[1]=="3")
rtfOddsDetail.oddsTableModel.optionCateg.markDeleteLine(idRow);}
function createOddsRow(idRow,wholeRowLine){var parts=idRow.split('_');if(parts[1]=="1")
rtfOddsDetail.oddsTableModel.bookieCateg.createRow(idRow,wholeRowLine);if(parts[1]=="2")
rtfOddsDetail.oddsTableModel.exCateg.createRow(idRow,wholeRowLine);if(parts[1]=="3")
rtfOddsDetail.oddsTableModel.optionCateg.createRow(idRow,wholeRowLine);}
function deleteOddsGroup(idGroup){var parts=idGroup.split('_');if(parts[1]=="1")
rtfOddsDetail.oddsTableModel.bookieCateg.deleteGroup(idGroup);if(parts[1]=="2")
rtfOddsDetail.oddsTableModel.exCateg.deleteGroup(idGroup);if(parts[1]=="3")
rtfOddsDetail.oddsTableModel.optionCateg.deleteGroup(idGroup);}
function markDeletedGroup(idGroup){var parts=idGroup.split('_');if(parts[1]=="1")
rtfOddsDetail.oddsTableModel.bookieCateg.markDeletedGroup(idGroup);if(parts[1]=="2")
rtfOddsDetail.oddsTableModel.exCateg.markDeletedGroup(idGroup);if(parts[1]=="3")
rtfOddsDetail.oddsTableModel.optionCateg.markDeletedGroup(idGroup);}
function createOddsGroup(idGroup){var parts=idGroup.split('_');if(parts[1]=="1")
rtfOddsDetail.oddsTableModel.bookieCateg.createGroup(idGroup);if(parts[1]=="2")
rtfOddsDetail.oddsTableModel.exCateg.createGroup(idGroup);if(parts[1]=="3")
rtfOddsDetail.oddsTableModel.optionCateg.createGroup(idGroup);}
function createCategory(tipCateg){rtfOddsDetail.oddsTableModel.createCateg(tipCateg);}
function deleteCategory(tipCateg){rtfOddsDetail.oddsTableModel.removeCateg(tipCateg);}
function markDeletedCategory(tipCateg){rtfOddsDetail.oddsTableModel.markDeletedCategory(tipCateg);}
function removeGroupFromGroupDropDown(group,sec){var selElName=sec?'cuponSecondKey':'cuponFirstKey';var formCoupon=document.forms['couponFormDetail'];if(!$defined(formCoupon))
return;var selCouponEl=formCoupon.elements[selElName];if(!selCouponEl){return;}
var lung=selCouponEl.options.length;for(var i=0;i<lung;i++){if(selCouponEl.options[i].text==group){if(Browser.Engine.name=='trident')
selCouponEl.options[i]=null;else
selCouponEl.remove(i);break;}}
if(Browser.Engine.name=='trident'&&selCouponEl.options.length>0)
selCouponEl.selectedIndex=0;}
function appendValueToCoupon(groupValue,sec){var selElName=sec?'cuponSecondKey':'cuponFirstKey';var formCoupon=document.forms['couponFormDetail'];if(!$defined(formCoupon))
return;var selCouponEl=formCoupon.elements[selElName];try{selCouponEl.add(new Option(groupValue,groupValue),null);}
catch(ex){selCouponEl.add(new Option(groupValue,groupValue));}}
function addGroupToGroupDropDown(groupValue,group){var formCoupon=document.forms['couponFormDetail'];if(!$defined(formCoupon))
return;var selCouponEl=formCoupon.elements['cuponFirstKey'];if(!selCouponEl){return;}
var lung=selCouponEl.options.length;var beforeOption=null;var beforeIndex=null;for(var i=0;i<lung;i++){var refValue=0;if(selCouponEl.options[i].text.indexOf(',')!=-1){var parts=selCouponEl.options[i].text.split(',');refValue=(parseFloat(parts[0])+parseFloat(parts[1]))/2;}else{refValue=parseFloat(selCouponEl.options[i].text);}
if(refValue>=group.getGroupValue()){beforeOption=selCouponEl.options[i];beforeIndex=beforeOption.index;break;}}
try{selCouponEl.add(new Option(groupValue,groupValue),beforeOption);}
catch(ex){if(beforeIndex!=null)
selCouponEl.add(new Option(groupValue,groupValue),beforeIndex);else
selCouponEl.add(new Option(groupValue,groupValue));}}
function changeCommission(checkElement){if(!$defined(rtfOddsDetail.oddsTableModel.exCateg))
return;if(checkElement.checked){rtfOddsDetail.constants.isWithCommission=true;rtfOddsDetail.oddsTableModel.exCateg.applyCommission();changeCommissionSocket.sendRequest('withCommission=1');}else{rtfOddsDetail.constants.isWithCommission=false;rtfOddsDetail.oddsTableModel.exCateg.resetCommission();changeCommissionSocket.sendRequest('withCommission=0');}}
function sanitizeCommission(initialCommission){var initialCommission=parseFloat(initialCommission);if(initialCommission<0||initialCommission>=1){return 0;}
return initialCommission;}
function changeOddsTypeServerNotification(param){changeOddsFormatSocket.sendRequest('client=<%=request.getSession().getId()%>&'+param);}
function hideArrow(idArow){var ele=$(idArow);if($defined(ele)){ele.removeClass("down");ele.removeClass("up");}}
function addHiddenCellsToDOM(){if(!rtfOddsDetail.notLoadedCells)
return;var noCells=rtfOddsDetail.notLoadedCells.length;for(var i=0;i<noCells;i++){rtfOddsDetail.notLoadedCells[i].unHide();rtfOddsDetail.notLoadedCells[i].parentRow.addOddsExHiddenCell(rtfOddsDetail.notLoadedCells[i]);}
var noExRows=rtfOddsDetail.exRowsWithNotLoadedCells.length;for(var i=0;i<noExRows;i++){rtfOddsDetail.exRowsWithNotLoadedCells[i].addNotLoadedCells();}
rtfOddsDetail.initialDumpOver=true;rtfOddsDetail.notLoadedCells=null;}
function getOtherOutcomes(){setTimeout("rtfOddsDetail.isAllowedToGetOtherOutcomes=true;",60000);if(rtfOddsDetail.isAllowedToGetOtherOutcomes){otherOutcomesSocket.sendRequest('eventId='+rtfOddsDetail.constants.eventId+'&betTypeId='+rtfOddsDetail.constants.betTypeId+'&scopeId='+rtfOddsDetail.constants.scopeId);rtfOddsDetail.isAllowedToGetOtherOutcomes=false;}}
function toggleLastCollectedTimeCell(){rtfOddsDetail.constants.collapsedLCT=!rtfOddsDetail.constants.collapsedLCT;var nrCateg=rtfOddsDetail.oddsTableModel.categories.length;if(nrCateg==0)
return;for(var i=0;i<nrCateg;i++){var categ=rtfOddsDetail.oddsTableModel.categories[i];var nrCategGroups=categ.sortedGroups.length;var header=categ.categoryHeader.dateLCTSpan;var imgSRC=categ.categoryHeader.imgLCT.get('src');if(imgSRC.indexOf('more')>-1){categ.categoryHeader.dateLCTCell.addClass('expanded');categ.categoryHeader.dateLCTCell.removeClass('collapsed');categ.categoryHeader.imgLCT.set('src',rtfOddsDetail.constants.hideCellSrc);header.removeClass('hidden');categ.categoryHeader.dateLCTIcon.addClass('hidden');}
else{categ.categoryHeader.dateLCTCell.removeClass('expanded');categ.categoryHeader.dateLCTCell.addClass('collapsed');categ.categoryHeader.imgLCT.set('src',rtfOddsDetail.constants.moreCellSrc);header.addClass('hidden');categ.categoryHeader.dateLCTIcon.removeClass('hidden');}
for(var j=0;j<nrCategGroups;j++){var group=categ.sortedGroups[j];var nrGroupRows=group.oddsRows.getLength();var groupRows=group.oddsRows.getValues();for(var k=0;k<nrGroupRows;k++){var row=groupRows[k];var lastCTCellTopElement=row.lastCollectedTimeCell;lastCTCellTopElement.toggleText();}}}}
function removeAllLCTTimeout(){function updateAllLCTCellsColour(){var nrCateg=rtfOddsDetail.oddsTableModel.categories.length;if(nrCateg==0)
return;for(var i=0;i<nrCateg;i++){var categ=rtfOddsDetail.oddsTableModel.categories[i];var nrCategGroups=categ.sortedGroups.length;for(var j=0;j<nrCategGroups;j++){var group=categ.sortedGroups[j];var nrGroupRows=group.oddsRows.getLength();var groupRows=group.oddsRows.getValues();for(var k=0;k<nrGroupRows;k++){if($defined(groupRows[k].lastCollectedTimeCell.x))
clearTimeout(groupRows[k].lastCollectedTimeCell.x);}}}}}
function updateAllLCTCellsColour(){var nrCateg=rtfOddsDetail.oddsTableModel.categories.length;if(nrCateg==0)
return;for(var i=0;i<nrCateg;i++){var categ=rtfOddsDetail.oddsTableModel.categories[i];var nrCategGroups=categ.sortedGroups.length;for(var j=0;j<nrCategGroups;j++){var group=categ.sortedGroups[j];var nrGroupRows=group.oddsRows.getLength();var groupRows=group.oddsRows.getValues();for(var k=0;k<nrGroupRows;k++){groupRows[k].lastCollectedTimeCell.updateCellColour();}}}}
function fillOtherOutcomes(response){rtfOddsDetail.isAllowedToGetOtherOutcomes=false;var selEl=document.getElementById('otherOutcomesSel');selEl.options.length=0;var items=response.split("\n");for(var i=0;i<items.length-1;i++){var parts=items[i].split('~~~');selEl.options[selEl.options.length]=new Option(parts[0].substring(1,parts[0].length-1),parts[1].substring(1,parts[1].length-2));}}
function goBetType(selEl,isPortal){if(!isPortal){var url=selEl.options[selEl.selectedIndex].value;if(url=='-1')
return;if($defined($('getUpdates')))
$('getUpdates').src='/blank.jsp';loadPage(url);}else{var url=selEl.options[selEl.selectedIndex].value;if(url=='-1')
return;window.location.href=url;}}
function goprocess(){processUpdate($('mlines').value);}
function reloadPage(){if(bbGlobal.portalId==0||bbGlobal.portalId==1162){var url=window.location.pathname;var urlHash=window.location.hash;if(urlHash!='')
url=urlHash.substring(1);var indexX=url.indexOf('?x=');if(indexX>-1)
url=url.substring(0,indexX);url=url+"?x="+Math.random();loadAPage(url);}
else{var url=window.location.href;window.location.href=url;}}
function computeCheckSum(){var checkSum='';var nrCateg=rtfOddsDetail.oddsTableModel.categories.length;if(nrCateg==0||rtfOddsDetail.oddsTableModel.nrOfValidCategories==0)
return'0';var categStrings=[];for(var i=0;i<nrCateg;i++){var categString='c'
var categ=rtfOddsDetail.oddsTableModel.categories[i];categString+='`'+categ.type;var nrCategGroups=0;if(categ.validGroups==0)
continue;categString+='`'+categ.validGroups;for(var j=0;j<categ.sortedGroups.length;j++){var group=categ.sortedGroups[j];if(group.deleted==true)
continue;var groupRows=group.oddsRows.getValues();var nrCells=0;var nrOfGroupRows=0;if(group.validOddsRows==0)
continue;categString+='`'+group.validOddsRows;for(var k=0;k<group.oddsRows.getLength();k++){var row=groupRows[k];if(row.rowDeleted==true)
continue;nrOfGroupRows++;if($defined(row.backOddsCells)){var cells=row.backOddsCells.getValues();for(var l=0;l<cells.length;l++){if(cells[l].oddsStatusId>=1&&cells[l].oddsStatusId<4)
nrCells+=1;}}
if($defined(row.layOddsCells)){var cells=row.layOddsCells.getValues();for(var l=0;l<cells.length;l++){if(cells[l].oddsStatusId>=1&&cells[l].oddsStatusId<4)
nrCells+=1;}}
if($defined(row.oddsCells)){var cells=row.oddsCells.getValues();for(var l=0;l<cells.length;l++){if(cells[l].oddsStatusId>=1&&cells[l].oddsStatusId<4)
nrCells+=1;}}}
categString+='`'+nrCells;categString+='`'+($defined(group.probabilityRow)?true:false);}
categStrings[categ.type-1]=categString;}
if($defined(rtfOddsDetail.oddsTableModel.categories[0]))
checkSum+=rtfOddsDetail.oddsTableModel.categories[0].sortedColumns.length;checkSum+='`'+nrCateg;for(var i=0;i<categStrings.length;i++){if($defined(categStrings[i]))
checkSum+='`'+categStrings[i];}
return checkSum+'`';}
function nothin(){return false;}