Guest User

Untitled

a guest
Jul 22nd, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  2008 PersonalGrid Corporation <http://personalgrid.com/>
  3.  @package LivePipe UI
  4.  @url http://livepipe.net/control/tabs
  5.  @require prototype.js, livepipe.js
  6. */
  7. if("undefined"==typeof Prototype)throw"Control.Tabs requires Prototype to be loaded.";if("undefined"==typeof Object.Event)throw"Control.Tabs requires Object.Event to be loaded.";
  8. Control.Tabs=Class.create({initialize:function(a,b){if(!$(a))throw"Control.Tabs could not find the element: "+a;this.activeLink=this.activeContainer=!1;this.containers=$H({});this.links=[];Control.Tabs.instances.push(this);this.options={beforeChange:Prototype.emptyFunction,afterChange:Prototype.emptyFunction,hover:!1,linkSelector:"li a",setClassOnContainer:!1,activeClassName:"active",defaultTab:"first",autoLinkExternal:!0,targetRegExp:/#(.+)$/,showFunction:Element.show,hideFunction:Element.hide};
  9. Object.extend(this.options,b||{});(typeof("string"==this.options.linkSelector)?$(a).select(this.options.linkSelector):this.options.linkSelector($(a))).findAll(function(a){return/^#/.exec((Prototype.Browser.WebKit?decodeURIComponent(a.href):a.href).replace((Prototype.Browser.WebKit?decodeURIComponent(window.location.href):window.location.href).split("#")[0],""))}).each(function(a){this.addTab(a)}.bind(this));this.containers.values().each(Element.hide);"first"==this.options.defaultTab?this.setActiveTab(this.links.first()):
  10. "last"==this.options.defaultTab?this.setActiveTab(this.links.last()):this.setActiveTab(this.options.defaultTab);var c=this.options.targetRegExp.exec(window.location);c&&c[1]&&c[1].split(",").each(function(a){this.setActiveTab(this.links.find(function(b){return b.key==a}))}.bind(this));this.options.autoLinkExternal&&$A(document.getElementsByTagName("a")).each(function(a){if(!this.links.include(a)){var b=a.href.replace(window.location.href.split("#")[0],"");"#"==b.substring(0,1)&&this.containers.keys().include(b.substring(1))&&
  11. $(a).observe("click",function(a,b){this.setActiveTab(b.substring(1))}.bindAsEventListener(this,b))}}.bind(this))},addTab:function(a){this.links.push(a);a.key=a.getAttribute("href").replace(window.location.href.split("#")[0],"").split("/").last().replace(/#/,"");var b=$(a.key);if(!b)throw"Control.Tabs: #"+a.key+" was not found on the page.";this.containers.set(a.key,b);Event.observe(a,this.options.hover?"mouseover":"click",function(b){Event.stop(b);this.setActiveTab(a);return!1}.bind(this))},setActiveTab:function(a){if(a||
  12. "undefined"!=typeof a)"string"==typeof a?this.setActiveTab(this.links.find(function(b){return b.key==a})):"number"==typeof a?this.setActiveTab(this.links[a]):!1!==this.notify("beforeChange",this.activeContainer,this.containers.get(a.key))&&(this.activeContainer&&this.options.hideFunction(this.activeContainer),this.links.each(function(a){(this.options.setClassOnContainer?$(a.parentNode):a).removeClassName(this.options.activeClassName)}.bind(this)),(this.options.setClassOnContainer?$(a.parentNode):
  13. a).addClassName(this.options.activeClassName),this.activeContainer=this.containers.get(a.key),this.activeLink=a,this.options.showFunction(this.containers.get(a.key)),this.notify("afterChange",this.containers.get(a.key)))},next:function(){this.links.each(function(a,b){if(this.activeLink==a&&this.links[b+1])throw this.setActiveTab(this.links[b+1]),$break;}.bind(this))},previous:function(){this.links.each(function(a,b){if(this.activeLink==a&&this.links[b-1])throw this.setActiveTab(this.links[b-1]),$break;
  14. }.bind(this))},first:function(){this.setActiveTab(this.links.first())},last:function(){this.setActiveTab(this.links.last())}});Object.extend(Control.Tabs,{instances:[],findByTabId:function(a){return Control.Tabs.instances.find(function(b){return b.links.find(function(b){return b.key==a})})}});Object.Event.extend(Control.Tabs);
  15. var CropDraggable=Class.create(Draggable,{initialize:function(a,b){this.options=Object.extend({drawMethod:function(){}},b||{});this.handle=this.element=$(a);this.delta=this.currentDelta();this.dragging=!1;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},draw:function(a){var b=Element.cumulativeOffset(this.element),c=this.currentDelta();b[0]-=c[0];b[1]-=c[1];c=[0,1].map(function(c){return a[c]-b[c]-this.offset[c]}.bind(this));
  16. this.options.drawMethod(c)}}),Cropper={};
  17. Cropper.Img=Class.create({initialize:function(a,b){this.options=Object.extend({ratioDim:{x:0,y:0},minWidth:0,minHeight:0,displayOnInit:!1,onEndCrop:Prototype.emptyFunction,captureKeys:!0,onloadCoords:null,maxWidth:0,maxHeight:0,autoIncludeCSS:!1},b||{});this.img=$(a);this.clickCoords={x:0,y:0};this.resizing=this.dragging=!1;this.isWebKit=/Konqueror|Safari|KHTML/.test(navigator.userAgent);this.isIE=/MSIE/.test(navigator.userAgent);this.isOpera8=/Opera\s[1-8]/.test(navigator.userAgent);this.ratioY=
  18. this.ratioX=0;this.attached=!1;this.fixedWidth=0<this.options.maxWidth&&this.options.minWidth>=this.options.maxWidth;this.fixedHeight=0<this.options.maxHeight&&this.options.minHeight>=this.options.maxHeight;if("undefined"!=typeof this.img){this.options.autoIncludeCSS&&$$("script").each(function(a){if(a.src.match(/\/cropper([^\/]*)\.js/)){a=a.src.replace(/\/cropper([^\/]*)\.js.*/,"");var b=document.createElement("link");b.rel="stylesheet";b.type="text/css";b.href=a+"/cropper.css";b.media="screen";
  19. document.getElementsByTagName("head")[0].appendChild(b)}});if(0<this.options.ratioDim.x&&0<this.options.ratioDim.y){var c=this.getGCD(this.options.ratioDim.x,this.options.ratioDim.y);this.ratioX=this.options.ratioDim.x/c;this.ratioY=this.options.ratioDim.y/c}this.subInitialize();if(this.img.complete||this.isWebKit)this.onLoad();else Event.observe(this.img,"load",this.onLoad.bindAsEventListener(this))}},getGCD:function(a,b){return 0===b?a:this.getGCD(b,a%b)},onLoad:function(){var a=this.img.parentNode,
  20. b="";this.isOpera8&&(b=" opera8");this.imgWrap=new Element("div",{"class":"imgCrop_wrap"+b});this.north=(new Element("div",{"class":"imgCrop_overlay imgCrop_north"})).insert(new Element("span"));this.east=(new Element("div",{"class":"imgCrop_overlay imgCrop_east"})).insert(new Element("span"));this.south=(new Element("div",{"class":"imgCrop_overlay imgCrop_south"})).insert(new Element("span"));this.west=(new Element("div",{"class":"imgCrop_overlay imgCrop_west"})).insert(new Element("span"));b=[this.north,
  21. this.east,this.south,this.west];this.dragArea=new Element("div",{"class":"imgCrop_dragArea"});b.each(function(a){this.dragArea.insert(a)},this);this.handleN=new Element("div",{"class":"imgCrop_handle imgCrop_handleN"});this.handleNE=new Element("div",{"class":"imgCrop_handle imgCrop_handleNE"});this.handleE=new Element("div",{"class":"imgCrop_handle imgCrop_handleE"});this.handleSE=new Element("div",{"class":"imgCrop_handle imgCrop_handleSE"});this.handleS=new Element("div",{"class":"imgCrop_handle imgCrop_handleS"});
  22. this.handleSW=new Element("div",{"class":"imgCrop_handle imgCrop_handleSW"});this.handleW=new Element("div",{"class":"imgCrop_handle imgCrop_handleW"});this.handleNW=new Element("div",{"class":"imgCrop_handle imgCrop_handleNW"});this.selArea=new Element("div",{"class":"imgCrop_selArea"});[(new Element("div",{"class":"imgCrop_marqueeHoriz imgCrop_marqueeNorth"})).insert(new Element("span")),(new Element("div",{"class":"imgCrop_marqueeVert imgCrop_marqueeEast"})).insert(new Element("span")),(new Element("div",
  23. {"class":"imgCrop_marqueeHoriz imgCrop_marqueeSouth"})).insert(new Element("span")),(new Element("div",{"class":"imgCrop_marqueeVert imgCrop_marqueeWest"})).insert(new Element("span")),this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW,new Element("div",{"class":"imgCrop_clickArea"})].each(function(a){this.selArea.insert(a)},this);this.imgWrap.appendChild(this.img);this.imgWrap.appendChild(this.dragArea);this.dragArea.appendChild(this.selArea);
  24. this.dragArea.appendChild(new Element("div",{"class":"imgCrop_clickArea"}));a.appendChild(this.imgWrap);this.startDragBind=this.startDrag.bindAsEventListener(this);Event.observe(this.dragArea,"mousedown",this.startDragBind);this.onDragBind=this.onDrag.bindAsEventListener(this);Event.observe(document,"mousemove",this.onDragBind);this.endCropBind=this.endCrop.bindAsEventListener(this);Event.observe(document,"mouseup",this.endCropBind);this.resizeBind=this.startResize.bindAsEventListener(this);this.handles=
  25. [this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];this.registerHandles(!0);this.options.captureKeys&&(this.keysBind=this.handleKeys.bindAsEventListener(this),Event.observe(document,"keypress",this.keysBind));new CropDraggable(this.selArea,{drawMethod:this.moveArea.bindAsEventListener(this)});this.setParams()},registerHandles:function(a){for(var b=0;b<this.handles.length;b++){var c=$(this.handles[b]);if(a){var d=!1;if(this.fixedWidth&&this.fixedHeight)d=
  26. !0;else if(this.fixedWidth||this.fixedHeight){var e=c.className.match(/([S|N][E|W])$/),f=c.className.match(/(E|W)$/),m=c.className.match(/(N|S)$/);if(e||this.fixedWidth&&f||this.fixedHeight&&m)d=!0}d?c.hide():Event.observe(c,"mousedown",this.resizeBind)}else c.show(),Event.stopObserving(c,"mousedown",this.resizeBind)}},setParams:function(){this.imgW=this.img.width;this.imgH=this.img.height;$(this.north).setStyle({height:0});$(this.east).setStyle({width:0,height:0});$(this.south).setStyle({height:0});
  27. $(this.west).setStyle({width:0,height:0});$(this.imgWrap).setStyle({width:this.imgW+"px",height:this.imgH+"px"});$(this.selArea).hide();var a={x1:0,y1:0,x2:0,y2:0},b=!1;null!==this.options.onloadCoords?(a=this.cloneCoords(this.options.onloadCoords),b=!0):0<this.options.ratioDim.x&&0<this.options.ratioDim.y&&(a.x1=Math.ceil((this.imgW-this.options.ratioDim.x)/2),a.y1=Math.ceil((this.imgH-this.options.ratioDim.y)/2),a.x2=a.x1+this.options.ratioDim.x,a.y2=a.y1+this.options.ratioDim.y,b=!0);this.setAreaCoords(a,
  28. !1,!1,1);this.options.displayOnInit&&b&&(this.selArea.show(),this.drawArea(),this.endCrop());this.attached=!0},remove:function(){this.attached&&(this.attached=!1,this.imgWrap.parentNode.insertBefore(this.img,this.imgWrap),this.imgWrap.parentNode.removeChild(this.imgWrap),Event.stopObserving(this.dragArea,"mousedown",this.startDragBind),Event.stopObserving(document,"mousemove",this.onDragBind),Event.stopObserving(document,"mouseup",this.endCropBind),this.registerHandles(!1),this.options.captureKeys&&
  29. Event.stopObserving(document,"keypress",this.keysBind))},reset:function(){if(this.attached)this.setParams();else this.onLoad();this.endCrop()},handleKeys:function(a){var b=0,c=0;if(!this.dragging){switch(a.keyCode){case 37:b=-1;break;case 38:c=-1;break;case 39:b=1;break;case 40:c=1}if(0!==b||0!==c)a.shiftKey&&(b*=10,c*=10),this.moveArea([this.areaCoords.x1+b,this.areaCoords.y1+c]),this.endCrop(),Event.stop(a)}},calcW:function(){return this.areaCoords.x2-this.areaCoords.x1},calcH:function(){return this.areaCoords.y2-
  30. this.areaCoords.y1},moveArea:function(a){this.setAreaCoords({x1:a[0],y1:a[1],x2:a[0]+this.calcW(),y2:a[1]+this.calcH()},!0,!1);this.drawArea()},cloneCoords:function(a){return{x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2}},setAreaCoords:function(a,b,c,d,e){if(b)c=a.x2-a.x1,d=a.y2-a.y1,0>a.x1&&(a.x1=0,a.x2=c),0>a.y1&&(a.y1=0,a.y2=d),a.x2>this.imgW&&(a.x2=this.imgW,a.x1=this.imgW-c),a.y2>this.imgH&&(a.y2=this.imgH,a.y1=this.imgH-d);else if(0>a.x1&&(a.x1=0),0>a.y1&&(a.y1=0),a.x2>this.imgW&&(a.x2=this.imgW),a.y2>this.imgH&&
  31. (a.y2=this.imgH),null!==d&&(0<this.ratioX?this.applyRatio(a,{x:this.ratioX,y:this.ratioY},d,e):c&&this.applyRatio(a,{x:1,y:1},d,e),b=[this.options.minWidth,this.options.minHeight],e=[this.options.maxWidth,this.options.maxHeight],0<b[0]||0<b[1]||0<e[0]||0<e[1])){var f={a1:a.x1,a2:a.x2};a={a1:a.y1,a2:a.y2};var m={min:0,max:this.imgW},l={min:0,max:this.imgH};if((0!==b[0]||0!==b[1])&&c)0<b[0]?b[1]=b[0]:0<b[1]&&(b[0]=b[1]);if((0!==e[0]||0!==e[0])&&c)0<e[0]&&e[0]<=e[1]?e[1]=e[0]:0<e[1]&&e[1]<=e[0]&&(e[0]=
  32. e[1]);0<b[0]&&this.applyDimRestriction(f,b[0],d.x,m,"min");1<b[1]&&this.applyDimRestriction(a,b[1],d.y,l,"min");0<e[0]&&this.applyDimRestriction(f,e[0],d.x,m,"max");1<e[1]&&this.applyDimRestriction(a,e[1],d.y,l,"max");a={x1:f.a1,y1:a.a1,x2:f.a2,y2:a.a2}}this.areaCoords=a},applyDimRestriction:function(a,b,c,d,e){if("min"==e?a.a2-a.a1<b:a.a2-a.a1>b)1==c?a.a2=a.a1+b:a.a1=a.a2-b,a.a1<d.min?(a.a1=d.min,a.a2=b):a.a2>d.max&&(a.a1=d.max-b,a.a2=d.max)},applyRatio:function(a,b,c,d){"N"==d||"S"==d?(b=this.applyRatioToAxis({a1:a.y1,
  33. b1:a.x1,a2:a.y2,b2:a.x2},{a:b.y,b:b.x},{a:c.y,b:c.x},{min:0,max:this.imgW}),a.x1=b.b1,a.y1=b.a1,a.x2=b.b2,a.y2=b.a2):(b=this.applyRatioToAxis({a1:a.x1,b1:a.y1,a2:a.x2,b2:a.y2},{a:b.x,b:b.y},{a:c.x,b:c.y},{min:0,max:this.imgH}),a.x1=b.a1,a.y1=b.b1,a.x2=b.a2,a.y2=b.b2)},applyRatioToAxis:function(a,b,c,d){a=Object.extend(a,{});var e=Math.floor((a.a2-a.a1)*b.b/b.a),f=null,m=f=null;1==c.b?(f=a.b1+e,f>d.max&&(f=d.max,m=f-a.b1),a.b2=f):(f=a.b2-e,f<d.min&&(f=d.min,m=f+a.b2),a.b1=f);null!==m&&(f=Math.floor(m*
  34. b.a/b.b),1==c.a?a.a2=a.a1+f:a.a1=a.a1=a.a2-f);return a},drawArea:function(){var a=this.calcW(),b=this.calcH(),c=[this.areaCoords.x1+"px",this.areaCoords.y1+"px",a+"px",b+"px",this.areaCoords.x2+"px",this.areaCoords.y2+"px",this.img.width-this.areaCoords.x2+"px",this.img.height-this.areaCoords.y2+"px"],d=this.selArea.style;d.left=c[0];d.top=c[1];d.width=c[2];d.height=c[3];a=Math.ceil((a-6)/2)+"px";b=Math.ceil((b-6)/2)+"px";this.handleN.style.left=a;this.handleE.style.top=b;this.handleS.style.left=
  35. a;this.handleW.style.top=b;this.north.style.height=c[1];b=this.east.style;b.top=c[1];b.height=c[3];b.left=c[4];b.width=c[6];b=this.south.style;b.top=c[5];b.height=c[7];b=this.west.style;b.top=c[1];b.height=c[3];b.width=c[0];this.subDrawArea();this.forceReRender()},forceReRender:function(){if(this.isIE||this.isWebKit){var a=document.createTextNode(" "),b,c,d;if(this.isIE)fixEl=this.selArea;else if(this.isWebKit){fixEl=document.getElementsByClassName("imgCrop_marqueeSouth",this.imgWrap)[0];b=new Element("div");
  36. b.style.visibility="hidden";var e=["SE","S","SW"];for(d=0;d<e.length;d++)c=document.getElementsByClassName("imgCrop_handle"+e[d],this.selArea)[0],c.childNodes.length&&c.removeChild(c.childNodes[0]),c.appendChild(b)}fixEl.appendChild(a);fixEl.removeChild(a)}},startResize:function(a){this.startCoords=this.cloneCoords(this.areaCoords);this.resizing=!0;this.resizeHandle=Event.element(a).classNames().toString().replace(/([^N|NE|E|SE|S|SW|W|NW])+/,"");Event.stop(a)},startDrag:function(a){this.selArea.show();
  37. this.clickCoords=this.getCurPos(a);this.setAreaCoords({x1:this.clickCoords.x,y1:this.clickCoords.y,x2:this.clickCoords.x,y2:this.clickCoords.y},!1,!1,null);this.dragging=!0;this.onDrag(a);Event.stop(a)},getCurPos:function(a){for(var b=this.imgWrap,c=Element.cumulativeOffset(b);"BODY"!=b.nodeName;)c[1]-=b.scrollTop||0,c[0]-=b.scrollLeft||0,b=b.parentNode;return{x:Event.pointerX(a)-c[0],y:Event.pointerY(a)-c[1]}},onDrag:function(a){if(this.dragging||this.resizing){var b=null,c=this.getCurPos(a),d=this.cloneCoords(this.areaCoords),
  38. e={x:1,y:1};this.dragging?(c.x<this.clickCoords.x&&(e.x=-1),c.y<this.clickCoords.y&&(e.y=-1),this.transformCoords(c.x,this.clickCoords.x,d,"x"),this.transformCoords(c.y,this.clickCoords.y,d,"y")):this.resizing&&(b=this.resizeHandle,b.match(/E/)?(this.transformCoords(c.x,this.startCoords.x1,d,"x"),c.x<this.startCoords.x1&&(e.x=-1)):b.match(/W/)&&(this.transformCoords(c.x,this.startCoords.x2,d,"x"),c.x<this.startCoords.x2&&(e.x=-1)),b.match(/N/)?(this.transformCoords(c.y,this.startCoords.y2,d,"y"),
  39. c.y<this.startCoords.y2&&(e.y=-1)):b.match(/S/)&&(this.transformCoords(c.y,this.startCoords.y1,d,"y"),c.y<this.startCoords.y1&&(e.y=-1)));this.setAreaCoords(d,!1,a.shiftKey,e,b);this.drawArea();Event.stop(a)}},transformCoords:function(a,b,c,d){var e=[a,b];a>b&&e.reverse();c[d+"1"]=e[0];c[d+"2"]=e[1]},endCrop:function(){this.resizing=this.dragging=!1;this.options.onEndCrop(this.areaCoords,{width:this.calcW(),height:this.calcH()})},subInitialize:function(){},subDrawArea:function(){}});
  40. Cropper.ImgWithPreview=Class.create(Cropper.Img,{subInitialize:function(){this.hasPreviewImg=!1;"undefined"!=typeof this.options.previewWrap&&(0<this.options.minWidth&&0<this.options.minHeight)&&(this.previewWrap=$(this.options.previewWrap),this.previewImg=this.img.cloneNode(!1),this.previewImg.id="imgCrop_"+this.previewImg.id,this.hasPreviewImg=this.options.displayOnInit=!0,this.previewWrap.addClassName("imgCrop_previewWrap"),this.previewWrap.setStyle({width:this.options.minWidth+"px",height:this.options.minHeight+
  41. "px"}),this.previewWrap.appendChild(this.previewImg))},subDrawArea:function(){if(this.hasPreviewImg){var a=this.calcW(),b=this.calcH(),c=this.imgH/b,d=a/this.options.minWidth,b=b/this.options.minHeight,a=Math.ceil(this.options.minWidth*(this.imgW/a))+"px",c=Math.ceil(this.options.minHeight*c)+"px",d="-"+Math.ceil(this.areaCoords.x1/d)+"px",b="-"+Math.ceil(this.areaCoords.y1/b)+"px",e=this.previewImg.style;e.width=a;e.height=c;e.left=d;e.top=b}}});
  42. if("undefined"==typeof unityObject)var unityObject=function(){function a(a,b,c){if(a==ja){if(null==da||da==ja)return}else if(null!=da)return;da=a;ra.send(a,b,c)}function b(a,b,c,d){da=a;ra.send(a,b,c,d)}function c(a){a=RegExp(escape(a)+"=([^;]+)");return a.test(A.cookie+";")?(a.exec(A.cookie+";"),RegExp.$1):!1}function d(a){J?a():I[I.length]=a}function e(){if(!J){try{var a=A.getElementsByTagName("body")[0],b=a.appendChild(A.createElement("span"));a.removeChild(b)}catch(c){return}J=!0;for(a=0;a<I.length;++a)I[a]()}}
  43. function f(a){if(typeof L.addEventListener!=R)L.addEventListener("load",a,!1);else if(typeof A.addEventListener!=R)A.addEventListener("load",a,!1);else if(typeof L.attachEvent!=R)m(L,"onload",a);else if("function"==typeof window.onload){var b=window.onload;L.onload=function(){b();a()}}else L.onload=a}function m(a,b,c){a.attachEvent(b,c);O[O.length]={target:a,type:b,event:c}}function l(a){var b=0;if(a){var c=a.toLowerCase().match(/^(\d+)(?:\.(\d+)(?:\.(\d+)([dabfr])?(\d+)?)?)?$/);if(c&&c[1]){a=c[1];
  44. var d=c[2]?c[2]:0,e=c[3]?c[3]:0,l=c[4]?c[4]:"r",c=c[5]?c[5]:0,b=b|a/10%10<<28|a%10<<24,b=b|d%10<<20,b=b|e%10<<16,b=b|{d:8192,a:16384,b:24576,f:32768,r:32768}[l],b=b|c/100%10<<8,b=b|c/10%10<<4,b=b|c%10}}return b}function u(a,b){var c=A.getElementsByTagName("body")[0],d=A.createElement("object");if(c&&d){d.setAttribute("type",M);d.style.visibility="hidden";c.appendChild(d);var e=0;(function(){if(typeof d.GetPluginVersion==R)10>e++?setTimeout(arguments.callee,10):(c.removeChild(d),a(null));else{var l=
  45. {};if(b)for(var f=0;f<b.length;++f)l[b[f]]=d.GetUnityVersion(b[f]);l.plugin=d.GetPluginVersion();c.removeChild(d);a(l)}})()}else a(null)}function h(b,c){var d=ua,e;y.plugins.refresh();if(typeof y.plugins!=R&&y.plugins[H]&&typeof y.mimeTypes!=R&&y.mimeTypes[M]&&y.mimeTypes[M].enabledPlugin){d=ja;if(K.sf&&/Mac OS X 10_6/.test(y.appVersion)){u(function(c){if(!c||!c.plugin)d=ka,e="OSX10.6-SFx64";a(d,Y,e);b(d,c)},c);return}if(K.mac&&K.ch){u(function(c){if(c&&(l(c.plugin)<=l("2.6.1f3")||l(c.plugin)<l(unityObject.minRequiredVersion)))d=
  46. ka,e="OSX-CH-U<=2.6.1f3";a(d,Y,e);b(d,c)},c);return}if(c){u(function(c){l(c.plugin)<l(unityObject.minRequiredVersion)&&(d=ka);a(d,Y,e);b(d,c)},c);return}}else if(K.ie)try{var f=new ActiveXObject("UnityWebPlayer.UnityWebPlayer.1"),n=f.GetPluginVersion();if(c){for(var g={},h=0;h<c.length;++h)g[c[h]]=f.GetUnityVersion(c[h]);g.plugin=n}d=ja;if("2.5.0f5"==n){var p=/Windows NT \d+\.\d+/.exec(y.userAgent);p&&0<p.length&&6<=parseFloat(p[0].split(" ")[2])&&(d=ka,e="WIN-U2.5.0f5")}l(n)<l(unityObject.minRequiredVersion)&&
  47. (d=ka)}catch(m){e=K.win&&K.ie&&K.x64?"WIN-IEx64":"ActiveXFailed"}a(d,Y,e);b(d,g)}function g(a){/^[-+]?[0-9]+$/.test(a)&&(a+="px");return a}function p(a,b,c,d){var e=A.getElementById(a);if(e){if(K.win&&K.ie){var l="",f;for(f in b)b[f]!=Object.prototype[f]&&("styleclass"==f.toLowerCase()?l+=' class="'+b[f]+'"':"classid"!=f.toLowerCase()&&(l+=" "+f+'="'+b[f]+'"'));var n="";for(f in c)c[f]!=Object.prototype[f]&&"classid"!=f.toLowerCase()&&(n+='<param name="'+f+'" value="'+c[f]+'" />');e.outerHTML='<div id="'+
  48. a+'" style="width: '+g(b.width)+"; height: "+g(b.height)+'; visibility: hidden;"><object classid="clsid:444785F1-DE89-4295-863A-D46C3A781394" style="display: block; width: 100%; height: 100%;"'+l+">"+n+"</object></div>";U[U.length]=a}else{l=A.createElement("div");l.setAttribute("id",a);l.style.width=g(b.width);l.style.height=g(b.height);l.style.visibility="hidden";n=A.createElement("embed");n.setAttribute("type",M);n.style.display="block";n.style.width="100%";n.style.height="100%";for(f in b)b[f]!=
  49. Object.prototype[f]&&("styleclass"==f.toLowerCase()?n.setAttribute("class",b[f]):"classid"!=f.toLowerCase()&&n.setAttribute(f,b[f]));for(f in c)c[f]!=Object.prototype[f]&&"classid"!=f.toLowerCase()&&n.setAttribute(f,c[f]);l.appendChild(n);e.parentNode.replaceChild(l,e)}s(a,function(b){b?(b.parentNode.style.visibility="visible",(!K.sf||!K.mac)&&setTimeout(function(){b.focus()},100)):E(a);if(d){var c;b||(c="UnityElementNotFound");d({success:Boolean(b),id:a,ref:b,type:Y,error:c})}})}else d&&d({success:!1,
  50. id:a,type:Y,error:"UnityElementNotFound"})}function w(a,b){for(var c in a)if(c.toLowerCase()==b){c=a[c];if(/^((?:[\da-f]){2}){3,4}$/i.test(c))return c.substr(0,6);break}return null}function t(a,b,c,d,e){var l=A.getElementById(a);if(l){var f=g(b.width);b=g(b.height);var n=w(c,"backgroundcolor"),h=w(c,"textcolor"),p=w(c,"bordercolor");K.win&&K.ie&&(c="font-family: Verdana; font-size: 12px; text-align: center;",n&&(c+=" background-color: #"+n+";"),h&&(c+=" color: #"+h+";"),p&&(c+=" border: 1px solid #"+
  51. p+";"),n="",V&&(c+=" width: "+f+"; height: "+b+";",n="width: "+f+"; line-height: "+b+";"),l.outerHTML='<div id="'+a+'" style="'+c+'"><span style="'+n+'">'+e+"</span></div>")}d&&d({success:!1,id:a,error:e})}function q(a,d,e,l,h,p,m){preInstallCallback=va[a];var u=A.getElementById(a);if(u){var q=ya;if(ea&&K.java&&!la&&!c(fa)){ga[a]={attributes:d,params:e,callback:l,broken:h};var t="javascript:unityObject.doJavaInstall('"+a+"');",q=oa}else pa&&K.co?(t=N+"3.0/co/UnityWebPlayer.application?installer="+
  52. encodeURIComponent(N+v()),q=sa):K.win?t=N+v():"MacIntel"==y.platform?(t=N+(W?"webplayer-i386.dmg":"webplayer-mini.dmg"),Z&&(t+="?referrer="+Z)):"MacPPC"==y.platform?(t=N+(W?"webplayer-ppc.dmg":"webplayer-mini.dmg"),Z&&(t+="?referrer="+Z)):(t='javascript:window.open("http://unity3d.com/webplayer/");',q=wa);b(za,q);if(h){var r="Unity Web Player. Install now! Restart your browser after install.",s=B+"/installation/getunityrestart.png";h=190;var x=75}else r="Unity Web Player. Install now!",s=B+"installation/getunity.png",
  53. h=193,x=63;var z=d.width||h;d=d.height||x;var T=g(-parseInt(x)),C="unityObject.notifyBeginInstall('"+a+"','"+q+"');unityObject.setInstallStatus('"+ta+"','"+q+"',null",C=q!=sa?C+(",'"+t.replace(/'/g,"\\'")+"');"):C+(");document.location='"+t+"';"),C=C+"return false;",L=w(e,"backgroundcolor"),ia=w(e,"textcolor");e=w(e,"bordercolor");var E=a+"_img";if(K.win&&K.ie){var M='<img id="'+E+'" alt="'+r+'" src="'+s+'" width="'+h+'" height="'+x+'" style="border-width: 0px;" />',t='<a href="'+t+'" title="'+r+
  54. '" onclick="'+C+'"';V&&(t+=' style="display: block; height: '+g(x)+"; position: relative; top: "+T+';"');t+=">"+M+"</a>";x="";L&&(x+=" background-color: #"+L+";");ia&&(x+=" color: #"+ia+";");e&&(x+=" border: 1px solid #"+e+";");V?(h='<div style="width: '+g(h)+'; margin: auto; position: relative;">'+t+"</div>",u.outerHTML='<div id="'+a+'" style="width: '+g(z)+"; height: "+g(d)+"; text-align: center;"+x+'">'+h+"</div>"):u.outerHTML='<div id="'+a+'" style="'+x+'">'+t+"</div>"}else{var G=A.createElement("div");
  55. G.setAttribute("id",a);L&&(G.style.backgroundColor="#"+L);ia&&(G.style.color="#"+ia);e&&(G.style.border="1px solid #"+e);V&&(G.style.width=g(z),G.style.height=g(d),M=A.createElement("div"),M.style.width=g(h),M.style.margin="auto",M.style.position="relative");z=A.createElement("a");z.setAttribute("href",t);z.setAttribute("title",r);z.setAttribute("onclick",C);V&&(z.style.display="block",z.style.height=g(x),z.style.position="relative",z.style.top=T);t=A.createElement("img");t.setAttribute("id",E);t.setAttribute("alt",
  56. r);t.setAttribute("src",s);t.setAttribute("width",h);t.setAttribute("height",x);t.style.borderWidth="0px";z.appendChild(t);V?(M.appendChild(z),G.appendChild(M)):G.appendChild(z);u.parentNode.replaceChild(G,u)}F(a,!0)}l&&l({success:!1,id:a,type:p,error:m});preInstallCallback&&preInstallCallback({id:a,type:q});Y=q;ma?q==oa?(b(ta,q),D(a)):q==sa&&!qa&&(qa=!0,f(function(){b(ta,q);A.location=N+"3.0/co/UnityWebPlayer.application?installer="+encodeURIComponent(N+v())})):q==oa&&aa&&(ba.push(E),n(a+"_java"))}
  57. function v(){var a=W?"UnityWebPlayerFull.exe":"UnityWebPlayer.exe";Z&&(a+="?referrer="+Z);return a}function x(a,b,c){if(K.win&&K.ie){var d="",e;for(e in a)d+=" "+e+'="'+a[e]+'"';a="";for(e in b)a+='<param name="'+e+'" value="'+b[e]+'" />';c.outerHTML="<object"+d+">"+a+"</object>"}else{d=A.createElement("object");for(e in a)d.setAttribute(e,a[e]);for(e in b)a=A.createElement("param"),a.name=e,a.value=b[e],d.appendChild(a);c.parentNode.replaceChild(d,c)}}function n(a){var b=!1;for(i=0;i<ba.length;i++)ba[i]&&
  58. (!(typeof A.images[ba[i]]==R||!A.images[ba[i]].complete||typeof A.images[ba[i]].naturalWidth!=R&&0==A.images[ba[i]].naturalWidth)?ba[i]=null:b=!0);b?setTimeout(arguments.callee,100):setTimeout(function(){var b=A.getElementById(a);b||(b=A.createElement("div"),A.body.insertBefore(b,A.body.lastChild.nextSibling));var c=N+"3.0/jws/";x({id:a,type:"application/x-java-applet",code:"JVMPreloader",width:1,height:1,name:"JVM Preloader"},{context:a,codebase:c,classloader_cache:!1,scriptable:!0,mayscript:!0,
  59. codebase:c},b);F(a,!0)},100)}function D(a){var b=la=!0;document.cookie=escape(fa)+"="+escape(b)+"; path=/";var b=A.getElementById(a),c=ga[a],d={id:a,type:"application/x-java-applet",archive:N+"3.0/jws/UnityWebPlayer.jar",code:"UnityWebPlayer",width:c.attributes.width||600,height:c.attributes.height||450,name:"Unity Web Player"};K.win&&K.ff&&(d.style="visibility: hidden;");var e=N+"3.0/jws/UnityWebPlayer.jnlp",l=N,f;K.win?f=v():(f="UnityPlayer.plugin.zip",Z&&(f+="?referrer="+Z));var e={context:a,jnlp_href:e,
  60. classloader_cache:!1,installer:l+f,image:B+"installation/unitylogo.png",centerimage:!0,boxborder:!1,scriptable:!0,mayscript:!0},n;for(n in c.params)"src"!=n&&c.params[n]!=Object.prototype[n]&&(e[n]=c.params[n],"logoimage"==n.toLowerCase()?e.image=c.params[n]:"backgroundcolor"==n.toLowerCase()?e.boxbgcolor="#"+c.params[n]:"bordercolor"==n.toLowerCase()?e.boxborder=!0:"textcolor"==n.toLowerCase()&&(e.boxfgcolor="#"+c.params[n]));x(d,e,b);F(a,!0)}function C(a){setTimeout(function(){var b=A.getElementById(a);
  61. b&&b.parentNode.removeChild(b)},0)}function E(a){var b=A.getElementById(a);if(b){if(K.win&&K.ie){var c=b.firstChild;if(c&&"OBJECT"==c.nodeName){b.style.display="none";(function(){if(4==c.readyState){for(var a in c)"function"==typeof c[a]&&(c[a]=null);b.parentNode.removeChild(b)}else setTimeout(arguments.callee,10)})();return}}b.parentNode.removeChild(b)}}function s(a,b){var c=A.getElementById(a);if(!c)return b&&b(null),null;var d;K.win&&K.ie?(c=c.getElementsByTagName("object")[0])&&"OBJECT"==c.nodeName&&
  62. (d=c):(c=c.getElementsByTagName("embed")[0])&&"EMBED"==c.nodeName&&(d=c);return function(){if(d&&typeof d.GetPluginVersion==R)return b&&setTimeout(arguments.callee,10),null;b&&b(d);return d}()}function F(a,b){if(P){var c=b?"visible":"hidden";if(J&&A.getElementById(a))A.getElementById(a).style.visibility=c;else{var d="#"+a,c="visibility: "+c+";";if(!K.mac||!K.ie){var e=A.getElementsByTagName("head")[0];if(e){if(!Q||"screen"!=S){var l=A.createElement("style");l.setAttribute("type","text/css");l.setAttribute("media",
  63. "screen");Q=e.appendChild(l);K.win&&(K.ie&&typeof A.styleSheets!=R&&0<A.styleSheets.length)&&(Q=A.styleSheets[A.styleSheets.length-1]);S="screen"}K.win&&K.ie&&"object"==typeof Q.addRule?Q.addRule(d,c):Q&&typeof A.createTextNode!=R&&Q.appendChild(A.createTextNode(d+" { "+c+" }"))}}}}}function z(){for(var a in O)try{var b=O[a];b.target.detachEvent(b.type,b.event)}catch(c){}for(a in U)E(U[a]);for(a in K)K[a]=null;K=null;for(a in unityObject)unityObject[a]=null;unityObject=null}function G(a,b,c){var d=
  64. {},e=-1;if(a&&"object"==typeof a)for(var l in a)d[l]=a[l],"tabindex"==l.toLowerCase()&&(e=d[l]);d.width=b;d.height=c;-1==e&&(d.tabIndex=0);return d}function r(a,b){var c="unityObject.firstFrameCallback();",d={};if(a&&"object"==typeof a)for(var e in a)d[e]=a[e],"firstframecallback"==e.toLowerCase()&&(d[e]=c+d[e],c=null);c&&(d.firstFrameCallback=c);d.src=b;return d}var H="Unity Player",M="application/vnd.unity",L=window,A=document,y=navigator,J=!1,I=[],U=[],O=[],Q=null,S=null,P=!0,V=!0,X="https:"==
  65. document.location.protocol,T=X?"https://ssl-webplayer.unity3d.com/":"http://webplayer.unity3d.com/",B=X?"https://ssl-webplayer.unity3d.com/":"http://webplayer.unity3d.com/",N=T+"download_webplayer-3.x/",W=!1,ma=!1,ea=!0,aa=!1,fa="_unity_triedjava",la=c(fa),ga=[],pa=!0,qa=!1,na=!X&&!1,ha=!0,ca=!1,Y=null,ia=[],va=[],ba=[],Z=null,da=null,xa=3E3,R="undefined",ja="installed",ua="missing",ka="broken",wa="unsupported",za="ready",ta="start",ya="standard",oa="java",sa="clickonce",K=function(){function a(b,
  66. c){for(var d=0;d<Math.max(b.length,c.length);++d){var e=d<b.length&&b[d]?new Number(b[d]):0,l=d<c.length&&c[d]?new Number(c[d]):0;if(e<l)return-1;if(e>l)return 1}return 0}var b=y.userAgent,c=y.platform,d=!1;/msie/i.test(b)?d=parseFloat(b.replace(/^.*msie ([0-9]+(\.[0-9]+)?).*$/i,"$1")):/Trident/i.test(b)&&(d=parseFloat(b.replace(/^.*rv:([0-9]+(\.[0-9]+)?).*$/i,"$1")));for(var e={w3:typeof A.getElementById!=R&&typeof A.getElementsByTagName!=R&&typeof A.createElement!=R,win:c?/win/i.test(c):/win/i.test(b),
  67. mac:c?/mac/i.test(c):/mac/i.test(b),ie:d,ff:/firefox/i.test(b),ch:/chrome/i.test(b),sf:/safari/i.test(b),wk:/webkit/i.test(b)?parseFloat(b.replace(/^.*webkit\/(\d+(\.\d+)?).*$/i,"$1")):!1,x64:/win64/i.test(b)&&/x64/i.test(b),moz:/mozilla/i.test(b)?parseFloat(b.replace(/^.*mozilla\/([0-9]+(\.[0-9]+)?).*$/i,"$1")):0},c=A.getElementsByTagName("script"),d=0;d<c.length;++d){var l=c[d].src.match(/^(.*)3\.0\/uo\/UnityObject\.js$/i);if(l){N=l[1];break}}e.java=function(){if(y.javaEnabled()){var b=e.win&&e.ff;
  68. if(b){if(typeof y.mimeTypes!=R)for(var c=b?[1,6,0,12]:[1,4,2,0],b=0;b<y.mimeTypes.length;++b)if(y.mimeTypes[b].enabledPlugin){var d=y.mimeTypes[b].type.match(/^application\/x-java-applet;(?:jpi-)?version=(\d+)(?:\.(\d+)(?:\.(\d+)(?:_(\d+))?)?)?$/);if(null!=d&&0>=a(c,d.slice(1)))return!0}}else if(e.win&&e.ie&&typeof ActiveXObject!=R){b=function(a){try{return null!=new ActiveXObject("JavaWebStart.isInstalled."+a+".0")}catch(b){return!1}};if(b("1.7.0"))return!0;if(8<=e.ie){if(b("1.6.0"))for(b=12;50>=
  69. b;++b){try{c=null!=new ActiveXObject("JavaPlugin.160_"+b)}catch(l){c=!1}if(c&&!(9==e.ie&&5==e.moz&&24>b))return!0}}else return b("1.6.0")||b("1.5.0")||b("1.4.2")}}return!1}();e.co=function(){if(e.win&&e.ie){var c=b.match(/(\.NET CLR [0-9.]+)|(\.NET[0-9.]+)/g);if(null!=c)for(var d=[3,5,0],l=0;l<c.length;++l){var f=c[l].match(/[0-9.]{2,}/g)[0].split(".");if(0>=a(d,f))return!0}}return!1}();return e}(),ra=function(){function a(b,e,l,f){if(na){b="http://unityanalyticscapture.appspot.com/event?u="+encodeURIComponent(c)+
  70. "&s="+encodeURIComponent(d)+"&e="+encodeURIComponent(b);Z&&(b+="?r="+Z);e&&(b+="&t="+encodeURIComponent(e));l&&(b+="&d="+encodeURIComponent(l));var n=new Image;if(f){var g=null;n.onload=n.onerror=function(){clearTimeout(g);n.onload=n.onerror=null;f()};g=setTimeout(n.onload,xa)}n.src=b}else f&&f()}function b(a,c,d,e){if(ha){var l=window._ugaq=window._ugaq||[];ca||l.push(["unity._setAccount","UA-16068464-16"]);a="/webplayer/install/"+a;var f="?";c&&(a+=f+"t="+encodeURIComponent(c),f="&");d&&(a+=f+"d="+
  71. encodeURIComponent(d),f="&");if(e){var n;c=function(){unityObject.googleAnalyticsCallback=null;clearTimeout(n);e()};unityObject.googleAnalyticsCallback=c;n=setTimeout(c,xa)}l.push(["unity._trackPageview",a]);if(!ca){l=N+"3.0/uo/ga.js";c=A.getElementsByTagName("script");for(d=0;d<c.length;++d)if(c[d].src&&c[d].src.toLowerCase()==l.toLowerCase()){ca=!0;break}ca||(ca=!0,c=A.createElement("script"),c.type="text/javascript",c.async=!0,c.src=l,l=document.getElementsByTagName("script")[0],l.parentNode.insertBefore(c,
  72. l))}}else e&&e()}var c=function(){var a=new Date;return Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDay(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds()).toString(16)+Math.floor(2147483647*Math.random()).toString(16)}(),d=0;return{send:function(c,e,l,f){function n(){0==--g&&(location.href=f)}++d;var g=2;a(c,e,l,f?n:null);b(c,e,l,f?n:null)}}}();(function(){K.w3&&((typeof A.readyState!=R&&"complete"==A.readyState||typeof A.readyState==R&&(A.getElementsByTagName("body")[0]||
  73. A.body))&&e(),J||(typeof A.addEventListener!=R?A.addEventListener("DOMContentLoaded",e,!1):K.win&&K.ie&&(A.attachEvent("onreadystatechange",function(){"complete"==A.readyState&&(A.detachEvent("onreadystatechange",arguments.callee),e())}),L==top&&function(){if(!J){try{A.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,10);return}e()}}()),K.wk&&function(){J||(/loaded|complete/.test(A.readyState)?e():setTimeout(arguments.callee,10))}(),f(e)))})();(function(){if(K.win&&K.ie)if(typeof L.attachEvent!=
  74. R)m(L,"onunload",z);else if("function"==typeof L.onunload){var a=L.onunload;L.onunload=function(){a();z()}}else L.onunload=z})();return{missingUnityId:null,minRequiredVersion:"3.0.0",embedUnity:function(a,b,c,e,l,f,n){K.w3&&!(K.wk&&312>K.wk)&&a&&b&&c&&e?d(function(){var d=G(f,c,e),g=r(l,b);h(function(b){b==ja?p(a,d,g,n):b==wa?t(a,d,g,n,"Unsupported browser."):(q(unityObject.missingUnityId||a,d,g,n,b==ka,null,"NotInstalled"),function(){var b=arguments.callee;h(function(c){c==ja?(F(a,!1),p(a,d,g,n)):
  75. setTimeout(b,500)})}())})}):n&&n({success:!1,id:a})},addPreInstallCallback:function(a,b){va[a]=b},addBeginInstallCallback:function(a,b){ia[a]=b},getObjectById:function(a,b){if(K.w3&&a)return s(a,b);b&&b(null);return null},setAutoHideShow:function(a){P=a},setFullSizeMissing:function(a){V=a},enableFullInstall:function(a){W=a},enableAutoInstall:function(a){ma=a},enableJavaInstall:function(a){ea=a},enableJavaPreloading:function(a,b){aa=a;typeof b!=R&&(ba=b)},enableClickOnceInstall:function(a){pa=a},enableAnalytics:function(a){na=
  76. !X&&a;ha=a},enableUnityAnalytics:function(a){na=!X&&a},enableGoogleAnalytics:function(a){ha=a},setBaseDomain:function(a){var b=T;T=a;"/"!=T[T.length-1]&&(T+="/");N=T+N.substr(b.length)},setBaseDownloadUrl:function(a){N=a;"/"!=N[N.length-1]&&(N+="/");T=a.match(/([^:]*):\/\/([^/]*)/)[0]+"/"},setReferrer:function(a){Z=a?encodeURIComponent(a):a},addLoadEvent:f,addDomLoadEvent:d,ua:K,detectUnity:function(a,b){K.w3&&!(K.wk&&312>K.wk)&&a?d(function(){h(a,b)}):a&&a(ua)},createUnity:function(a,b,c,d){K.w3&&
  77. !(K.wk&&312>K.wk)&&a&&b&&c&&d?p(a,c,b,d):d&&d({success:!1,id:a})},removeUnity:function(a){K.w3&&E(a)},notifyBeginInstall:function(a,b){(callback=ia[a])&&callback({id:a,type:b})},setInstallStatus:function(a,c,d,e){b(a,c,d,e)},doJavaInstall:function(a){D(a)},jvmPreloaded:function(a){C(a)},appletStarted:function(a){},javaInstallDone:function(a,b,c){setTimeout('unityObject.javaInstallDoneDirect("'+a+'", '+b+', "'+c+'");',0)},javaInstallDoneDirect:function(a,c,d){c||(c=ga[a],b("error",oa,d),q(unityObject.missingUnityId||
  78. a,c.attributes,c.params,c.callback,c.broken,oa,d))},firstFrameCallback:function(){var a=Y;null!=da&&(da="first",ra.send("first",a,void 0))}}}();
  79. function addDOMLoadEvent(a){if(!window.__load_events){var b=function(){if(!arguments.callee.done){arguments.callee.done=!0;window.__load_timer&&(clearInterval(window.__load_timer),window.__load_timer=null);for(var a=0;a<window.__load_events.length;a++)window.__load_events[a]();window.__load_events=null}};document.addEventListener&&document.addEventListener("DOMContentLoaded",b,!1);/WebKit/i.test(navigator.userAgent)&&(window.__load_timer=setInterval(function(){/loaded|complete/.test(document.readyState)&&
  80. b()},10));window.onload=b;window.__load_events=[]}window.__load_events.push(a)}
  81. function tabset(){if(!document.getElementById)return!1;var a=document.getElementsByTagName("dl"),b;for(k=0;k<a.length;k++){var c=a[k];if(-1!=c.className.indexOf("tabset")){var d=0,e=c.getElementsByTagName("dd");for(i=0;i<e.length;i++)e[i].parentNode==c&&(0===i?b=e.item(0):e[i].style.display="none",e[i].count=d++);d=[];e=c.getElementsByTagName("dt");for(i=0;i<e.length;i++)e[i].parentNode==c&&(d[d.length]=e[i]);c=[];for(i=0;i<d.length;i++)d[i].transformed_to_tab||(d[i].transformed_to_tab=!0,d[i].count=
  82. i,d[i].onclick=toggleDt,d[i].innerHTML="<a href='#' title='"+d[i].innerHTML+"'>"+d[i].innerHTML+"</a>",d[i].parentNode.removeChild(d[i]),b.parentNode.insertBefore(d[i],b)),0<=d[i].className.indexOf("active")&&(c[c.length]=d[i]);for(i=0;i<c.length;i++)c[i].onclick()}}}
  83. function toggleDt(){var a=this.parentNode.getElementsByTagName("dt");for(i=0;i<a.length;i++)this==a[i]&&0<=this.className.indexOf("dormant")&&-1==this.className.indexOf("active")&&a[i].parentNode==this.parentNode?(this.className+=" active",this.className=this.className.replace(/(?:^\s*|\s*$)/,"")):this!=a[i]&&a[i].parentNode==this.parentNode&&(a[i].className=a[i].className.replace("active","dormant"));a=this.parentNode.getElementsByTagName("dd");for(i=0;i<a.length;i++)a[i].parentNode==this.parentNode&&
  84. (a[i].style.display=this.count==a[i].count?"block":"none");return!1}addDOMLoadEvent(tabset);Accomplishment=function(a){this.initialize(a)};
  85. Accomplishment.prototype={initialize:function(a){this._tasks=(a.accomplishment_tasks||[]).map(function(b){b.statistic=a.statisticProvider(b.statistic_id);b=new AccomplishmentTask(b);a.onTaskComplete&&(b.onComplete=a.onTaskComplete.curry(b));return b});this._onComplete=a.onAccomplishmentComplete?a.onAccomplishmentComplete.curry(this):function(a){};this._id=a.id;this._dom_id=a.dom_id;this._level=a.level;this._badge_id=a.badge_id;this._card_id=a.card_id;this._raffle_id=a.raffle_id;this._item_id=a.item_id;
  86. this._reward_points=a.reward_points;this._pur_points=a.pur_points;this._badge_of_the_day=a.badge_of_the_day;this._hidden=a.hidden;a.accomplishment_group&&(this._accomplishment_group=new AccomplishmentGroup(a.accomplishment_group));this._has_completion_tab_been_shown=!1;a.scheduled_end&&(this._scheduled_end=new Date(1E3*a.scheduled_end))},id:function(){return this._id},domId:function(){return this._dom_id},tasks:function(){return this._tasks},andTasks:function(){return this.tasks().select(function(a){return a.isAndTask()})},
  87. orTasks:function(){return this.tasks().select(function(a){return a.isOrTask()})},isComplete:function(){if(this._complete)return!0;var a=!0;0<this.andTasks().length&&this.andTasks().any(function(a){return!a.isComplete()})&&(a=!1);a&&(0<this.orTasks().length&&this.orTasks().all(function(a){return!a.isComplete()}))&&(a=!1);a&&(this._complete=!0);return a},isAchievement:function(){return this._level?!0:!1},isBadgeOfTheDay:function(){return this._badge_of_the_day},rank:function(){return[null,"badge_of_the_day",
  88. "easy","medium","hard","impossible"].indexOf(this._level)},scheduledEnd:function(){return this._scheduled_end},purPoints:function(){return this._pur_points},purAwardContent:function(){var a=$j("#js-pur-award").clone().attr("id",""),b=this.purPoints();active_user.powerupRewardsUser()?(a.find(".js-pur-linked").show(),active_user.powerupRewardsProUser()&&(b=active_user.powerupRewardsBonusFor(b))):a.find(".js-pur-unlinked").show();a.find(".js-pur-points").html(b);return a},isActive:function(){return!this.scheduledEnd()?
  89. !0:this.scheduledEnd()>=new Date},isHidden:function(){return this._hidden},updateProgress:function(a,b){if(this.isComplete())return[];var c=this._tasks.inject([],function(c,e){return c.concat(e.updateProgress(a,b))});return this.isComplete()?[this._onComplete]:c},purgeProgress:function(){this.tasks().invoke("purgeProgress")},prizeName:function(){return this._card_id?"card":this._badge_id?"badge":this._raffle_id?"ticket":this._reward_points?"points":"reward"},hasCompletionTabBeenShown:function(){return this._has_completion_tab_been_shown},
  90. setHasCompletionTabBeenShown:function(){this._has_completion_tab_been_shown=!0},accomplishmentGroup:function(){return this._accomplishment_group},setAccomplishmentGroupProgressContent:function(a){this._accomplishment_group.setProgressContent(a)},accomplishmentGroupProgressContent:function(){var a=this.accomplishmentGroup();if(a)return a.progressContent()},hasCompleteAccomplishmentGroup:function(){return this.accomplishmentGroup()&&!this.accomplishmentGroup().expired()&&!this.accomplishmentGroup().progressContent()},
  91. hasItem:function(){return!!this._item_id}};function AccomplishmentGroup(a){this.initialize(a)}
  92. AccomplishmentGroup.prototype={initialize:function(a){this._id=a.id;this._scheduled_end=null;a.scheduled_end&&(this._scheduled_end=new Date(a.scheduled_end));this._progress_content=null;this._dueling_group=a.dueling_group;this._name=a.name},id:function(){return this._id},name:function(){return this._name},scheduledEnd:function(){return this._scheduled_end},setProgressContent:function(a){this._progress_content=a},progressContent:function(){return this.expired()?null:this._progress_content},expired:function(){return this._dueling_group&&
  93. active_user.duelingGroup()&&this._dueling_group!=active_user.duelingGroup()||this._scheduled_end&&new Date>this._scheduled_end?!0:!1}};AccomplishmentTask=function(a){this.initialize(a)};AccomplishmentTask.AND_OPERATOR="AND";AccomplishmentTask.OR_OPERATOR="OR";
  94. AccomplishmentTask.prototype={initialize:function(a){this._id=a.id;this._quota=a.quota;this._operator=a.operator;this._statistic=a.statistic;this._current_progress=a.current_progress},quota:function(){return this._quota},isAndTask:function(){return AccomplishmentTask.AND_OPERATOR==this._operator},isOrTask:function(){return AccomplishmentTask.OR_OPERATOR==this._operator},id:function(){return this._id},statistic:function(){return this._statistic},progress:function(){return this._current_progress},isComplete:function(){return 0<=
  95. this._statistic.compare(this._quota,this._current_progress)},isUnprogressed:function(){var a=this.progress();return null===a||void 0===a},updateProgress:function(a,b){if(this.isComplete()||a!==this._statistic.id()||(null===b||void 0===b)||1>this._statistic.compare(this._current_progress,b))return[];this._current_progress=b;this.renderUpdateTasks();return this.isComplete()?[this.onComplete]:[]},displayValue:function(){this.statistic().type();return this.isUnprogressed()?0:this.progress()},percentValue:function(){var a;
  96. a=this.statistic().type();Statistic.ADD_TYPE==a||Statistic.MAX_TYPE==a?this.isUnprogressed()?a=0:(a=this.quota()+0,a=100*((this.progress()+0)/a)):a=this.isComplete()?100:0;100<a&&(a=100);return a},purgeProgress:function(){this._current_progress=void 0},renderUpdateTasks:function(){var a=this.isComplete(),b=this.displayValue(),c=this.percentValue();$$(".accomplishmenttasks-"+this.id()).each(function(d){if(a){d.addClassName("complete");var e=d.down(".accomplishment_task_progress");e&&e.remove()}else(e=
  97. d.down(".progress_amount"))&&e.update(b);50<c&&(e=d.down(".marker"))&&e.addClassName("right");(e=d.down(".current"))&&e.update(b);d=d.down(".bar");e=c+"%";d&&d.setStyle({width:e})})}};AccomplishmentTracker=function(a){this.initialize(a)};
  98. AccomplishmentTracker.prototype={initialize:function(a){this._node=$$(".accomplishment_notifications")[0];this._holodeck=a.holodeck;this._accomplishments=[];this._statistics=[];this._buffered_events=[];this._accomplishments_ever_set=!1;this._onTaskComplete=a.onTaskComplete;this._onAccomplishmentComplete=a.onAccomplishmentComplete;this._earned_as_guest=(this._earned_as_guest=Cookie.get("guest_accomplishments"))?this._earned_as_guest.split(","):[];this._guest_points=parseInt(Cookie.get("guest_points")||
  99. 0,10);this._stat_values={};this._watch_stats=!1},purgeProgress:function(){this.accomplishments().invoke("purgeProgress")},node:function(){return this._node},setAccomplishmentsProgress:function(a){this.purgeProgress();var b=this;a.pluck("accomplishment_tasks").flatten().each(function(a){b.updateProgress(a.statistic_id,a.current_progress)});this.updateAccomplishmentPaneTitle()},setAccomplishments:function(a){this._accomplishments_ever_set=!0;this._accomplishments=[];for(var b=a.length-1;0<=b;b--){var c=
  100. a[b];c.statisticProvider=this.getStatisticById.bind(this);c.onAccomplishmentComplete=this._onAccomplishmentComplete;c.onTaskComplete=this._onTaskComplete;this._accomplishments.push(new Accomplishment(c))}var d=this;this._buffered_events.each(function(a){d.onStatisticUpdated(a)});this._buffered_events=[]},getAccomplishmentById:function(a){return this.accomplishments().detect(function(b){return a==b.id()})},accomplishmentHasInProgressGroup:function(a){(a=this.getAccomplishmentById(a))&&a.setAccomplishmentGroupInProgress()},
  101. accomplishments:function(){return this._accomplishments.select(function(a){return a.isActive()&&!a.isHidden()})},achievements:function(){return this.accomplishments().filter(function(a){return a.isAchievement()})},completeAchievements:function(){return this.achievements().filter(function(a){return a.isComplete()})},statistics:function(){return this._statistics},setStatistics:function(a){this._statistics=[];for(var b=a.length-1;0<=b;b--)this._statistics.push(new Statistic(a[b]))},onStatisticUpdated:function(a){this._accomplishments_ever_set?
  102. this.renderUpdateProgress(a.data.id,a.data.value):this._buffered_events.push(a)},completeAccomplishments:function(){return this.accomplishments().select(function(a){return!a.isHidden()&&a.isComplete()}).sortBy(function(a){return a.rank()})},incompleteAccomplishments:function(){return this.accomplishments().select(function(a){return!a.isComplete()}).sortBy(function(a){return a.rank()})},hiddenAccomplishments:function(){return this.accomplishments().select(function(a){return a.isHidden()})},nextAccomplishment:function(){if(0===
  103. this._earned_as_guest.size())return this.incompleteAccomplishments()[0];var a=this;return this.incompleteAccomplishments().find(function(b){return!a._earned_as_guest.include(b.id())})},getStatisticById:function(a){return this._statistics.detect(function(b){return a===b.id()})||new Statistic({id:a})},updateProgress:function(a,b){this._watch_stats&&this.statWatch(a,b);return this.accomplishments().inject([],function(c,d){return c.concat(d.updateProgress(a,b))})},renderUpdateProgress:function(a,b){var c=
  104. this;this.updateProgress(a,b).each(function(a){a.bind(c)()})},accomplishmentForId:function(a){return this.accomplishments().find(function(b){return b.id()==a})},updateAccomplishmentTab:function(a){var b=this.accomplishmentForId(a);b&&b.isComplete()&&($$(".achieved_image_"+a+"_for_award").each(function(a){a&&!a.visible()&&(a.previous().hide(),a.show())}),this.updateAccomplishmentPaneTitle())},updateAccomplishmentPaneTitle:function(){var a=$("accomplishments_pane_title"),b=a.down(".no_accomplishments_completed"),
  105. c=a.down(".some_accomplishments_completed"),a=a.down(".all_accomplishments_completed"),d=this.completeAccomplishments().length,e=this.accomplishments().length-this.hiddenAccomplishments().length;0===d?(a.hide(),c.hide(),b.show()):e==d?(c.hide(),b.hide(),a.show()):(a.hide(),b.hide(),c.down(".earned_accomplishments_count").update(d),c.show())},getTime:function(){return new Date},startWatchingStats:function(){console.log("Started watching stats");this._watch_stats=!0},statWatch:function(a,b){var c=this.getStatisticById(a);
  106. c?(0<c.compare(this._stat_values[a],b)&&console.log("Statistic %o id %o updated to value %o",c.name(),a,b),this._stat_values[a]=b):console.log("no such stat")},threeAMTomorrow:function(){var a=new Date;a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);3<=a.getHours()?a.setTime(a.getTime()+36E5*(24-(a.getHours()-3))):a.setTime(a.getTime()+36E5*(3-a.getHours()));return a},recordGuestAccomplishment:function(a){this._earned_as_guest.include(a.id())||(this._earned_as_guest.push(a.id()),this._guest_points+=
  107. a._reward_points,Cookie.setWithDate("guest_points",this._guest_points,this.threeAMTomorrow()),Cookie.setWithDate("guest_accomplishments",this._earned_as_guest,this.threeAMTomorrow()))}};ChatApiTab=function(a){this.initialize(a)};
  108. ChatApiTab.prototype={initialize:function(a){this._holodeck=a.holodeck;if(this._node=$("chat_api_pane")){this._canvas_node=this._node.down("#chat_api_canvas");this._title_node=this._node.down(".chat_api_pane_title");var b=this,c=this._holodeck;this._chat_dialogue=new ChatDialogue(this._node,function(a){b.sentMessage(a);c.konduit().dispatchEvent({type:KonduitEvent.CUSTOM_TAB_MESSAGE,data:{message:a,user:{username:c.username()}}})},this._holodeck,this._holodeck.chatWindow())}},sentMessage:function(a){this._chat_dialogue.displayMessage(this._holodeck.username(),
  109. a,{},{non_user:!0})},receivedMessage:function(a){this._chat_dialogue.displayMessage(a.data.user.username,a.data.message,{},{non_user:!0})},clearMessages:function(a){this._chat_dialogue.clear()},setTabInfo:function(a){var b=this._holodeck.height(),c=parseInt(a.data.size*b,10),b=Math.min(b-94,b-c-80);$("chat_api_canvas").setStyle({height:c+"px"});this._chat_dialogue.setMessageWindowHeight(b);this._title_node.update(a.data.description);a="string"==typeof a.data.name?a.data.name.substr(0,10):"Match";
  110. $("chat_api_title").update(a)}};ChatDialogue=function(a,b,c,d){this.initialize(a,b,c,d)};ChatDialogue.SCROLL_FUDGE=35;ChatDialogue.VERY_LARGE_SCROLL=131072;ChatDialogue.COLLECTION_PERIOD=8;ChatDialogue.MESSAGE_TEMPLATE=new Template('<p class="#{classNames}"><span username="#{username}" class="username #{userClassNames}">#{prefix}#{username}</span><span class="separator">: </span><span class="message hyphenate">#{message}</span><span class="clear"></span></p>');ChatDialogue.BIN_SIZE=8;
  111. ChatDialogue.prototype={initialize:function(a,b,c,d){this._messages_until_next_collection=0;this._holodeck=c;this._user_manager=d;this._parent_node=a;this._insertion_count=this._messages_count=0;this._onInputFunction=b;this._message_window_node=a.down(".chat_message_window");this._input_node=a.down(".chat_input");this._messages_to_retain=parseInt(document.location.href.parseQuery().messages_to_retain,10)||200;var e=this;this._input_node.observe("keypress",function(a){e.onKeyPress(a)});this._input_node.observe("focus",
  112. function(a){e.clearPrompt()});this._message_window_node.observe("click",function(a){if(a.target){var b=a.target.getAttribute("username");b&&(a.stop(),d.showProfile(b))}})},focus:function(){this._input_node.focus()},onKeyPress:function(a){a.keyCode==Event.KEY_RETURN&&(this.sendInput(),a.stop())},clearPrompt:function(){this._input_node.hasClassName("prompt_text")&&(this._input_node.removeClassName("prompt_text"),this._input_node.value="",this._input_node.stopObserving("focus"))},sendInput:function(){var a=
  113. this._input_node.value;this._holodeck.processChatCommand(a)&&this._holodeck.filterOutgoingMessage(a,this._onInputFunction);this._input_node.value=""},disable:function(){this._parent_node.down(".chat_controls").hide()},enable:function(){this._parent_node.down(".chat_controls").show()},displayUnsanitizedMessage:function(a,b,c,d){c||(c={});d||(d={});allow_mutes=(active_room=this._holodeck.chatWindow().activeRoom())&&!active_room.canUserModerate(active_room.self())||d.whisper;if(!allow_mutes||!this._user_manager.isMuted(a)){var e=
  114. !d.non_user?"chat_message_window_username":"chat_message_window_undecorated_username",f=a==this._user_manager.username(),m=[],e=[e];d=d["private"]?"To ":"";this._messages_count%2&&m.push("even");c["class"]&&m.push(c["class"]);f&&e.push("is_self");a=ChatDialogue.MESSAGE_TEMPLATE.evaluate({prefix:d,username:a,message:b,classNames:m.join(" "),userClassNames:e.join(" ")});this.insert(a);this._messages_count++}},displayMessage:function(a,b,c,d){var e=this;this._holodeck.filterIncomingMessage(b,function(b){e.displayUnsanitizedMessage(a,
  115. b,c,d)})},kongBotMessage:function(a){this.displayMessage("Kong Bot",a,{"class":"whisper received_whisper"},{non_user:!0})},cullMessages:function(){this._messages_until_next_collection=(this._messages_until_next_collection+1)%ChatDialogue.COLLECTION_PERIOD;if(0===this._messages_until_next_collection){var a=this._message_window_node.immediateDescendants(),b=a.length-this._messages_to_retain,c=0>b?0:b,b=function(){a.shift().remove()};if(0!==c)for(;0<c;c--)setTimeout(b,0)}},insert:function(a,b){var c=
  116. this,d=this._message_window_node,e=this._holodeck;e.scheduleRender(function(){var f=d.getHeight(),m=f+d.scrollTop+ChatDialogue.SCROLL_FUDGE>=d.scrollHeight,l=0!==f&&m;e.scheduleRender(function(){0===c._insertion_count%ChatDialogue.BIN_SIZE&&(c._insertion_target=document.createElement("div"),d.appendChild(c._insertion_target));c._insertion_count++;if("string"==typeof a||a instanceof String)a=(new Element("div")).update(a);c._insertion_target.appendChild(a);l&&c.scrollToBottom();b&&b()})})},scrollToBottom:function(){this._message_window_node.scrollTop=
  117. ChatDialogue.VERY_LARGE_SCROLL},setInput:function(a){this.clearPrompt();var b=this._input_node;setTimeout(function(){b.setValue(a);b.positionCaretAtEnd()},0)},sendPrivateMessage:function(a,b){this._user_manager.sendPrivateMessage(a,b);this.displayMessage(a,b,{"class":"whisper sent_whisper"},{"private":!0})},receivedPrivateMessage:function(a){if(a.data.success){var b=this;this._holodeck.filterIncomingMessage(a.data.message,function(c){b.displayUnsanitizedMessage(a.data.from,c+'&nbsp; (<a class="reply_link" onclick="holodeck.insertPrivateMessagePrefixFor(\''+
  118. a.data.from+'\');return false;" href="#">reply</a>)',{"class":"whisper received_whisper"},{whisper:!0})})}else this.kongBotMessage(a.data.to+" cannot be reached. Please try again later.")},setMessageWindowHeight:function(a){this._message_window_node.setStyle({height:a+"px"})},clear:function(){this._message_window_node.update("");this._insertion_count=this._messages_count=0}};ChatNag=function(a,b){this.initialize(a,b)};
  119. ChatNag.prototype={initialize:function(a,b){this._chat_window=a;this._chat_nags=b;this._current_increment=0;b.each(function(a){active_user.isPremium()&&a.advertising&&b.splice(b.indexOf(a),1)});if(b&&0<b.length){var c=this;this._executer=new PeriodicalExecuter(function(){c.showNag()},60)}},showNag:function(){var a,b,c,d,e,f;this._current_increment+=1;if(this._chat_nags&&0<this._chat_nags.length&&this._current_increment===this._chat_nags.first().spawn_delay){a=this._chat_nags.shift();if(e=null!==a.cnid){f=
  120. "kong_cns_"+a.cnid;if(a.suppressible&&Cookie.get(f))return;if(a.per_user_limit){b="kong_cnul_"+a.cnid;c=parseInt(Cookie.get(b)||0,10);if(c>=a.per_user_limit)return;Cookie.set(b,c+1,a.days_to_expire,"/")}b=parseInt(Cookie.get(Holodeck.KONG_GAMEPLAYS_COOKIE_NAME)||1,10);c="kong_cn_"+a.cnid;d=parseInt(Cookie.get(c)||0,10);d+=a.frequency}if(!e||d<=b)this._chat_window.showChatNag(this.prepareNagContent(a),function(){var b=$("nag_supress_control_"+a.cnid);b&&b.observe("click",function(b){$("nag_wrapper_"+
  121. a.cnid).hide();Cookie.set(f,"true",a.days_to_expire,"/");Event.stop(b);return!1})}),this._chat_window.recordAnalyticsEvent("ChatNag",a.name),e&&(Cookie.set(c,b,a.days_to_expire,"/"),a.has_campaign_cap&&new Ajax.Request("/chat_nags/"+a.cnid+"/increment",{method:"post"}))}},prepareNagContent:function(a){var b=(new Date).getTime(),b=a.nag_content.gsub("TIMESTAMP",b),c=new Template('<div id="nag_wrapper_#{cnid}" class="chat_nag"><a title="Do not show this again" id="nag_supress_control_#{cnid}" class="nag_supress_control">X</a>#{content}</div>');
  122. a.suppressible&&(b=c.evaluate({cnid:a.cnid,content:b}));return b},updateDefaultNag:function(a){if(this._chat_nags&&!(0==this._chat_nags.length||null!=this._chat_nags[0].cnid))this._chat_nags[0]=a}};ChatRoom=function(a,b){this.initialize(a,b)};ChatRoom._generateTemplate=function(){this._template||(this._template=$$(".chat_room_template")[0])};ChatRoom.template=function(){this._generateTemplate();return this._template.cloneNode(!0)};
  123. ChatRoom.updateTemplateSilenceScheduledEnd=function(a){this._generateTemplate();this._template.down(".silence_duration").update(tr("You have been silenced for "+a))};ChatRoom.initializeTemplates=function(){ChatRoom.USER_ROW_TEMPLATE||(ChatRoom.USER_ROW_TEMPLATE=new Template($("user_row_template").innerHTML),ChatRoom.ADMIN_MESSAGE_TEMPLATE=new Template($("admin_message_template").innerHTML))};
  124. ChatRoom.prototype={initialize:function(a,b){this._chat_window=a;this._room=b;this._users={};this._users_list=[];this._guests_in_room_count=this._users_in_room_count=0;this._favorite_room=a.isFavoriteRoom(b.id);this._guildRoster=void 0;this._node=ChatRoom.template();ChatRoom.initializeTemplates();this._users_in_room_node=this._node.down(".users_in_room");this._guests_in_room_node=this._node.down(".guest_count_in_room");this._number_in_room_node=a._chat_window_node.down(".number_in_room");this._guest_count_holder=
  125. this._node.down(".guest_count_holder");this._silence_duration_node=this._node.down(".silence_duration");this._chat_actions_node=(new Element("div")).setStyle({display:"none"}).update($("chat_actions_dropdown_template").innerHTML);this._chat_actions_options=this._chat_actions_node.down("ul.chat_actions_list");this._chat_actions_control=this._chat_actions_node.down("span.btn");var c=this;this._chat_actions_control.observe("click",function(){$j(c._chat_actions_options).toggle()});document.observe("click",
  126. function(a){a.target.hasClassName("btn_target")||$j(c._chat_actions_options).hide()});$("chat_actions_container").insert(this._chat_actions_node);this._chat_actions_options.select(".exclude_"+this.type()).invoke("remove");this._favorite_room_option_node=this._chat_actions_options.down(".favorite_room");this._tab_for_room=this._chat_window.tabForRoom(this);this._unread_message_node=this._tab_for_room.down(".unread_chat_messages");this._favorite_room_option_node&&this._favorite_room&&this._favorite_room_option_node.writeAttribute("data-chat-action",
  127. "unfavorite_room").update(tr8nProxy.trl("Unfavorite room"));var d=function(a){c.addToFavorites();a.stop()},e=function(b){a.showOnlineFriends();b.stop()};this._chat_actions_options.observe("click",function(b){var m;m=$j(b.target);var l=null;m.is("li")||(m=m.parent("li"));l=m.attr("data-chat-action");switch(l){case "room_chooser":a.activateRoomChooser();break;case "leave_private":c.isMyPrivateRoom()?holodeck.destroyPrivateRoom():holodeck.leavePrivateRoom();break;case "leave_guild":holodeck.leaveGuildRoom();
  128. break;case "friends_online":m=CapturesToInlineRegistration.decorate(e);m(b);break;case "room_details":a.activateRoomInfo(c);b.stop();break;case "favorite_room":b.stop();m=CapturesToInlineRegistration.decorate(d);m(b);break;case "unfavorite_room":c.removeFromFavorites();b.stop();break;case "set_status":KonduitPresenceType.AWAY==c._presence?a.holodeck().setPresenceChat():a.holodeck().setPresenceAway()}c._chat_actions_options.hide()});this._users_in_room_node.observe("mouseover",function(b){var d=b.target.getAttribute("username");
  129. d&&d.toLowerCase()!=c.username().toLowerCase()&&(d=c.user(d),a.showUserRollover(d),Event.stop(b))});this._users_in_room_node.observe("mouseout",function(b){a.hideUserRollover();Event.stop(b)});this._users_in_room_node.observe("click",function(b){var c=b.target.getAttribute("username");c&&(a.showProfile(c),Event.stop(b))});this._messages_to_retain=parseInt(document.location.href.parseQuery().messages_to_retain,10)||200;this._chat_dialogue=new ChatDialogue(this._node,function(a){c.sendRoomMessage(a)},
  130. this.holodeck(),this._chat_window);a._chat_rooms_container_node.insert({bottom:this._node})},destroy:function(){this._node.remove();this._chat_actions_node.remove()},chatEnabled:function(){return this._chat_enabled},disable:function(){this._chat_dialogue.disable();this._chat_enabled=!1},disableDueToGuest:function(){this._node.down(".guest_chat_controls").show();this.disable()},disableDueToSilence:function(){this.isPrivate()||(this._node.down(".silenced_chat_controls").show(),this.disable())},enable:function(){this._node.down(".guest_chat_controls").hide();
  131. this._node.down(".silenced_chat_controls").hide();this._chat_dialogue.enable();this._chat_enabled=!0},username:function(){return this._chat_window.username()},name:function(){return this._room.name},xmppName:function(){return this._room.xmpp_name},shortName:function(){this._short_room_name||(this._short_room_name="room_"+this._room.xmpp_name);return this._short_room_name},type:function(){return this._room.type},guildId:function(){if("guild"!=this.type())console.error("Attempted to check guildId for non guild room");
  132. else return Holodeck.guildIdFromXmppName(this.xmppName())},updateGuildRoster:function(a){var b=this;this._guildRoster={};$j.each(a,function(a,d){b._guildRoster[d.username]=d});this.updateExistingGuildUsernames(b._guildRoster)},updateExistingGuildUsernames:function(a){var b=this;$j.each(a,function(a,d){var e=b.user(d.username);e&&$j(e.userRowNode()).find(".js-guild-name").html("("+d.game_character_name+")")})},hasGuildRoster:function(){return!!this._guildRoster},getGuildMembership:function(a){return this._guildRoster[a]||
  133. {}},konduit:function(){return this._chat_window.konduit()},isPrivate:function(){return"private"==this.type()},isMyPrivateRoom:function(){return this.isPrivateRoomOwner(this.username())},isPrivateRoomOwner:function(a){if(this.isPrivate()&&a)try{var b=this.xmppName(),c=b.substr(b.indexOf("-")+1);return c&&c.toLowerCase()==a.toLowerCase()}catch(d){}return!1},privateRoomOwnerUsername:function(){if(this.isPrivate())try{return this.name().split("'")[0]}catch(a){}return null},dispatchEvent:function(a){this.konduit().dispatchEvent(a)},
  134. insert:function(a,b){this._chat_dialogue.insert(a,b)},receivedAdminMessage:function(a){this._chat_dialogue.insert(ChatRoom.ADMIN_MESSAGE_TEMPLATE.evaluate({content:a.data.admin_message}))},sendRoomMessage:function(a){a&&this.dispatchEvent({type:KonduitEvent.ROOM_MESSAGE,data:{message:this._chat_window.escapeOutgoingMessage(a),room:this._room}})},receivedMessage:function(a){this.isActive()||this._unread_message_node.show();this.checkUserForModeration(a.data.user.username);this._chat_dialogue.displayMessage(a.data.user.username,
  135. a.data.message)},checkUserForModeration:function(a){this.self()?this.canUserModerate(this.self())&&this._chat_window.noticedModeratableUser(a):this.checkUserForModeration.bind(this).delay(500,a)},messageError:function(a){this.insert(this._chat_window.errorMessageTemplate(a.data.errorType))},_avatarSrc:function(a){return a.chatAvatarUrl()},_avatarStyle:function(a){return""},_generateUserNode:function(a){var b=this._chat_window,c=a.username,d={rowClasses:[],avatarSrc:this._avatarSrc(a),avatarStyle:this._avatarStyle(a),
  136. userNodeId:this.userNodeId(c),usernameNodeId:this.usernameNodeId(c),username:c,level:a.level()};if("guild"===this.type()&&this.hasGuildRoster()){var e=this.getGuildMembership(c).game_character_name;e&&(d.game_character_name="("+e+")")}a.isSilenced()&&d.rowClasses.push("silenced");KonduitPresenceType.AWAY==a.presence()&&d.rowClasses.push("away");b.isMuted(a)&&d.rowClasses.push("muted");e={};a.isAdmin()?e={extraIconClass:"spritesite admin_icon",extraIconType:"Administrator",extraIconTitle:"Administrator"}:
  137. this.owner()==c?e={extraIconClass:"spritesite room_owner_icon",extraIconType:"Room Owner",extraIconTitle:"Room Owner"}:this.canUserModerate(a)?e={extraIconClass:"spritesite moderator_icon",extraIconType:"Moderator",extraIconTitle:"Moderator"}:a.isDeveloper()&&(e={extraIconClass:"spritesite developer_icon",extraIconType:"Developer",extraIconTitle:"Developer"});d=Object.extend(d,e);c=ChatRoom.USER_ROW_TEMPLATE;if(e=a.specialChatVars()){var f=(active_user.username()==a.username?"You've":a.username)+
  138. " completed",m=[];e.chat_icons&&(e.chat_icons.each(function(a){a.message=f;m.push('<img src="#{image_url}" alt="#{message} #{subject_name}" title="#{message} #{subject_name}" class="#{slug} rank_icon" />'.interpolate(a))}),d.extraIconTags=m.join(""))}c=(new Element("div",{id:d.userNodeId,"class":"user_row "+d.rowClasses.join(" ")})).update(c.evaluate(d));b.isFriend(a)||c.down(".friend_icon").remove();d.extraIconType||c.down(".rank_icon").remove();a.isPremium()?active_user.premiumizeUpsellNode(c.down(".premium_icon"),
  139. "username_icon","icon_tab"):c.down(".premium_icon").remove();return c},self:function(){return this._users[this.username().toLowerCase()]},removeUserNode:function(a){(a=this.user(a.username))&&a.userRowNode()&&a.userRowNode().remove()},isGuest:function(a){return this._chat_window.isGuest(a)},userSorter:function(){var a=this._chat_window,b=this,c=function(b){return a.username()==b.username},d=function(a){return!a.isSilenced()},e=function(a){return a.isAdmin()},f=function(a){return!a.isAdmin()&&b.canUserModerate(a)},
  140. m=function(b){return a.isFriend(b)},l=function(b){return!a.isMuted(b)},u=function(a){return a.isAway()},h=function(a,b,c){b=a(b);a=a(c);return b&&!a?-1:!b&&a?1:0};return function(a,b){return h(c,a,b)||h(d,a,b)||h(e,a,b)||h(f,a,b)||h(m,a,b)||h(l,a,b)||a.username.toLowerCase().localeCompare(b.username.toLowerCase())||h(u,a,b)}},updateUser:function(a,b){if(!this.isGuest(a)){var c=this.userSorter(),d=this._users[a.username.toLowerCase()],e=new ChatUser(a.variables);if(b||!(d&&0===c(d,e)))if(d&&(this.removeUserNode(e),
  141. this._users_list.orderedDelete(d,c)),this._users[e.username.toLowerCase()]=e,e.setUserRowNode(this._generateUserNode(e)),c=this._users_list.orderedInsert(e,c),0<c?this._users_list[c-1].userRowNode().insert({after:e.userRowNode()}):this._users_in_room_node.insert({top:e.userRowNode()}),e.username==this._chat_window.username()){if(this._presence!=e.presence())switch(e.presence()){case KonduitPresenceType.CHAT:this._chat_dialogue.kongBotMessage("Set status to active");$j("[data-chat-action=set_status]").html(tr8nProxy.trl("Set status")+
  142. ":"+tr8nProxy.trl("Away"));break;case KonduitPresenceType.AWAY:this._chat_dialogue.kongBotMessage("Set status to away"),$j("[data-chat-action=set_status]").html(tr8nProxy.trl("Set status")+":"+tr8nProxy.trl("Active"))}this._presence=e.presence()}}},updateRoomHeader:function(){this._chat_window._chat_window_node.down(".room_name").innerHTML=this.name();this.updateUsersCount()},updateUsersCount:function(){this.isActive()&&this._number_in_room_node.update(this._users_list.length+this._guests_in_room_count)},
  143. updateGuestCount:function(a){a&&this.setGuestCount(this._guests_in_room_count+a)},guestCountUpdated:function(a){this.setGuestCount(a.data.guests)},setGuestCount:function(a){0<=a&&(this._guests_in_room_count=a);a=" guests in room";1==this._guests_in_room_count&&(a=" guest in room");0<this._guests_in_room_count?(this._guest_count_holder.show(),this._guests_in_room_node.update(this._guests_in_room_count+a)):this._guest_count_holder.hide()},updateSilenceScheduledEnd:function(a){this._silence_duration_node.update(tr("You have been silenced for "+
  144. a))},isSilenced:function(){return this._chat_window.isSilenced()},userJoined:function(a){a=a.data.user;this.user(a.username)||this.updateUser(a);this.isGuest(a)&&this.updateGuestCount(1);this.updateUsersCount()},userChanged:function(a){this.updateUser(a.data.user,a.data.force||a.data.user.variables.force)},userLeft:function(a){a=a.data.user;this.isGuest(a)||(this._users_list.orderedDelete(this.user(a.username.toLowerCase()),this.userSorter()),this.removeUserNode(a),this._users[a.username.toLowerCase()]=
  145. void 0,this.isMyPrivateRoom()&&delete holodeck._users_invited[a.username]);this.isGuest(a)&&this.updateGuestCount(-1);this.updateUsersCount()},updateChatControlsForUser:function(a){a.username==this.username()&&(a.isSilenced()||this.enable(),this.isGuest(a)&&this.disableDueToGuest())},userListScrollTop:function(){return this._users_in_room_node.scrollTop},user:function(a){return this._users[a.toLowerCase()]},users:function(){return this._users_list},addFriends:function(a){this.refreshUsers(a)},removeFriends:function(a){this.refreshUsers(a)},
  146. addMutings:function(a){this.refreshUsers(a)},refreshUsers:function(a){for(var b,c=0,d=a.length;c<d;c++)(b=this.user(a[c]))&&this.userChanged({data:{user:b,force:!0}})},hide:function(){this._node.hide();this._chat_actions_node.hide();this._tab_for_room.removeClassName("active")},show:function(){this._node.show();this.updateRoomHeader();this._chat_actions_node.show();this._tab_for_room.addClassName("active");this._unread_message_node.hide();this.scrollToBottom()},showChatNag:function(a,b){this.insert(a,
  147. b)},owner:function(){return this._chat_window.roomOwner(this._room.id)},holodeck:function(){return this._chat_window.holodeck()},insertInChatInput:function(a){this._chat_dialogue.setInput(a)},addToFavorites:function(){this._chat_window.recordAnalyticsEvent("ChatAction","FavoriteRoom");new Ajax.Request("/rooms/"+this._room.id+"/favorite_rooms",{asynchronous:!0,evalScripts:!0,method:"post"});this._favorite_room_option_node.writeAttribute("data-chat-action","unfavorite_room").update(tr8nProxy.trl("Unfavorite room"));
  148. this._chat_window.addFavoriteRooms([this._room.id])},removeFromFavorites:function(){new Ajax.Request("/rooms/"+this._room.id+"/unfavorite_rooms",{asynchronous:!0,method:"post"});this._favorite_room_option_node.writeAttribute("data-chat-action","favorite_room").update(tr8nProxy.trl("Favorite this room"));this._chat_window.removeFavoriteRoom(this._room.id)},userNodeId:function(a){return"user_"+a+"_"+this.shortName()},usernameNodeId:function(a){return"username_"+this.userNodeId(a)},getId:function(){return this._room.id},
  149. scrollToBottom:function(){this._chat_dialogue.scrollToBottom()},isActive:function(){return this==this._chat_window.activeRoom()},roomId:function(){return parseInt(this._room.id)},isGameRoom:function(){return"game"==this._room.type},gameId:function(){return!this.isGameRoom()?null:parseInt(this._room.id.split("-")[0])},canUserModerate:function(a){if(!a)return!1;var b=a.moderatorRoomIds();a=a.moderatorGameIds();return"all"==b||"all"==a?!0:this.isGameRoom()?a.include(this.gameId()):b.include(this.roomId())}};
  150. ChatRoomChooser=function(a){this.initialize(a)};ChatRoomChooser.DESCRIPTION_TOP_FUDGE=9;
  151. ChatRoomChooser.prototype={initialize:function(a){this._chat_window=a.chat_window;this._node=$("chat_room_chooser");this._holodeck=a.holodeck;if(this._node){this._rooms_list_node=this._node.down(".rooms_list");if(this._room_description_rollover_node=this._rooms_list_node.down(".room_description_rollover_container"))this._room_description_rollover_content=this._room_description_rollover_node.down(".room_description_rollover_content");var b=this,c=this._holodeck;this._node.down(".return_to_room").observe("click",
  152. function(a){b.deactivate();a.stop()});this._rooms_list_node.observe("click",function(a){var e=a.target;e.hasClassName("room")||(e=e.up(".room"));if(e&&(!e.hasClassName("full")||c.isChatModerator()))b._chat_window.recordAnalyticsEvent("ChatAction","ChangeRoom"),b.joinRoom(e);a.stop()});this._room_groups=$H()}},isActive:function(){return this._node.visible()},activate:function(a){a&&this._node.down(".room_name").update(a.name());this._chat_window.hideChatWindow();this.requestJoinableRooms();this.clearGroups();
  153. this._chat_window.setActiveTempPane(this);this.show()},deactivate:function(){this.hide();this._chat_window.clearActiveTempPane();this._chat_window.showChatWindow()},show:function(){this._node.ieHappyShow()},hide:function(){this._node&&this._node.ieHappyHide()},clearGroups:function(){$H(this._room_groups).each(function(a){a=a[1];a.clearRooms();a._node.hide()})},roomGroups:function(a){this.clearGroups();for(var b=0,c=a.length;b<c;b++)this.addRoomGroup(a[b])},redoRoomList:function(){this.clearGroups();
  154. this.isActive()&&this.requestJoinableRooms()},addRoomGroup:function(a){var b=this._rooms_list_node,c=this,d=this._room_groups.getWithDefault(a.name,function(){return new ChatRoomGroup(c,b,a)});d.setRooms(a.rooms);d.show();a.expand&&d.open()},requestJoinableRooms:function(){this._chat_window.showSpinner();var a=this._chat_window;new Ajax.Request("/rooms.js?game_id="+this.holodeck().gameId(),{method:"get",onComplete:a.hideSpinner})},roomGroup:function(a){return this._room_groups.get(a)},joinRoom:function(a){var b=
  155. a.room;(a=$j(a).data("guild-room"))?this.holodeck().joinRoom(a):b.premium_only&&!active_user.isPremium()?lightbox.prototype.initializePremiumMembershipPurchase("premium_only_chatroom","chat_features_tab"):this.holodeck().joinRoom(b)},holodeck:function(){return this._holodeck},showDescriptionRollover:function(a,b){this._room_description_rollover_content.update(a);this.setDescriptionRolloverPosition(b);this._room_description_rollover_node.show()},hideDescriptionRollover:function(){this._room_description_rollover_content.update("");
  156. this._room_description_rollover_node.hide()},beginDescriptionRolloverHide:function(){var a=this;this._room_rollover_hide_timer&&clearTimeout(this._room_rollover_hide_timer);this._room_rollover_hide_timer=setTimeout(function(){a.hideDescriptionRollover()},2E3)},stopDescriptionRolloverHide:function(){clearTimeout(this._room_rollover_hide_timer)},setDescriptionRolloverPosition:function(a){var b=this._rooms_list_node.scrollTop;a=a.positionedOffset()[1];var c=a-=ChatRoomChooser.DESCRIPTION_TOP_FUDGE;b<
  157. a&&(c=a-b);this._room_description_rollover_node.setStyle({top:c+"px"})}};ChatRoomGroup=function(a,b,c){this.initialize(a,b,c)};ChatRoomGroup.template=function(){this._template||(this._template=$$(".joinable_rooms_group")[0]);return this._template.cloneNode(!0)};
  158. ChatRoomGroup.prototype={initialize:function(a,b,c){this._name=c.name;this._chooser=a;a=ChatRoomGroup.template();b.insert(a);c.move_to_top?b.insert({top:a}):b.insert({bottom:a});this._node=a;this._list_node=a.down(".rooms");this._panel=new CollapsiblePanel(a);a.down(".group_name").update(this._name)},setRooms:function(a){var b=this._list_node,c=this._chooser;c.holodeck();var d=this;a.each(function(a,f){var m=d.buildRoomNode(a);b.insert(m);a.description&&(m.observe("mouseover",function(b){c.showDescriptionRollover(a.description,
  159. m);Event.stop(b)}),m.observe("mouseout",function(a){c.beginDescriptionRolloverHide();Event.stop(a)}))})},buildRoomNode:function(a){return"guild"===a.type?this.buildGuildRoomNode(a):this.buildRegularRoomNode(a)},buildGuildRoomNode:function(a){var b=$j("#js-guild-room-template li").clone();b.find(".js-name").html(a.game_title+": "+a.guild_name);b.data("guild-room",a);return b[0]},buildRegularRoomNode:function(a){var b=new Element("li",{"class":0===i%2?"even room":"odd room"});b.room=a;var c=(new Element("p",
  160. {"class":"name"})).update(a.name);a.premium_only&&(active_user.isPremium()||c.addClassName("upsell"),c.addClassName("premium_room_icon spritesite"));"game"===a.type&&("en"!==a.language&&"any"!=a.language)&&(c.insert("&nbsp;"),c.insert((new Element("em")).update("<strong>("+a.language+")</strong>")));b.insert(c);a.joinable?b.insert((new Element("p",{"class":"user_count"})).update(a.total_user_count)):(b.insert((new Element("p",{"class":"user_count"})).update("full")),holodeck.isChatModerator()?b.addClassName("mod_full"):
  161. b.addClassName("full"));b.insert(new Element("div",{style:"clear:both;"}));return b},node:function(){return this._node},clearRooms:function(){this._list_node.select(".room").each(function(a){a.remove()})},show:function(){this._node.show()},hide:function(){this._node.hide()},open:function(){this._panel.open()}};ChatUser=function(a){this.initialize(a)};
  162. ChatUser.prototype={initialize:function(a){this.username=a.username;this._game_url=a.game_url;this._game_title=a.game_title;this._chat_avatar_url=a.chat_avatar_url;this._admin=a.admin;this._developer=a.developer;this._premium=a.premium;this._role=a.role;this._presence=a.presence;this._level=a.level;this._special_chat_vars=null;try{this._special_chat_vars="object"==typeof a.special_chat_vars?a.special_chat_chars:a.special_chat_vars.evalJSON()}catch(b){if("undefined"!=typeof console)try{console.log("Could not parse variables object %o",
  163. a.special_chat_vars)}catch(c){}}this._moderator_room_ids=a.moderator_room_ids||[];this._moderator_game_ids=a.moderator_game_ids||[]},gameUrl:function(){return this._game_url},gameTitle:function(){return this._game_title},chatAvatarUrl:function(){return this._chat_avatar_url},isAdmin:function(){return this._admin},isDeveloper:function(){return this._developer},isPremium:function(){return this._premium},role:function(){return this._role},level:function(){return this._level},presence:function(){return this._presence},
  164. specialChatVars:function(){return this._special_chat_vars},moderatorRoomIds:function(){return this._moderator_room_ids},moderatorGameIds:function(){return this._moderator_game_ids},isSilenced:function(){return"participant"!=this.role()&&"moderator"!=this.role()},isAway:function(){return KonduitPresenceType.AWAY==this.presence()},changeRole:function(a){this._role=a},setUserRowNode:function(a){this._user_row_node=a},userRowNode:function(){return this._user_row_node}};ChatWindow=function(a){this.initialize(a)};
  165. ChatWindow.MODERATABLE_TIME_LIMIT=18E5;
  166. ChatWindow.prototype={initialize:function(a){a.chat_window=this;this._holodeck=a.holodeck;this._friends={};this._mutings={};this._rooms=new Hash;this._room_owners={};this._node=$("chat_tab_pane");this._chat_window_node=$("chat_window");this._chat_rooms_container_node=$("chat_rooms_container");this._rooms_to_join=[];this._favorite_rooms=[];this._rooms_by_type={};this._chat_tab_clicked=this._logged_in_to_chat=!1;this._room_chooser=new ChatRoomChooser(a);this._user_rollover_manager=new UserRollover(this);
  167. this._mini_profile=new MiniProfile(a);this._online_friends=new OnlineFriends(this);this._room_info=new RoomInfo(a);this._moderatableUsers={};this._moderatableUsersSweeper=null;this._chat_bootstrap_url=a.chat_bootstrap_url;this._seen=!1;this._deferred_room_params={};this._deferred_room_callbacks={};this.LAST_VIEWED_TAB_COOKIE="kong_chat_tab";this.GENERAL_CHAT_ROOM="chat";this.GAME_CHAT_ROOM="game";this.GUILD_CHAT_ROOM="guild";this.PRIVATE_CHAT_ROOM="private";this.SINGLE_PLAYER_GAME="spg";this.MULTIPLAYER_GAME=
  168. "mpg";this.GUILD_GAME="guilds";this._activeTabMatrix={};this._activeTabMatrix[this.SINGLE_PLAYER_GAME]={};this._activeTabMatrix[this.SINGLE_PLAYER_GAME][this.GENERAL_CHAT_ROOM]=this.GENERAL_CHAT_ROOM;this._activeTabMatrix[this.SINGLE_PLAYER_GAME][this.GAME_CHAT_ROOM]=this.GENERAL_CHAT_ROOM;this._activeTabMatrix[this.SINGLE_PLAYER_GAME][this.GUILD_CHAT_ROOM]=this.GUILD_CHAT_ROOM;this._activeTabMatrix[this.SINGLE_PLAYER_GAME][this.PRIVATE_CHAT_ROOM]=this.PRIVATE_CHAT_ROOM;this._activeTabMatrix[this.MULTIPLAYER_GAME]=
  169. {};this._activeTabMatrix[this.MULTIPLAYER_GAME][this.GENERAL_CHAT_ROOM]=this.GAME_CHAT_ROOM;this._activeTabMatrix[this.MULTIPLAYER_GAME][this.GAME_CHAT_ROOM]=this.GAME_CHAT_ROOM;this._activeTabMatrix[this.MULTIPLAYER_GAME][this.GUILD_CHAT_ROOM]=this.GUILD_CHAT_ROOM;this._activeTabMatrix[this.MULTIPLAYER_GAME][this.PRIVATE_CHAT_ROOM]=this.PRIVATE_CHAT_ROOM;this._activeTabMatrix[this.GUILD_GAME]={};this._activeTabMatrix[this.GUILD_GAME][this.GENERAL_CHAT_ROOM]=this.GUILD_CHAT_ROOM;this._activeTabMatrix[this.GUILD_GAME][this.GAME_CHAT_ROOM]=
  170. this.GUILD_CHAT_ROOM;this._activeTabMatrix[this.GUILD_GAME][this.GUILD_CHAT_ROOM]=this.GUILD_CHAT_ROOM;this._activeTabMatrix[this.GUILD_GAME][this.PRIVATE_CHAT_ROOM]=this.PRIVATE_CHAT_ROOM;var b=this;this._chat_bootstrap_url&&this.bootstrapChat.bind(this).runWhenDomLoaded(!0);$$("#chat_room_tabs .chat_room_tab").each(function(a){a.down("a").observe("click",function(d){var e=a.id.split("_")[0],f=b.roomByType(e),m=["chat","game"],l=function(a){return a===e};0<=m.indexOf(e)&&active_user.isChatModerator()&&
  171. (m.reject(l).each(function(a){(f=b.roomByType(a))&&holodeck.setPresenceAway(f.xmppName())}),m.filter(l).each(function(a){(f=b.roomByType(a))&&holodeck.setPresenceChat(f.xmppName())}));f?(b.setActiveRoom(f),b.activeChatDialogue().focus()):(b.joinDeferredRoom(e),function(){b.activeChatDialogue().focus()}.delay(0.2));Event.stop(d);return!1})})},roomByType:function(a){return this._rooms_by_type[a]},hasJoinedAnyRooms:function(){return 0<this._rooms.size()},requestRoomToJoin:function(){new Ajax.Request(this._chat_bootstrap_url,
  172. {method:"post",parameters:{choose_room:!0}})},bootstrapChat:function(a){var b=this._chat_bootstrap_url,c=Cookie.get("kong_room_id"),d={};c&&(d.room_id=c);a&&(d.gameplay_id=this._holodeck.gameplay(),d.reload=!0,this._mini_profile.deactivate(),this._room_info.deactivate(),this._room_chooser.deactivate());new Ajax.Request(b,{method:"post",parameters:d})},findOrCreateRoom:function(a){if(!a.id)return null;a.owner=this.roomOwner(a.id);var b=this._rooms.get(a.id);b||(b=new ChatRoom(this,a),this._rooms.set(a.id,
  173. b),$("chat_window_header").show());return b},joinedRoom:function(a){var b=this.roomByType(a.type),c=this.findOrCreateRoom(a);if(c&&c!=b)if(this._rooms_by_type[a.type]=c,this.authenticated()&&("private"!=c.type()&&b&&this.updateLastActionTaken(),this.startBeacon()),this.GAME_CHAT_ROOM==a.type&&this._hide_first_game_room_join)this._hide_first_game_room_join=!1;else return this.tabForRoom(c).show(),this.setActiveRoom(c),c},holodeck:function(){return this._holodeck},authenticated:function(){return this._holodeck.authenticated()},
  174. isAdmin:function(a){return this._active_room.user(a).isAdmin()},setLastViewedTabCookie:function(a){Cookie.set(this.LAST_VIEWED_TAB_COOKIE,a,void 0,"/games")},getLastViewedTabCookie:function(){return Cookie.get(this.LAST_VIEWED_TAB_COOKIE)},setActiveRoom:function(a){var b=a.type();this._active_room=a;this.setLastViewedTabCookie(b);this._holodeck._active_dialogue=a._chat_dialogue;this.showActiveRoom()},showActiveRoom:function(){var a=this,b=this._active_room;this.activeTempPane();var c=this._holodeck;
  175. this._rooms.values().each(function(d){d==b?d.show():d.hide();a.isSilenced()&&!d.isPrivate()?d.disableDueToSilence():c.authenticated()?d.enable():d.disableDueToGuest()})},activatePrivateRoom:function(){this.canActivatePrivateRoom()&&this.roomByType("private")&&this.setActiveRoom(this.roomByType("private"))},canActivatePrivateRoom:function(){return this.roomByType("private")&&this._active_room!=this.roomByType("private")},leftRoom:function(a){var b=a.room,c=this._rooms.get(b.id),d=c?c.type():void 0;
  176. if("private"==d||"guild"==d){var e=this.roomByType(d);e&&e.xmppName()==b.xmpp_name&&(this.tabForRoom(e).hide(),this.setFirstAvailableRoomAsActive(["game","chat"]),delete this._rooms_by_type[d])}a.kicked?function(a){a.activeChatDialogue().displayMessage("Kong Bot","You have been removed from "+b.name+".",{"class":"whisper received_whisper"},{non_user:!0})}.defer(this):c&&(c.isPrivate()&&!c.isMyPrivateRoom()&&(a.owner_destroyed||a.owner_left))&&function(a){var b=c.privateRoomOwnerUsername()||"The room owner";
  177. a.activeChatDialogue().displayMessage("Kong Bot",b+" has left the room and the private session has ended.",{"class":"whisper received_whisper"},{non_user:!0})}.defer(this);this._rooms.unset(b.id);c&&(c.destroy(),delete c);0===this._rooms.keys().length&&$("chat_window_header").hide()},setFirstAvailableRoomAsActive:function(a){var b=this,c,d;a.find(function(a){c=b.roomByType(a);return!!c})?this.setActiveRoom(c):a.find(function(a){(c=b.hasDeferredRoom(a))&&(d=a);return!!c})&&this.joinDeferredRoom(d)},
  178. errorMessageTemplate:function(a){this._error_message_templates_node||(this._error_message_templates_node=this._node.down(".chat_error_message_templates"));if(a=this._error_message_templates_node.down("."+a))return a.cloneNode(!0)},konduit:function(){return this._holodeck.konduit()},userJoinedRoom:function(a){this.withRoom(a,"userJoined")},userLeftRoom:function(a){this.withRoom(a,"userLeft")},userChangedInRoom:function(a){this.withRoom(a,"userChanged")},updateGuestCount:function(a){this.withRoom(a,
  179. "guestCountUpdated")},receivedRoomMessage:function(a){this.withRoom(a,"receivedMessage")},receivedAdminMessage:function(a){this._active_room&&this._active_room.receivedAdminMessage(a)},receivedPrivateRoomInvitation:function(a){var b=this.roomByType("private");if(!b||!b.isPrivateRoomOwner(a.username)){var c=(new Element("div")).update((new Template($("chat_notification_received_private_message").innerHTML)).evaluate({username:a.username})),d=c.down(".yes"),e=c.down(".no"),f=function(a){c.hide();d.stopObserving("click");
  180. e.stopObserving("click");Event.stop(a);return!1};b&&d.update("Leave "+b.name()+" and join");d.observe("click",function(b){holodeck.joinRoom(a);return f(b)});e.observe("click",function(b){holodeck.invitationIgnoredBy(a.username);return f(b)});this.activeChatDialogue().insert(c)}},roomNotFound:function(a){(function(b){var c=a.name+" is no longer available.",d=b.activeChatDialogue();d&&d.displayMessage("Kong Bot",c,{"class":"whisper received_whisper"},{non_user:!0});b.roomJoinFail(a.type)}).defer(this)},
  181. roomJoinFail:function(a){if(this.GUILD_CHAT_ROOM==a||this.PRIVATE_CHAT_ROOM==a)this.tabForType(a).hide(),this.activeChatDialogue()||this.joinDeferredRoom(this.GENERAL_CHAT_ROOM)},roomFull:function(a){(function(b){var c=a.name+" is full. Please try again later.";b.activeChatDialogue().displayMessage("Kong Bot",c,{"class":"whisper received_whisper"},{non_user:!0})}).defer(this)},onPrivateRoomInvitationSent:function(a){var b=a.error;a=a.success?a.username+" was invited to join your private chat room.":
  182. "user_in_room"==b?a.username+" is already in your private chat room.":a.username+" cannot be reached. Please try again later";this.activeChatDialogue().displayMessage("Kong Bot",a,{"class":"whisper received_whisper"},{non_user:!0})},activeChatDialogue:function(){if(this._active_room)return this._active_room._chat_dialogue},room:function(a){return this._rooms.get(a)},withRoom:function(a,b){var c=this.room(a.data.room.id);c||(c=this.findOrCreateRoom(a.data.room));if(c)c[b](a)},addFriends:function(a){var b=
  183. this._friends;a.each(function(a){b[a.toLowerCase()]=!0});this._rooms.values().each(function(b){b.addFriends(a)})},removeFriends:function(a){var b=this._friends;a.each(function(a){b[a.toLowerCase()]=!1});this._rooms.values().each(function(b){b.removeFriends(a)})},addMutings:function(a){var b=this._mutings;a.each(function(a){b[a.toLowerCase()]=!0});this._rooms.values().each(function(b){b.addMutings(a)})},addFavoriteRooms:function(a){this._favorite_rooms=this._favorite_rooms.concat(a);var b=this._rooms;
  184. a.each(function(a){if(a=b.get(a))a._favorite_room=!0})},removeFavoriteRoom:function(a){this._rooms.get(a)._favorite_room=!1;this._favorite_rooms=this._favorite_rooms.reject(function(b){return b==a})},removeMutings:function(a){var b=this._mutings;a.each(function(a){delete b[a.toLowerCase()]});this._rooms.values().each(function(b){b.addMutings(a)})},isFavoriteRoom:function(a){return void 0!==this._favorite_rooms.find(function(b){return b==a})},isFriend:function(a){return!0===this._friends[(a.username?
  185. a.username:a).toLowerCase()]},isMuted:function(a){return!0===this._mutings[(a.username?a.username:a).toLowerCase()]},isGuest:function(a){return this._holodeck.isGuestUsername(a.username)},onSilenced:function(a){this._silenced=!0;this.updateSilenceScheduledEnd(a.data.scheduled_end);this._rooms.values().each(function(a){a.isPrivate()||a.disableDueToSilence()})},onParticipate:function(a){this._silenced=!1;this._rooms.values().each(function(a){a.enable()})},isSilenced:function(){return this._silenced},
  186. updateSilenceScheduledEnd:function(a){var b=TimeInWordsHelper.distanceInWordsFromNow(new Date(a));this._rooms.values().each(function(a){a.updateSilenceScheduledEnd(b)});ChatRoom.updateTemplateSilenceScheduledEnd(b)},username:function(){if(this._holodeck)return this._holodeck.username()},processRoomEvent:function(a){this._room_chooser.deactivate();this._seen&&this._logged_in_to_chat?this.konduit().dispatchEvent(a):this._rooms_to_join.push(a)},setRooms:function(a){var b=a.defaultRooms;this.clearRoomsToJoin();
  187. this.roomByType(this.GENERAL_CHAT_ROOM)||this.setDeferredRoomParams(this.GENERAL_CHAT_ROOM,b.generalChatRoom);a.currentGameType=this.SINGLE_PLAYER_GAME;a.gameRoomEnabled&&(this.roomByType(this.GAME_CHAT_ROOM)||this.determineGameChatRoom(a),a.currentGameType=this.MULTIPLAYER_GAME);this.roomByType(this.GUILD_CHAT_ROOM)||this.determineGuildChatRoom(a);b.guildChatRoom&&(a.currentGameType=this.GUILD_GAME);!this.roomByType(this.PRIVATE_CHAT_ROOM)&&a.previousPrivateRoom&&this.setDeferredRoomParams(this.PRIVATE_CHAT_ROOM,
  188. a.previousPrivateRoom,a.previousPrivateRoomCallback);a.mostRecentChatTab=this.getLastViewedTabCookie()||this.GENERAL_CHAT_ROOM;this.hasJoinedAnyRooms()||this.joinActiveRoomType(a)},joinActiveRoomType:function(a){var b=this._activeTabMatrix[a.currentGameType][a.mostRecentChatTab];a=this.hasDeferredRoom(b)?b:this._activeTabMatrix[a.currentGameType][this.GENERAL_CHAT_ROOM];this.GUILD_CHAT_ROOM==a&&this._deferred_room_params[this.GAME_CHAT_ROOM]&&(this._hide_first_game_room_join=!0,this.joinDeferredRoom(this.GAME_CHAT_ROOM));
  189. this.joinDeferredRoom(a)},determineGameChatRoom:function(a){this.setDeferredRoomParams(this.GAME_CHAT_ROOM,a.previousGameRoom?a.previousGameRoom:a.defaultRooms.gameChatRoom?a.defaultRooms.gameChatRoom:a.gameRoomJoin)},determineGuildChatRoom:function(a){var b,c;a.previousGuildChatRoomForCurrentGame?(b=a.previousGuildChatRoomForCurrentGame,c=a.previousGuildChatRoomForCurrentGameCallback):a.defaultRooms.guildChatRoom?b=a.defaultRooms.guildChatRoom:a.previousSitewideGuildChatRoom&&(b=a.previousSitewideGuildChatRoom,
  190. c=a.previousSitewideGuildChatRoomCallback);b&&this.setDeferredRoomParams(this.GUILD_CHAT_ROOM,b,c)},hasDeferredRoom:function(a){return!!this._deferred_room_params[a]},joinDeferredRoom:function(a){var b=this._deferred_room_params[a];this._deferred_room_params[a]=void 0;var c=this._deferred_room_callbacks[a];c&&c();this._deferred_room_callbacks[a]=void 0;this.joinRoom(b)},joinRoom:function(a){"guild"===a.type?this.processRoomEvent({type:KonduitEvent.JOIN_GUILD_ROOM,data:{guildId:a.guild_id}}):(this.addRoomOwner(a),
  191. this.room(a.id)||this.processRoomEvent({type:KonduitEvent.JOIN_ROOM,data:{room:a}}))},setDeferredRoomParams:function(a,b,c){this.tabForType(a).show();this._deferred_room_params[a]=b;this._deferred_room_callbacks[a]=c},updateGuildRoster:function(a,b){var c=this.roomByType(this.GUILD_CHAT_ROOM);c&&a==c.guildId()&&c.updateGuildRoster(b)},sendPrivateMessage:function(a,b){a&&b&&this.konduit().dispatchEvent({type:KonduitEvent.PRIVATE_MESSAGE,data:{message:this.escapeOutgoingMessage(b),username:a}})},escapeOutgoingMessage:function(a){return a.replace(/\\(?!u[0-9a-fA-f]{4}|x[0-9a-fA-f]{2})/g,
  192. "\\\\")},onLogin:function(){this._logged_in_to_chat=!0;this.joinRequestedRooms()},onLogout:function(){this._logged_in_to_chat=!1},joinRequestedRooms:function(){if(this._seen&&this._logged_in_to_chat){for(var a=this._rooms_to_join.length-1;0<=a;a--)this.processRoomEvent(this._rooms_to_join[a]);this.clearRoomsToJoin()}},clearRoomsToJoin:function(){this._rooms_to_join=[]},activateRoomChooser:function(){this.recordAnalyticsEvent("ChatAction","RoomList");this._room_chooser.activate(this._active_room)},
  193. hideChatWindow:function(){this._chat_window_node.hide()},showChatWindow:function(){this._chat_window_node.show();this.scrollToBottom()},tabForRoom:function(a){return this.tabForType(a.type())},tabForType:function(a){return $(a+"_room_tab")},messageError:function(a){this._active_room&&this._active_room.messageError(a)},roomGroups:function(a){this._room_chooser.roomGroups(a)},redoRoomList:function(){this._room_chooser.redoRoomList()},showChatNag:function(a,b){this._active_room&&this._active_room.showChatNag(a,
  194. b)},showUserRollover:function(a){this._user_rollover_manager.show(a)},hideUserRollover:function(){this._user_rollover_manager.beginHide()},addRoomOwner:function(a){this._room_owners[a.id]=a.owner},roomOwner:function(a){return this._room_owners[a]},insertPrivateMessagePrefixFor:function(a){this.insertInActiveChatInput("/w "+a+" ")},insertInActiveChatInput:function(a){this._active_room&&this._active_room.insertInChatInput(a)},insert:function(a){this._active_room&&this._active_room.insert(a)},updateRolloverMutingLink:function(a){this._user_rollover_manager.updateMutingLink(a)},
  195. activeRoomUserListScrollTop:function(){return this._active_room.userListScrollTop()},showProfile:function(a){this.recordAnalyticsEvent("ChatAction","Profile");this._mini_profile.activate(a,this._active_room)},showSpinner:function(){$("chat_window_spinner").show()},hideSpinner:function(){$("chat_window_spinner").hide()},showOnlineFriends:function(){this.recordAnalyticsEvent("ChatAction","FriendsList");this._online_friends.activate(this._active_room.name())},loadFriendsPage:function(a){this._online_friends.getOnlineFriends(a)},
  196. updateLastActionTaken:function(){if(this.roomByType("chat")){var a={method:"post",parameters:{game_id:this.gameId(),room:this.roomByType("chat")._room.id}};this.roomByType("game")&&(a.parameters.game_room=this.roomByType("game")._room.id);new Ajax.Request("/last_action_taken/update",a)}},activeRoomUsernameNode:function(a){return $(this._active_room.usernameNodeId(a))},activeRoom:function(){return this._active_room},startBeacon:function(){this._last_action_beacon&&this._last_action_beacon.stop();var a=
  197. this;this._last_action_beacon=new PeriodicalExecuter(function(){a.updateLastActionTaken()},600)},setupBanAndSilencingControls:function(){this._mini_profile.setupBanAndSilencingControls()},gameId:function(){return this._holodeck.gameId()},deactivateMiniProfile:function(){this._mini_profile.deactivate()},activateRoomInfo:function(a){this.recordAnalyticsEvent("ChatAction","RoomDetails");this._room_info.activate(a)},scrollToBottom:function(){this._rooms.each(function(a){a.value.scrollToBottom()})},deactivateRoomChooser:function(){this._room_chooser.deactivate()},
  198. recordAnalyticsEvent:function(a,b){this._holodeck.recordAnalyticsEvent(a,b)},restoreDefaultView:function(){this.clearActiveTempPane();this.hideSpinner();this._chat_tab_clicked=!0;this._mini_profile._container.hide();this._room_chooser.hide();this._room_info._container.hide();this._online_friends._container.hide();this.showChatWindow()},setActiveTempPane:function(a){this._active_temp_pane=a},clearActiveTempPane:function(){this._active_temp_pane=null},activeTempPane:function(){return this._active_temp_pane},
  199. noticedModeratableUser:function(a){active_user.isSuperChatModerator()||(this._moderatableUsers[a]=new Date,this.conditionallyStartModeratableSweeper())},isModeratableUser:function(a){return active_user.isSuperChatModerator()?!0:!!this._moderatableUsers[a]},conditionallyStartModeratableSweeper:function(){this._moderatableUsersSweeper||(this._moderatableUsersSweeper=new PeriodicalExecuter(function(a){a=new Date;for(var b in this._moderatableUsers)a-this._moderatableUsers[b]>ChatWindow.MODERATABLE_TIME_LIMIT&&
  200. delete this._moderatableUsers[b]}.bind(this),60))}};CollapsiblePanel=function(a,b){this.initialize(a,b)};
  201. CollapsiblePanel.prototype={initialize:function(a,b){this.element=$(a);this.toggle_callback=b;this.element.panel=this;this.handle=this.element.down(".panel_handle");this.body=this.element.down(".panel_body");var c=this;this.handle.observe("click",function(a){c.toggle();a.stop()});this.collapsed()?this.collapse():this.open()},collapsed:function(){return this.handle.hasClassName("closed_link")},collapse:function(){this.body.hide();this.handle.removeClassName("opened_link");this.handle.addClassName("closed_link")},
  202. open:function(){this.body.show();this.handle.removeClassName("closed_link");this.handle.addClassName("opened_link")},toggle:function(){this.toggle_callback&&this.toggle_callback();this.collapsed()?this.open():this.collapse()},scrollTab:function(a){a.scrollTop=this.handle.positionedOffset()[1]-parseInt(this.handle.getStyle("margin-top"),10)}};window.lightboxController={closeLightboxWithResult:function(a,b){parent.parent.lightbox.prototype.shutdown()}};function evalJS(a){eval(a)}
  203. function updateTaskProgress(a,b){try{$(a+"-progress-amount").update(b)}catch(c){console.warn("error during updateTaskProgress on %s to %s",a,b)}}function markTaskComplete(a){try{Element.addClassName(a,"complete"),Element.removeClassName(a,"incomplete"),$(a+"-progress")&&Element.hide(a+"-progress"),new Effect.Highlight(a,{})}catch(b){console.warn("error during markTaskComplete on %s",a)}}
  204. function markAccomplishmentComplete(a){try{Element.addClassName(a,"complete"),Element.removeClassName(a,"incomplete"),new Effect.Highlight(a,{})}catch(b){console.warn("error during markAccomplishmentComplete on %s",a)}}HighScores=function(a){this.initialize(a)};
  205. HighScores.prototype={initialize:function(a){this._active=!1;this._holodeck=a;this._container=$("high_scores_container");this._high_scores_node=$("high_scores");this._high_scores_spinner=$("high_scores_spinner")},activate:function(a){this._holodeck.recordAnalyticsEvent("Achievements","Scores");this.hideAccomplishmentsSection();this.getHighScores(a)},getHighScores:function(a,b,c){var d=this._container,e=this._holodeck,f=this._high_scores_node;e.chatWindow();var m=this,l="/high_scores.chat?game_id="+
  206. e.gameId();this._active=!0;f.hide();this._high_scores_spinner.show();a&&(l+="&statistic_id="+a);c&&(l+="&"+c+"="+b,e.recordAnalyticsEvent("Achievements","ScoresChangePage"));this._tabs&&(this._last_tab=this._tabs.activeLink.key);new Ajax.Updater({success:"high_scores"},l,{method:"get",onComplete:function(){m._active&&(m.hideAccomplishmentsSection(),m._high_scores_spinner.hide(),m.hookUpTabsAndSelect(),f.show(),d.ieHappyShow())}})},deactivate:function(){this._active=!1;this._high_scores_spinner&&this._high_scores_spinner.hide();
  207. this._container&&this._container.ieHappyHide();this.showAccomplishmentsSection()},hideAccomplishmentsSection:function(){this.accomplishmentsTabNode().ieHappyHide()},showAccomplishmentsSection:function(){this.accomplishmentsTabNode().ieHappyShow()},hookUpTabsAndSelect:function(a){var b=this,c=$("statistic_id");a="weekly_high_score_tab_pane";this._last_tab&&(a=this._last_tab);this._tabs=new HolodeckTabs("high_score_tab_set",{defaultTab:a});$$(".high_score_panel_tab").each(function(a){a.observe("click",
  208. function(a){holodeck.recordMappedEventAnalytic(a.target.up("li").id)})});c&&c.observe("change",function(){b._holodeck.recordAnalyticsEvent("Achievements","ScoresChangeStat");var a=c.getValue();b.getHighScores(a)})},accomplishmentsTabNode:function(){this._accomplishments_tab_content_node||(this._accomplishments_tab_content_node=$("accomplishments_tab_content"));return this._accomplishments_tab_content_node}};Holodeck=function(a){this.initialize(a)};Holodeck.KONG_GAMEPLAYS_COOKIE_NAME="kong_gameplays";
  209. Holodeck.KONG_HS_ALERT_COOKIE_NAME="kong_hs_alert";Holodeck.KONG_HS_ALERT_TIME_COOKIE_NAME="kong_hs_alert_time";Holodeck.HOLODECK_TAB_COOKIE_NAME="holodeck_tab";Holodeck.SIGNUP_TAB_NAME="signup_tab_pane";Holodeck.SIGNIN_TAB_NAME="signin_tab_pane";Holodeck.CHAT_TAB_NAME="chat_tab_pane";Holodeck.LAST_PRIVATE_ROOM_KEY="last_private_room";Holodeck.LAST_GAME_ROOM_COOKIE_PREFIX="last_game_room_";Holodeck.LAST_GUILD_ROOM_FOR_CURRENT_GAME_COOKIE_PREFIX="last_kgr_";
  210. Holodeck.LAST_SITEWIDE_GUILD_ROOM_COOKIE="last_kgr";Holodeck.GAME_ROOM_JOIN={type:"game"};Holodeck.GOOGLE_A_DAY_START_DATE=new Date("Aug 16 2012");Holodeck.GOOGLE_A_DAY_END_DATE=new Date("Sep 30 2012");Holodeck.HS_ALERT_WAIT_MILLISECONDS=9E5;Holodeck.guildIdFromXmppName=function(a){if(a=/kgr-(\d+)/.exec(a))return a[1]};
  211. Holodeck.prototype={initialize:function(a){var b=window.location.search.parseQuery().guest_access_key,c={};b&&(c.guest_access_key=b);this.ready=!1;new Ajax.Updater({success:"chat_container"},a.holodeck_url,{method:"get",parameters:c,evalScripts:!0,onComplete:function(){holodeck.uiLoaded(a)},onException:function(a,b){console.log(b.message)}})},uiLoaded:function(a){window.onunload||(window.onunload=Prototype.emptyFunction);if(a){a.holodeck=this;var b=document.location.href.parseQuery();this._interval_between_renders=
  212. parseInt(b.interval_between_renders,10)||20;this._has_shown_cannot_connect_alert=!1;this._event_dispatcher=new KonduitEventDispatcher;this._accomplishment_tracker=new AccomplishmentTracker(Object.extend(Object.clone(a),{onAccomplishmentComplete:function(a){holodeck.recordGuestCompletion(a);var b=holodeck._tabs.activeContainer;holodeck.showAccomplishmentsTab();holodeck.setTab(b.id);a.hasCompletionTabBeenShown()||(holodeck.showAccomplishmentCompletionTab(a.id()),b=holodeck.accomplishmentCompletionTemplate(a.id()),
  213. b=a.isBadgeOfTheDay()?$("won_both_badge_and_botd_content"):b.down(".reward_tasks h4"),CinematicMode.addCinematicMessage(b.innerHTML));holodeck.authenticated()&&a.hasCompleteAccomplishmentGroup()&&(holodeck.showAccomplishmentGroupCompletionTab(a.accomplishmentGroup().id()),b="Congratulations! You completed the '"+a.accomplishmentGroup().name()+"' quest.",CinematicMode.addCinematicMessage(b));holodeck.updateAccomplishmentTab(a.id())},onTaskComplete:function(a){(a=holodeck.accomplishmentTaskCompletionTemplate(a.id()))&&
  214. holodeck.showAccomplishmentCompletedTab(a.cloneNode(!0))}}));this._html_dimensions=a.html_dimensions;this._chat_window=new ChatWindow(a);this._guildRosters={};this._users_invited={};this._ignored_invitations={};this._holodeck_event_analytics=new HolodeckEventAnalytics;this._incoming_message_filters=[];this._outgoing_message_filters=[];this._konduit=a.konduit;this._game_id=a.game_id;(this._active_user=a.active_user)&&this._active_user.setHolodeck(this);this._chat_disconnected_indicator_node=$("chat_disconnected_indicator");
  215. this._chat_connected_indicator_node=$("chat_connected_indicator");this._chat_limited_connection_indicator_node=$("chat_limited_connection_indicator");this._accomplishment_group_award_tab_node=$("accomplishment_group_awarded_tab_pane_content");this._just_earned_badge=this._suppress_disconnect=this._has_logged_in=!1;this._accomplishments_bootstrap_url=a.accomplishments_bootstrap_url;this._on_loaded_accomplishments_callbacks=[];this._game_path=a.game_path;this._shared_content_type_permalinks=a.shared_content_type_permalinks;
  216. this._shared_content_type_names=a.shared_content_type_names;this._permissions=a.permissions;this._authenticated_only_shared_content_sorts=a.authenticated_only_shared_content_sorts;this._has_game_specific_forum=a.has_game_specific_forum;this._multiplayer_game=a.multiplayer_game;this._suppress_setting_preference_cookie=!1;this._in_beta=a.in_beta;this._in_preview=a.in_preview;this._active_dialogue=void 0;this._chat_commands={};this._chat_api_tab=new ChatApiTab(a);this._saved_shared_content_event=null;
  217. this._login_url=a.login_url;this._custom_game_avatar=null;this._avatar_crop_boundaries={};this._gameplay_id=this._avatar_cropper=null;this._coupon_templates={};this.addChatCommand("w",this.sendWhisper);this.addChatCommand("msg",this.sendWhisper);this.addChatCommand("bug",function(a,b){var c=(b.match(/^\/\S+\s+(.+)$/)||[])[1],d=a.activeDialogue();c?a.submitGameBug(c,{onSuccess:function(a){d.insert('<p class="bug">Your bug report has been successfully submitted. Thank you!</p>')},onFailure:function(a){d.insert('<p class="bug">Uh oh! Your bug report could not be completed at this time. Please visit the <a href="/feedbacks/new">feedback form</a> and try again.</p>')}}):
  218. d.insert('<p>Use the <code>/bug</code> command to submit a bug report for the game you are playing. Just type <code>/bug</code> followed by a brief report, or visit the <a href="/feedbacks/new">feedback form</a> to submit a more detailed bug report.</p>');return!1});this.addChatCommand("afk",this.setPresenceAway.bind(this));this.addChatCommand("back",this.setPresenceChat.bind(this));this.addChatCommand("invite",function(a,b){var c=(b.match(/^\/([^\s]+)\s+([^\s]+)/)||[])[2];c&&0<c.length&&a.sendPrivateRoomInvitation(c);
  219. return!1});this.addChatCommand("kick",function(a,b){var c=(b.match(/^\/([^\s]+)\s+([^\s]+)/)||[])[2];c&&0<c.length&&a.privateRoomKick(c);return!1});this.addMessageFilters();var b=this._event_dispatcher,c=this._chat_window,d=this._accomplishment_tracker,e=a.achievements&&0<a.achievements.length;b.register(KonduitEvent.INIT,function(a){holodeck.updateDefaultChatTabMessage("Connecting to chat")});b.register(KonduitEvent.DISCONNECT,function(a){holodeck.showDisconnectedIndicator();CinematicMode.addCinematicMessage("You have been disconnected from Kongregate and scores will not be submitted.");
  220. a.data.banned?window.location.href="/pages/banned":a.data.conflict?holodeck.showSessionAlert():a.data.login_failed?holodeck.showSessionExpiredAlert():holodeck._suppress_disconnect?holodeck._suppress_disconnect=!1:holodeck.showDisconnectedAlert()});b.register(KonduitEvent.API_INITIALIZED,function(a){(function(){holodeck.loadSharedContentFromUrl();holodeck.saveSharedContentFromUrl();holodeck.konduit().dispatchEvent({type:KonduitEvent.ADD_STATISTICS,data:holodeck._statistics})}).defer()});b.register(KonduitEvent.STATISTIC_UPDATED,
  221. function(a){holodeck._has_submitted_stats=!0;d.onStatisticUpdated(a)});b.register(KonduitEvent.LOGIN,function(a){!0===a.data.success?(holodeck.updateDefaultChatTabMessage("Joining room"),holodeck.setUsername(a.data.username),holodeck._has_logged_in=!0,!0===a.data.bosh?holodeck.showLimitedConnectionIndicator():holodeck.showConnectedIndicator(),c.onLogin(),holodeck.closeAlertTab()):holodeck.updateDefaultChatTabMessage("Chat signin failed!")});b.register(KonduitEvent.CONNECT,function(a){!1===a.data.success?
  222. !1===holodeck._has_logged_in&&(holodeck.updateDefaultChatTabMessage("Chat connection failed!"),holodeck.showCannotConnectAlert()):holodeck.updateDefaultChatTabMessage("Signing in")});b.register(KonduitEvent.SILENCED,function(a){c.onSilenced(a)});b.register(KonduitEvent.PARTICIPATE,function(a){c.onParticipate(a)});b.register(KonduitEvent.JOIN_ROOM,function(a){switch(a.data.room.type){case "game":holodeck.setGameRoomCookie(a.data.room);break;case "guild":var b=Holodeck.guildIdFromXmppName(a.data.room.xmpp_name);
  223. a.data.room.guildId=b;var c={type:a.data.room.type,guild_id:b};holodeck.setGuildRoomForCurrentGameCookie(c);holodeck.setSitewideGuildRoomCookie(c);holodeck.hasGuildRoster(b)?holodeck.updateGuildRoster(b):$j.getJSON("/guilds/"+b+".json",function(a){holodeck.updateGuildRoster(b,a)}).fail(function(a){404===a.status&&(holodeck.setGuildRoomForCurrentGameCookie(),holodeck.setSitewideGuildRoomCookie(),holodeck.leaveGuildRoom())});break;case "private":$.jStorage.set(Holodeck.LAST_PRIVATE_ROOM_KEY,a.data.room)}holodeck.displayRoom(a.data.room)});
  224. b.register(KonduitEvent.ROOM_NOT_FOUND,function(a){"game"==a.data.room.type&&holodeck.getGameRoomCookie()?(holodeck.setGameRoomCookie(),holodeck.joinRoom({type:"game"})):c.roomNotFound(a.data.room)});b.register(KonduitEvent.JOIN_GUILD_ROOM,function(a){c.roomNotFound({type:"guild",name:"Guild Room"})});b.register(KonduitEvent.ROOM_FULL,function(a){c.roomFull(a.data.room)});b.register(KonduitEvent.REQUEST_CHAT_ROOM,function(a){c.requestRoomToJoin()});b.register(KonduitEvent.LEAVE_ROOM,function(a){c.leftRoom(a.data);
  225. "guild"===a.data.room.type&&(holodeck.setGuildRoomForCurrentGameCookie(),holodeck.setSitewideGuildRoomCookie())});b.register(KonduitEvent.ROOM_MESSAGE,function(a){c.receivedRoomMessage(a)});b.register(KonduitEvent.MESSAGE_ERROR,function(a){c.messageError(a);if("error_msg_rate_limit"==a.data.errorType){var b=c.activeRoom(),b=b?b.getId():null,d=(Cookie.get("rate_limit_log")||"[]").evalJSON();d.push([(new Date).getTime(),b,a.data.ruleViolated]);Cookie.set("rate_limit_log",Object.toJSON(d),void 0,"/")}});
  226. b.register(KonduitEvent.PRIVATE_MESSAGE,function(a){holodeck.receivedPrivateMessage(a)});b.register(KonduitEvent.ADMIN_MESSAGE,function(a){c.receivedAdminMessage(a)});b.register(KonduitEvent.USER_JOIN,function(a){holodeck.displayRoomOnFirstJoin(a.data.room);c.userJoinedRoom(a)});b.register(KonduitEvent.USER_CHANGED,function(a){c.userChangedInRoom(a)});b.register(KonduitEvent.USER_DEPARTURE,function(a){c.userLeftRoom(a)});b.register(KonduitEvent.GUEST_COUNT,function(a){c.updateGuestCount(a)});b.register(KonduitEvent.DISPLAY_SHOUT_BOX,
  227. function(a){f.capturedSelectorWrapper(a,function(a){holodeck.displayShoutBox(a)})});b.register(KonduitEvent.DISPLAY_INVITATION_BOX,function(a){f.capturedSelectorWrapper(a,function(a){holodeck.displayInvitationBox(a)})});b.register(KonduitEvent.SEND_PRIVATE_MESSAGE,function(a){f.capturedSelectorWrapper(a,function(a){holodeck.sendPrivateMessage(a)})});b.register(KonduitEvent.DISPLAY_FEED_POST_BOX,function(a){f.capturedSelectorWrapper(a,function(a){holodeck.displayFeedPostBox(a)})});b.register(KonduitEvent.HANDLE_ITEM_CHECKOUT_REQUEST,
  228. function(a){holodeck.recordAnalyticsEvent("Lightbox","Kred");var b=a.data.url;setTimeout(function(){top.lightbox.prototype.initializeKredItemPurchaseFrame(b)},0)});b.register(KonduitEvent.DISPLAY_REGISTRATION_LIGHTBOX,function(a){setTimeout(function(){lightbox.prototype.initializeKongregateLightboxFromAjax("/accounts/new/behind_login?game_id="+f.gameId(),{afterStaticContentLoad:lightbox.prototype.toggleRegistration})},0)});b.register(KonduitEvent.DISPLAY_SIGN_IN_LIGHTBOX,function(a){setTimeout(function(){f.activateInlineLogin()},
  229. 0)});b.register(KonduitEvent.RESIZE_GAME,function(a){var b=a.data.resize_width,c=a.data.resize_height;setTimeout(function(){holodeck.resizeGame(b,c)},0)});b.register(KonduitEvent.NEW_HIGH_SCORE,function(a){holodeck.showHighScoreAlert(a)});b.register(KonduitEvent.CUSTOM_TAB_SHOW,function(a){holodeck._chat_api_tab.setTabInfo(a);holodeck.showChatApiTab()});b.register(KonduitEvent.CUSTOM_TAB_CLOSE,function(a){holodeck.closeChatApiTab()});b.register(KonduitEvent.CUSTOM_TAB_MESSAGE,function(a){holodeck._chat_api_tab.receivedMessage(a)});
  230. b.register(KonduitEvent.CUSTOM_TAB_CLEAR_MESSAGES,function(a){holodeck._chat_api_tab.clearMessages(a)});b.register(KonduitEvent.PROCESSING_SAVE_SHARED_CONTENT,function(a){holodeck.promptProcessingSaveSharedContent(a)});b.register(KonduitEvent.SAVE_SHARED_CONTENT,function(a){holodeck.promptSaveSharedContent(a.data)});b.register(KonduitEvent.IMAGE_AVATAR_SUBMIT,function(a){holodeck.showAvatarTab(a.data.filename)});b.register(KonduitEvent.BROWSE_SHARED_CONTENT,function(a){holodeck.showSharedContentsIndex(a.data.content_type,
  231. a.data.sort_order,a.data.label)});b.register(KonduitEvent.PRIVATE_ROOM_INVITATION,function(a){holodeck.receivedPrivateRoomInvitation(a.data)});b.register(KonduitEvent.PRIVATE_ROOM_INVITATION_SENT,function(a){c.onPrivateRoomInvitationSent(a.data)});b.register(KonduitEvent.HOLODECK_DATA,function(a){holodeck.handleHolodeckPacket(a.data)});this._accomplishments=(a.achievements||[]).concat(a.challenges||[]);this._has_submitted_stats=this._authenticated_and_loaded_accomplishments=!1;this._statistics=a.statistics||
  232. [];this.setStatisticsAndAccomplishments(this._statistics,this._accomplishments)}var f=holodeck._active_user;holodeck._tabs=new HolodeckTabs("main_tab_set",{afterChange:function(){if(holodeck._tabs){var a=holodeck._tabs.activeContainer;holodeck.checkChatScroll();holodeck.updateTabCookie(a);"chat_tab_pane"===a.id?holodeck.chatWindow().restoreDefaultView():"accomplishments_tab_pane"===a.id&&e&&holodeck.hideHighScores()}},beforeChange:function(a,b){if(!holodeck._tabs)return!1;var c=b.id;if(0===b.children.length){var d=
  233. new Template($(c+"_template").innerHTML);b.insert(d.evaluate());document.fire(c+":loaded")}},defaultTab:void 0,holodeck:holodeck});var m=holodeck._chat_window;holodeck.addOnTabSelectCallback("chat_tab_pane",function(){m._seen||(m._seen=!0,m.joinRequestedRooms())});holodeck.addOnTabSelectCallback("more_games_tab_pane",function(){holodeck._seen_more_games_tab||holodeck.loadMoreGamesTab();holodeck._seen_more_games_tab=!0});holodeck._tabs.addOnCloseCallback("avatar_tab_pane",function(){holodeck.cancelAvatar()});
  234. holodeck.authenticated()?$j("#shared_links_tab").show():f.addRunWhenAuthenticatedObserver(function(){$j("#shared_links_tab").show()});holodeck.authenticated()?(b=holodeck.getTabFromCookie(),holodeck._tab_from_cookie=b.gsub("_pane",""),holodeck._tabs.show(b)):page_data.autofill_username?($$("#new_session_form input[name='username']").first().value=page_data.autofill_username,holodeck._tabs.show(Holodeck.SIGNIN_TAB_NAME)):holodeck._tabs.show(Holodeck.SIGNUP_TAB_NAME);holodeck.addOnTabLoadCallback("accomplishments_tab_pane",
  235. function(){$("accomplishment_vtab_set")?(holodeck.buildAccomplishmentVtabSet(),holodeck.authenticated()||$$(".accomplishment_signin").each(Element.show)):holodeck.loadHighScores();var a=$("accomplishment_awarded_tab");a&&a.down(".close_tab_link").observe("click",function(a){holodeck.recordAnalyticsEvent("Award","Close")})});setTimeout(!this._in_beta&&!this._in_preview?function(){holodeck.loadRateThisGameTab()}:function(){holodeck.showMoreGamesTab()},12E5);holodeck._shared_content_welcome_tab=new SharedContentWelcomeTab(a);
  236. holodeck._lightbox=lightbox.prototype;document.fire("chat_tabs:ready");a=parseInt(Cookie.get(Holodeck.KONG_GAMEPLAYS_COOKIE_NAME)||0,10);Cookie.set(Holodeck.KONG_GAMEPLAYS_COOKIE_NAME,a+1,1E4,"/");this.ready=!0;document.fire("holodeck:ready")},displayRoomOnFirstJoin:function(a){this._chat_window.roomByType(a.type)||this.displayRoom(a)},handleHolodeckPacket:function(a){switch(a.holodeck_type){case "levelup":holodeck.showLevelUpTab(a);break;case "coupon_awarded":holodeck.showCouponAwardsTab(a);break;
  237. default:console.log("I do not understand this packet type captain.")}},showLevelUpTab:function(a){var b=new Template($("levelup_content_template").innerHTML);holodeck.showProgressTab(b.evaluate($H(a).merge({username:active_user.username()})));65==a.level&&($("hololevel_next_level_message").hide(),$("hololevel_max_level_message").show())},addCouponTemplate:function(a,b){this._coupon_templates[a]=new Template(b)},showCouponAwardsTab:function(a){var b=a.coupon_promotion_id;if(void 0!==this._coupon_templates[b]){var c=
  238. $j("#coupon_promotion_"+b+"_award_content");$j(".js-coupon-promotion-award-content").hide();c.html(this._coupon_templates[b].evaluate(a));c.show();this._tabs.showOnTop("coupon_awards_tab_pane")}},displayRoom:function(a){this._chat_window._active_room||this._chat_window.showChatWindow();this.hideDefaultChatTabContent();this.hideSessionAlertContentInChatTab();this.updateDefaultChatTabMessage("Connecting to chat");this._chat_window.joinedRoom(a)},rebootstrapChat:function(){this._chat_window.bootstrapChat(!0)},
  239. showAccomplishmentCompletionTab:function(a){var b=this._accomplishment_tracker.getAccomplishmentById(a);b&&!b.isHidden()&&(this.showAccomplishmentCompletedTab(this.accomplishmentCompletionTemplate(a).cloneNode(!0)),this._currently_shown_award_tab="award",this._holodeck_event_analytics.recordEvent("TabView","Award"),b.setHasCompletionTabBeenShown(),this.authenticated()&&!b.isBadgeOfTheDay()&&b.accomplishmentGroupProgressContent()?this.insertProgressContentInSuggestionNodes(b.accomplishmentGroupProgressContent()):
  240. b.purPoints()&&active_user.showPowerupRewardsUpsell()?this.insertProgressContentInSuggestionNodes(b.purAwardContent()):(!b.isBadgeOfTheDay()||b.isBadgeOfTheDay()&&!this.authenticated())&&this.insertTemplateForNextActionSuggestion({".prize_name":b.prizeName()},this.suggestNextAction.bind(this)),this.getsGoogleADayUpsell(b)&&(a=$("google_a_day_award_tab_upsell_"+b.id()))&&a.show())},insertProgressContentInSuggestionNodes:function(a){this.suggestionLocationNodes().each(function(b){$j(b).html(a)})},getsGoogleADayUpsell:function(a){var b=
  241. new Date;return Holodeck.GOOGLE_A_DAY_START_DATE<b&&Holodeck.GOOGLE_A_DAY_END_DATE>b&&!active_user.hasGoogleADayForToday()&&a.isAchievement()},showBadgeOfTheDayAwardTab:function(a){this.showAccomplishmentCompletedTab(this.accomplishmentCompletionTemplate(a).cloneNode(!0));$("won_both_badge_and_botd_content").hide();$("won_just_botd_content").show();active_user.powerupRewardsUser()&&$j("#award_tab_linked_account_plus_points_past").show()},updateAccomplishmentTab:function(a){this._accomplishment_tracker.updateAccomplishmentTab(a)},
  242. insertTaskCompletedIntoChat:function(a){this.chatWindow().insert(holodeck.accomplishmentTaskCompletionTemplate(a).cloneNode(!0))},currentAwardTab:function(){var a=this._currently_shown_award_tab;this._currently_shown_award_tab=null;return a},showHighScoreAlert:function(a){if(this.shouldShowHighScoreAlert(a.data.value)){this._currently_shown_award_tab="high score";this._holodeck_event_analytics.recordEvent("TabView","HighScoreAlert");$("high_score_alert_username").update(active_user.username());var b=
  243. a.data.id,c=this._accomplishment_tracker.getStatisticById(b);a='<p class="high_score_number holodeck_kongbot_happy"><strong>'+a.data.value.toLocaleString()+"</strong> "+c.displayName()+"</p>";c=(new Element("a",{href:"#"})).update("view leaderboard &raquo;");c.observe("click",function(a){holodeck.showHighScores(b)});this._tabs.show("high_score_alert_tab_pane");this._tabs.container("high_score_alert_tab_pane").down(".high_score_summary").update(a).insert(c);this.insertTemplateForNextActionSuggestion({},
  244. this.suggestNextAction.bind(this))}},shouldShowHighScoreAlert:function(a){if(0===a||isNaN(a)||this.isShowingAccomplishmentCompletedTab())return!1;a=Cookie.get(Holodeck.KONG_HS_ALERT_COOKIE_NAME);return this.hasNotSeenHighScoreRecently()&&!a?(Cookie.set(Holodeck.KONG_HS_ALERT_COOKIE_NAME,"hs_alert",void 0,this._game_path),!0):!1},hasNotSeenHighScoreRecently:function(){var a=Cookie.get(Holodeck.KONG_HS_ALERT_TIME_COOKIE_NAME);if(a){if(a=new Date(a),(new Date).getTime()-a.getTime()>Holodeck.HS_ALERT_WAIT_MILLISECONDS)return Cookie.set(Holodeck.KONG_HS_ALERT_TIME_COOKIE_NAME,
  245. new Date,void 0,"/"),!0}else return Cookie.set(Holodeck.KONG_HS_ALERT_TIME_COOKIE_NAME,new Date,void 0,"/"),!0;return!1},chatWindow:function(){return this._chat_window},setTab:function(a){this._suppress_setting_preference_cookie=!0;this._tabs.setActiveTab(a)},closeAlertTab:function(){this._tabs.close("alert_tab_pane")},showAlertTab:function(){this._tabs.show("alert_tab_pane",HolodeckTabs.Priority.ERROR)},showAccomplishmentsTab:function(){this.setTab("accomplishments_tab_pane")},showAvatarTab:function(a){if(a){this._custom_game_avatar=
  246. a;a=this.avatarUrlForFile(this._custom_game_avatar);var b=$("game_supplied_avatar_image_tag");this.setAvatarCropBoundaries({});this._custom_game_avatar&&b&&(startCropper=function(){var a=b.width,d=b.height,e,f,m,l;a==d?(e=0,f=a,m=0,l=d):a>d?(m=0,l=d,e=a/2-d/2,f=e+d):(e=0,f=a,m=d/2-a/2,l=m+a);e={x1:e,x2:f,y1:m,y2:l};40<a&&40<d&&(this.setAvatarCropBoundaries(e),this._avatar_cropper=new Cropper.Img("game_supplied_avatar_image_tag",{displayOnInit:a==d?!1:!0,ratioDim:{x:1,y:1},minWidth:40,minHeight:40,
  247. onloadCoords:e,onEndCrop:function(a,b){holodeck.setAvatarCropBoundaries({x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2})}}))}.bind(this),b.onload=startCropper,b.src=a,this.prepareAvatarTab(),this._tabs.show("avatar_tab_pane"))}},prepareAvatarTab:function(){this.authenticated()&&($("avatar_controls_guest").hide(),$("avatar_controls").show());$("avatar_save_results").hide();$("avatar_update_spinner").hide();$("game_avatar_accept_button").show();$("avatar_prompt_content").show()},avatarUrlForFile:function(a){return"/assets/imported_images/"+
  248. a},saveAvatar:function(){var a="/accounts/"+this.username()+"/update_avatar.chat";$("game_avatar_accept_button").hide();$("avatar_update_spinner").show();new Ajax.Updater({success:"avatar_save_results"},a,{method:"post",parameters:$H(this.scaledAvatarCropBoundaries()).merge({filename:this._custom_game_avatar,game_id:this.gameId()}).toObject(),onSuccess:function(){holodeck.avatarSuccess()},onFailure:function(){holodeck.notifyKonduitOfAvatarResults(!1)},onComplete:function(){$("avatar_prompt_content").hide();
  249. $("avatar_save_results").show()}})},setAvatarCropBoundaries:function(a){this._avatar_crop_boundaries=a},scaledAvatarCropBoundaries:function(){var a=this._avatar_crop_boundaries,b=a.x1,c=a.y1,d=a.x2,a=a.y2,e=this.avatarScaleRatios();if(void 0===b||void 0===d||void 0===c||void 0===a)return{};b=parseInt(b/e.wRatio,10);d=parseInt(d/e.wRatio,10);c=parseInt(c/e.hRatio,10);a=parseInt(a/e.hRatio,10);return{x1:b,y1:c,x2:d,y2:a}},avatarScaleRatios:function(){var a,b,c,d,e;e=$("game_supplied_avatar_image_tag");
  250. a=e.getStyle("max-height");b=e.getStyle("max-width");e.setStyle({maxHeight:""});e.setStyle({maxWidth:""});c=e.height;d=e.width;e.setStyle({maxHeight:a});e.setStyle({maxWidth:b});return{hRatio:e.height/c,wRatio:e.width/d}},avatarSuccess:function(){this.notifyKonduitOfAvatarResults(!0);active_user.pullUserData()},cancelAvatar:function(){this.notifyKonduitOfAvatarResults(!1);this.closeAvatarTab()},closeAvatarTab:function(){this._tabs.close("avatar_tab_pane")},notifyKonduitOfAvatarResults:function(a){holodeck._avatar_cropper&&
  251. holodeck._avatar_cropper.remove();holodeck.konduit().dispatchEvent({type:KonduitEvent.IMAGE_AVATAR_COMPLETE,data:{success:a}})},showShareTab:function(){this._holodeck_event_analytics.recordEvent("TabView","Share");this._tabs.showOnTop("share_tab_pane")},showAccomplishmentsOrMoreGamesTab:function(){$("accomplishments_tab_pane")?this.showAccomplishmentsTab():this.showMoreGamesTab()},showAccomplishmentCompletedTab:function(a){$("more_games_tab_pane").hide();this._just_earned_badge=!0;this._tabs.showOnTop("accomplishment_awarded_tab_pane");
  252. this._tabs.container("accomplishment_awarded_tab_pane").down("#accomplishment_awarded_tab_pane_content").update(a)},showProgressTab:function(a){$("more_games_tab_pane").hide();this._just_earned_badge=!0;this._tabs.showOnTop("progress_tab_pane");this._tabs.container("progress_tab_pane").down("#progress_tab_pane_content").update(a)},showMoreGamesTab:function(){this.setTab("more_games_tab_pane")},loadMoreGamesTab:function(){holodeck._more_game_tab_page=1;new Ajax.Updater({success:"more_games_tab_pane"},
  253. "/recommended_games/show_more_tab",{parameters:{game_id:this.gameId()},method:"get"})},moreGamesNextPage:function(){new Ajax.Request("/recommended_games/show_more_tab",{parameters:{game_id:this.gameId(),page:this._more_game_tab_page+1},method:"get",onSuccess:function(a){holodeck._more_game_tab_page+=1;$$(".more_games_load_btn")[0].insert({before:a.responseText});48>4*holodeck._more_game_tab_page?$("load_more_games_button").restore():($("load_more_games_button").hide(),$$(".more_games_load_btn").each(Element.hide))}})},
  254. showChatApiTab:function(){this._tabs.show("chat_api_pane")},closeChatApiTab:function(){this._tabs.close("chat_api_pane")},showSharedContentWelcomeTab:function(){this._tabs.show("shared_content_welcome_tab_pane")},isShowingAccomplishmentCompletedTab:function(){return $("accomplishment_awarded_tab_pane").visible()},revealContent:function(a,b,c){var d=$(a);b=$(b);var e;if(d&&b&&(e=b.panel))this.setTab(a),e.open(),e.scrollTab(d),(a=$(c))&&a.highlight();return!1},revealFullInstructions:function(){this._tabs.show("game_tab_pane");
  255. this.recordAnalyticsEvent("Quick","Instructions");this.revealContent("game_tab_pane","game_instructions_panel","game_instructions");var a=$("game_instructions");if(a){var b=a.down(".truncated_text"),a=a.down(".full_text");b&&(a&&b.visible())&&(b.hide(),a.show())}},hideDefaultChatTabContent:function(){$("chat_default_content").hide()},showDefaultChatTabContent:function(){$("chat_default_content").show()},showDisconnectedAlert:function(){this._holodeck_event_analytics.recordEvent("TabView","Disconnect");
  256. this.showDefaultChatTabContent();this.showDefaultChatTabContent();this._tabs.showAlert("disconnected_alert")},showSessionAlert:function(){this.showSessionAlertContentInChatTab();this._holodeck_event_analytics.recordEvent("TabView","SessionAlert");this._tabs.showAlert("session_conflict_alert")},showSessionExpiredAlert:function(){this.showSessionAlertContentInChatTab();this._tabs.showAlert("session_expired_alert")},showCannotConnectAlert:function(){this._has_shown_cannot_connect_alert||this._holodeck_event_analytics.recordEvent("TabView",
  257. "CannotConnect");this._tabs.showAlert("cannot_connect_alert");this._has_shown_cannot_connect_alert=!0},updateTabCookie:function(a){this.authenticated()&&!a.closeable&&(this._suppress_setting_preference_cookie?this._suppress_setting_preference_cookie=!1:Cookie.get("holodeck_tab_override")!=a.id&&Cookie.set(Holodeck.HOLODECK_TAB_COOKIE_NAME,this.makeCookieValue(a.id),12,"/"))},getTabsFromCookie:function(){var a=Cookie.get("kong_opened_panel"),b=Cookie.get(Holodeck.HOLODECK_TAB_COOKIE_NAME),c=Cookie.get("holodeck_tab_override"),
  258. d=this;return c?[c]:a?(Cookie.erase("kong_opened_panel"),["game_tab_pane"]):b&&(a=b.split("|").select(function(a){return(a=d._tabs.tab(d._tabs.linkForKey(a)))&&a.visible()}),0<a.length)?a:["chat_tab_pane"]},getTabFromCookie:function(){return this.getTabsFromCookie()[0]},makeCookieValue:function(a){var b=Cookie.get(Holodeck.HOLODECK_TAB_COOKIE_NAME);return b?(b=b.split("|").select(function(b){return b!=a}),b.unshift(a),b.join("|")):a},registerKonduitCallback:function(a,b){this._event_dispatcher.register(a,
  259. b)},konduit:function(){this._konduit||(this._konduit=function(){var a=$("konduit");return{swf:a,dispatchEvent:function(b){a.dispatchJSONEvent(Object.toJSON(b))},alertLog:function(b){return a.alertLog()}}}());return this._konduit},konduitEvent:function(a){a=Base64.decode(a).evalJSON(!0);this._event_dispatcher.fire(a)},updateGuildRoster:function(a,b){var c=this;b&&(this._guildRosters[a]=b.users);setTimeout(function(){c._chat_window.updateGuildRoster(a,c._guildRosters[a])},100)},hasGuildRoster:function(a){return!!this._guildRosters[a]},
  260. getGameRoomCookie:function(){var a=Cookie.get(Holodeck.LAST_GAME_ROOM_COOKIE_PREFIX+this.gameId());if(a)return a.evalJSON()},setGameRoomCookie:function(a){a=Object.toJSON(a);Cookie.set(Holodeck.LAST_GAME_ROOM_COOKIE_PREFIX+this.gameId(),a,7,this._game_path)},getGuildRoomForCurrentGameCookie:function(){if(this.authenticated()){var a=Cookie.get(Holodeck.LAST_GUILD_ROOM_FOR_CURRENT_GAME_COOKIE_PREFIX+this.gameId());if(a)return a.evalJSON()}else this.setGuildRoomForCurrentGameCookie()},setGuildRoomForCurrentGameCookie:function(a){a=
  261. Object.toJSON(a);Cookie.set(Holodeck.LAST_GUILD_ROOM_FOR_CURRENT_GAME_COOKIE_PREFIX+this.gameId(),a,7,this._game_path)},getSitewideGuildRoomCookie:function(){if(this.authenticated()){var a=Cookie.get(Holodeck.LAST_SITEWIDE_GUILD_ROOM_COOKIE);if(a)return a.evalJSON()}else this.setSitewideGuildRoomCookie()},setSitewideGuildRoomCookie:function(a){a=Object.toJSON(a);Cookie.set(Holodeck.LAST_SITEWIDE_GUILD_ROOM_COOKIE,a,void 0,"/")},deletePrivateRoomCookie:function(){$.jStorage.deleteKey(Holodeck.LAST_PRIVATE_ROOM_KEY)},
  262. initializeChatWindow:function(a){a.gameRoomEnabled&&(a.previousGameRoom=this.getGameRoomCookie(),a.gameRoomJoin=Holodeck.GAME_ROOM_JOIN);if(!page_data.opted_out_of_guilds){var b=this.getGuildRoomForCurrentGameCookie();b&&(a.previousGuildChatRoomForCurrentGameCallback=this.setGuildRoomForCurrentGameCookie.bind(this),a.previousGuildChatRoomForCurrentGame=b);if(b=this.getSitewideGuildRoomCookie())a.previousSitewideGuildChatRoomCallback=this.setSitewideGuildRoomCookie.bind(this),a.previousSitewideGuildChatRoom=
  263. b}if(b=$.jStorage.get(Holodeck.LAST_PRIVATE_ROOM_KEY))a.previousPrivateRoomCallback=this.deletePrivateRoomCookie.bind(this),a.previousPrivateRoom=b;this._chat_window.setRooms(a)},joinRoom:function(a){this._chat_window.joinRoom(a)},addChatCommand:function(a,b){this._chat_commands[a]||(this._chat_commands[a]=[]);this._chat_commands[a].push(b)},processChatCommand:function(a){var b=((a.match(/^\/([^\s]+)/)||[])[1]||"").toLowerCase();if(this._chat_commands[b]){var c=this;return void 0===this._chat_commands[b].detect(function(b){return!1===
  264. b(c,a)})}return!0},sendWhisper:function(a,b){var c=b.match(/^\/([^\s]+)\s+([^\s]+)\s+([\s\S]+)/)||[],d=c[2],c=c[3],e=a.chatWindow(),f=a.activeDialogue();d&&c&&(f?f.sendPrivateMessage(d,c):e.sendPrivateMessage(d,c));return!1},setPresenceAway:function(a){a==holodeck&&(a=null);this.konduit().dispatchEvent({type:KonduitEvent.SET_PRESENCE,data:{presence:KonduitPresenceType.AWAY,room_name:a}});return!1},setPresenceChat:function(a){a==holodeck&&(a=null);this.konduit().dispatchEvent({type:KonduitEvent.SET_PRESENCE,
  265. data:{presence:KonduitPresenceType.CHAT,room_name:a}});return!1},setStatisticsAndAccomplishments:function(a,b){this._accomplishment_tracker.setStatistics(a);this._accomplishment_tracker.setAccomplishments(b)},setAccomplishmentsProgress:function(a){a&&(this._accomplishment_tracker.setAccomplishmentsProgress(a),this.insertTemplateForNextActionSuggestion({},this.suggestNextAction.bind(this)),this.konduit().dispatchEvent({type:KonduitEvent.SET_ACCOMPLISHMENT_PROGRESS,data:a}))},addFriends:function(a){this._chat_window.addFriends(a)},
  266. addMutings:function(a){this._chat_window.addMutings(a)},addFavoriteRooms:function(a){this._chat_window.addFavoriteRooms(a)},roomGroups:function(a){this._chat_window.roomGroups(a)},redoRoomList:function(){this._chat_window.redoRoomList()},addChatNags:function(a){this._chat_nag=new ChatNag(this._chat_window,a)},switchUser:function(a,b,c,d,e,f){this._active_user.updateGameAttributes({game_auth_token:d});this._suppress_disconnect=f;this.chatWindow().onLogout();this.konduit().dispatchEvent({type:KonduitEvent.SWITCH_USER,
  267. data:{username:a,user_id:e,slk:b,variables:c,game_auth_token:d}})},isGuestUsername:function(a){return/^Guest/i.match(a)},setUsername:function(a){var b=this.isGuestUsername(this._username);if(!1===this._has_logged_in||a!=this._username)if(this._username=a,!this.isGuestUsername(a))this.onAuthenticated(b)},username:function(){return!this._active_user?"Guest":this._active_user.username()},onAuthenticated:function(a){a=a&&this._has_submitted_stats;this.updateUsernameIndicator();this.loadAccomplishments(a);
  268. this.hideNextActionSuggestion()},hasAccomplishments:function(){return 0<this._accomplishments.length},updateUsernameIndicator:function(){var a=$$(".user_connection .logged_in_user")[0];a.down(".logged_in_user_username").update(this.username());a.show()},authenticated:function(){return this._active_user&&this._active_user.isAuthenticated()},gameId:function(){return this._game_id},addFriend:function(a){this._chat_window.addFriends([a])},removeFriend:function(a){this._chat_window.removeFriends([a])},
  269. addMuting:function(a){this._chat_window.addMutings([a]);this._chat_window.updateRolloverMutingLink(a)},removeMuting:function(a){this._chat_window.removeMutings([a]);this._chat_window.updateRolloverMutingLink(a)},alertLog:function(){return this.konduit().alertLog()},insertPrivateMessagePrefixFor:function(a){this._chat_window.insertPrivateMessagePrefixFor(a)},selectRoom:function(a){a.premium_only&&!active_user.isPremium()?lightbox.prototype.initializePremiumMembershipPurchase("premium_only_chatroom",
  270. "chat_features_tab"):(holodeck._chat_window._online_friends.deactivate(),this.joinRoom(a))},loadFriendsPage:function(a){this._chat_window.loadFriendsPage(a)},loadAccomplishments:function(a){var b=this._on_loaded_accomplishments_callbacks,c=function(){for(;b;)b.pop()()};!this._authenticated_and_loaded_accomplishments&&(this.hasAccomplishments()&&this.authenticated())&&(a||(this._authenticated_and_loaded_accomplishments=!0),new Ajax.Request(this._accomplishments_bootstrap_url,{method:"get",onComplete:c}))},
  271. addKongpanionInfoToBotdTab:function(){active_user.powerupRewardsUser()&&$j("#award_tab_linked_account_plus_points").show();$j(".kongpanion_botd_award_name").text(active_user.kongpanionInfo().name);$j(".kongpanion_botd_award_link").attr("href","/accounts/"+active_user.username()+"/kongpanions");var a=$j("<img />");0===active_user.botdsThisWeek()?(a.attr("src",active_user.kongpanionInfo().normal_url),$j("#kongpanion_botd_award_icon_normal_target").append(a),$j("#kongpanion_botd_award_content_normal").show()):
  272. active_user.botdsThisWeek()==active_user.shinyThreshold()-1&&(a.attr("src",active_user.kongpanionInfo().shiny_url),$j("#kongpanion_botd_award_icon_shiny_target").append(a),$j("#kongpanion_botd_award_content_shiny").show());$j("#award_tab_pur_info").show()},prepareBadgeOfTheDayAwardTab:function(a){if(active_user.powerupRewardsProUser()){var b=active_user.powerupRewardsBonusFor(a);$$(".pur_points_number").each(function(a){a.update(b)})}active_user.kongpanionInfo()&&(0===active_user.botdsThisWeek()||
  273. active_user.botdsThisWeek()==active_user.shinyThreshold()-1)?this.addKongpanionInfoToBotdTab():(this.authenticated()&&$("award_tab_botd_check_tomorrow_content")&&($("award_tab_botd_check_tomorrow_content").show(),$("award_tab_pur_info").show()),active_user.showPowerupRewardsUpsell()&&(active_user.powerupRewardsUser()?$("award_tab_linked_account_message").show():($("badge_of_the_day_gs_upsell")&&$("badge_of_the_day_gs_upsell").show(),this.authenticated()&&$("award_tab_unlinked_account_message").show()),
  274. $$(".powerup_point_content").each(Element.show)))},prioritizeBadgeOfTheDay:function(a){if(a=this._accomplishment_tracker.accomplishmentForId(a))a._level="badge_of_the_day"},addOnLoadedAccomplishmentsCallback:function(a){this._on_loaded_accomplishments_callbacks.push(a)},tabbifyAccomplishments:function(){var a=this;(function(){a.showAccomplishmentTab(a.nextAccomplishment())}).defer();this.buildAccomplishmentVtabSet()},buildAccomplishmentVtabSet:function(){this._accomplishment_vtab_set=new HolodeckTabs("accomplishment_vtab_set",
  275. {tabSelector:".vtab"})},loadScoresPage:function(a,b,c){this._high_scores.getHighScores(a,b,c)},loadHighScores:function(){this._high_scores||(this._high_scores=new HighScores(this));this._high_scores.getHighScores()},showHighScores:function(a){this._tabs.show("accomplishments_tab_pane");this._high_scores||(this._high_scores=new HighScores(this));this._high_scores.activate(a)},hideHighScores:function(){this._high_scores||(this._high_scores=new HighScores(this));this._high_scores.deactivate()},registerAccomplishmentCompletionCallback:function(a,
  276. b){this._accomplishment_tracker.registerAccomplishmentCompletionCallback(a,b)},registerAccomplishmentProgressCallback:function(a,b,c,d){this._accomplishment_tracker.registerAccomplishmentProgressCallback(a,b,c,d)},accomplishmentTemplates:function(){return this._accomplishment_tracker.node()},accomplishmentCompletionTemplate:function(a){return this.accomplishmentTemplates().down(".accomplishment_"+a).down(".accomplishment_completed")},accomplishmentTaskCompletionTemplate:function(a){if(a=$("completed_accomplishment_task_"+
  277. a))return a.down(".task_completed")},accomplishmentSuggestionTemplate:function(a){return this.accomplishmentTemplates().down(".accomplishment_"+a).down(".accomplishment_suggested")},accomplishmentFromOtherGameSuggestionTemplate:function(){var a=this.accomplishmentTemplates().down("#suggestibles").select(".suggestible");return a[parseInt(Math.random()*a.length,10)]},claimAwardTemplate:function(){return this.accomplishmentTemplates().down(".claim_award_box")},showDisconnectedIndicator:function(){this._chat_connected_indicator_node.hide();
  278. this._chat_limited_connection_indicator_node.hide();this._chat_disconnected_indicator_node.show()},showConnectedIndicator:function(){this._chat_disconnected_indicator_node.hide();this._chat_limited_connection_indicator_node.hide();this._chat_connected_indicator_node.show()},showLimitedConnectionIndicator:function(){this._chat_disconnected_indicator_node.hide();this._chat_connected_indicator_node.hide();this._chat_limited_connection_indicator_node.show()},reconnect:function(){this.konduit().dispatchEvent({type:KonduitEvent.CONNECT})},
  279. setupBanAndSilencingControls:function(){this._chat_window.setupBanAndSilencingControls()},hideNextActionSuggestion:function(){var a=$("accomplishment_awarded_tab_pane").down(".suggestion_placeholder");a&&a.update("")},suggestionLocationNodes:function(){return[$("accomplishment_awarded_tab_pane"),$("high_score_alert_tab_pane")].compact().map(function(a){return a.down(".suggestion_placeholder")}).compact()},suggestNextAction:function(a){this.suggestionLocationNodes().each(function(b){a.insertAt(b)})},
  280. setAccomplishmentGroupSuggestions:function(a){var b=this;a.each(function(a){var d=a[1];b._accomplishment_tracker.getAccomplishmentById(a[0]).setAccomplishmentGroupProgressContent(d)})},showAccomplishmentGroupCompletionTab:function(a){if(a=$("accomplishment_group_completion_tab_content_"+a))this._accomplishment_group_award_tab_node.update(a.innerHTML),this._active_user.populateUserSpecificLinks(this._accomplishment_group_award_tab_node),this._tabs.showOnTop("accomplishment_group_awarded_tab_pane")},
  281. insertTemplateForNextActionSuggestion:function(a,b){var c;c=this.authenticated()?(c=this.nextAccomplishment())?this.accomplishmentSuggestionTemplate(c.id()):this.accomplishmentFromOtherGameSuggestionTemplate():this.claimAwardTemplate();b(new SuggestionTemplate(c,a))},nextAccomplishment:function(){return this._accomplishment_tracker.nextAccomplishment()},showMiniProfile:function(a){this.showChatTab();this._chat_window.showProfile(a)},updateDefaultChatNag:function(a){this._chat_nag&&this._chat_nag.updateDefaultNag(a)},
  282. showChatTab:function(){this._tabs.show("chat_tab_pane")},showAccomplishmentTab:function(a){a&&this._accomplishment_vtab_set.show(a.domId())},setSilenceScheduledEnd:function(a){this._chat_window.updateSilenceScheduledEnd(a)},isChatModerator:function(){return active_user.isChatModerator()},activeDialogue:function(){return this._active_dialogue},receivedPrivateMessage:function(a){var b=this._active_dialogue;b&&b.receivedPrivateMessage(a)},sendPrivateRoomInvitation:function(a){this.premiumUserOnly(function(){holodeck._users_invited[a]=
  283. !0;holodeck.konduit().dispatchEvent({type:KonduitEvent.PRIVATE_ROOM_INVITATION,data:{username:a}})},"chat_features_tab")},receivedPrivateRoomInvitation:function(a){this._ignored_invitations[a.username]||this._chat_window.receivedPrivateRoomInvitation(a)},hasActiveShoutCall:function(){return!!this._currentRequestId},sendPrivateMessage:function(a){var b=a.data.message;this._currentRequestId=a.data[KonduitEvent.PARAM_REQUEST_ID];void 0===b&&(b="");new Ajax.Request("/api/shout.json",{method:"post",parameters:{game_id:active_user.gameId(),
  284. game_message:b,from_game:!0,"shout[private]":!0,game_auth_token:active_user.gameAuthToken(),username:active_user.username()},onSuccess:function(a){holodeck.invokeShoutCallback({message_type:"private",success:a.responseJSON.success,error:a.responseJSON.error})}})},displayShoutBox:function(a){var b=a.data.message;this._currentRequestId=a.data[KonduitEvent.PARAM_REQUEST_ID];void 0===b&&(b="");setTimeout(function(){lightbox.prototype.initializeShoutFrame(holodeck.gameId(),b)},0)},displayInvitationBox:function(a){var b=
  285. a.data.message;this._currentRequestId=a.data[KonduitEvent.PARAM_REQUEST_ID];void 0===b&&(b="");var c=a.data.friend_filter;void 0===c&&(c="");lightbox.prototype.initializeInvitationFrame(holodeck.gameId(),b,c,a.data.kv_params)},displayFeedPostBox:function(a){var b=a.data.message;this._currentRequestId=a.data[KonduitEvent.PARAM_REQUEST_ID];void 0===b&&(b="");var c=a.data.image_uri;void 0===c&&(c="");var d=a.data.kv_params;void 0===d&&(d={});setTimeout(function(){var a=function(){active_user.shoutForGame(active_user.gameId(),
  286. function(a){if(a){a={game_id:holodeck.gameId(),image_uri:c,game_auth_token:active_user.gameAuthToken(),game_message:b,from_game:!0,username:active_user.username()};var e={};$H(d).each(function(a){e["shout_api_params["+a[0]+"]"]=a[1]});new Ajax.Request("/api/shout.json",{method:"post",parameters:$H(a).merge(e),onSuccess:function(a){holodeck.invokeShoutCallback({message_type:"feed",success:a.responseJSON.success,error:a.responseJSON.error})}})}else lightbox.prototype.initializeFeedPostFrame(holodeck.gameId(),
  287. b,c,d)})};active_user.isAuthenticated()?a():(lightbox.prototype.addOnCloseCallback(function(){active_user.isAuthenticated()&&a()}),lightbox.prototype.initializeKongregateLightboxFromAjax("/accounts/new/behind_login?game_id="+holodeck.gameId(),{done_class_name:"lightbox_login"}))},0)},invokeShoutCallback:function(a){var b={};b[KonduitEvent.PARAM_REQUEST_ID]=this._currentRequestId;b[KonduitEvent.PARAM_MESSAGE_TYPE]=a.message_type;b[KonduitEvent.PARAM_MESSAGE_RECIPIENTS]=a.recipients;b[KonduitEvent.PARAM_SUCCESS]=
  288. a.success;b[KonduitEvent.PARAM_ERROR]=a.error;this._currentRequestId=null;holodeck.konduit().dispatchEvent({type:KonduitEvent.OP_SHOUT_CALLBACK,data:b})},invokeShoutDialogClosedCallback:function(a){holodeck.hasActiveShoutCall()&&holodeck.invokeShoutCallback({message_type:a,success:!1,error:"User closed dialog"})},destroyPrivateRoom:function(){holodeck._users_invited={};holodeck.konduit().dispatchEvent({type:KonduitEvent.DESTROY_PRIVATE_ROOM,data:{}})},leaveRoom:function(a){holodeck.konduit().dispatchEvent({type:KonduitEvent.LEAVE_ROOM,
  289. data:{room_type:a}})},leavePrivateRoom:function(){this.leaveRoom("private")},leaveGuildRoom:function(){this.leaveRoom("guild")},invitationIgnoredBy:function(a){this._ignored_invitations[a]=!0},privateRoomKick:function(a){holodeck.konduit().dispatchEvent({type:KonduitEvent.PRIVATE_ROOM_KICK,data:{username:a}})},hasInvited:function(a){return this._users_invited[a]},premiumUserOnly:function(a,b){active_user.isPremium()?a():lightbox.prototype.initializePremiumMembershipPurchase("private_chat",b)},height:function(){return this._html_dimensions.game_frame_height},
  290. checkChatScroll:function(){this._tabs&&"chat_tab_pane"==this._tabs.activeContainer.id&&this._chat_window.scrollToBottom()},recordAnalyticsEvent:function(a,b,c){this._holodeck_event_analytics.recordEvent(a,b,c)},recordMappedEventAnalytic:function(a){this._holodeck_event_analytics.recordMappedEventAnalytic(a)},setMetricTracker:function(a){this._holodeck_event_analytics.setMetricTracker(a)},startWatchingStats:function(){this._accomplishment_tracker.startWatchingStats()},scheduleRender:function(a){this._queued_renders||
  291. (this._queued_renders=[]);this._queued_renders.push(a);if(!this._queued_render_worker){var b=this;this._queued_render_worker=setTimeout(function(){b.processRenderQueue()},this._interval_between_renders)}},processRenderQueue:function(){var a=this._queued_renders.shift();if(this._queued_renders.length){var b=this;this._queued_render_worker=setTimeout(function(){b.processRenderQueue()},this._interval_between_renders)}else this._queued_render_worker=null;a&&a()},showSessionAlertContentInChatTab:function(){$("session_conflict_content_for_chat_tab").show()},
  292. hideSessionAlertContentInChatTab:function(){$("session_conflict_content_for_chat_tab").hide()},updateDefaultChatTabMessage:function(a){$("chat_default_content").down("p").update(a)},submitGameBug:function(a,b){var c=$H(b).merge({method:"post",parameters:{type:"GameBugReport","feedback[game_bug_content]":a,"feedback[game_id]":this.gameId(),"alert[log]":this.alertLog().toJSON()}}).toObject();new Ajax.Request("/feedbacks",c);this.recordAnalyticsEvent("Game","Bug")},showSignupTab:function(){this.authenticated()||
  293. (this._tabs.showOnTop("signup_tab_pane"),new Effect.Highlight("signup_tab_pane",{startcolor:"#ffff99",endcolor:"#dddddd",restorecolor:"#dddddd"}))},closeSignupTab:function(a){this._tabs.closeSignupTab(a)},closeSigninTab:function(a){this._tabs.closeSigninTab(a)},addSignupTabOnCloseCallback:function(a){this._tabs.addOnCloseCallback("signup_tab_pane",a)},isShowingSignupTab:function(){return $("signup_tab_pane").visible()},_purgeTabCookies:function(){Cookie.erase("kong_opened_panel");Cookie.erase(Holodeck.HOLODECK_TAB_COOKIE_NAME);
  294. Cookie.erase("holodeck_tab_override")},loadCollaborators:function(){new Ajax.Request(this._game_path+"/collaborations.js",{method:"get",onSuccess:function(a){var b=$("collaborators_placeholder");b&&b.update(a.responseText)}})},sharedContentData:function(){if(this._shared_content_data)return this._shared_content_data.content},promptSaveSharedContent:function(a){this._permissions.save_shared_content?this.authenticated()?(this._shared_content_data=a,a=Object.extend({},a),delete a.content,this._lightbox.reloadInfoFromUrl(this._active_user.gameResourcePath()+
  295. "/shared_contents/new?"+Object.toQueryString(a),"kred_purchase")):(this._shared_content_data=a,this._lightbox.wait_for_shutdown=!0,this._lightbox.reloadInfoFromUrl(this._login_url,"kred_purchase lightbox_login")):this.alertSharedContentSavingNotPermitted(a.contentType)},redoPromptSavedSharedContent:function(){this._shared_content_data&&(this._lightbox.wait_for_shutdown=!1,this._lightbox.reloadInfoFromUrl(this._active_user.gameResourcePath()+"/shared_contents/new?"+Object.toQueryString(this._shared_content_data),
  296. "kred_purchase"))},promptProcessingSaveSharedContent:function(a){var b=this;this._lightbox.addOnCloseCallback(function(){b.saveSharedContentFailed()});this._lightbox.initializeKongregateLightboxFromContent('<p class="shared_content_loading_message">Processing Thumbnail (<a href="#" onclick="holodeck.closeLightbox();return false;">cancel</a>)</p>',{afterStaticContentLoad:function(){$("kongregate_lightbox_spinner").show()}})},saveSharedContentFailed:function(){this.konduit().dispatchEvent({type:KonduitEvent.SAVE_SHARED_CONTENT_COMPLETE,
  297. data:{success:!1}});this._lightbox.deactivate()},saveSharedContentSuccessful:function(a){this._lightbox.clearOnCloseCallbacks();this.konduit().dispatchEvent({type:KonduitEvent.SAVE_SHARED_CONTENT_COMPLETE,data:{success:!0,content:a.content,name:a.name,permalink:a.permalink,id:a.id,label:a.label}});a.externally_submitted?this.loadSharedContentWithoutClosingLightbox(a):this.showSharedContent(a.tab_link,a.tab_contents_url)},loadSharedContentWithoutClosingLightbox:function(a){var b=this;this._last_loaded_shared_content_id&&
  298. this._last_loaded_shared_content_id==a.id||(this._shared_content_timer&&clearTimeout(this._shared_content_timer),this._last_loaded_shared_content_id=a.id,this._shared_content_timer=setTimeout(function(){b._last_loaded_shared_content_id=null},5E3),this.konduit().dispatchEvent({type:KonduitEvent.LOAD_SHARED_CONTENT,data:{contentType:a.contentType,content:a.content,name:a.name,permalink:a.permalink,id:a.id,label:a.label}}),this.showSharedContent(a.tab_link,a.tab_contents_url))},loadSharedContent:function(a){this.closeLightbox();
  299. this.loadSharedContentWithoutClosingLightbox(a)},loadSharedContentFromUrl:function(){var a=this,b=document.location.search.parseQuery(),c=this._shared_content_type_permalinks.find(function(a){return b[a]});c&&new Ajax.Request(this._active_user.gameResourcePath()+"/shared_contents/"+b[c]+".json",{method:"get",onSuccess:function(b){b=b.responseText.evalJSON();a.loadSharedContent(b)}})},alertSharedContentSavingNotPermitted:function(a){alert(a+" saving is not permitted for this game.")},saveSharedContentFromUrl:function(){if(!this._shared_content_saved_from_url){this._shared_content_saved_from_url=
  300. !0;var a=document.location.search.parseQuery();a.type&&(this._permissions.save_shared_content?this._permissions.save_external_shared_content?!this._shared_content_type_names.include(a.type.toLowerCase())||!a.content||!/&z$/.match(document.location.href)?alert("This "+a.type+" could not be saved."):this.promptSaveSharedContent({contentType:a.type,label:a.label,content:a.content,fromUrl:!0}):alert(a.type+" saving is only enabled on Kongregate.com."):this.alertSharedContentSavingNotPermitted(a.type))}},
  301. showSharedContent:function(a,b){var c=a+"_pane",d=c+"_spinner",e=$("shared_content_tab_content"),f=$(d);f&&f.show();e&&e.remove();this._tabs.ajaxUpdateTab(c,b,function(){f&&f.hide();(e=$("shared_content_tab_content"))&&e.select(".collapsible_panel").each(function(a){new CollapsiblePanel(a)})});this._tabs.show(c);Element.scrollTo("maingame")},showSharedContentsIndex:function(a,b,c){a=this._active_user.gameResourcePath()+"/shared/"+encodeURIComponent(a)+(b?"?"+Object.toQueryString({sort:b,label:c}):
  302. "");!this.authenticated()&&b&&this._authenticated_only_shared_content_sorts.include(b.toLowerCase())?(this._show_shared_contents_index_url=a,this._lightbox.wait_for_shutdown=!0,this.showLightbox(this._login_url)):this.showLightbox(a)},redoShowSharedContentsIndex:function(){this._show_shared_contents_index_url&&this._lightbox.reloadInfoFromUrlFromUrl(this._show_shared_contents_index_url)},updateSharedContentsIndex:function(a){new Ajax.Updater({success:"lightbox_form"},a,{asynchronous:!0,evalScripts:!0,
  303. method:"get",onLoading:function(a){Element.show("shared_content_sorting_indicator")}})},showLightbox:function(a){this._lightbox.initializeKongregateLightboxFromAjax(a)},closeLightbox:function(){this._lightbox&&this._lightbox.deactivate()},showRegistrationLightboxFromPreroll:function(){this._active_user.activateInlineLogin({},!0)},recordGuestCompletion:function(a){this.authenticated()||this._accomplishment_tracker.recordGuestAccomplishment(a)},loadAdminControls:function(){this._active_user.isAdmin()&&
  304. new Ajax.Updater({success:"admin_control_container"},this._active_user.gameResourcePath()+"/admin_controls",{method:"get"})},loadDeveloperControls:function(){this._active_user.isDeveloperOfGame()&&!this._active_user.isAdmin()&&new Ajax.Updater({success:"developer_control_container"},this._active_user.gameResourcePath()+"/developer_controls",{method:"get"})},loadForum:function(){new Ajax.Request(this._active_user.gameResourcePath()+"/forum",{method:"get",onSuccess:function(a){$("latest_posts").update(a.responseText)}})},
  305. loadGuildForum:function(){var a=this;new Ajax.Request(this._active_user.gameResourcePath()+"/forum/guild",{method:"get",onSuccess:function(b){$("guild_posts_container").update(b.responseText);a.setupBelowFoldTabs()}})},loadDiscussions:function(){this._has_game_specific_forum&&this.loadForum();page_data.in_guilds&&this.loadGuildForum()},loadRateThisGameTab:function(){this.userRating()||($("rate_this_game_tab").show(),0>=this.userRating()&&$$(".rate_this_game_tab_unrated").invoke("show"),this._tabs.showOnTop("rate_this_game_tab_pane"),
  306. $j(".rate_later_link").click(function(a){a.preventDefault();holodeck.closeRateThisGameTab()}))},closeRateThisGameTab:function(){this._tabs.close("rate_this_game_tab_pane")},hasSharedContent:function(){return this._shared_content_type_names&&this._shared_content_type_names.length},showPlayLaterLinks:function(){$("quicklinks_play_later_block").show();$("below_game_play_later_block").show()},addIncomingMessageFilter:function(a){this._incoming_message_filters.unshift(a)},filterIncomingMessage:function(a,
  307. b){this.filterMessage(a,this._incoming_message_filters,b)},addOutgoingMessageFilter:function(a){this._outgoing_message_filters.unshift(a)},filterOutgoingMessage:function(a,b){this.filterMessage(a,this._outgoing_message_filters,b)},filterMessage:function(a,b,c){b.inject(c,function(a,b){return function(c){b(c,a)}})(a)},addMessageFilters:function(){if(this._active_user){var a=this._active_user.domain().gsub(".","\\."),b=RegExp("\\b((?:https?://)?www\\."+a+'(?:/[^\\s"]*)*\\b/?)',"i"),c=new Element("p");
  308. this.addIncomingMessageFilter(function(a,b){c.setText(a);b(c.innerHTML.gsub("\\\\","\\").gsub("<br>",""),b)});this.addIncomingMessageFilter(function(a,c){c(a.gsub(b,function(a){return'<a href="'+(0===a[0].indexOf("http")?"":"http://")+a[0]+'" target="_blank">'+a[0]+"</a>"}),c)})}},resizeGame:function(a,b){function c(a,b,c,d){var p={};$A([e,u,m]).each(function(b){c.hasOwnProperty(b)&&(p[b]=a+c[b]+g)});$A([f,h,l]).each(function(a){c.hasOwnProperty(a)&&(p[a]=b+c[a]+g)});d.setStyle(p)}var d=this._html_dimensions;
  309. a=parseInt(a,10)||0;b=parseInt(b,10)||0;a<d.game_width&&(a=d.game_width);b<d.game_height&&(b=d.game_height);for(var d=[["#maingame",{width:d.divider_width+d.chat_width,height:d.quicklinks_height}],["#maingamecontent",{width:d.divider_width+d.chat_width,height:d.quicklinks_height}],["#flashframecontent",{width:d.divider_width+d.chat_width,height:d.quicklinks_height}],["#gameholder",{width:0}],["#game",{width:0,height:0}],["#gameiframe",{width:0,height:0}],["#chat_container",{height:0}],[".game_avatar_image>img",
  310. {maxHeight:-d.avatar_image_gutter_height}],["#kong_game_ui>.tabpane",{height:-d.chat_pane_tab_height}]],e="width",f="height",m="maxWidth",l="maxHeight",u="minWidth",h="minHeight",g="px",p=d.length-1;0<=p;p--)$$(d[p][0]).each(c.curry(a,b,d[p][1]))},updateGameplay:function(a){this._gameplay_id=a},gameplay:function(){return this._gameplay_id},userRating:function(){return this._user_rating},addOnTabSelectCallback:function(a,b){this._tabs.addOnSelectCallback(a,b)},addOnTabLoadCallback:function(a,b){document.observe(a+
  311. ":loaded",b);this._tabs.activeContainer.id===a&&b()},setupBelowFoldTabs:function(){$$(".game_tab_index").each(function(a){$(a).firstDescendant().addClassName("active")});$$(".game_tab_group").each(function(a){$(a).firstDescendant().addClassName("active")});$$(".game_discussions .game_tab_index").each(function(a){!0!==page_data.in_guilds&&($(a).down(".game_tab_item",0).removeClassName("active"),$(a).down(".game_tab_item",1).addClassName("active"))});$$(".game_discussions .game_tab_group").each(function(a){!0!==
  312. page_data.in_guilds&&($(a).down(".tab",0).removeClassName("active"),$(a).down(".tab",1).addClassName("active"))});$$(".game_tab_link").each(function(a){a.observe("click",function(a){var c=this.readAttribute("href").sub("#","");this.up().siblings().each(function(a){$(a).removeClassName("active")});this.up().addClassName("active");$(c).siblings().each(function(a){$(a).removeClassName("active")});$(c).addClassName("active");a.stop()})})}};function CapturesToInlineRegistration(){}
  313. CapturesToInlineRegistration.decorate=function(a){return active_user.capturedSelectorWrapper.bindAsEventListener(active_user,a)};HolodeckEventAnalytics=function(){this.initialize()};
  314. HolodeckEventAnalytics.tab_mappings={chat_tab:["TabView","Chat"],game_tab:["TabView","Game"],accomplishments_tab:["TabView","Achievements"],more_games_tab:["TabView","MoreGames"],signup_tab:["TabView","Signup"],game_info_panel:["Game","InfoToggle"],game_description_panel:["Game","DescriptionToggle"],game_instructions_panel:["Game","InstructionsToggle"],game_shared_contents_panel:["Game","SharedContentToggle"],today_high_score_tab:["Achievements","ScoresToday"],weekly_high_score_tab:["Achievements",
  315. "ScoresLast7"],all_time_high_score_tab:["Achievements","ScoresAllTime"],friends_high_score_tab:["Achievements","ScoresFriends"]};
  316. HolodeckEventAnalytics.prototype={initialize:function(){var a=this;["chat_tab","game_tab","accomplishments_tab","more_games_tab","signup_tab"].each(function(b){var c=$(b);c&&c.observe("click",function(c){a.recordMappedEventAnalytic(b)})})},setMetricTracker:function(a){this._metric_tracker=a},recordEvent:function(a,b,c){if(this._metric_tracker){var d=this._metric_tracker;setTimeout(function(){d.trackEvent(a,b,c)},0)}},recordMappedEventAnalytic:function(a){(a=HolodeckEventAnalytics.tab_mappings[a])&&
  317. this.recordEvent(a[0],a[1])}};
  318. HolodeckTabs=Class.create(Control.Tabs,{initialize:function($super,b,c){c||(c={});this._closeableTabs={};this._preservableTabs={};this._closeableTabsStack=[];this._onCloseCallbacks={};this._onSelectCallbacks={};this._onChangeCallback=c.afterChange;this._tabSelector=c.tabSelector||".tab";c.hideFunction=this.hideContainer;c.showFunction=this.showContainer;c.afterChange=function(b){(b=this._onSelectCallbacks[b.id])&&b.each(function(b){b()});this._onChangeCallback&&this._onChangeCallback()};this._current_top_priority=
  319. HolodeckTabs.Priority.ON_TOP;$super(b,c);this._holodeck=c.holodeck},addTab:function($super,b){var c=this,d=b.up(this._tabSelector),e=d.hasClassName("closeable"),f=d.hasClassName("preserve");$super(b);var m=this.containers.get(b.key);m.closeable=e;m.preservable=f;e&&(this._closeableTabs[b.key]=!0,(d=d.down(".close_tab_link"))&&d.observe("click",function(d){c.close(b);d.stop()}));f&&(this._preservableTabs[b.key]=!0)},keyForLink:function(a){var b;if(a||"undefined"!==typeof a)return b="string"==typeof a?
  320. this.links.find(function(b){return b.key==a}).key:"number"==typeof a?this.links[a].key:a.key},linkForKey:function(a){return a.key?a:void 0===a.length?this.links[a]:"first"==a?this.links[0]:this.links.find(function(b){return b.key==a})},tab:function(a){var b=this.keyForLink(a);return(a=this.links.find(function(a){return a.key==b}))?a.up("li"):null},container:function(a){return this.containers.get(this.keyForLink(a))},addOnCloseCallback:function(a,b){var c=this._onCloseCallbacks[a]||[];c.push(b);this._onCloseCallbacks[a]=
  321. c},addOnSelectCallback:function(a,b){var c=this._onSelectCallbacks[a]||[];c.push(b);this._onSelectCallbacks[a]=c;this.activeContainer.id==a&&b()},close:function(a,b){var c=this.linkForKey(a),d=this._onCloseCallbacks[c.key];if(this.isCloseable(c))return d&&(delete this._onCloseCallbacks[c.key],d.each(function(a){a(b)})),this._closeableTabsStack=this._closeableTabsStack.reject(function(a){return a==c}),this._closeableTabsStack.length&&(d=this._closeableTabsStack[this._closeableTabsStack.length-1],this.show(d,
  322. d._priority)),this.hide(c),this.updateStackedTab(),!0},closeTab:function(a,b){$(a)&&this.close(a,b)},closeSignupTab:function(a){this.closeTab("signup_tab_pane",a)},closeSigninTab:function(a){this.closeTab("signin_tab_pane",a)},updateStackedTab:function(){(function(){this._closeableTabsStack.each(function(a){a.up("li").removeClassName("stacked")});1<this._closeableTabsStack.length&&this._closeableTabsStack[0].up("ul").down(".active").up("li").addClassName("stacked")}).bind(this).defer()},hide:function(a,
  323. b){var c=this.tab(a),d=this.container(a);c.hide();d.hide();this.activeLink==a&&!b&&(c=this._holodeck.getTabFromCookie(),a.id.startsWith("signup")||c.startsWith("signup")?holodeck.showAccomplishmentsOrMoreGamesTab():this.show(c))},showOnTop:function(a){this.show(a,++this._current_top_priority)},show:function(a,b){var c=this.linkForKey(a),d=c;if(this.isCloseable(c)){for(var d=this._closeableTabsStack.reject(function(a){return a==c}),e=d.length-1;0<=e;e--)c!=d[e]&&this.hide(d[e],!0);c._priority=b||0;
  324. d.push(c);this._closeableTabsStack=d.sortBy(function(a){return a._priority});d=this._closeableTabsStack[this._closeableTabsStack.length-1]}this.updateStackedTab();var e=this.tab(d),f=this.container(d);e&&f&&(e.show(),f.show(),this.setActiveTab(d))},isCloseable:function(a){return this._closeableTabs[this.keyForLink(a)]},ajaxUpdateTab:function(a,b,c,d){var e=this;new Ajax.Request(b,{method:"get",onSuccess:function(b){var m=e.container(a);d&&(m=m.down(d));m.update(b.responseText);c&&c()},onFailure:function(b){e.close(a)}})},
  325. showAlert:function(a){this._alert_tab_pane_content||(this._alert_tab_pane_content=$("alert_tab_pane_content"));alert_div=$(a);this._alert_tab_pane_content.innerHTML=alert_div.innerHTML;a.startsWith("session_")&&($("session_conflict_content_for_chat_tab").innerHTML=alert_div.innerHTML);this.show("alert_tab_pane",HolodeckTabs.Priority.ERROR)},hideContainer:function(a){a.preservable?(a.setStyle({visibility:"hidden"}),a.select(".hideable").each(function(a){a.setStyle({visibility:"hidden"})})):a.hide()},
  326. showContainer:function(a){a.preservable?(a.setStyle({visibility:"visible"}),a.select(".hideable").each(function(a){a.setStyle({visibility:"visible"})})):a.show()}});HolodeckTabs.Priority={ERROR:1,ON_TOP:2};
  327. KonduitEvent={INIT:"init",CONNECT:"connect",DISCONNECT:"disconnect",LOGIN:"login",SWITCH_USER:"switch_user",JOIN_ROOM:"join_room",LEAVE_ROOM:"leave_room",USER_JOIN:"user_join",USER_DEPARTURE:"user_departure",USER_CHANGED:"user_changed",ROOM_MESSAGE:"room_message",PRIVATE_MESSAGE:"private_message",ADMIN_MESSAGE:"admin_message",MESSAGE_ERROR:"message_error",SET_PRESENCE:"set_presence",GUEST_COUNT:"guest_count",ROOM_NOT_FOUND:"room_not_found",ROOM_FULL:"room_full",REQUEST_CHAT_ROOM:"request_chat_room",
  328. CREATE_PRIVATE_ROOM:"create_private_room",DESTROY_PRIVATE_ROOM:"destroy_private_room",PRIVATE_ROOM_INVITATION:"private_room_invitation",PRIVATE_ROOM_KICK:"private_room_kick",PRIVATE_ROOM_INVITATION_SENT:"private_room_invitation_sent",JOIN_GUILD_ROOM:"join_guild_room",SILENCED:"silenced",PARTICIPATE:"participate",AMNESTY:"amnesty",API_INITIALIZED:"api_initialized",ADD_STATISTICS:"add_statistics",STATISTIC_UPDATED:"statistic_updated",SET_ACCOMPLISHMENT_PROGRESS:"set_accomplishment_progress",NEW_HIGH_SCORE:"new_high_score",
  329. DISPLAY_SHOUT_BOX:"display_shout_box",DISPLAY_INVITATION_BOX:"display_invitation_box",SEND_PRIVATE_MESSAGE:"send_private_message",DISPLAY_FEED_POST_BOX:"display_feed_post_box",DISPLAY_SIGN_IN_LIGHTBOX:"display_sign_in_lightbox",DISPLAY_REGISTRATION_LIGHTBOX:"display_registration_lightbox",RESIZE_GAME:"resize_game",HANDLE_ITEM_CHECKOUT_REQUEST:"handle_item_checkout_request",CUSTOM_TAB_MESSAGE:"custom_tab_message",CUSTOM_TAB_SHOW:"custom_tab_show",CUSTOM_TAB_CLOSE:"custom_tab_close",CUSTOM_TAB_CLEAR_MESSAGES:"custom_tab_clear_messages",
  330. OP_SHOUT_CALLBACK:"ext.shout_callback",PARAM_MESSAGE_TYPE:"ext.message_type",PARAM_MESSAGE_RECIPIENTS:"ext.message_recipients",PARAM_ERROR:"error",PARAM_SUCCESS:"success",PARAM_REQUEST_ID:"req.id",PROCESSING_SAVE_SHARED_CONTENT:"processing_save_shared_content",SAVE_SHARED_CONTENT:"save_shared_content",SAVE_SHARED_CONTENT_COMPLETE:"shared_content_save_complete",LOAD_SHARED_CONTENT:"load_shared_content",BROWSE_SHARED_CONTENT:"browse_shared_content",IMAGE_AVATAR_SUBMIT:"image_avatar_submit",IMAGE_AVATAR_COMPLETE:"image_avatar_complete",
  331. HOLODECK_DATA:"holodeck_data",PARAM_HOLODECK_TYPE:"holodeck_type"};KonduitChatErrorMessage={MESSAGE_TOO_LONG:"error_msg_too_long",RATE_LIMITED:"error_msg_rate_limit"};KonduitPresenceType={CHAT:"chat",AWAY:"away"};KonduitEventDispatcher=function(){this.initialize()};
  332. KonduitEventDispatcher.prototype={initialize:function(){this._callbacks={}},register:function(a,b){this._callbacks.hasOwnProperty(a)||(this._callbacks[a]=[]);this._callbacks[a].push(b)},fire:function(a){var b=a.type;if(this._callbacks.hasOwnProperty(b))for(var c=0,d=this._callbacks[b].length;c<d;c++)this._callbacks[b][c](a)}};MiniProfile=function(a){this.initialize(a)};
  333. MiniProfile.prototype={initialize:function(a){this._chat_window=a.chat_window;this._holodeck=a.holodeck;var b=this;(this._container=$("user_mini_profile_container"))&&this._container.down(".return_to_room").observe("click",function(a){b.deactivate();a.stop()})},activate:function(a,b){this._chat_window.setActiveTempPane(this);this._current_username=a;this._current_room=b;var c=this._container,d=this._chat_window,e=this;$("user_mini_profile").update("");c.down(".room_name").update(b.name());d.hideChatWindow();
  334. d._chat_tab_clicked=!1;c.ieHappyShow();d.showSpinner();new Ajax.Updater({success:"user_mini_profile"},"/accounts/"+a+".chat",{method:"get",onComplete:function(){!1==d._chat_tab_clicked&&(d.hideSpinner(),e.setupBanAndSilencingControls(a),e._holodeck.authenticated()||(hookupCaptureToInlineRegistration("#add_friend"),hookupCaptureToInlineRegistration("#mute_user")))}})},deactivate:function(){this._chat_window.clearActiveTempPane();this._container.ieHappyHide();this._chat_window.hideSpinner();this._chat_window.showChatWindow()},
  335. updateManualBanReasonField:function(a){$("ban_ban_reason_id").value?$("ban_reason_block").hide():$("ban_reason_block").show()},updateManualSilencingReasonField:function(a){$("silencing_silencing_reason_id").value?$("silencing_reason_block").hide():$("silencing_reason_block").show()},setupBanAndSilencingControls:function(a){this._chat_window.isModeratableUser(a)&&(["silencings","bans"].each(Element.show),$("ban_ban_reason_id")&&($("ban_ban_reason_id").observe("click",this.updateManualBanReasonField),
  336. $("ban_ban_reason_id").observe("change",this.updateManualBanReasonField),$("ban_ban_reason_id").observe("keypress",this.updateManualBanReasonField),this.updateManualBanReasonField(null)),$("silencing_silencing_reason_id")&&($("silencing_silencing_reason_id").observe("click",this.updateManualSilencingReasonField),$("silencing_silencing_reason_id").observe("change",this.updateManualSilencingReasonField),$("silencing_silencing_reason_id").observe("keypress",this.updateManualSilencingReasonField),this.updateManualSilencingReasonField(null)))}};
  337. OnlineFriends=function(a){this.initialize(a)};
  338. OnlineFriends.prototype={initialize:function(a){this._chat_window=a;var b=this;this._container=$("friends_online_container");this._friend_list_node=$("friends_online");this._container&&this._container.down(".return_to_room").observe("click",function(a){b.deactivate();a.stop()})},activate:function(a){var b=this._chat_window;this._container.down(".room_name").update(a);b.hideChatWindow();this.getOnlineFriends()},getOnlineFriends:function(a){var b=this._container,c=this._chat_window,d=this._friend_list_node;
  339. d.hide();c.showSpinner();c._chat_tab_clicked=!1;new Ajax.Updater({success:"friends_online"},"/accounts/"+c.username()+"/online_friends.chat"+(a?"?page="+a:""),{method:"get",onSuccess:function(a){!1==c._chat_tab_clicked&&(c.hideChatWindow(),c.hideSpinner(),d.show(),b.show())}})},deactivate:function(){this._container.hide();this._chat_window.showChatWindow()}};
  340. Array.prototype.binarySearch=function(a,b,c){b||(b=function(a,b){return a==b?0:a<b?-1:1});for(var d=0,e=this.length-1,f,m;d<=e;)if(f=Math.floor((d+e)/2),m=b(this[f],a),0>m)d=f+1;else if(0<m)e=f-1;else return f;return c?d:-1};Array.prototype.orderedInsert=function(a,b){var c=this.binarySearch(a,b,!0);this.splice(c,0,a);return c};Array.prototype.orderedDelete=function(a,b){var c=this.binarySearch(a,b);0<=c&&this.splice(c,1);return c};RoomInfo=function(a){this.initialize(a)};
  341. RoomInfo.prototype={initialize:function(a){this._chat_window=a.chat_window;this._holodeck=a.holodeck;var b=this;(this._container=$("room_info_container"))&&this._container.down(".return_to_room").observe("click",function(a){b.deactivate();a.stop()})},activate:function(a){this._chat_window._chat_tab_clicked=!1;this._chat_window.setActiveTempPane(this);this._current_room=a;var b=this._container,c=this._chat_window;b.down(".room_name").update(a.name());c.hideChatWindow();c.showSpinner();new Ajax.Updater({success:"room_info"},
  342. "/rooms/"+a.getId()+".chat",{method:"get",onSuccess:function(a){!1==c._chat_tab_clicked&&(c.hideChatWindow(),c.hideSpinner(),b.ieHappyShow())}})},deactivate:function(){this._chat_window.clearActiveTempPane();this._container.ieHappyHide();this._chat_window.showChatWindow()}};SharedContentWelcomeTab=function(a){this.initialize(a)};
  343. SharedContentWelcomeTab.prototype={initialize:function(a){this._active_user=a.active_user;this._holodeck=a.holodeck;this._active_user&&(this._active_user.isAuthenticated()&&this._holodeck.hasSharedContent()&&!this._active_user.seenSharedContentWelcome())&&this.update()},update:function(){var a=this._holodeck,b=this._active_user.gameResourcePath()+"/featured_shared_contents.chat";this._active_user.setSeenSharedContentWelcome(!0);new Ajax.Updater({success:"shared_content_welcome_tab_pane_content"},
  344. b,{method:"get",on200:a.showSharedContentWelcomeTab.bind(a)})}};Statistic=function(a){this.initialize(a)};Statistic.ADD_TYPE="Add";Statistic.MAX_TYPE="Max";Statistic.MIN_TYPE="Min";Statistic.REPLACE_TYPE="Replace";
  345. Statistic.prototype={initialize:function(a){this._stat_type=a.stat_type;this._id=a.id;this._name=a.name;this._display_name=a.display_name},name:function(){return this._name},displayName:function(){return this._display_name||this._name},id:function(){return this._id},type:function(){return this._stat_type},compare:function(a,b){return void 0===a?1:void 0===b?-1:a==b?0:this._stat_type==Statistic.MIN_TYPE?a>b?1:-1:a<b?1:-1}};SuggestionTemplate=function(a,b){this.initialize(a,b)};
  346. SuggestionTemplate.prototype={initialize:function(a,b){var c=$(a);this._source=c?c.cloneNode(!0):void 0;this._substitutions=$H(b||{})},source:function(){return this._source?this._source.cloneNode(!0):void 0},substitutions:function(){return this._substitutions},insertAt:function(a){if(this.source()){var b=$(a);b&&(b.update(this.source()),this.substitutions().each(function(a){var d=a.value;(a=b.down(a.key))&&a.update(d)}))}}};UserRollover=function(a){this.initialize(a)};
  347. UserRollover.USER_TOP_FUDGE=9;UserRollover.BASE_LEFT_VALUE=54;
  348. UserRollover.prototype={initialize:function(a){this._chat_window=a;this._rollover_template_node=$("user_rollover_template");this._gamelink_node=$("rollover_game_link");this._profile_node=$("rollover_profile_link");this._add_friend_node=$("rollover_add_friend_link");this._private_message_node=$("rollover_private_message_link");this._private_room_invite_node=$("rollover_private_room_invite_link");this._private_room_kick_node=$("rollover_private_room_kick_link");this._mute_node=$("rollover_mute_link");
  349. this._add_friend_observer=function(){};this._profile_observer=function(){};this._private_message_observer=function(){};this._mute_observer=function(){};if(this._rollover_template_node){var b=this;this._rollover_template_node.observe("mouseover",function(a){b.stopHide();Event.stop(a)});this._rollover_template_node.observe("mouseout",function(a){b.beginHide();Event.stop(a)})}},show:function(a){this._hideTimer&&clearTimeout(this._hideTimer);this.updateCurrentGame(a);this.updateProfileLink(a);this.updateAddFriendLink(a.username);
  350. this.updatePrivateMessageLink(a.username);this.updatePrivateRoomInviteLink(a.username);this.updatePrivateRoomKickLink(a.username);this.updateMutingLink(a.username);this.setRolloverPosition(a.username);this._rollover_template_node.show()},setRolloverPosition:function(a){var b=this._chat_window.activeRoomUsernameNode(a),c=this._chat_window.activeRoomUserListScrollTop(),d=b.positionedOffset()[1];a=d-=UserRollover.USER_TOP_FUDGE;c<d&&(a=d-c);b=b.getWidth();this._rollover_template_node.setStyle({left:UserRollover.BASE_LEFT_VALUE+
  351. b+"px",top:a+"px"})},updateCurrentGame:function(a){this._gamelink_node.writeAttribute("href",a.gameUrl());this._gamelink_node.update(a.gameTitle())},updateAddFriendLink:function(a){this._chat_window.username();this._chat_window.isFriend(a)?this._add_friend_node.hide():(this._add_friend_node.update("Add Friend"),this._add_friend_node.stopObserving("click",this._add_friend_observer),this._add_friend_observer=CapturesToInlineRegistration.decorate(function(b){Element.show("add_as_friend_indicator");var c=
  352. "/accounts/"+this._chat_window.username()+"/friends/"+a+"?friend_from=chat";new Ajax.Request(c,{asynchronous:!0,evalScripts:!0,method:"put"});Event.stop(b);return!1}.bind(this)),this._add_friend_node.observe("click",this._add_friend_observer),this._add_friend_node.show())},updatePrivateMessageLink:function(a){var b=this._chat_window;this._private_message_node.stopObserving("click",this._private_message_observer);this._private_message_observer=CapturesToInlineRegistration.decorate(function(c){b.insertPrivateMessagePrefixFor(a);
  353. Event.stop(c);return!1}.bind(this));this._private_message_node.observe("click",this._private_message_observer)},updatePrivateRoomInviteLink:function(a){var b=this._private_room_invite_node,c=this._chat_window.roomByType("private");c&&c.isMyPrivateRoom()&&c.user(a)?b.hide():(b.show(),holodeck.hasInvited(a)?(b.down(".invite").hide(),b.down(".retry").show()):(b.down(".invite").show(),b.down(".retry").hide()));b.stopObserving("click");b.observe("click",function(c){b.down(".invite").hide();b.down(".retry").show();
  354. holodeck.sendPrivateRoomInvitation(a);Event.stop(c);return!1})},updatePrivateRoomKickLink:function(a){var b=this._chat_window._active_room,c=this._private_room_kick_node,d=this;b.isPrivate()&&b.isMyPrivateRoom()?(c.show(),c.stopObserving("click"),c.observe("click",function(b){holodeck.privateRoomKick(a);d.hide();Event.stop(b);return!1})):c.hide()},updateMutingLink:function(a){var b;if(this._chat_window.isAdmin(a))this._mute_node.hide();else{this._mute_node.show();var c=this._chat_window.username();
  355. this._chat_window.isMuted(a)?(b="/accounts/"+c+"/muted_users/"+a+"?from_chat=true",this._mute_node.update("Unmute"),this._mute_node.stopObserving("click",this._mute_observer),this._mute_observer=function(a){Element.show("muting_indicator");new Ajax.Request(b,{asynchronous:!0,evalScripts:!0,method:"delete"});Event.stop(a);return!1}):(b="/accounts/"+c+"/muted_users?username="+a+"&from_chat=true",this._mute_node.update("Mute"),this._mute_node.stopObserving("click",this._mute_observer),this._mute_observer=
  356. CapturesToInlineRegistration.decorate(function(a){Element.show("muting_indicator");new Ajax.Request(b,{asynchronous:!0,evalScripts:!0,method:"post"});Event.stop(a);return!1}.bind(this)));this._mute_node.observe("click",this._mute_observer)}},updateProfileLink:function(a){var b=this._chat_window,c=this;this._profile_node.stopObserving("click",this._profile_observer);this._profile_observer=function(d){c.hide();b.showProfile(a.username);Event.stop(d);return!1};this._profile_node.observe("click",this._profile_observer)},
  357. beginHide:function(){var a=this;this._hideTimer&&clearTimeout(this._hideTimer);this._hideTimer=setTimeout(function(){a.hide()},500)},stopHide:function(){clearTimeout(this._hideTimer)},hide:function(){this._rollover_template_node.hide()}};
  358. var GameBelowFold={setup:function(){$j("#highscoresholder").on("change","#stat_selector",function(a){a.preventDefault();a=$j(this).val();GameBelowFold.updateScores(a,1,"today_page")});$j("#highscoresholder").on("click",".js-high-scores-paginate",function(a){a.preventDefault();var b=$j(this);a=b.data("statistic-id");var c=b.data("page"),b=b.data("page-param");GameBelowFold.updateScores(a,c,b)})},updateScores:function(a,b,c){a={game_id:active_user.gameId(),statistic_id:a,page_param:c};a[c]=b;$j.get("/high_scores/game_below_fold",
  359. a,function(a){$j("#highscoresholder").html(a);tabset()})}};function Bumper(a){this.initialize(a)}Bumper.HTML_TEMPLATE=new Template('<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><title>Kongregate</title><style type="text/css">img{border-style:none;}html,body,div{padding:0;margin:0;border:none;overflow:hidden;background-color:#000}</style></head><body>#{body}</body></html>');Bumper.IFRAME_TEMPLATE=new Template("<iframe id='bumper_iframe' name='bumper_iframe' style='overflow:hidden;position:relative;top:0px;left:0px;padding:0;margin:0;border:none;width:#{width}px;;height:#{height}px;background-color:#000' scrolling='no' border='0' frameborder='0' #{extra}></iframe>");
  360. Bumper.CLOSE_LINK_PADDING=20;Bumper.MILLISECONDS_UNTIL_CLOSE_LINK_APPEARS=1E4;Bumper.MILLISECONDS_UNTIL_FORCE_CLOSE=121E3;
  361. Bumper.prototype=function(){return{initialize:function(a){this._closed=this._content_rendered=this._response_received=this._timed_out=!1;this._options={};this._interval=null;this._shown=!1;this._response=null;this._ready=!1;this._startTime=(new Date).getTime();this._embed_called=!1;this._onCloseAdHandler=new HandlerQueue;this._content_div_names=a.content_divs;this._content_divs={};this._category=a.category;this._game_id=a.game_id;this._referring_url=a.referring_url;this._enabled=kong_ads&&a.enabled;
  362. this._game_title=a.title||"unknown";this._track_events=!!a.track_events;this._events=[];this._events_interval=null;this._liverail_config=a.liverail;this._ova_debug_level=a.ova_debug_level||"none";this.trackTimedEvent("BumperInitialized");this._post_message_handler=a.post_message_handler},addOnCloseCallback:function(a){this._onCloseAdHandler.add(a)},addPayloadHandler:function(a){this._post_message_handler.addCallback(a)},displayAreaDimensions:function(){return this._display_area_dimensions},isReady:function(){return this._ready},
  363. isEnabled:function(){return this._enabled},getContentDiv:function(a){var b=this._content_divs[a];if(!b)if(b=$(this._content_div_names[a]))this._content_divs[a]=b;else return null;return b},setReady:function(){this.isReady()||(this.trackTimedEvent("BumperReady"),this._ready=!0,this.isEnabled()?(this.initAdTimeouts(),this._response&&this.embedAd(this._response)):this.showContent())},setResponse:function(a){this._response||this.trackTimedEvent("BumperResponse");this._response=a},requestAd:function(){kong_ads&&
  364. (this.trackTimedEvent("BumperRequested"),kong_ads.displayAd("kong_bumper_preroll_600x400"))},getOption:function(a){return this._options[a]},isTimedOut:function(){return this._timed_out},wasShown:function(){return this._shown},initAdTimeouts:function(){setTimeout(this.adResponseTimeout.bind(this),6E3)},embedAd:function(a,b){if(!this._closed&&($("kong_bumper_preroll_600x400-ad-slot")&&$("kong_bumper_preroll_600x400-ad-slot").hide(),swfobject.hasFlashPlayerVersion("9")&&(this.setResponse(a),this.isReady()&&
  365. !this._embed_called&&(this._embed_called=!0,!this.isTimedOut()))))try{this._response_received=!0,b?(this.prepareAdLocation(a,0,0),b()):this.validateAdResponse(a)?this.oldShowAd(a):(this.showContent(),this.closeAd())}catch(c){this.closeAd()}},validateAdResponse:function(a){var b;if(a.type||a.url)if(a.type=a.type||"bumper","bumper"==a.type||"superbumper"==a.type){b=a.content_type=a.content_type;if("swf"==b||"VAST"==b||"iframe"==b||"html"==b||"liverail"==b||"intergi"==b)return!0;try{console.error("Unable to validate ad response: %o",
  366. a)}catch(c){}}return!1},prepareAdLocation:function(a,b,c){a=this.getContentDiv(a.type);var d=a.getDimensions();this._display_area_dimensions={x:b,y:c,width:d.width,height:d.height};this.insertAdDivs(a,b,c,d.width,d.height);this.showUncoveredContent();this.hideContent()},oldShowAd:function(a){var b,c,d,e;this._options=a;var f=this.getOption("content_type");b=a.content_type;c=this.getContentDiv(a.type);d=a.width;e=a.height;c=c.getDimensions();var m=c.width,l=c.height;["swf","iframe","html"].include(b)?
  367. (b=d,c=e,d=(m-d)/2,e=(l-e+Bumper.CLOSE_LINK_PADDING)/2):(b=m,c=l,e=d=0);this._type=a.type;this._width=b;this._height=c;this._x=d;this._y=e;a.countdown=!!a.countdown;a.upsell=a.upsell||void 0==a.upsell;this.prepareAdLocation(a,d,e);this._options.upsell&&(a=$("bumper_premium_header").getDimensions().height,this._height-=a);switch(f){case "swf":this.showBumperFlashAd();break;case "iframe":this.showIframeAd();break;case "liverail":this.showLiveRailAd();break;case "intergi":this.showIntergiAd();break;
  368. case "html":this.showHtmlAd();break;case "VAST":this.showVastAd();break;default:try{console.error("No candidate found to display ad of type %o",f)}catch(u){}}},showVastAd:function(){jwplayer("bumper_content").setup({flashplayer:"/flash/jw_player_licensed.swf",playlist:"none",width:this._width,height:this._height-Bumper.CLOSE_LINK_PADDING,controlbar:"none",autoStart:!0,plugins:{"/flash/ova-jw.swf":{delayAdRequestUntilPlay:!1,canFireEventAPICalls:!0,debug:{levels:this._ova_debug_level},ads:{schedule:[{position:"pre-roll",
  369. notice:{show:!1},tag:this._options.url}]}}}});this._options.url.match(/ima3vpaid/)?this.insertNoCloseMessageText():this.insertCountdownText()},insertNoCloseMessageText:function(){$("bumper_label").innerHTML='<p class="ad_skip_outer"><span class="ad_skip_left_arrow"></span><span class="ad_skip_inner">Your game will start after this message</span><span class="ad_skip_right_arrow"></span></p>';$("bumper_label").show();var a=this;setTimeout(function(){a.closeAd()},Bumper.MILLISECONDS_UNTIL_FORCE_CLOSE)},
  370. showBumperFlashAd:function(){var a=this.getOption("url"),b="never";if(a.match(/TelemetryAdPlayer\.swf/)||a.match(/http:\/\/cdn\d\.kong[a-z]*\.com\/assets\/files/))b="always";swfobject.embedSWF(a,"bumper_content",this._width,this._height,"6",!1,{},{allownetworking:"all",allowscriptaccess:b,wmode:"opaque"},{});this.insertCountdownText()},showIframeAd:function(){$("bumper_content").innerHTML=Bumper.IFRAME_TEMPLATE.evaluate({width:this._width,height:this._height,extra:"src='"+this.getOption("url")+"'"});
  371. this.insertCountdownText()},showLiveRailAd:function(){var a=this._liverail_config,b=a.flashvars,c=this.getOption("lr_verticals"),d=!0;c&&(b.lr_verticals=c,"20_secs_close"==c&&(d=!1));swfobject.embedSWF(a.liverail_component_path,"bumper_content",this._width,this._height-Bumper.CLOSE_LINK_PADDING,"9",null,b,{allowscriptaccess:"always",allownetworking:"all",wmode:"transparent"});d&&this.insertCountdownText()},showIntergiAd:function(){var a=Math.floor(1E8*Math.random()),b=(new Date).getTime();this._options.url=
  372. "http://ads.intergi.com/adrawdata/3.0/5205/2305295/0/2898/ADTECH;referring_url="+this._referring_url+";number="+a+";time="+b;this.showVastAd()},showHtmlAd:function(){$("bumper_content").update(Bumper.IFRAME_TEMPLATE.evaluate({width:this._width,eight:this._height,extra:""}));var a=Bumper.HTML_TEMPLATE.evaluate({body:unescape(this.getOption("html"))});this.insertCountdownText();setTimeout(function(){var b=$("bumper_iframe"),c=window.frames.bumper_iframe.document;null===c&&(b.contentDocument?c=b.contentDocument:
  373. b.contentWindow&&(c=b.contentWindow.document));c.open();c.write(a);window.opera&&c.close()}.bind(this),0)},insertCountdownText:function(){var a=this._options;this._closed||(a.countdown&&active_user.shouldSeeBumperCloseLink()?($("bumper_label").innerHTML='<p class="ad_skip_outer"><span class="ad_skip_left_arrow"></span><span class="ad_skip_inner"><span id="bumper_label_countdown"></span><a id="bumper_close_link" href="javascript:bumper.closeAd();" style="display:none;">Skip this ad</a></span><span class="ad_skip_right_arrow"></span></p>',
  374. this.updateAdDurationText(a.duration)):$("bumper_label").innerHTML='<p class="ad_skip_outer"><span class="ad_skip_left_arrow"></span><span class="ad_skip_inner">Your game will start after this message <a id="bumper_close_link" style="display:none;" href="javascript:bumper.closeAd();">&#40;close&#41;</a></span><span class="ad_skip_right_arrow"></span></p>',setTimeout(function(){this._end_time=(new Date).getTime()+a.duration;this._time_for_close_link=(new Date).getTime()+Bumper.MILLISECONDS_UNTIL_CLOSE_LINK_APPEARS;
  375. this._interval=setInterval(this.checkAdDuration.bind(this),250);this.updateAdDurationText(Bumper.MILLISECONDS_UNTIL_CLOSE_LINK_APPEARS)}.bind(this),500),$("bumper_label")&&$("bumper_label").appear({duration:1}),active_user.shouldSeeBumperCloseLink()&&setTimeout(function(){clearInterval(this._interval);$("bumper_label_countdown")&&$("bumper_label_countdown").remove();$("bumper_close_link")&&$("bumper_close_link").appear({duration:1})},Bumper.MILLISECONDS_UNTIL_CLOSE_LINK_APPEARS))},closeAd:function(){this._closed||
  376. (setTimeout(this.removeAd.bind(this),0),this._closed=!0,this.showContent(),clearInterval(this._interval),this._onCloseAdHandler.handle())},removeAd:function(){$("bumper_content")&&$("bumper_content").remove();$("bumper_holder")&&($("bumper_holder").remove(),navigator.userAgent.toLowerCase().match(/safari/)&&(window.scrollBy(0,1),window.scrollBy(0,-1)))},checkAdDuration:function(){var a=this._end_time-(new Date).getTime();timeToCloseLink=this._time_for_close_link-(new Date).getTime();0<a?this.updateAdDurationText(timeToCloseLink):
  377. this.closeAd()},updateAdDurationText:function(a){$("bumper_label_countdown")&&!this._closed&&(a=Math.round(a/1E3),$("bumper_label_countdown").innerHTML="Your game will start after this message ("+a+" seconds)")},showContent:function(){var a=this;this.renderContent();$H(this._content_div_names).keys().each(function(b){if((b=a.getContentDiv(b))&&"undefined"!==typeof lightbox)lightbox.prototype._activated?lightbox.prototype._dom_elements_actually_hidden.push(b):b.hiddenByLightbox||(b.style.visibility=
  378. "visible")})},hideContent:function(){for(var a in this._content_div_names)if(a==this._type||"superbumper"==this._type){var b=this.getContentDiv(a);b&&(b.style.visibility="hidden")}},adResponseTimeout:function(){this._response_received||(this._timed_out=!0,this.trackTimedEvent("BumperTimeout"),this.closeAd())},showUncoveredContent:function(){if("superbumper"!=this._type){var a=this;$H(this._content_div_names).keys().each(function(b){var c=a.getContentDiv(b);c&&(b!=a._type&&c.hiddenByLightbox)&&(c.style.visibility=
  379. "visible")})}},renderContent:function(){this._content_rendered||(this._content_rendered=!0,activateGame())},insertAdDivs:function(a,b,c,d,e){b=(new Element("div",{id:"bumper_holder"})).setStyle({position:"absolute",width:d+"px",height:e+"px",visibility:"visible",backgroundColor:"#000",overflow:"hidden",top:"0px",left:"0px"});c=(new Element("div",{id:"bumper"})).setStyle({top:c+"px",left:"0px",position:"relative"});d=new Element("div",{id:"bumper_content"});e=(new Element("div",{id:"bumper_label"})).setStyle({display:"none"});
  380. if(this._options.upsell){var f=(new Element("div",{id:"bumper_premium_header"})).update($("ad_premium_header_template").innerHTML);b.insert(f)}c.insert(d);b.insert(c).insert(e);a.insert(b)},showAllContent:function(){this.renderContent();var a=$("game");$("flashframecontent").style.visibility="visible";a.hiddenByLightbox||(a.style.visibility="visible");this.closeAd()},attemptBumperEmbed:function(){try{kong_ads?this.setReady():this.showAllContent()}catch(a){this.showAllContent()}},trackTimedEvent:function(a){if(this._track_events)try{var b=
  381. "undefined"==typeof ls?this._startTime:ls,c=(new Date).getTime()-b;"undefined"!=typeof metricTracker?metricTracker.trackEvent("LoadTime",a,this._game_title,c):kong_ads&&(this._events.push([a,c]),this._events_interval||(this._events_interval=setInterval(this.submitEvents.bind(this),1E3)))}catch(d){}},submitEvents:function(){if("undefined"!=typeof metricTracker){clearInterval(this._events_interval);try{for(var a=0;a<this._events.length;a++){var b=this._events[a];metricTracker.trackEvent("LoadTime",
  382. b[0],this._game_title,b[1])}}catch(c){}this._events=[]}}}}();function embedAd(a){"string"==typeof a?bumper.embedAd(a.evalJSON()):"object"==typeof a?bumper.embedAd(a):bumper.embedAd({})}function onMediaEnd(){bumper.closeAd()}function bumperCloseWithJwPlayerCleanup(){setTimeout(function(){jwplayer("bumper_content").remove();bumper.closeAd()},500)}function onLinearAdFinish(a){bumperCloseWithJwPlayerCleanup()}function onVPAIDAdComplete(a){bumperCloseWithJwPlayerCleanup()}
  383. function onVPAIDAdError(){bumperCloseWithJwPlayerCleanup()}function onAdSchedulingComplete(a){0==a.length&&bumperCloseWithJwPlayerCleanup()}
  384. var CinematicMode={initialize:function(a){this._disallow_cinematic_scaling=a;this._cinematic_mode_active=this._hooked_up_cinematic_mode_link=!1;this._suppress_room_not_found=null;this._showingCinematicMessage=!1;this._cinematic_messages=[];this._game_standard_layout=null},hookUpCinematicQuicklink:function(){this._hooked_up_cinematic_mode_link||($("cinematic_mode_link").removeClassName("disabled"),$("cinematic_mode_link").observe("click",function(a){a.stop();CinematicMode.activateCinematicMode()}),
  385. this._hooked_up_cinematic_mode_link=!0)},isInCinematicMode:function(){return $("play").hasClassName("cinematic_mode")},addCinematicMessage:function(a){this.isInCinematicMode()&&($("cinematic_close_link").addClassName("alt"),this._cinematic_messages.push(a),this.showNextCinematicMessage())},showNextCinematicMessage:function(){if(!this._showingCinematicMessage&&0<this._cinematic_messages.length){this._showingCinematicMessage=!0;var a=CinematicMode._cinematic_messages.shift(),b=$("cinematic_close_container").getWidth(),
  386. c=($("game").getWidth()-20-b)/2;$("game").insert('<p id="overlay_message" class="cinematic_alert" style="left:'+c+"px;width:"+b+'px; opacity:0;"><span class="spritegame cinematic_alert_ico mrm"></span><span class="cinematic_alert_text">'+a+"</span></p>");$("overlay_message").fade({duration:2,from:0,to:1,afterFinish:function(){setTimeout(function(){$("overlay_message").fade({duration:2,from:1,to:0,afterFinish:function(){$("overlay_message")&&($("overlay_message").remove(),$("cinematic_close_link").removeClassName("alt"));
  387. CinematicMode._showingCinematicMessage=!1;CinematicMode.showNextCinematicMessage()}})},3E4)}})}},activateCinematicMode:function(){if(!this._cinematic_mode_active)if(active_user.isAuthenticated()){holodeck.recordAnalyticsEvent("CinematicMode","Enter");var a=$("play");a.addClassName("cinematic_mode");a.insert({top:(new Element("div")).addClassName("cinematic_overlay")});$("cinematic_close_link").show();document.viewport.getDimensions();$("game").getLayout();110<$("game").cumulativeOffset()[1]&&($("play").hasClassName("premium_user")?
  388. $("game").setStyle({top:"50px"}):$("game").setStyle({top:"130px"}));this._game_standard_layout=($("game_wrapper")||$("gameholder")).getLayout();$("cinematic_close_container").setStyle({width:this._game_standard_layout.get("width")+"px"});Event.observe(document,"click",this.handleClickInCinematicMode);window.scrollTo(0,0);this.refreshCinematicLayout();Event.observe(window,"resize",this.refreshCinematicLayout);$$(".square_ad").each(function(a){a.hide()});this._cinematic_mode_active=!0}else active_user.activateInlineLogin({from_upsell:"cinematic_mode"},
  389. !0)},deactivateCinematicMode:function(){if(CinematicMode._cinematic_mode_active){holodeck.recordAnalyticsEvent("CinematicMode","Exit");this._cinematic_mode_active=!1;Event.stopObserving(window,"resize",this.refreshCinematicLayout);Event.stopObserving(document,"click",this.deactivateCinematicMode);if(!CinematicMode._disallow_cinematic_scaling){var a=this._game_standard_layout;$("gamediv").width=a.get("width");$("gamediv").height=a.get("height");$("game_wrapper").setStyle({width:a.get("width")+"px",
  390. height:a.get("height")+"px"});$("cinematic_close_container").setStyle({width:a.get("width")+"px"})}a=$("play");a.removeClassName("cinematic_mode");$("cinematic_close_link").hide();$$(".cinematic_overlay").each(Element.remove);$("play").removeClassName("cinematic_small");$$(".square_ad").each(function(a){a.show()});$("game").setStyle({left:"",top:"",width:this._game_standard_layout.get("width")+"px"})}CinematicMode._cinematic_messages=[];$("cinematic_close_link").removeClassName("alt");$("overlay_message")&&
  391. $("overlay_message").remove();a=$("play");a.removeClassName("cinematic_mode");$("cinematic_close_link").hide();$$(".cinematic_overlay").each(Element.remove);$$(".square_ad").each(function(a){a.show()})},handleClickInCinematicMode:function(a){if(!a.findElement("#gamediv")){var b=$("game_wrapper")||$("gameiframe"),c=b.getDimensions(),b=b.cumulativeOffset(),d=a.pointerX();a=a.pointerY();d>b.left-30&&d<b.left+c.width+30&&a>b.top-30&&a<b.top+c.height+30||CinematicMode.deactivateCinematicMode()}},refreshCinematicLayout:function(){if(!CinematicMode._disallow_cinematic_scaling){var a=
  392. $("play").hasClassName("premium_user")?80:50,b=CinematicMode._game_standard_layout,c=b.get("width")/b.get("height"),d=document.viewport.getWidth()-110,e=d/c;e+$("gamediv").viewportOffset().top+a>document.viewport.getHeight()&&(e=document.viewport.getHeight()-$("gamediv").viewportOffset().top-a,d=e*c);d<b.get("width")&&(d=b.get("width"),e=b.get("height"));$("gamediv").width=d.toFixed();$("gamediv").height=e.toFixed();$("game_wrapper").setStyle({width:d.toFixed()+"px",height:e.toFixed()+"px"});$("overlay_message")&&
  393. $("overlay_message").setStyle({width:d+60+"px"})}a=$("gamediv")||$("gameholder");b=a.getWidth()+60;$("cinematic_close_container").setStyle({width:b+"px"});$("game").setStyle({width:b+"px"});a=(document.viewport.getWidth()-a.getWidth()-60)/2;b=document.viewport.getDimensions().height;$("game").setStyle({left:Math.max(0,a)+"px"});b>$("game").getHeight()+129?$("play").hasClassName("cinematic_small")||$("play").addClassName("cinematic_small"):$("play").hasClassName("premium_user")&&b>$("game").getHeight()+
  394. 39?$("play").hasClassName("cinematic_small")||$("play").addClassName("cinematic_small"):$("play").hasClassName("cinematic_small")&&$("play").removeClassName("cinematic_small")}},GameIframe=function(a,b,c){this.config=a;this.urlOptions=b;this.channelId=c};
  395. GameIframe.prototype.createGameIframeElement=function(){var a=new Element("iframe",{id:"gameiframe",name:"gameiframe",style:"border:none;position:relative;z-index:1;",scrolling:"auto",border:0,frameborder:0,width:this.config.game_width,height:this.config.game_height,style:"margin-top: "+this.config.game_top+"px; left: "+this.config.game_left+"px;","class":this.config.iframe_class,allowfullscreen:"true"});$("gameiframe").replace(a);a.contentWindow.location.replace(this.getGameIframeUrl());this.config.post_message&&
  396. window.addEventListener("message",function(b){b.origin==this.config.game_host&&"kongregate_request_params"==b.data&&a.contentWindow.postMessage({type:"params",data:this.iframeOptions()},this.config.game_host)}.bind(this),!1);this.config.max_game_width&&this.config.max_game_height&&(function(){this.setSizeToMaxForWindow()}.bind(this).runWhenGameLoaded(),document.observe("holodeck:ready",function(a){this.setSizeToMaxForWindow()}.bind(this)),$j(window).resize(function(a){this.setSizeToMaxForWindow()}.bind(this)))};
  397. GameIframe.prototype.getGameIframeUrl=function(){var a=this.config.iframe_url;this.config.post_message||(a+=0>a.indexOf("?")?"?":"&",a+=Object.toQueryString(this.iframeOptions()));return a};
  398. GameIframe.prototype.iframeOptions=function(){var a={DO_NOT_SHARE_THIS_LINK:1,kongregate_username:active_user.username(),kongregate_user_id:active_user.id(),kongregate_game_auth_token:active_user.gameAuthToken(),kongregate_game_id:this.config.game_id,kongregate_host:this.config.host,kongregate_game_url:this.config.game_url,kongregate_api_host:this.config.api_host,kongregate_channel_id:this.config.channel_id,kongregate_api_path:this.config.api_path,kongregate_ansible_path:this.config.ansible_path,
  399. kongregate_preview:this.config.preview,kongregate_language:active_user.currentLocale().slice(0,2),preview:this.config.preview,kongregate_split_treatments:encodeURIComponent(active_user.gameSplitTreatments(this.config.game_permalink)),kongregate:!0,KEEP_THIS_DATA_PRIVATE:1},b=$H(location.search.toQueryParams()).merge(this.urlOptions.toQueryParams()).toObject(),c;for(c in b)if(0==c.indexOf("guest_access_key")||0==c.indexOf(this.config.flash_var_prefix))a[c]=b[c];return a};
  400. GameIframe.prototype.setSizeToMaxForWindow=function(){this.setSize(Math.max(this.config.game_width,Math.min($j(window).width()-333,this.config.max_game_width)),Math.max(this.config.game_height,Math.min($j(window).height()-150,this.config.max_game_height)))};
  401. GameIframe.prototype.setSize=function(a,b){for(var c=["flashframecontent","maingamecontent","maingame"],d=["gameholder","gameiframe"],e=$("maingame").getLayout(),f=$("gameiframe").getLayout(),m=e.get("width")-f.get("width"),e=e.get("height")-f.get("height"),m=a+m,l=b+e,e=0;e<d.length;e++)f=$(d[e]),f.style.width=a+"px",f.width=a,f.style.height=b+"px",f.height=b;for(e=0;e<c.length;e++)f=$(c[e]),f.style.width=m+"px",f.width=m,f.style.height=l+"px",f.height=l;if(c=$("chat_container"))c.style.height=l-
  402. 26+"px",c.height=l-26;$$(".chat_message_window").each(function(a){a.style.height=l-263+"px";a.style["max-height"]=l-263+"px";a.height=l-263});$$(".tabpane").each(function(a){a.style.height=l-66+"px";a.height=l-66})};
  403. var GameMetricsUpdater=function(){return{update:function(){new Ajax.Request(active_user.gameResourcePath()+"/metrics.json",{method:"get",onSuccess:function(a){a=a.responseJSON;[[".favorites_count",a.favorites_count_with_delimiter],[".gameplays_count",a.gameplays_count_with_delimiter],["#game_statistics",a.game_statistics],[".average_rating",a.average_rating_text],[".average_rating_with_count",a.average_rating_with_count],["#rating_message",a.rating_message],["#below_game_rating_message",a.below_game_rating_message],
  404. ["#star_ratings_block",a.user_rating],["#below_game_star_ratings_block",a.below_game_user_rating],["#quicklinks_star_ratings_block",a.quicklinks_user_rating],[".flag_game",a.flagged],["#favorite_game",a.favorite_message],["#below_game_favorite_game",a.below_game_favorite_message],["#quicklinks_favorite_block",a.quicklinks_favorite_message],["#quicklinks_play_later_block",a.quicklinks_play_later_message],["#below_game_play_later_block",a.below_game_play_later_message],["#user_donation_holder",a.last_tip_message],
  405. ["#combined_favorites_js",a.combined_favorites_js],["#game_block",a.block_game_js]].each(function(a){var c=a[0],d=a[1];d&&$$(c).each(function(a){a.update(d)})});holodeck._user_rating=a.user_rating_value},onFailure:function(a){console.error("Error loading game metrics: %o",a.responseText)}})}}}(),GamePage={minimalize:function(){active_user.getsMinimalGamepage()&&$j(".not_minimal").remove()}};
  406. if("undefined"==typeof jwplayer){var jwplayer=function(a){if(jwplayer.api)return jwplayer.api.selectPlayer(a)},$jw=jwplayer;jwplayer.version="5.10.2295 (Licensed version)";jwplayer.vid=document.createElement("video");jwplayer.audio=document.createElement("audio");jwplayer.source=document.createElement("source");(function(a){a.utils=function(){};a.utils.typeOf=function(a){var c=typeof a;"object"===c&&(a?a instanceof Array&&(c="array"):c="null");return c};a.utils.extend=function(){var b=a.utils.extend.arguments;
  407. if(1<b.length){for(var c=1;c<b.length;c++)for(var d in b[c])b[0][d]=b[c][d];return b[0]}return null};a.utils.clone=function(b){var c;b=a.utils.clone.arguments;if(1==b.length)switch(a.utils.typeOf(b[0])){case "object":c={};for(var d in b[0])c[d]=a.utils.clone(b[0][d]);break;case "array":c=[];for(d in b[0])c[d]=a.utils.clone(b[0][d]);break;default:return b[0]}return c};a.utils.extension=function(a){if(!a)return"";a=a.substring(a.lastIndexOf("/")+1,a.length);a=a.split("?")[0];if(-1<a.lastIndexOf("."))return a.substr(a.lastIndexOf(".")+
  408. 1,a.length).toLowerCase()};a.utils.html=function(a,c){a.innerHTML=c};a.utils.wrap=function(a,c){a.parentNode&&a.parentNode.replaceChild(c,a);c.appendChild(a)};a.utils.ajax=function(b,c,d){var e;e=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");e.onreadystatechange=function(){if(4===e.readyState)if(200===e.status){if(c){if(!a.utils.exists(e.responseXML))try{if(window.DOMParser){var f=(new DOMParser).parseFromString(e.responseText,"text/xml");f&&(e=a.utils.extend({},
  409. e,{responseXML:f}))}else f=new ActiveXObject("Microsoft.XMLDOM"),f.async="false",f.loadXML(e.responseText),e=a.utils.extend({},e,{responseXML:f})}catch(l){d&&d(b)}c(e)}}else d&&d(b)};try{e.open("GET",b,!0),e.send(null)}catch(f){d&&d(b)}return e};a.utils.load=function(a,c,d){a.onreadystatechange=function(){4===a.readyState&&(200===a.status?c&&c():d&&d())}};a.utils.find=function(a,c){return a.getElementsByTagName(c)};a.utils.append=function(a,c){a.appendChild(c)};a.utils.isIE=function(){return!+"\v1"||
  410. "undefined"!=typeof window.ActiveXObject};a.utils.userAgentMatch=function(a){return null!==navigator.userAgent.toLowerCase().match(a)};a.utils.isIOS=function(){return a.utils.userAgentMatch(/iP(hone|ad|od)/i)};a.utils.isIPad=function(){return a.utils.userAgentMatch(/iPad/i)};a.utils.isIPod=function(){return a.utils.userAgentMatch(/iP(hone|od)/i)};a.utils.isAndroid=function(){return a.utils.userAgentMatch(/android/i)};a.utils.isLegacyAndroid=function(){return a.utils.userAgentMatch(/android 2.[012]/i)};
  411. a.utils.isBlackberry=function(){return a.utils.userAgentMatch(/blackberry/i)};a.utils.isMobile=function(){return a.utils.userAgentMatch(/(iP(hone|ad|od))|android/i)};a.utils.getFirstPlaylistItemFromConfig=function(a){var c={};a=a.playlist&&a.playlist.length?a.playlist[0]:a;c.file=a.file;c.levels=a.levels;c.streamer=a.streamer;c.playlistfile=a.playlistfile;c.provider=a.provider;if(!c.provider){if(c.file&&(-1<c.file.toLowerCase().indexOf("youtube.com")||-1<c.file.toLowerCase().indexOf("youtu.be")))c.provider=
  412. "youtube";c.streamer&&0==c.streamer.toLowerCase().indexOf("rtmp://")&&(c.provider="rtmp");a.type&&(c.provider=a.type.toLowerCase())}"audio"==c.provider&&(c.provider="sound");return c};a.utils.getOuterHTML=function(a){if(a.outerHTML)return a.outerHTML;try{return(new XMLSerializer).serializeToString(a)}catch(c){return""}};a.utils.setOuterHTML=function(a,c){if(a.outerHTML)a.outerHTML=c;else{var d=document.createElement("div");d.innerHTML=c;var e=document.createRange();e.selectNodeContents(d);d=e.extractContents();
  413. a.parentNode.insertBefore(d,a);a.parentNode.removeChild(a)}};a.utils.hasFlash=function(){if("undefined"!=typeof navigator.plugins&&"undefined"!=typeof navigator.plugins["Shockwave Flash"])return!0;if("undefined"!=typeof window.ActiveXObject)try{return new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),!0}catch(a){}return!1};a.utils.getPluginName=function(a){0<=a.lastIndexOf("/")&&(a=a.substring(a.lastIndexOf("/")+1,a.length));0<=a.lastIndexOf("-")&&(a=a.substring(0,a.lastIndexOf("-")));0<=a.lastIndexOf(".swf")&&
  414. (a=a.substring(0,a.lastIndexOf(".swf")));0<=a.lastIndexOf(".js")&&(a=a.substring(0,a.lastIndexOf(".js")));return a};a.utils.getPluginVersion=function(a){return 0<=a.lastIndexOf("-")?0<=a.lastIndexOf(".js")?a.substring(a.lastIndexOf("-")+1,a.lastIndexOf(".js")):0<=a.lastIndexOf(".swf")?a.substring(a.lastIndexOf("-")+1,a.lastIndexOf(".swf")):a.substring(a.lastIndexOf("-")+1):""};a.utils.getAbsolutePath=function(b,c){a.utils.exists(c)||(c=document.location.href);if(a.utils.exists(b)){var d;if(a.utils.exists(b)){d=
  415. b.indexOf("://");var e=b.indexOf("?");d=0<d&&(0>e||e>d)}else d=void 0;if(d)return b;d=c.substring(0,c.indexOf("://")+3);var e=c.substring(d.length,c.indexOf("/",d.length+1)),f;0===b.indexOf("/")?f=b.split("/"):(f=c.split("?")[0],f=f.substring(d.length+e.length+1,f.lastIndexOf("/")),f=f.split("/").concat(b.split("/")));for(var m=[],l=0;l<f.length;l++)f[l]&&(a.utils.exists(f[l])&&"."!=f[l])&&(".."==f[l]?m.pop():m.push(f[l]));return d+e+"/"+m.join("/")}};a.utils.pluginPathType={ABSOLUTE:"ABSOLUTE",RELATIVE:"RELATIVE",
  416. CDN:"CDN"};a.utils.getPluginPathType=function(b){if("string"==typeof b){b=b.split("?")[0];var c=b.indexOf("://");if(0<c)return a.utils.pluginPathType.ABSOLUTE;var d=b.indexOf("/");b=a.utils.extension(b);return 0>c&&0>d&&(!b||!isNaN(b))?a.utils.pluginPathType.CDN:a.utils.pluginPathType.RELATIVE}};a.utils.mapEmpty=function(a){for(var c in a)return!1;return!0};a.utils.mapLength=function(a){var c=0,d;for(d in a)c++;return c};a.utils.log=function(a,c){"undefined"!=typeof console&&"undefined"!=typeof console.log&&
  417. (c?console.log(a,c):console.log(a))};a.utils.css=function(b,c,d){if(a.utils.exists(b))for(var e in c)try{if("undefined"!==typeof c[e]){if("number"==typeof c[e]&&!("zIndex"==e||"opacity"==e)){if(isNaN(c[e]))continue;e.match(/color/i)?c[e]="#"+a.utils.strings.pad(c[e].toString(16),6):c[e]=Math.ceil(c[e])+"px"}b.style[e]=c[e]}}catch(f){}};a.utils.isYouTube=function(a){return-1<a.indexOf("youtube.com")||-1<a.indexOf("youtu.be")};a.utils.transform=function(b,c,d,e,f){a.utils.exists(c)||(c=1);a.utils.exists(d)||
  418. (d=1);a.utils.exists(e)||(e=0);a.utils.exists(f)||(f=0);1==c&&1==d&&0==e&&0==f?(b.style.webkitTransform="",b.style.MozTransform="",b.style.OTransform=""):(c="scale("+c+","+d+") translate("+e+"px,"+f+"px)",b.style.webkitTransform=c,b.style.MozTransform=c,b.style.OTransform=c)};a.utils.stretch=function(b,c,d,e,f,m){if(!("undefined"==typeof d||"undefined"==typeof e||"undefined"==typeof f||"undefined"==typeof m)){var l=d/f,u=e/m,h=!1,g={};c.parentElement&&(c.parentElement.style.overflow="hidden");a.utils.transform(c);
  419. switch(b.toUpperCase()){case a.utils.stretching.NONE:g.width=f;g.height=m;g.top=(e-g.height)/2;g.left=(d-g.width)/2;break;case a.utils.stretching.UNIFORM:l>u?(g.width=f*u,g.height=m*u,0.95<g.width/d&&(h=!0,l=Math.ceil(100*d/g.width)/100,u=1,g.width=d)):(g.width=f*l,g.height=m*l,0.95<g.height/e&&(h=!0,l=1,u=Math.ceil(100*e/g.height)/100,g.height=e));g.top=(e-g.height)/2;g.left=(d-g.width)/2;break;case a.utils.stretching.FILL:l>u?(g.width=f*l,g.height=m*l):(g.width=f*u,g.height=m*u);g.top=(e-g.height)/
  420. 2;g.left=(d-g.width)/2;break;case a.utils.stretching.EXACTFIT:g.width=f;g.height=m;var p=Math.round(f/2*(1-1/l)),w=Math.round(m/2*(1-1/u)),h=!0;g.top=g.left=0}h&&a.utils.transform(c,l,u,p,w);a.utils.css(c,g)}};a.utils.stretching={NONE:"NONE",FILL:"FILL",UNIFORM:"UNIFORM",EXACTFIT:"EXACTFIT"};a.utils.deepReplaceKeyName=function(b,c,d){switch(a.utils.typeOf(b)){case "array":for(var e=0;e<b.length;e++)b[e]=a.utils.deepReplaceKeyName(b[e],c,d);break;case "object":for(var f in b){var m;if(c instanceof
  421. Array&&d instanceof Array)if(c.length!=d.length)continue;else m=c;else m=[c];for(var l=f,e=0;e<m.length;e++)l=l.replace(RegExp(c[e],"g"),d[e]);b[l]=a.utils.deepReplaceKeyName(b[f],c,d);f!=l&&delete b[f]}}return b};a.utils.isInArray=function(a,c){if(!a||!(a instanceof Array))return!1;for(var d=0;d<a.length;d++)if(c===a[d])return!0;return!1};a.utils.exists=function(a){switch(typeof a){case "string":return 0<a.length;case "object":return null!==a;case "undefined":return!1}return!0};a.utils.empty=function(a){if("function"==
  422. typeof a.hasChildNodes)for(;a.hasChildNodes();)a.removeChild(a.firstChild)};a.utils.parseDimension=function(a){if("string"==typeof a){if(""===a)return 0;if(!(-1<a.lastIndexOf("%")))return parseInt(a.replace("px",""),10)}return a};a.utils.getDimensions=function(b){return b&&b.style?{x:a.utils.parseDimension(b.style.left),y:a.utils.parseDimension(b.style.top),width:a.utils.parseDimension(b.style.width),height:a.utils.parseDimension(b.style.height)}:{}};a.utils.getElementWidth=function(b){return b?b==
  423. document.body?a.utils.parentNode(b).clientWidth:0<b.clientWidth?b.clientWidth:b.style?a.utils.parseDimension(b.style.width):null:null};a.utils.getElementHeight=function(b){return b?b==document.body?a.utils.parentNode(b).clientHeight:0<b.clientHeight?b.clientHeight:b.style?a.utils.parseDimension(b.style.height):null:null};a.utils.timeFormat=function(a){str="00:00";0<a&&(str=10>Math.floor(a/60)?"0"+Math.floor(a/60)+":":Math.floor(a/60)+":",str+=10>Math.floor(a%60)?"0"+Math.floor(a%60):Math.floor(a%
  424. 60));return str};a.utils.useNativeFullscreen=function(){return navigator&&navigator.vendor&&0==navigator.vendor.indexOf("Apple")};a.utils.parentNode=function(a){return a?a.parentNode?a.parentNode:a.parentElement?a.parentElement:a:document.body};a.utils.getBoundingClientRect=function(a){return"function"==typeof a.getBoundingClientRect?a.getBoundingClientRect():{left:a.offsetLeft+document.body.scrollLeft,top:a.offsetTop+document.body.scrollTop,width:a.offsetWidth,height:a.offsetHeight}};a.utils.translateEventResponse=
  425. function(b,c){var d=a.utils.extend({},c);b==a.api.events.JWPLAYER_FULLSCREEN&&!d.fullscreen?(d.fullscreen="true"==d.message?!0:!1,delete d.message):"object"==typeof d.data?(d=a.utils.extend(d,d.data),delete d.data):"object"==typeof d.metadata&&a.utils.deepReplaceKeyName(d.metadata,["__dot__","__spc__","__dsh__"],["."," ","-"]);var e=["position","duration","offset"],f;for(f in e)d[e[f]]&&(d[e[f]]=Math.round(1E3*d[e[f]])/1E3);return d};a.utils.saveCookie=function(a,c){document.cookie="jwplayer."+a+
  426. "="+c+"; path=/"};a.utils.getCookies=function(){for(var a={},c=document.cookie.split("; "),d=0;d<c.length;d++){var e=c[d].split("=");0==e[0].indexOf("jwplayer.")&&(a[e[0].substring(9,e[0].length)]=e[1])}return a};a.utils.readCookie=function(b){return a.utils.getCookies()[b]}})(jwplayer);(function(a){a.events=function(){};a.events.COMPLETE="COMPLETE";a.events.ERROR="ERROR"})(jwplayer);(function(a){a.events.eventdispatcher=function(b){var c,d;this.resetEventListeners=function(){c={};d=[]};this.resetEventListeners();
  427. this.addEventListener=function(b,d,m){try{a.utils.exists(c[b])||(c[b]=[]),"string"==typeof d&&eval("listener = "+d),c[b].push({listener:d,count:m})}catch(l){a.utils.log("error",l)}return!1};this.removeEventListener=function(b,d){if(c[b]){try{for(var m=0;m<c[b].length;m++)if(c[b][m].listener.toString()==d.toString()){c[b].splice(m,1);break}}catch(l){a.utils.log("error",l)}return!1}};this.addGlobalListener=function(b,c){try{"string"==typeof b&&eval("listener = "+b),d.push({listener:b,count:c})}catch(m){a.utils.log("error",
  428. m)}return!1};this.removeGlobalListener=function(b){if(b){try{for(var c=0;c<d.length;c++)if(d[c].listener.toString()==b.toString()){d.splice(c,1);break}}catch(m){a.utils.log("error",m)}return!1}};this.sendEvent=function(e,f){a.utils.exists(f)||(f={});b&&a.utils.log(e,f);if("undefined"!=typeof c[e])for(var m=0;m<c[e].length;m++){try{c[e][m].listener(f)}catch(l){a.utils.log("There was an error while handling a listener: "+l.toString(),c[e][m].listener)}c[e][m]&&(1===c[e][m].count?delete c[e][m]:0<c[e][m].count&&
  429. (c[e][m].count-=1))}for(m=0;m<d.length;m++){try{d[m].listener(f)}catch(u){a.utils.log("There was an error while handling a listener: "+u.toString(),d[m].listener)}d[m]&&(1===d[m].count?delete d[m]:0<d[m].count&&(d[m].count-=1))}}}})(jwplayer);(function(a){var b={};a.utils.animations=function(){};a.utils.animations.transform=function(a,b){a.style.webkitTransform=b;a.style.MozTransform=b;a.style.OTransform=b;a.style.msTransform=b};a.utils.animations.transformOrigin=function(a,b){a.style.webkitTransformOrigin=
  430. b;a.style.MozTransformOrigin=b;a.style.OTransformOrigin=b;a.style.msTransformOrigin=b};a.utils.animations.rotate=function(b,d){a.utils.animations.transform(b,["rotate(",d,"deg)"].join(""))};a.utils.cancelAnimation=function(a){delete b[a.id]};a.utils.fadeTo=function(c,d,e,f,m,l){if(!(b[c.id]!=l&&a.utils.exists(l))&&c.style.opacity!=d){var u=(new Date).getTime();l>u&&setTimeout(function(){a.utils.fadeTo(c,d,e,f,0,l)},l-u);"none"==c.style.display&&(c.style.display="block");a.utils.exists(f)||(f=""===
  431. c.style.opacity?1:c.style.opacity);c.style.opacity==d&&""!==c.style.opacity&&a.utils.exists(l)?0===d&&(c.style.display="none"):(a.utils.exists(l)||(l=u,b[c.id]=l),a.utils.exists(m)||(m=0),u=0<e?(u-l)/(1E3*e):0,u=f+(1<u?1:u)*(d-f),1<u?u=1:0>u&&(u=0),c.style.opacity=u,0<m?(b[c.id]=l+1E3*m,a.utils.fadeTo(c,d,e,f,0,b[c.id])):setTimeout(function(){a.utils.fadeTo(c,d,e,f,0,l)},10))}}})(jwplayer);(function(a){a.utils.arrays=function(){};a.utils.arrays.indexOf=function(a,c){for(var d=0;d<a.length;d++)if(a[d]==
  432. c)return d;return-1};a.utils.arrays.remove=function(b,c){var d=a.utils.arrays.indexOf(b,c);-1<d&&b.splice(d,1)}})(jwplayer);(function(a){a.utils.extensionmap={"3gp":{html5:"video/3gpp",flash:"video"},"3gpp":{html5:"video/3gpp"},"3g2":{html5:"video/3gpp2",flash:"video"},"3gpp2":{html5:"video/3gpp2"},flv:{flash:"video"},f4a:{html5:"audio/mp4"},f4b:{html5:"audio/mp4",flash:"video"},f4v:{html5:"video/mp4",flash:"video"},mov:{html5:"video/quicktime",flash:"video"},m4a:{html5:"audio/mp4",flash:"video"},
  433. m4b:{html5:"audio/mp4"},m4p:{html5:"audio/mp4"},m4v:{html5:"video/mp4",flash:"video"},mp4:{html5:"video/mp4",flash:"video"},rbs:{flash:"sound"},aac:{html5:"audio/aac",flash:"video"},mp3:{html5:"audio/mp3",flash:"sound"},ogg:{html5:"audio/ogg"},oga:{html5:"audio/ogg"},ogv:{html5:"video/ogg"},webm:{html5:"video/webm"},m3u8:{html5:"audio/x-mpegurl"},gif:{flash:"image"},jpeg:{flash:"image"},jpg:{flash:"image"},swf:{flash:"image"},png:{flash:"image"},wav:{html5:"audio/x-wav"}}})(jwplayer);(function(a){function b(b,
  434. c){a.utils.exists(c)?a.utils.extend(c,f[b]):c=f[b];return c}function c(c,d){if(m[c.tagName.toLowerCase()]&&!a.utils.exists(d))return m[c.tagName.toLowerCase()](c);d=b("element",d);var e={},f;for(f in d)if("length"!=f){var p=c.getAttribute(f);a.utils.exists(p)&&(e[d[f]]=p)}if((f=c.style["#background-color"])&&!("transparent"==f||"rgba(0, 0, 0, 0)"==f))e.screencolor=f;return e}function d(d,f){f=b("media",f);var h=[],g=a.utils.selectors("source",d),p;for(p in g)isNaN(p)||h.push(e(g[p]));g=c(d,f);a.utils.exists(g.file)&&
  435. (h[0]={file:g.file});g.levels=h;return g}function e(a,d){d=b("source",d);var e=c(a,d);e.width=e.width?e.width:0;e.bitrate=e.bitrate?e.bitrate:0;return e}a.utils.mediaparser=function(){};var f={element:{width:"width",height:"height",id:"id","class":"className",name:"name"},media:{src:"file",preload:"preload",autoplay:"autostart",loop:"repeat",controls:"controls"},source:{src:"file",type:"type",media:"media","data-jw-width":"width","data-jw-bitrate":"bitrate"},video:{poster:"image"}},m={};a.utils.mediaparser.parseMedia=
  436. function(a){return c(a)};m.media=d;m.audio=d;m.source=e;m.video=function(a,c){c=b("video",c);return d(a,c)}})(jwplayer);(function(a){a.utils.loaderstatus={NEW:"NEW",LOADING:"LOADING",ERROR:"ERROR",COMPLETE:"COMPLETE"};a.utils.scriptloader=function(b){var c=a.utils.loaderstatus.NEW,d=new a.events.eventdispatcher;a.utils.extend(this,d);this.load=function(){if(c==a.utils.loaderstatus.NEW){c=a.utils.loaderstatus.LOADING;var e=document.createElement("script");e.onload=function(b){c=a.utils.loaderstatus.COMPLETE;
  437. d.sendEvent(a.events.COMPLETE)};e.onerror=function(b){c=a.utils.loaderstatus.ERROR;d.sendEvent(a.events.ERROR)};e.onreadystatechange=function(){if("loaded"==e.readyState||"complete"==e.readyState)c=a.utils.loaderstatus.COMPLETE,d.sendEvent(a.events.COMPLETE)};document.getElementsByTagName("head")[0].appendChild(e);e.src=b}};this.getStatus=function(){return c}}})(jwplayer);(function(a){a.utils.selectors=function(b,c){a.utils.exists(c)||(c=document);b=a.utils.strings.trim(b);var d=b.charAt(0);return"#"==
  438. d?c.getElementById(b.substr(1)):"."==d?c.getElementsByClassName?c.getElementsByClassName(b.substr(1)):a.utils.selectors.getElementsByTagAndClass("*",b.substr(1)):0<b.indexOf(".")?(d=b.split("."),a.utils.selectors.getElementsByTagAndClass(d[0],d[1])):c.getElementsByTagName(b)};a.utils.selectors.getElementsByTagAndClass=function(b,c,d){var e=[];a.utils.exists(d)||(d=document);b=d.getElementsByTagName(b);for(d=0;d<b.length;d++)if(a.utils.exists(b[d].className))for(var f=b[d].className.split(" "),m=0;m<
  439. f.length;m++)f[m]==c&&e.push(b[d]);return e}})(jwplayer);(function(a){a.utils.strings=function(){};a.utils.strings.trim=function(a){return a.replace(/^\s*/,"").replace(/\s*$/,"")};a.utils.strings.pad=function(a,c,d){for(d||(d="0");a.length<c;)a=d+a;return a};a.utils.strings.serialize=function(a){return null==a?null:"true"==a?!0:"false"==a?!1:isNaN(Number(a))||5<a.length||0==a.length?a:Number(a)};a.utils.strings.seconds=function(a){a=a.replace(",",".");var c=a.split(":"),d=0;"s"==a.substr(-1)?d=Number(a.substr(0,
  440. a.length-1)):"m"==a.substr(-1)?d=60*Number(a.substr(0,a.length-1)):"h"==a.substr(-1)?d=3600*Number(a.substr(0,a.length-1)):1<c.length?(d=Number(c[c.length-1]),d+=60*Number(c[c.length-2]),3==c.length&&(d+=3600*Number(c[c.length-3]))):d=Number(a);return d};a.utils.strings.xmlAttribute=function(a,c){for(var d=0;d<a.attributes.length;d++)if(a.attributes[d].name&&a.attributes[d].name.toLowerCase()==c.toLowerCase())return a.attributes[d].value.toString();return""};a.utils.strings.jsonToString=function(b){var c=
  441. c||{};if(c&&c.stringify)return c.stringify(b);c=typeof b;if("object"!=c||null===b)if("string"==c)b.replace(/"/g,'\\"');else return String(b);else{var c=[],d=b&&b.constructor==Array,e;for(e in b){var f=b[e];switch(typeof f){case "string":f='"'+f.replace(/"/g,'\\"')+'"';break;case "object":a.utils.exists(f)&&(f=a.utils.strings.jsonToString(f))}d?"function"!=typeof f&&c.push(String(f)):"function"!=typeof f&&c.push('"'+e+'":'+String(f))}return d?"["+String(c)+"]":"{"+String(c)+"}"}}})(jwplayer);(function(a){function b(b,
  442. d){if(!a.utils.exists(d))return b;switch(d){case "color":return 0<b.length?c(b):null;case "integer":return parseInt(b,10);case "float":return parseFloat(b);case "boolean":return"true"==b.toLowerCase()||"1"==b?!0:!1}return b}function c(a){switch(a.toLowerCase()){case "blue":return 255;case "green":return 65280;case "red":return 16711680;case "cyan":return 65535;case "magenta":return 16711935;case "yellow":return 16776960;case "black":return 0;case "white":return 16777215;default:return a=a.replace(/(#|0x)?([0-9A-F]{3,6})$/gi,
  443. "$2"),3==a.length&&(a=a.charAt(0)+a.charAt(0)+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)),parseInt(a,16)}}var d=RegExp(/^(#|0x)[0-9a-fA-F]{3,6}/);a.utils.typechecker=function(c,f){f=!a.utils.exists(f)?0<=["true","false","t","f"].toString().indexOf(c.toLowerCase().replace(" ",""))?"boolean":d.test(c)?"color":!isNaN(parseInt(c,10))&&parseInt(c,10).toString().length==c.length?"integer":!isNaN(parseFloat(c))&&parseFloat(c).toString().length==c.length?"float":"string":f;return b(c,f)}})(jwplayer);
  444. (function(a){a.utils.parsers=function(){};a.utils.parsers.localName=function(a){return a?a.localName?a.localName:a.baseName?a.baseName:"":""};a.utils.parsers.textContent=function(a){return a?a.textContent?a.textContent:a.text?a.text:"":""}})(jwplayer);(function(a){a.utils.parsers.jwparser=function(){};a.utils.parsers.jwparser.PREFIX="jwplayer";a.utils.parsers.jwparser.parseEntry=function(b,c){for(var d=0;d<b.childNodes.length;d++)b.childNodes[d].prefix==a.utils.parsers.jwparser.PREFIX&&(c[a.utils.parsers.localName(b.childNodes[d])]=
  445. a.utils.strings.serialize(a.utils.parsers.textContent(b.childNodes[d])),"file"==a.utils.parsers.localName(b.childNodes[d])&&c.levels&&delete c.levels),!c.file&&-1<String(c.link).toLowerCase().indexOf("youtube")&&(c.file=c.link);return c};a.utils.parsers.jwparser.getProvider=function(b){if(b.type)return b.type;if(-1<b.file.indexOf("youtube.com/w")||-1<b.file.indexOf("youtube.com/v")||-1<b.file.indexOf("youtu.be/"))return"youtube";if(b.streamer&&0==b.streamer.indexOf("rtmp"))return"rtmp";if(b.streamer&&
  446. 0==b.streamer.indexOf("http"))return"http";b=a.utils.strings.extension(b.file);return extensions.hasOwnProperty(b)?extensions[b]:""}})(jwplayer);(function(a){a.utils.parsers.mediaparser=function(){};a.utils.parsers.mediaparser.PREFIX="media";a.utils.parsers.mediaparser.parseGroup=function(b,c){for(var d=!1,e=0;e<b.childNodes.length;e++)if(b.childNodes[e].prefix==a.utils.parsers.mediaparser.PREFIX&&a.utils.parsers.localName(b.childNodes[e]))switch(a.utils.parsers.localName(b.childNodes[e]).toLowerCase()){case "content":d||
  447. (c.file=a.utils.strings.xmlAttribute(b.childNodes[e],"url"));a.utils.strings.xmlAttribute(b.childNodes[e],"duration")&&(c.duration=a.utils.strings.seconds(a.utils.strings.xmlAttribute(b.childNodes[e],"duration")));a.utils.strings.xmlAttribute(b.childNodes[e],"start")&&(c.start=a.utils.strings.seconds(a.utils.strings.xmlAttribute(b.childNodes[e],"start")));b.childNodes[e].childNodes&&0<b.childNodes[e].childNodes.length&&(c=a.utils.parsers.mediaparser.parseGroup(b.childNodes[e],c));if(a.utils.strings.xmlAttribute(b.childNodes[e],
  448. "width")||a.utils.strings.xmlAttribute(b.childNodes[e],"bitrate")||a.utils.strings.xmlAttribute(b.childNodes[e],"url"))c.levels||(c.levels=[]),c.levels.push({width:a.utils.strings.xmlAttribute(b.childNodes[e],"width"),bitrate:a.utils.strings.xmlAttribute(b.childNodes[e],"bitrate"),file:a.utils.strings.xmlAttribute(b.childNodes[e],"url")});break;case "title":c.title=a.utils.parsers.textContent(b.childNodes[e]);break;case "description":c.description=a.utils.parsers.textContent(b.childNodes[e]);break;
  449. case "keywords":c.tags=a.utils.parsers.textContent(b.childNodes[e]);break;case "thumbnail":c.image=a.utils.strings.xmlAttribute(b.childNodes[e],"url");break;case "credit":c.author=a.utils.parsers.textContent(b.childNodes[e]);break;case "player":var f=b.childNodes[e].url;if(0<=f.indexOf("youtube.com")||0<=f.indexOf("youtu.be"))d=!0,c.file=a.utils.strings.xmlAttribute(b.childNodes[e],"url");break;case "group":a.utils.parsers.mediaparser.parseGroup(b.childNodes[e],c)}return c}})(jwplayer);(function(a){function b(b){for(var d=
  450. {},e=0;e<b.childNodes.length;e++)if(a.utils.parsers.localName(b.childNodes[e]))switch(a.utils.parsers.localName(b.childNodes[e]).toLowerCase()){case "enclosure":d.file=a.utils.strings.xmlAttribute(b.childNodes[e],"url");break;case "title":d.title=a.utils.parsers.textContent(b.childNodes[e]);break;case "pubdate":d.date=a.utils.parsers.textContent(b.childNodes[e]);break;case "description":d.description=a.utils.parsers.textContent(b.childNodes[e]);break;case "link":d.link=a.utils.parsers.textContent(b.childNodes[e]);
  451. break;case "category":d.tags=d.tags?d.tags+a.utils.parsers.textContent(b.childNodes[e]):a.utils.parsers.textContent(b.childNodes[e])}d=a.utils.parsers.mediaparser.parseGroup(b,d);d=a.utils.parsers.jwparser.parseEntry(b,d);return new a.html5.playlistitem(d)}a.utils.parsers.rssparser=function(){};a.utils.parsers.rssparser.parse=function(c){for(var d=[],e=0;e<c.childNodes.length;e++)if("channel"==a.utils.parsers.localName(c.childNodes[e]).toLowerCase())for(var f=0;f<c.childNodes[e].childNodes.length;f++)"item"==
  452. a.utils.parsers.localName(c.childNodes[e].childNodes[f]).toLowerCase()&&d.push(b(c.childNodes[e].childNodes[f]));return d}})(jwplayer);(function(a){var b={},c={};a.plugins=function(){};a.plugins.loadPlugins=function(d,e){c[d]=new a.plugins.pluginloader(new a.plugins.model(b),e);return c[d]};a.plugins.registerPlugin=function(d,e,f){var m=a.utils.getPluginName(d);if(b[m])b[m].registerPlugin(d,e,f);else{a.utils.log("A plugin ("+d+") was registered with the player that was not loaded. Please check your configuration.");
  453. for(var l in c)c[l].pluginFailed()}}})(jwplayer);(function(a){a.plugins.model=function(b){this.addPlugin=function(c){var d=a.utils.getPluginName(c);b[d]||(b[d]=new a.plugins.plugin(c));return b[d]}}})(jwplayer);(function(a){a.plugins.pluginmodes={FLASH:"FLASH",JAVASCRIPT:"JAVASCRIPT",HYBRID:"HYBRID"};a.plugins.plugin=function(b){function c(){switch(a.utils.getPluginPathType(b)){case a.utils.pluginPathType.ABSOLUTE:return b;case a.utils.pluginPathType.RELATIVE:return a.utils.getAbsolutePath(b,window.location.href);
  454. case a.utils.pluginPathType.CDN:var c=a.utils.getPluginName(b),d=a.utils.getPluginVersion(b);return(0==window.location.href.indexOf("https://")?f.replace("http://","https://secure"):f)+"/"+a.version.split(".")[0]+"/"+c+"/"+c+(""!==d?"-"+d:"")+".js"}}function d(b){h=setTimeout(function(){m=a.utils.loaderstatus.COMPLETE;g.sendEvent(a.events.COMPLETE)},1E3)}function e(b){m=a.utils.loaderstatus.ERROR;g.sendEvent(a.events.ERROR)}var f="http://lp.longtailvideo.com",m=a.utils.loaderstatus.NEW,l,u,h,g=new a.events.eventdispatcher;
  455. a.utils.extend(this,g);this.load=function(){if(m==a.utils.loaderstatus.NEW)if(0<b.lastIndexOf(".swf"))l=b,m=a.utils.loaderstatus.COMPLETE,g.sendEvent(a.events.COMPLETE);else{m=a.utils.loaderstatus.LOADING;var f=new a.utils.scriptloader(c());f.addEventListener(a.events.COMPLETE,d);f.addEventListener(a.events.ERROR,e);f.load()}};this.registerPlugin=function(b,c,d){h&&(clearTimeout(h),h=void 0);c&&d?(l=d,u=c):"string"==typeof c?l=c:"function"==typeof c?u=c:!c&&!d&&(l=b);m=a.utils.loaderstatus.COMPLETE;
  456. g.sendEvent(a.events.COMPLETE)};this.getStatus=function(){return m};this.getPluginName=function(){return a.utils.getPluginName(b)};this.getFlashPath=function(){if(l)switch(a.utils.getPluginPathType(l)){case a.utils.pluginPathType.ABSOLUTE:return l;case a.utils.pluginPathType.RELATIVE:return 0<b.lastIndexOf(".swf")?a.utils.getAbsolutePath(l,window.location.href):a.utils.getAbsolutePath(l,c());case a.utils.pluginPathType.CDN:return-1<l.indexOf("-")?l+"h":l+"-h"}return null};this.getJS=function(){return u};
  457. this.getPluginmode=function(){if("undefined"!=typeof l&&"undefined"!=typeof u)return a.plugins.pluginmodes.HYBRID;if("undefined"!=typeof l)return a.plugins.pluginmodes.FLASH;if("undefined"!=typeof u)return a.plugins.pluginmodes.JAVASCRIPT};this.getNewInstance=function(a,b,c){return new u(a,b,c)};this.getURL=function(){return b}}})(jwplayer);(function(a){a.plugins.pluginloader=function(b,c){function d(){l||(l=!0,m=a.utils.loaderstatus.COMPLETE,u.sendEvent(a.events.COMPLETE))}function e(){if(!l){var b=
  458. 0;for(plugin in f){var c=f[plugin].getStatus();(c==a.utils.loaderstatus.LOADING||c==a.utils.loaderstatus.NEW)&&b++}0==b&&d()}}var f={},m=a.utils.loaderstatus.NEW,l=!1,u=new a.events.eventdispatcher;a.utils.extend(this,u);this.setupPlugins=function(a,b,c){var d={length:0,plugins:{}},e=0,l={},m;for(m in f){var u=f[m].getPluginName();f[m].getFlashPath()&&(d.plugins[f[m].getFlashPath()]=b.plugins[m],d.plugins[f[m].getFlashPath()].pluginmode=f[m].getPluginmode(),d.length++);if(f[m].getJS()){var n=document.createElement("div");
  459. n.id=a.id+"_"+u;n.style.position="absolute";n.style.zIndex=e+10;l[u]=f[m].getNewInstance(a,b.plugins[m],n);e++;"undefined"!=typeof l[u].resize&&(a.onReady(c(l[u],n,!0)),a.onResize(c(l[u],n)))}}a.plugins=l;return d};this.load=function(){m=a.utils.loaderstatus.LOADING;for(var d in c)a.utils.exists(d)&&(f[d]=b.addPlugin(d),f[d].addEventListener(a.events.COMPLETE,e),f[d].addEventListener(a.events.ERROR,e));for(d in f)f[d].load();e()};this.pluginFailed=function(){d()};this.getStatus=function(){return m}}})(jwplayer);
  460. (function(a){var b=[];a.api=function(b){function d(a,b){return function(c,d,e,f){if("flash"==a.renderingMode||"html5"==a.renderingMode){var l;d?(x[c]=d,l="jwplayer('"+a.id+"').callback('"+c+"')"):!d&&x[c]&&delete x[c];g.jwDockSetButton(c,l,e,f)}return b}}function e(b){w=[];a.utils.getOuterHTML(b.container)!=q&&a.api.destroyPlayer(b.id,q)}function f(a){return function(b){var c=b.newstate;b=b.oldstate;if(c==a){var d=u[c];if(d)for(var e=0;e<d.length;e++)"function"==typeof d[e]&&d[e].call(this,{oldstate:b,
  461. newstate:c})}}}function m(a,b){return function(c){if(a==c.component){var d=h[a][b];if(d)for(var e=0;e<d.length;e++)"function"==typeof d[e]&&d[e].call(this,c)}}}this.container=b;this.id=b.id;var l={},u={},h={},g=void 0,p=!1,w=[],t=void 0,q=a.utils.getOuterHTML(b),v={},x={};this.getBuffer=function(){return this.callInternal("jwGetBuffer")};this.getContainer=function(){return this.container};this.getPlugin=function(b){var c=this,e={};return"dock"==b?a.utils.extend(e,{setButton:d(c,e),show:function(){c.callInternal("jwDockShow");
  462. return e},hide:function(){c.callInternal("jwDockHide");return e},onShow:function(b){c.componentListener("dock",a.api.events.JWPLAYER_COMPONENT_SHOW,b);return e},onHide:function(b){c.componentListener("dock",a.api.events.JWPLAYER_COMPONENT_HIDE,b);return e}}):"controlbar"==b?a.utils.extend(e,{show:function(){c.callInternal("jwControlbarShow");return e},hide:function(){c.callInternal("jwControlbarHide");return e},onShow:function(b){c.componentListener("controlbar",a.api.events.JWPLAYER_COMPONENT_SHOW,
  463. b);return e},onHide:function(b){c.componentListener("controlbar",a.api.events.JWPLAYER_COMPONENT_HIDE,b);return e}}):"display"==b?a.utils.extend(e,{show:function(){c.callInternal("jwDisplayShow");return e},hide:function(){c.callInternal("jwDisplayHide");return e},onShow:function(b){c.componentListener("display",a.api.events.JWPLAYER_COMPONENT_SHOW,b);return e},onHide:function(b){c.componentListener("display",a.api.events.JWPLAYER_COMPONENT_HIDE,b);return e}}):this.plugins[b]};this.callback=function(a){if(x[a])return x[a]()};
  464. this.getDuration=function(){return this.callInternal("jwGetDuration")};this.getFullscreen=function(){return this.callInternal("jwGetFullscreen")};this.getHeight=function(){return this.callInternal("jwGetHeight")};this.getLockState=function(){return this.callInternal("jwGetLockState")};this.getMeta=function(){return this.getItemMeta()};this.getMute=function(){return this.callInternal("jwGetMute")};this.getPlaylist=function(){var b=this.callInternal("jwGetPlaylist");"flash"==this.renderingMode&&a.utils.deepReplaceKeyName(b,
  465. ["__dot__","__spc__","__dsh__"],["."," ","-"]);for(var c=0;c<b.length;c++)a.utils.exists(b[c].index)||(b[c].index=c);return b};this.getPlaylistItem=function(b){a.utils.exists(b)||(b=this.getCurrentItem());return this.getPlaylist()[b]};this.getPosition=function(){return this.callInternal("jwGetPosition")};this.getRenderingMode=function(){return this.renderingMode};this.getState=function(){return this.callInternal("jwGetState")};this.getVolume=function(){return this.callInternal("jwGetVolume")};this.getWidth=
  466. function(){return this.callInternal("jwGetWidth")};this.setFullscreen=function(b){a.utils.exists(b)?this.callInternal("jwSetFullscreen",b):this.callInternal("jwSetFullscreen",!this.callInternal("jwGetFullscreen"));return this};this.setMute=function(b){a.utils.exists(b)?this.callInternal("jwSetMute",b):this.callInternal("jwSetMute",!this.callInternal("jwGetMute"));return this};this.lock=function(){return this};this.unlock=function(){return this};this.load=function(a){this.callInternal("jwLoad",a);
  467. return this};this.playlistItem=function(a){this.callInternal("jwPlaylistItem",a);return this};this.playlistPrev=function(){this.callInternal("jwPlaylistPrev");return this};this.playlistNext=function(){this.callInternal("jwPlaylistNext");return this};this.resize=function(a,b){if("html5"==this.renderingMode)g.jwResize(a,b);else{this.container.width=a;this.container.height=b;var c=document.getElementById(this.id+"_wrapper");c&&(c.style.width=a+"px",c.style.height=b+"px")}return this};this.play=function(b){"undefined"==
  468. typeof b?(b=this.getState(),b==a.api.events.state.PLAYING||b==a.api.events.state.BUFFERING?this.callInternal("jwPause"):this.callInternal("jwPlay")):this.callInternal("jwPlay",b);return this};this.pause=function(b){"undefined"==typeof b?(b=this.getState(),b==a.api.events.state.PLAYING||b==a.api.events.state.BUFFERING?this.callInternal("jwPause"):this.callInternal("jwPlay")):this.callInternal("jwPause",b);return this};this.stop=function(){this.callInternal("jwStop");return this};this.seek=function(a){this.callInternal("jwSeek",
  469. a);return this};this.setVolume=function(a){this.callInternal("jwSetVolume",a);return this};this.loadInstream=function(b,c){return t=new a.api.instream(this,g,b,c)};this.onBufferChange=function(b){return this.eventListener(a.api.events.JWPLAYER_MEDIA_BUFFER,b)};this.onBufferFull=function(b){return this.eventListener(a.api.events.JWPLAYER_MEDIA_BUFFER_FULL,b)};this.onError=function(b){return this.eventListener(a.api.events.JWPLAYER_ERROR,b)};this.onFullscreen=function(b){return this.eventListener(a.api.events.JWPLAYER_FULLSCREEN,
  470. b)};this.onMeta=function(b){return this.eventListener(a.api.events.JWPLAYER_MEDIA_META,b)};this.onMute=function(b){return this.eventListener(a.api.events.JWPLAYER_MEDIA_MUTE,b)};this.onPlaylist=function(b){return this.eventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,b)};this.onPlaylistItem=function(b){return this.eventListener(a.api.events.JWPLAYER_PLAYLIST_ITEM,b)};this.onReady=function(b){return this.eventListener(a.api.events.API_READY,b)};this.onResize=function(b){return this.eventListener(a.api.events.JWPLAYER_RESIZE,
  471. b)};this.onComplete=function(b){return this.eventListener(a.api.events.JWPLAYER_MEDIA_COMPLETE,b)};this.onSeek=function(b){return this.eventListener(a.api.events.JWPLAYER_MEDIA_SEEK,b)};this.onTime=function(b){return this.eventListener(a.api.events.JWPLAYER_MEDIA_TIME,b)};this.onVolume=function(b){return this.eventListener(a.api.events.JWPLAYER_MEDIA_VOLUME,b)};this.onBeforePlay=function(b){return this.eventListener(a.api.events.JWPLAYER_MEDIA_BEFOREPLAY,b)};this.onBeforeComplete=function(b){return this.eventListener(a.api.events.JWPLAYER_MEDIA_BEFORECOMPLETE,
  472. b)};this.onBuffer=function(b){return this.stateListener(a.api.events.state.BUFFERING,b)};this.onPause=function(b){return this.stateListener(a.api.events.state.PAUSED,b)};this.onPlay=function(b){return this.stateListener(a.api.events.state.PLAYING,b)};this.onIdle=function(b){return this.stateListener(a.api.events.state.IDLE,b)};this.remove=function(){if(!p)throw"Cannot call remove() before player is ready";e(this)};this.setup=function(b){if(a.embed){var c=this.id;e(this);c=a(c);c.config=b;return new a.embed(c)}return this};
  473. this.registerPlugin=function(b,c,d){a.plugins.registerPlugin(b,c,d)};this.setPlayer=function(a,b){g=a;this.renderingMode=b};this.stateListener=function(b,c){u[b]||(u[b]=[],this.eventListener(a.api.events.JWPLAYER_PLAYER_STATE,f(b)));u[b].push(c);return this};this.detachMedia=function(){if("html5"==this.renderingMode)return this.callInternal("jwDetachMedia")};this.attachMedia=function(){if("html5"==this.renderingMode)return this.callInternal("jwAttachMedia")};this.componentListener=function(a,b,c){h[a]||
  474. (h[a]={});h[a][b]||(h[a][b]=[],this.eventListener(b,m(a,b)));h[a][b].push(c);return this};this.addInternalListener=function(b,c){try{b.jwAddEventListener(c,'function(dat) { jwplayer("'+this.id+'").dispatchEvent("'+c+'", dat); }')}catch(d){a.utils.log("Could not add internal listener")}};this.eventListener=function(a,b){l[a]||(l[a]=[],g&&p&&this.addInternalListener(g,a));l[a].push(b);return this};this.dispatchEvent=function(a,b){if(l[a])for(var c=_utils.translateEventResponse(a,b),d=0;d<l[a].length;d++)"function"==
  475. typeof l[a][d]&&l[a][d].call(this,c)};this.dispatchInstreamEvent=function(a){t&&t.dispatchEvent(a,arguments)};this.callInternal=function(){if(p){for(var a=arguments[0],b=[],c=1;c<arguments.length;c++)b.push(arguments[c]);return"undefined"!=typeof g&&"function"==typeof g[a]?2==b.length?g[a](b[0],b[1]):1==b.length?g[a](b[0]):g[a]():null}w.push(arguments)};this.playerReady=function(b){p=!0;g||this.setPlayer(document.getElementById(b.id));this.container=document.getElementById(this.id);for(var c in l)this.addInternalListener(g,
  476. c);this.eventListener(a.api.events.JWPLAYER_PLAYLIST_ITEM,function(a){v={}});this.eventListener(a.api.events.JWPLAYER_MEDIA_META,function(b){a.utils.extend(v,b.metadata)});for(this.dispatchEvent(a.api.events.API_READY);0<w.length;)this.callInternal.apply(this,w.shift())};this.getItemMeta=function(){return v};this.getCurrentItem=function(){return this.callInternal("jwGetPlaylistIndex")};return this};a.api.selectPlayer=function(b){var d;a.utils.exists(b)||(b=0);b.nodeType?d=b:"string"==typeof b&&(d=
  477. document.getElementById(b));return d?(b=a.api.playerById(d.id))?b:a.api.addPlayer(new a.api(d)):"number"==typeof b?a.getPlayers()[b]:null};a.api.events={API_READY:"jwplayerAPIReady",JWPLAYER_READY:"jwplayerReady",JWPLAYER_FULLSCREEN:"jwplayerFullscreen",JWPLAYER_RESIZE:"jwplayerResize",JWPLAYER_ERROR:"jwplayerError",JWPLAYER_MEDIA_BEFOREPLAY:"jwplayerMediaBeforePlay",JWPLAYER_MEDIA_BEFORECOMPLETE:"jwplayerMediaBeforeComplete",JWPLAYER_COMPONENT_SHOW:"jwplayerComponentShow",JWPLAYER_COMPONENT_HIDE:"jwplayerComponentHide",
  478. JWPLAYER_MEDIA_BUFFER:"jwplayerMediaBuffer",JWPLAYER_MEDIA_BUFFER_FULL:"jwplayerMediaBufferFull",JWPLAYER_MEDIA_ERROR:"jwplayerMediaError",JWPLAYER_MEDIA_LOADED:"jwplayerMediaLoaded",JWPLAYER_MEDIA_COMPLETE:"jwplayerMediaComplete",JWPLAYER_MEDIA_SEEK:"jwplayerMediaSeek",JWPLAYER_MEDIA_TIME:"jwplayerMediaTime",JWPLAYER_MEDIA_VOLUME:"jwplayerMediaVolume",JWPLAYER_MEDIA_META:"jwplayerMediaMeta",JWPLAYER_MEDIA_MUTE:"jwplayerMediaMute",JWPLAYER_PLAYER_STATE:"jwplayerPlayerState",JWPLAYER_PLAYLIST_LOADED:"jwplayerPlaylistLoaded",
  479. JWPLAYER_PLAYLIST_ITEM:"jwplayerPlaylistItem",JWPLAYER_INSTREAM_CLICK:"jwplayerInstreamClicked",JWPLAYER_INSTREAM_DESTROYED:"jwplayerInstreamDestroyed"};a.api.events.state={BUFFERING:"BUFFERING",IDLE:"IDLE",PAUSED:"PAUSED",PLAYING:"PLAYING"};a.api.playerById=function(a){for(var d=0;d<b.length;d++)if(b[d].id==a)return b[d];return null};a.api.addPlayer=function(a){for(var d=0;d<b.length;d++)if(b[d]==a)return a;b.push(a);return a};a.api.destroyPlayer=function(c,d){for(var e=-1,f=0;f<b.length;f++)b[f].id==
  480. c&&(e=f);if(0<=e){try{b[e].callInternal("jwDestroy")}catch(m){}f=document.getElementById(b[e].id);document.getElementById(b[e].id+"_wrapper")&&(f=document.getElementById(b[e].id+"_wrapper"));if(f)if(d)a.utils.setOuterHTML(f,d);else{var l=document.createElement("div"),u=f.id;f.id.indexOf("_wrapper")==f.id.length-8&&(newID=f.id.substring(0,f.id.length-8));l.setAttribute("id",u);f.parentNode.replaceChild(l,f)}b.splice(e,1)}return null};a.getPlayers=function(){return b.slice(0)}})(jwplayer);var _userPlayerReady=
  481. "function"==typeof playerReady?playerReady:void 0;playerReady=function(a){var b=jwplayer.api.playerById(a.id);b?b.playerReady(a):jwplayer.api.selectPlayer(a.id).playerReady(a);_userPlayerReady&&_userPlayerReady.call(this,a)};(function(a){a.api.instream=function(b,c,d,e){function f(a,b){g[a]||(g[a]=[],h.jwInstreamAddEventListener(a,'function(dat) { jwplayer("'+u.id+'").dispatchInstreamEvent("'+a+'", dat); }'));g[a].push(b);return this}function m(b,c){p[b]||(p[b]=[],f(a.api.events.JWPLAYER_PLAYER_STATE,
  482. l(b)));p[b].push(c);return this}function l(a){return function(b){var c=b.newstate,d=b.oldstate;if(c==a){var e=p[c];if(e)for(var f=0;f<e.length;f++)"function"==typeof e[f]&&e[f].call(this,{oldstate:d,newstate:c,type:b.type})}}}var u=b,h=c,g={},p={};this.dispatchEvent=function(a,b){if(g[a])for(var c=_utils.translateEventResponse(a,b[1]),d=0;d<g[a].length;d++)"function"==typeof g[a][d]&&g[a][d].call(this,c)};this.onError=function(b){return f(a.api.events.JWPLAYER_ERROR,b)};this.onFullscreen=function(b){return f(a.api.events.JWPLAYER_FULLSCREEN,
  483. b)};this.onMeta=function(b){return f(a.api.events.JWPLAYER_MEDIA_META,b)};this.onMute=function(b){return f(a.api.events.JWPLAYER_MEDIA_MUTE,b)};this.onComplete=function(b){return f(a.api.events.JWPLAYER_MEDIA_COMPLETE,b)};this.onSeek=function(b){return f(a.api.events.JWPLAYER_MEDIA_SEEK,b)};this.onTime=function(b){return f(a.api.events.JWPLAYER_MEDIA_TIME,b)};this.onVolume=function(b){return f(a.api.events.JWPLAYER_MEDIA_VOLUME,b)};this.onBuffer=function(b){return m(a.api.events.state.BUFFERING,b)};
  484. this.onPause=function(b){return m(a.api.events.state.PAUSED,b)};this.onPlay=function(b){return m(a.api.events.state.PLAYING,b)};this.onIdle=function(b){return m(a.api.events.state.IDLE,b)};this.onInstreamClick=function(b){return f(a.api.events.JWPLAYER_INSTREAM_CLICK,b)};this.onInstreamDestroyed=function(b){return f(a.api.events.JWPLAYER_INSTREAM_DESTROYED,b)};this.play=function(a){h.jwInstreamPlay(a)};this.pause=function(a){h.jwInstreamPause(a)};this.seek=function(a){h.jwInstreamSeek(a)};this.destroy=
  485. function(){h.jwInstreamDestroy()};this.getState=function(){return h.jwInstreamGetState()};this.getDuration=function(){return h.jwInstreamGetDuration()};this.getPosition=function(){return h.jwInstreamGetPosition()};u.callInternal("jwLoadInstream",d,e)}})(jwplayer);(function(a){function b(){if(!document.body)return setTimeout(b,15);for(var d=c.selectors.getElementsByTagAndClass("video","jwplayer"),e=0;e<d.length;e++){var f=d[e];""==f.id&&(f.id="jwplayer_"+Math.round(1E5*Math.random()));a(f.id).setup({})}}
  486. var c=a.utils;a.embed=function(b){function e(){if(l.getStatus()==c.loaderstatus.COMPLETE){for(var e=0;e<m.modes.length;e++)if(m.modes[e].type&&a.embed[m.modes[e].type]){var f=m.modes[e].config,g=m;if(f)for(var g=c.extend(c.clone(m),f),p=["file","levels","playlist"],w=0;w<p.length;w++)if(c.exists(f[p[w]]))for(var t=0;t<p.length;t++)if(t!=w){var q=p[t];c.exists(g[q])&&!c.exists(f[q])&&delete g[q]}f=new a.embed[m.modes[e].type](document.getElementById(b.id),m.modes[e],g,l,b);if(f.supportsConfig()){f.embed();
  487. e=b;f=m.events;g=void 0;for(g in f)"function"==typeof e[g]&&e[g].call(e,f[g]);return b}}c.log("No suitable players found");new a.embed.logo(c.extend({hide:!0},m.components.logo),"none",b.id)}}var f=c.mediaparser.parseMedia(b.container),m=new a.embed.config(c.extend({width:400,height:300,components:{controlbar:{position:"over"}}},f,b.config),this),l=a.plugins.loadPlugins(b.id,m.plugins);l.addEventListener(a.events.COMPLETE,e);l.addEventListener(a.events.ERROR,e);l.load();return b};b()})(jwplayer);
  488. (function(a){function b(a){a=[{type:"flash",src:a?a:"/jwplayer/player.swf"},{type:"html5"},{type:"download"}];e.isAndroid()&&(a[0]=a.splice(1,1,a[0])[0]);return a}function c(a){return"string"==typeof a&&(parseInt(a).toString()==a||-1<a.toLowerCase().indexOf("px"))?parseInt(a):a}function d(a,b,c,d){"object"!=e.typeOf(a[b])&&(a[b]={});var f=a[b][c];"object"!=e.typeOf(f)&&(a[b][c]=f={});d&&("plugins"==b?(b=e.getPluginName(c),f[d]=a[b+"."+d],delete a[b+"."+d]):(f[d]=a[c+"."+d],delete a[c+"."+d]))}var e=
  489. a.utils,f={players:"modes",autoplay:"autostart"},m=["playlist","dock","controlbar","logo","display"];a.embed.deserialize=function(a){var b={};switch(e.typeOf(a.plugins)){case "object":for(var c in a.plugins)b[e.getPluginName(c)]=c;break;case "string":c=a.plugins.split(",");for(var f=0;f<c.length;f++)b[e.getPluginName(c[f])]=c[f]}for(var p in b)d(a,"plugins",b[p]);for(var w in a)-1<w.indexOf(".")&&(w=w.split("."),p=w[0],w=w[1],e.isInArray(m,p)?d(a,"components",p,w):b[p]&&d(a,"plugins",b[p],w));return a};
  490. a.embed.config=function(d,u){var h=e.extend({},d),g,p=h.playlist,w=!1;if(w=p instanceof Array||"object"==typeof p&&!p.position&&!p.size)g=h.playlist,delete h.playlist;h=a.embed.deserialize(h);h.height=c(h.height);h.width=c(h.width);if("string"==typeof h.plugins){p=h.plugins.split(",");"object"!=typeof h.plugins&&(h.plugins={});for(w=0;w<p.length;w++){var t=e.getPluginName(p[w]);"object"==typeof h[t]?(h.plugins[p[w]]=h[t],delete h[t]):h.plugins[p[w]]={}}}for(p=0;p<m.length;p++)w=m[p],e.exists(h[w])&&
  491. ("object"!=typeof h[w]?(h.components[w]||(h.components[w]={}),"logo"==w?h.components[w].file=h[w]:h.components[w].position=h[w]):(h.components[w]||(h.components[w]={}),e.extend(h.components[w],h[w])),delete h[w]),"undefined"!=typeof h[w+"size"]&&(h.components[w]||(h.components[w]={}),h.components[w].size=h[w+"size"],delete h[w+"size"]);"undefined"!=typeof h.icons&&(h.components.display||(h.components.display={}),h.components.display.icons=h.icons,delete h.icons);for(var q in f)h[q]&&(h[f[q]]||(h[f[q]]=
  492. h[q]),delete h[q]);var v;h.flashplayer&&!h.modes?(v=b(h.flashplayer),delete h.flashplayer):h.modes?("string"==typeof h.modes?v=b(h.modes):h.modes instanceof Array?v=h.modes:"object"==typeof h.modes&&h.modes.type&&(v=[h.modes]),delete h.modes):v=b();h.modes=v;g&&(h.playlist=g);return h}})(jwplayer);(function(a){a.embed.download=function(b,c,d,e,f){function m(b,c,d){if(d)return!1;d=["image","sound","youtube","http"];if(c&&-1<d.toString().indexOf(c))return!0;if(!c||c&&"video"==c)if((b=a.utils.extension(b))&&
  493. a.utils.extensionmap[b])return!0;return!1}this.embed=function(){a.utils.extend({},d);var c,e,h,g,p=d.width?d.width:480;"number"!=typeof p&&(p=parseInt(p,10));var m=d.height?d.height:320;"number"!=typeof m&&(m=parseInt(m,10));var t;d.playlist&&d.playlist.length?(c=d.playlist[0].file,g=d.playlist[0].image,t=d.playlist[0].levels):(c=d.file,g=d.image,t=d.levels);c?h=c:t&&t.length&&(h=t[0].file);c=h?"pointer":"auto";var q={display:{style:{cursor:c,width:p,height:m,backgroundColor:"#000",position:"relative",
  494. textDecoration:"none",border:"none",display:"block"}},display_icon:{style:{cursor:c,position:"absolute",display:h?"block":"none",top:0,left:0,border:0,margin:0,padding:0,zIndex:3,width:50,height:50,backgroundImage:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAALdJREFUeNrs18ENgjAYhmFouDOCcQJGcARHgE10BDcgTOIosAGwQOuPwaQeuFRi2p/3Sb6EC5L3QCxZBgAAAOCorLW1zMn65TrlkH4NcV7QNcUQt7Gn7KIhxA+qNIR81spOGkL8oFJDyLJRdosqKDDkK+iX5+d7huzwM40xptMQMkjIOeRGo+VkEVvIPfTGIpKASfYIfT9iCHkHrBEzf4gcUQ56aEzuGK/mw0rHpy4AAACAf3kJMACBxjAQNRckhwAAAABJRU5ErkJggg==)"}},
  495. display_iconBackground:{style:{cursor:c,position:"absolute",display:h?"block":"none",top:(m-50)/2,left:(p-50)/2,border:0,width:50,height:50,margin:0,padding:0,zIndex:2,backgroundImage:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEpJREFUeNrszwENADAIA7DhX8ENoBMZ5KR10EryckCJiIiIiIiIiIiIiIiIiIiIiIh8GmkRERERERERERERERERERERERGRHSPAAPlXH1phYpYaAAAAAElFTkSuQmCC)"}},display_image:{style:{width:p,height:m,display:g?"block":"none",
  496. position:"absolute",cursor:c,left:0,top:0,margin:0,padding:0,textDecoration:"none",zIndex:1,border:"none"}}};t=function(c,d,e){c=document.createElement(c);c.id=e?e:b.id+"_jwplayer_"+d;a.utils.css(c,q[d].style);return c};c=t("a","display",b.id);h&&c.setAttribute("href",a.utils.getAbsolutePath(h));e=t("img","display_image");e.setAttribute("alt","Click to download...");g&&e.setAttribute("src",a.utils.getAbsolutePath(g));h=t("div","display_icon");g=t("div","display_iconBackground");c.appendChild(e);g.appendChild(h);
  497. c.appendChild(g);_css=a.utils.css;_hide=function(a){_css(a,{display:"none"})};e.onerror=function(a){_hide(e)};e.onload=function(b){_imageWidth=e.naturalWidth;_imageHeight=e.naturalHeight;a.utils.stretch(a.utils.stretching.UNIFORM,e,p,m,_imageWidth,_imageHeight)};b.parentNode.replaceChild(c,b);c.appendChild(new a.embed.logo(d.components.logo,"download",b.id));f.container=document.getElementById(f.id);f.setPlayer(c,"download")};this.supportsConfig=function(){if(d){var b=a.utils.getFirstPlaylistItemFromConfig(d);
  498. if("undefined"==typeof b.file&&"undefined"==typeof b.levels)return!0;if(b.file)return m(b.file,b.provider,b.playlistfile);if(b.levels&&b.levels.length)for(var c=0;c<b.levels.length;c++)if(b.levels[c].file&&m(b.levels[c].file,b.provider,b.playlistfile))return!0}else return!0}}})(jwplayer);(function(a){a.embed.flash=function(b,c,d,e,f){function m(a,b,c){var d=document.createElement("param");d.setAttribute("name",b);d.setAttribute("value",c);a.appendChild(d)}function l(b,c,d){return function(e){d&&document.getElementById(f.id+
  499. "_wrapper").appendChild(c);e=document.getElementById(f.id).getPluginConfig("display");b.resize(e.width,e.height);a.utils.css(c,{left:e.x,top:e.y})}}function u(a,b){if(a[b]){var c=a[b],d;for(d in c){var e=c[d];if("string"==typeof e)a[d]||(a[d]=e);else for(var f in e)a[d+"."+f]||(a[d+"."+f]=e[f])}delete a[b]}}function h(b){if(!b)return{};var c={},d=[],e;for(e in b){var f=a.utils.getPluginName(e),l=b[e];d.push(e);for(var g in l)c[f+"."+g]=l[g]}c.plugins=d.join(",");return c}function g(b){var c=b.netstreambasepath?
  500. "":"netstreambasepath="+encodeURIComponent(window.location.href.split("#")[0])+"&",d;for(d in b)c="object"==typeof b[d]?c+(d+"="+encodeURIComponent("[[JSON]]"+a.utils.strings.jsonToString(b[d]))+"&"):c+(d+"="+encodeURIComponent(b[d])+"&");return c.substring(0,c.length-1)}this.embed=function(){d.id=f.id;var p,w=a.utils.extend({},d),t=w.width,q=w.height;b.id+"_wrapper"==b.parentNode.id?document.getElementById(b.id+"_wrapper"):(p=document.createElement("div"),p.id=b.id+"_wrapper",a.utils.wrap(b,p),a.utils.css(p,
  501. {position:"relative",width:t,height:q}));p=e.setupPlugins(f,w,l);0<p.length?a.utils.extend(w,h(p.plugins)):delete w.plugins;p=["height","width","modes","events"];for(t=0;t<p.length;t++)delete w[p[t]];p="opaque";w.wmode&&(p=w.wmode);u(w,"components");u(w,"providers");"undefined"!=typeof w["dock.position"]&&"false"==w["dock.position"].toString().toLowerCase()&&(w.dock=w["dock.position"],delete w["dock.position"]);var t=a.utils.getCookies(),v;for(v in t)"undefined"==typeof w[v]&&(w[v]=t[v]);a.utils.isIE()?
  502. (v='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" bgcolor="#000000" width="100%" height="100%" id="'+b.id+'" name="'+b.id+'" tabindex=0"">',v+='<param name="movie" value="'+c.src+'">',v+='<param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always">',v+='<param name="seamlesstabbing" value="true">',v+='<param name="wmode" value="'+p+'">',v+='<param name="flashvars" value="'+g(w)+'">',v+="</object>",a.utils.setOuterHTML(b,v),w=document.getElementById(b.id)):
  503. (v=document.createElement("object"),v.setAttribute("type","application/x-shockwave-flash"),v.setAttribute("data",c.src),v.setAttribute("width","100%"),v.setAttribute("height","100%"),v.setAttribute("bgcolor","#000000"),v.setAttribute("id",b.id),v.setAttribute("name",b.id),v.setAttribute("tabindex",0),m(v,"allowfullscreen","true"),m(v,"allowscriptaccess","always"),m(v,"seamlesstabbing","true"),m(v,"wmode",p),m(v,"flashvars",g(w)),b.parentNode.replaceChild(v,b),w=v);f.container=w;f.setPlayer(w,"flash")};
  504. this.supportsConfig=function(){if(a.utils.hasFlash())if(d){var b=a.utils.getFirstPlaylistItemFromConfig(d);if("undefined"==typeof b.file&&"undefined"==typeof b.levels)return!0;if(b.file)return flashCanPlay(b.file,b.provider);if(b.levels&&b.levels.length)for(var c=0;c<b.levels.length;c++)if(b.levels[c].file&&flashCanPlay(b.levels[c].file,b.provider))return!0}else return!0;return!1};flashCanPlay=function(b,c){var d=["video","http","sound","image"];if(c&&0>d.toString().indexOf(c))return!0;d=a.utils.extension(b);
  505. return!d?!0:a.utils.exists(a.utils.extensionmap[d])&&!a.utils.exists(a.utils.extensionmap[d].flash)?!1:!0}}})(jwplayer);(function(a){a.embed.html5=function(b,c,d,e,f){function m(a,c,d){return function(e){e=document.getElementById(b.id+"_displayarea");d&&e.appendChild(c);a.resize(e.clientWidth,e.clientHeight);c.left=e.style.left;c.top=e.style.top}}this.embed=function(){if(a.html5){e.setupPlugins(f,d,m);b.innerHTML="";for(var c=a.utils.extend({screencolor:"0x000000"},d),u=["plugins","modes","events"],
  506. h=0;h<u.length;h++)delete c[u[h]];c.levels&&!c.sources&&(c.sources=d.levels);c.skin&&0<c.skin.toLowerCase().indexOf(".zip")&&(c.skin=c.skin.replace(/\.zip/i,".xml"));c=new (a.html5(b).setup)(c);f.container=document.getElementById(f.id);f.setPlayer(c,"html5")}else return null};this.supportsConfig=function(){if(a.vid.canPlayType)if(d){var b=a.utils.getFirstPlaylistItemFromConfig(d);if("undefined"==typeof b.file&&"undefined"==typeof b.levels)return!0;if(b.file)return html5CanPlay(a.vid,b.file,b.provider,
  507. b.playlistfile);if(b.levels&&b.levels.length)for(var c=0;c<b.levels.length;c++)if(b.levels[c].file&&html5CanPlay(a.vid,b.levels[c].file,b.provider,b.playlistfile))return!0}else return!0;return!1};html5CanPlay=function(b,c,d,e){if(e)return!1;if(d&&"youtube"==d)return!0;if(d&&"video"!=d&&"http"!=d&&"sound"!=d||null!==navigator.userAgent.match(/BlackBerry/i))return!1;c=a.utils.extension(c);return!a.utils.exists(c)||!a.utils.exists(a.utils.extensionmap[c])?!0:!a.utils.exists(a.utils.extensionmap[c].html5)?
  508. !1:a.utils.isLegacyAndroid()&&c.match(/m4v|mp4/)?!0:browserCanPlay(b,a.utils.extensionmap[c].html5)};browserCanPlay=function(a,b){return!b?!0:a.canPlayType(b)?!0:"audio/mp3"==b&&navigator.userAgent.match(/safari/i)?a.canPlayType("audio/mpeg"):!1}}})(jwplayer);(function(a){a.embed.logo=function(b,c,d){function e(a){"undefined"!=typeof a&&(a.preventDefault(),a.stopPropagation());h.link&&window.open(h.link,h.linktarget)}function f(a){h.link&&(u.style.opacity=h.out)}function m(a){h.hide&&(u.style.opacity=
  509. h.over)}var l={prefix:"http://l.longtailvideo.com/"+c+"/",file:"",link:"",linktarget:"_top",margin:8,out:0.5,over:1,timeout:5,hide:!1,position:"bottom-left"};_css=a.utils.css;var u,h;(function(){if(l.prefix){var c=a.version.split(/\W/).splice(0,2).join("/");0>l.prefix.indexOf(c)&&(l.prefix+=c+"/")}h=a.utils.extend({},l,b)})();(function(){u=document.createElement("img");u.id=d+"_jwplayer_logo";u.style.display="none";u.onload=function(a){a=_css;var b=u,c={border:"none",textDecoration:"none",position:"absolute",
  510. cursor:"pointer",zIndex:10};c.display=h.hide?"none":"block";var d=h.position.toLowerCase().split("-"),e;for(e in d)c[d[e]]=h.margin;a(b,c);f()};h.file&&(0===h.file.indexOf("http://")?u.src=h.file:u.src=h.prefix+h.file)})();(function(){h.link?(u.onmouseover=m,u.onmouseout=f,u.onclick=e):this.mouseEnabled=!1})();if(h.file)return u}})(jwplayer);(function(a){a.html5=function(b){this.setup=function(c){a.utils.extend(this,new a.html5.api(b,c));return this};return this}})(jwplayer);(function(a){var b=a.utils,
  511. c=b.css,d=b.isIOS();a.html5.view=function(e,f,m){function l(){F=document.createElement("div");F.id=E.id;F.className=E.className;_videowrapper=document.createElement("div");_videowrapper.id=F.id+"_video_wrapper";E.id=F.id+"_video";var a=c,d=F,e=s.height,f=s.width,g;g=C.skin.getComponentSettings("display")&&C.skin.getComponentSettings("display").backgroundcolor?C.skin.getComponentSettings("display").backgroundcolor:0;a(d,{position:"relative",height:e,width:f,padding:0,backgroundColor:g,zIndex:0});c(E,
  512. {width:"100%",height:"100%",top:0,left:0,zIndex:1,margin:"auto",display:"block"});c(_videowrapper,{overflow:"hidden",position:"absolute",top:0,left:0,bottom:0,right:0});b.wrap(E,F);b.wrap(E,_videowrapper);r=document.createElement("div");r.id=F.id+"_displayarea";F.appendChild(r);_instreamArea=document.createElement("div");_instreamArea.id=F.id+"_instreamarea";c(_instreamArea,{overflow:"hidden",position:"absolute",top:0,left:0,bottom:0,right:0,zIndex:100,background:"000000",display:"none"});F.appendChild(_instreamArea)}
  513. function u(){for(var a=0;a<s.plugins.order.length;a++){var c=s.plugins.order[a];b.exists(s.plugins.object[c].getDisplayElement)&&(s.plugins.object[c].height=b.parseDimension(s.plugins.object[c].getDisplayElement().style.height),s.plugins.object[c].width=b.parseDimension(s.plugins.object[c].getDisplayElement().style.width),s.plugins.config[c].currentPosition=s.plugins.config[c].position)}p()}function h(a){A=s.fullscreen}function g(b){if(!I){switch(b.newstate){case a.api.events.state.PLAYING:s.getMedia()&&
  514. s.getMedia().hasChrome()&&(r.style.display="none");break;default:r.style.display="block"}Q()}}function p(a){a=s.getMedia()?s.getMedia().getDisplayElement():null;if(b.exists(a)){M!=a&&(M&&M.parentNode&&M.parentNode.replaceChild(a,M),M=a);for(a=0;a<s.plugins.order.length;a++){var c=s.plugins.order[a];b.exists(s.plugins.object[c].getDisplayElement)&&(s.plugins.config[c].currentPosition=s.plugins.config[c].position)}}t(s.width,s.height)}function w(b){switch(b.keyCode){case 27:C.jwGetFullscreen()&&C.jwSetFullscreen(!1);
  515. break;case 32:C.jwGetState()!=a.api.events.state.IDLE&&C.jwGetState()!=a.api.events.state.PAUSED?C.jwPause():C.jwPlay()}}function t(a,e){if("none"!=F.style.display){var f=[].concat(s.plugins.order);f.reverse();H=f.length+2;if(A&&D())try{s.fullscreen&&!s.getMedia().getDisplayElement().webkitDisplayingFullscreen&&(s.fullscreen=!1)}catch(g){}if(s.fullscreen)!D()&&!d&&q(n,f,!0);else{z=a;G=e;z="string"==typeof a&&0<a.indexOf("%")?b.getElementWidth(b.parentNode(F))*parseInt(a.replace("%"),"")/100:a;G="string"==
  516. typeof e&&0<e.indexOf("%")?b.getElementHeight(b.parentNode(F))*parseInt(e.replace("%"),"")/100:e;var l={top:0,bottom:0,left:0,right:0,width:z,height:G,position:"absolute"};c(r,l);var h={},m;try{m=s.plugins.object.display.getDisplayElement()}catch(p){}m&&(h.width=b.parseDimension(m.style.width),h.height=b.parseDimension(m.style.height));l=b.extend({},l,h,{zIndex:_instreamArea.style.zIndex,display:_instreamArea.style.display});c(_instreamArea,l);c(F,{height:G,width:z});f=q(v,f);0<f.length&&(H+=f.length,
  517. l=f.indexOf("playlist"),h=f.indexOf("controlbar"),0<=l&&0<=h&&(f[l]=f.splice(h,1,f[l])[0]),q(x,f,!0));y=b.getElementWidth(r);J=b.getElementHeight(r)}Q()}}function q(d,e,f){O=0;for(var g=[],l=0;l<e.length;l++){var n=e[l];if(b.exists(s.plugins.object[n].getDisplayElement))if(s.plugins.config[n].currentPosition!=a.html5.view.positions.NONE){var h=d(n,H--);if(h){var m=h.width,q=h.height;f&&(delete h.width,delete h.height);c(s.plugins.object[n].getDisplayElement(),h);s.plugins.object[n].resize(m,q)}else g.push(n)}else c(s.plugins.object[n].getDisplayElement(),
  518. {display:"none"})}return g}function v(c,d){if(b.exists(s.plugins.object[c].getDisplayElement)&&s.plugins.config[c].position&&-1<[a.html5.view.positions.TOP,a.html5.view.positions.RIGHT,a.html5.view.positions.BOTTOM,a.html5.view.positions.LEFT].toString().indexOf(s.plugins.config[c].position.toUpperCase())){b.exists(s.plugins.object[c].getDisplayElement().parentNode)||F.appendChild(s.plugins.object[c].getDisplayElement());var e=S(c);e.zIndex=d;return e}return!1}function x(a,c){b.exists(s.plugins.object[a].getDisplayElement().parentNode)||
  519. r.appendChild(s.plugins.object[a].getDisplayElement());return{position:"absolute",width:b.getElementWidth(r)-b.parseDimension(r.style.right),height:b.getElementHeight(r)-b.parseDimension(r.style.bottom),zIndex:c}}function n(a,b){return{position:"fixed",width:s.width,height:s.height,zIndex:b}}function D(){return C.jwGetState()!=a.api.events.state.IDLE&&!L&&s.getMedia()&&(s.getMedia().getDisplayElement()&&s.getMedia().getDisplayElement().webkitSupportsFullscreen)&&b.useNativeFullscreen()?!0:!1}var C=
  520. e,E=f,s=m,F,z,G,r,H,M,L=!1,A=!1,y,J,I,U;this.setup=function(){s&&s.getMedia()&&(E=s.getMedia().getDisplayElement());l();u();C.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,g);C.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_LOADED,p);C.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_BEFOREPLAY,h);C.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_META,function(a){Q()});var c;b.exists(window.onresize)&&(c=window.onresize);window.onresize=function(a){if(b.exists(c))try{c(a)}catch(d){}C.jwGetFullscreen()?
  521. D()||(a=b.getBoundingClientRect(document.body),s.width=Math.abs(a.left)+Math.abs(a.right),s.height=window.innerHeight,t(s.width,s.height)):t(s.width,s.height)}};var O,Q=this.resizeMedia=function(){r.style.position="absolute";var e=s.getMedia()?s.getMedia().getDisplayElement():U;if(e)if(e&&"video"==e.tagName.toLowerCase())if(!e.videoWidth||!e.videoHeight)e.style.width=r.style.width,e.style.height=r.style.height;else if(e.style.position="absolute",b.fadeTo(e,1,0.25),e.parentNode&&(e.parentNode.style.left=
  522. r.style.left,e.parentNode.style.top=r.style.top),s.fullscreen&&C.jwGetStretching()==a.utils.stretching.EXACTFIT&&!b.isMobile()){var f=document.createElement("div");b.stretch(a.utils.stretching.UNIFORM,f,b.getElementWidth(r),b.getElementHeight(r),y,J);b.stretch(a.utils.stretching.EXACTFIT,e,b.parseDimension(f.style.width),b.parseDimension(f.style.height),e.videoWidth?e.videoWidth:400,e.videoHeight?e.videoHeight:300);c(e,{left:f.style.left,top:f.style.top})}else d||b.stretch(C.jwGetStretching(),e,b.getElementWidth(r),
  523. b.getElementHeight(r),e.videoWidth?e.videoWidth:400,e.videoHeight?e.videoHeight:300);else(e=s.plugins.object.display.getDisplayElement())?s.getMedia().resize(b.parseDimension(e.style.width),b.parseDimension(e.style.height)):s.getMedia().resize(b.parseDimension(r.style.width),b.parseDimension(r.style.height))},S=this.getComponentPosition=function(c){var d={position:"absolute",margin:0,padding:0,top:null},e=s.plugins.config[c].currentPosition.toLowerCase();switch(e.toUpperCase()){case a.html5.view.positions.TOP:d.top=
  524. b.parseDimension(r.style.top);d.left=b.parseDimension(r.style.left);d.width=b.getElementWidth(r)-b.parseDimension(r.style.left)-b.parseDimension(r.style.right);d.height=s.plugins.object[c].height;r.style[e]=b.parseDimension(r.style[e])+s.plugins.object[c].height+"px";r.style.height=b.getElementHeight(r)-d.height+"px";break;case a.html5.view.positions.RIGHT:d.top=b.parseDimension(r.style.top);d.right=b.parseDimension(r.style.right);d.width=s.plugins.object[c].width;d.height=b.getElementHeight(r)-b.parseDimension(r.style.top)-
  525. b.parseDimension(r.style.bottom);r.style.width=b.getElementWidth(r)-d.width+"px";break;case a.html5.view.positions.BOTTOM:d.left=b.parseDimension(r.style.left);d.width=b.getElementWidth(r)-b.parseDimension(r.style.left)-b.parseDimension(r.style.right);d.height=s.plugins.object[c].height;d.bottom=b.parseDimension(r.style.bottom+O);O+=d.height;r.style.height=b.getElementHeight(r)-d.height+"px";break;case a.html5.view.positions.LEFT:d.top=b.parseDimension(r.style.top),d.left=b.parseDimension(r.style.left),
  526. d.width=s.plugins.object[c].width,d.height=b.getElementHeight(r)-b.parseDimension(r.style.top)-b.parseDimension(r.style.bottom),r.style[e]=b.parseDimension(r.style[e])+s.plugins.object[c].width+"px",r.style.width=b.getElementWidth(r)-d.width+"px"}return d};this.resize=t;var P,V,X;this.fullscreen=function(a){if(!d){var e;try{e=s.getMedia().getDisplayElement()}catch(f){}a&&(V=s.width,X=s.height);var g={position:"fixed",width:"100%",height:"100%",top:0,left:0,zIndex:2147483E3},n={position:"relative",
  527. height:V,width:X,zIndex:0};if(D()&&e&&e.webkitSupportsFullscreen){if(a&&!e.webkitDisplayingFullscreen)try{c(e,g),b.transform(e),P=r.style.display,r.style.display="none",e.webkitEnterFullscreen()}catch(l){}else if(!a){c(e,n);Q();if(e.webkitDisplayingFullscreen)try{e.webkitExitFullscreen()}catch(h){}r.style.display=P}L=!1}else a?(document.onkeydown=w,clearInterval(void 0),a=b.getBoundingClientRect(document.body),s.width=Math.abs(a.left)+Math.abs(a.right),s.height=window.innerHeight,c(F,g),g.zIndex=
  528. 1,s.getMedia()&&s.getMedia().getDisplayElement()&&c(s.getMedia().getDisplayElement(),g),g.zIndex=2,c(r,g),L=!0):(document.onkeydown="",s.width=z,s.height=G,c(F,n),L=!1),t(s.width,s.height)}};this.setupInstream=function(a,c){b.css(_instreamArea,{display:"block",position:"absolute"});r.style.display="none";_instreamArea.appendChild(a);U=c;I=!0};this.destroyInstream=function(){_instreamArea.style.display="none";_instreamArea.innerHTML="";r.style.display="block";U=null;I=!1;t(s.width,s.height)}};a.html5.view.positions=
  529. {TOP:"TOP",RIGHT:"RIGHT",BOTTOM:"BOTTOM",LEFT:"LEFT",OVER:"OVER",NONE:"NONE"}})(jwplayer);(function(a){var b={backgroundcolor:"",margin:10,font:"Arial,sans-serif",fontsize:10,fontcolor:0,fontstyle:"normal",fontweight:"bold",buttoncolor:16777215,position:a.html5.view.positions.BOTTOM,idlehide:!1,hideplaylistcontrols:!1,forcenextprev:!1,layout:{left:{position:"left",elements:[{name:"play",type:"button"},{name:"divider",type:"divider"},{name:"prev",type:"button"},{name:"divider",type:"divider"},{name:"next",
  530. type:"button"},{name:"divider",type:"divider"},{name:"elapsed",type:"text"}]},center:{position:"center",elements:[{name:"time",type:"slider"}]},right:{position:"right",elements:[{name:"duration",type:"text"},{name:"blank",type:"button"},{name:"divider",type:"divider"},{name:"mute",type:"button"},{name:"volume",type:"slider"},{name:"divider",type:"divider"},{name:"fullscreen",type:"button"}]}}};_utils=a.utils;_css=_utils.css;_hide=function(a){_css(a,{display:"none"})};_show=function(a){_css(a,{display:"block"})};
  531. a.html5.controlbar=function(c,d){function e(){ea||(ea=y.skin.getSkinElement("controlbar","background"))||(ea={width:0,height:0,src:null});return ea}function f(){U=0;if(!N){var a={height:e().height,backgroundColor:J.backgroundcolor};I=document.createElement("div");I.id=y.id+"_jwplayer_controlbar";_css(I,a)}var a=y.skin.getSkinElement("controlbar","capLeft"),b=y.skin.getSkinElement("controlbar","capRight");a&&q("capLeft","left",!1,I);p("background",I,{position:"absolute",height:e().height,left:a?a.width:
  532. 0,zIndex:0},"img");e().src&&(B.background.src=e().src);p("elements",I,{position:"relative",height:e().height,zIndex:1});b&&q("capRight","right",!1,I)}function m(){var a=["timeSlider","volumeSlider","timeSliderRail","volumeSliderRail"],b;for(b in a){var c=a[b];"undefined"!=typeof B[c]&&(W[c]=_utils.getBoundingClientRect(B[c]))}}function l(b){if(!aa)if(clearTimeout(fa),J.position==a.html5.view.positions.OVER||y.jwGetFullscreen())switch(y.jwGetState()){case a.api.events.state.PAUSED:case a.api.events.state.IDLE:if(I&&
  533. 1>I.style.opacity&&(!J.idlehide||_utils.exists(b)))ha=!1,setTimeout(function(){ha||h()},100);J.idlehide&&(fa=setTimeout(function(){u()},2E3));break;default:ha=!0,b&&h(),fa=setTimeout(function(){u()},2E3)}else h()}function u(){aa||(Y(),1==I.style.opacity&&(_utils.cancelAnimation(I),_utils.fadeTo(I,0,0.1,1,0)))}function h(){aa||(ca(),0==I.style.opacity&&(_utils.cancelAnimation(I),_utils.fadeTo(I,1,0.1,0,0)))}function g(b){return function(){ga&&la!=b&&(la=b,na.sendEvent(b,{component:"controlbar",boundingRect:J.position==
  534. a.html5.view.positions.OVER||y.jwGetFullscreen()?_utils.getDimensions(I):{x:0,y:0,width:0,height:0}}))}}function p(a,b,c,d){N?d=document.getElementById(I.id+"_"+a):(d||(d="div"),d=document.createElement(d),B[a]=d,d.id=I.id+"_"+a,b.appendChild(d));_utils.exists(c)&&_css(d,c);return d}function w(){if(40>=y.jwGetHeight()){J.layout=_utils.clone(J.layout);for(var a=0;a<J.layout.left.elements.length;a++)"fullscreen"==J.layout.left.elements[a].name&&J.layout.left.elements.splice(a,1);for(a=0;a<J.layout.right.elements.length;a++)"fullscreen"==
  535. J.layout.right.elements[a].name&&J.layout.right.elements.splice(a,1);r()}t(J.layout.left);t(J.layout.center);t(J.layout.right)}function t(a,b){var c="right"==a.position?"right":"left",d=_utils.extend([],a.elements);_utils.exists(b)&&d.reverse();a=p(a.position+"Group",B.elements,{"float":"left",styleFloat:"left",cssFloat:"left",height:"100%"});for(var f=0;f<d.length;f++){var g=d[f],n=c,l=a,h=void 0,m=void 0,h=h=void 0;l||(l=B.elements);if("divider"==g.type)q("divider"+U++,n,!0,l,void 0,g.width,g.element);
  536. else switch(g.name){case "play":q("playButton",n,!1,l);q("pauseButton",n,!0,l);D("playButton","jwPlay");D("pauseButton","jwPause");break;case "prev":q("prevButton",n,!0,l);D("prevButton","jwPlaylistPrev");break;case "stop":q("stopButton",n,!0,l);D("stopButton","jwStop");break;case "next":q("nextButton",n,!0,l);D("nextButton","jwPlaylistNext");break;case "elapsed":q("elapsedText",n,!0,l,null,null,y.skin.getSkinElement("controlbar","elapsedBackground"));break;case "time":!_utils.exists(y.skin.getSkinElement("controlbar",
  537. "timeSliderCapLeft"))||y.skin.getSkinElement("controlbar","timeSliderCapLeft");!_utils.exists(y.skin.getSkinElement("controlbar","timeSliderCapRight"))||y.skin.getSkinElement("controlbar","timeSliderCapRight");h={height:e().height,position:"relative","float":"left",styleFloat:"left",cssFloat:"left"};g=p("timeSlider",l,h);q("timeSliderCapLeft",n,!0,g,"relative");q("timeSliderRail",n,!1,g,"relative");q("timeSliderBuffer",n,!1,g,"absolute");q("timeSliderProgress",n,!1,g,"absolute");q("timeSliderThumb",
  538. n,!1,g,"absolute");q("timeSliderCapRight",n,!0,g,"relative");C("time");break;case "fullscreen":q("fullscreenButton",n,!1,l);q("normalscreenButton",n,!0,l);D("fullscreenButton","jwSetFullscreen",!0);D("normalscreenButton","jwSetFullscreen",!1);break;case "volume":h=!_utils.exists(y.skin.getSkinElement("controlbar","volumeSliderCapLeft"))?0:y.skin.getSkinElement("controlbar","volumeSliderCapLeft").width;m=!_utils.exists(y.skin.getSkinElement("controlbar","volumeSliderCapRight"))?0:y.skin.getSkinElement("controlbar",
  539. "volumeSliderCapRight").width;h=y.skin.getSkinElement("controlbar","volumeSliderRail").width+h+m;h={height:e().height,position:"relative",width:h,"float":"left",styleFloat:"left",cssFloat:"left"};g=p("volumeSlider",l,h);q("volumeSliderCapLeft",n,!1,g,"relative");q("volumeSliderRail",n,!1,g,"relative");q("volumeSliderProgress",n,!1,g,"absolute");q("volumeSliderThumb",n,!1,g,"absolute");q("volumeSliderCapRight",n,!1,g,"relative");C("volume");break;case "mute":q("muteButton",n,!1,l);q("unmuteButton",
  540. n,!0,l);D("muteButton","jwSetMute",!0);D("unmuteButton","jwSetMute",!1);break;case "duration":q("durationText",n,!0,l,null,null,y.skin.getSkinElement("controlbar","durationBackground"))}}}function q(a,b,c,d,f,n,g){if(_utils.exists(y.skin.getSkinElement("controlbar",a))||0<a.indexOf("Text")||0===a.indexOf("divider")){f={height:"100%",position:f?f:"relative",display:"block","float":"left",styleFloat:"left",cssFloat:"left"};if((0===a.indexOf("next")||0===a.indexOf("prev"))&&(2>y.jwGetPlaylist().length||
  541. "true"==J.hideplaylistcontrols.toString())&&"true"!=J.forcenextprev.toString())c=!1,f.display="none";var l;if(0<a.indexOf("Text"))a.innerhtml="00:00",f.font=J.fontsize+"px/"+(e().height+1)+"px "+J.font,f.color=J.fontcolor,f.textAlign="center",f.fontWeight=J.fontweight,f.fontStyle=J.fontstyle,f.cursor="default",g&&(f.background="url("+g.src+") no-repeat center",f.backgroundSize="100% "+e().height+"px"),f.padding="0 5px";else if(0===a.indexOf("divider"))if(n)isNaN(parseInt(n))||(l=parseInt(n));else if(g){if(n=
  542. y.skin.getSkinElement("controlbar",g))f.background="url("+n.src+") repeat-x center left",l=n.width}else f.background="url("+y.skin.getSkinElement("controlbar","divider").src+") repeat-x center left",l=y.skin.getSkinElement("controlbar","divider").width;else f.background="url("+y.skin.getSkinElement("controlbar",a).src+") repeat-x center left",l=y.skin.getSkinElement("controlbar",a).width;"undefined"==_utils.typeOf(d)&&(d=B.elements);f.width=l;if(N)_css(B[a],f);else{var h=p(a,d,f);_utils.exists(y.skin.getSkinElement("controlbar",
  543. a+"Over"))&&(h.onmouseover=function(b){h.style.backgroundImage=["url(",y.skin.getSkinElement("controlbar",a+"Over").src,")"].join("")},h.onmouseout=function(b){h.style.backgroundImage=["url(",y.skin.getSkinElement("controlbar",a).src,")"].join("")});0==a.indexOf("divider")&&h.setAttribute("class","divider");h.innerHTML="&nbsp;"}}}function v(){J.hideplaylistcontrols||(1<y.jwGetPlaylist().length||"true"==J.forcenextprev.toString()?(_show(B.nextButton),_show(B.prevButton)):(_hide(B.nextButton),_hide(B.prevButton)),
  544. H(),n())}function x(a){P=y.jwGetPlaylist()[a.index].duration;ma=-1;G({id:y.id,duration:P,position:0});E({id:y.id,bufferProgress:0})}function n(){G({id:y.id,duration:y.jwGetDuration(),position:0});E({id:y.id,bufferProgress:0});s({id:y.id,mute:y.jwGetMute()});F({id:y.id,newstate:a.api.events.state.IDLE});M({id:y.id,volume:y.jwGetVolume()})}function D(a,b,c){!N&&_utils.exists(y.skin.getSkinElement("controlbar",a))&&(a=B[a],_utils.exists(a)&&(_css(a,{cursor:"pointer"}),a.onmouseup="fullscreen"==b?function(a){a.stopPropagation();
  545. y.jwSetFullscreen(!y.jwGetFullscreen())}:function(a){a.stopPropagation();if(_utils.exists(c))y[b](c);else y[b]()}))}function C(b){if(!N){var c=B[b+"Slider"];_css(B.elements,{cursor:"pointer"});_css(c,{cursor:"pointer"});c.onmousedown=function(a){O=b};c.onmouseup=function(b){b.stopPropagation();b=b.pageX;Q=!1;"time"==O?(b=b-W.timeSliderRail.left+window.pageXOffset,b=b/W.timeSliderRail.width*P,0>b?b=0:b>P&&(b=P-3),(y.jwGetState()==a.api.events.state.PAUSED||y.jwGetState()==a.api.events.state.IDLE)&&
  546. y.jwPlay(),y.jwSeek(b)):"volume"==O&&(b=b-W.volumeSliderRail.left-window.pageXOffset,b=Math.round(100*(b/W.volumeSliderRail.width)),10>b?b=0:100<b&&(b=100),y.jwGetMute()&&y.jwSetMute(!1),y.jwSetVolume(b));O="none"};c.onmousemove=function(a){"time"==O&&(Q=!0,_css(B[O+"SliderThumb"],{left:a.pageX-W[b+"Slider"].left-window.pageXOffset}))}}}function E(a){_utils.exists(a.bufferPercent)&&(V=a.bufferPercent);if(W.timeSliderRail){a=y.skin.getSkinElement("controlbar","timeSliderCapLeft");var b=W.timeSliderRail.width,
  547. b=isNaN(Math.round(b*V/100))?0:Math.round(b*V/100);_css(B.timeSliderBuffer,{width:b,left:a?a.width:0})}}function s(a){a.mute?(_hide(B.muteButton),_show(B.unmuteButton),_hide(B.volumeSliderProgress)):(_show(B.muteButton),_hide(B.unmuteButton),_show(B.volumeSliderProgress))}function F(b){b.newstate==a.api.events.state.BUFFERING||b.newstate==a.api.events.state.PLAYING?(_show(B.pauseButton),_hide(B.playButton)):(_hide(B.pauseButton),_show(B.playButton));l();b.newstate==a.api.events.state.IDLE?(_hide(B.timeSliderBuffer),
  548. _hide(B.timeSliderProgress),_hide(B.timeSliderThumb),G({id:y.id,duration:y.jwGetDuration(),position:0})):(_show(B.timeSliderBuffer),b.newstate!=a.api.events.state.BUFFERING&&(_show(B.timeSliderProgress),_show(B.timeSliderThumb)))}function z(a){E({bufferPercent:0});G(_utils.extend(a,{position:0,duration:P}))}function G(a){_utils.exists(a.position)&&(S=a.position);var b=!1;_utils.exists(a.duration)&&a.duration!=P&&(P=a.duration,b=!0);a=0===(S===P)?0:S/P;var c=W.timeSliderRail;if(c){a=isNaN(Math.round(c.width*
  549. a))?0:Math.round(c.width*a);var c=y.skin.getSkinElement("controlbar","timeSliderCapLeft"),d=a+(c?c.width:0);B.timeSliderProgress&&(_css(B.timeSliderProgress,{width:a,left:c?c.width:0}),!Q&&B.timeSliderThumb&&(B.timeSliderThumb.style.left=d+"px"))}B.durationText&&(B.durationText.innerHTML=_utils.timeFormat(P));B.elapsedText&&(a=_utils.timeFormat(S),B.elapsedText.innerHTML=a,ma!=a.length&&(b=!0,ma=a.length));b&&H()}function r(){for(var a=B.elements.childNodes,b,c,d=0;d<a.length;d++){var e=a[d].childNodes,
  550. f;for(f in e)isNaN(parseInt(f,10))||(0===e[f].id.indexOf(I.id+"_divider")&&c&&0===c.id.indexOf(I.id+"_divider")&&e[f].style.backgroundImage==c.style.backgroundImage?e[f].style.display="none":0===e[f].id.indexOf(I.id+"_divider")&&(b&&"none"!=b.style.display)&&(e[f].style.display="block"),"none"!=e[f].style.display&&(c=e[f]),b=e[f])}}function H(){r();y.jwGetFullscreen()?(_show(B.normalscreenButton),_hide(B.fullscreenButton)):(_hide(B.normalscreenButton),_show(B.fullscreenButton));y.jwGetState()==a.api.events.state.BUFFERING||
  551. y.jwGetState()==a.api.events.state.PLAYING?(_show(B.pauseButton),_hide(B.playButton)):(_hide(B.pauseButton),_show(B.playButton));!0==y.jwGetMute()?(_hide(B.muteButton),_show(B.unmuteButton),_hide(B.volumeSliderProgress)):(_show(B.muteButton),_hide(B.unmuteButton),_show(B.volumeSliderProgress));var b={width:X},c={"float":"left",styleFloat:"left",cssFloat:"left"};if(J.position==a.html5.view.positions.OVER||y.jwGetFullscreen())b.left=J.margin,b.width-=2*J.margin,b.top=T-e().height-J.margin,b.height=
  552. e().height;var d=y.skin.getSkinElement("controlbar","capLeft"),f=y.skin.getSkinElement("controlbar","capRight");c.width=b.width-(d?d.width:0)-(f?f.width:0);var d=_utils.getBoundingClientRect(B.leftGroup).width,f=_utils.getBoundingClientRect(B.rightGroup).width,f=d=c.width-d-f-1,n=y.skin.getSkinElement("controlbar","timeSliderCapLeft"),g=y.skin.getSkinElement("controlbar","timeSliderCapRight");_utils.exists(n)&&(f-=n.width);_utils.exists(g)&&(f-=g.width);B.timeSlider.style.width=d+"px";B.timeSliderRail.style.width=
  553. f+"px";_css(I,b);_css(B.elements,c);_css(B.background,c);m();return b}function M(a){if(_utils.exists(B.volumeSliderRail)){var b=isNaN(a.volume/100)?1:a.volume/100;a=_utils.parseDimension(B.volumeSliderRail.style.width);b=isNaN(Math.round(a*b))?0:Math.round(a*b);_utils.parseDimension(B.volumeSliderRail.style.right);var c=!_utils.exists(y.skin.getSkinElement("controlbar","volumeSliderCapLeft"))?0:y.skin.getSkinElement("controlbar","volumeSliderCapLeft").width;_css(B.volumeSliderProgress,{width:b,left:c});
  554. B.volumeSliderThumb&&(b-=Math.round(_utils.parseDimension(B.volumeSliderThumb.style.width)/2),b=Math.min(Math.max(b,0),a-_utils.parseDimension(B.volumeSliderThumb.style.width)),_css(B.volumeSliderThumb,{left:b}));_utils.exists(B.volumeSliderCapLeft)&&_css(B.volumeSliderCapLeft,{left:0})}}function L(){try{var a=0<y.id.indexOf("_instream")?y.id.replace("_instream",""):y.id;qa=document.getElementById(a);qa.addEventListener("mousemove",l)}catch(b){_utils.log("Could not add mouse listeners to controlbar: "+
  555. b)}}function A(){f();w();m();N=!0;y.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,v);y.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_ITEM,x);y.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_BUFFER,E);y.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,F);y.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_TIME,G);y.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_MUTE,s);y.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_VOLUME,M);y.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_COMPLETE,
  556. z);J.idlehide="true"==J.idlehide.toString().toLowerCase();J.position==a.html5.view.positions.OVER&&J.idlehide?(I.style.opacity=0,ga=!0):(I.style.opacity=1,setTimeout(function(){ga=!0;ca()},1));L();n()}window.controlbar=this;var y=c,J=_utils.extend({},b,y.skin.getComponentSettings("controlbar"),d);if(!(J.position==a.html5.view.positions.NONE||"undefined"==typeof a.html5.view.positions[J.position])){0<_utils.mapLength(y.skin.getComponentLayout("controlbar"))&&(J.layout=y.skin.getComponentLayout("controlbar"));
  557. var I,U,O="none",Q,S,P,V,X,T,B={},N=!1,W={},ma=-1,ea,aa=!1,fa,la,ga=!1,pa=!1,qa,na=new a.html5.eventdispatcher;_utils.extend(this,na);this.getDisplayElement=function(){return I};this.resize=function(a,b){L();_utils.cancelAnimation(I);X=a;T=b;pa!=y.jwGetFullscreen()&&((pa=y.jwGetFullscreen())||l(),la=void 0);var c=H();G({id:y.id,duration:P,position:S});E({id:y.id,bufferPercent:V});return c};this.show=function(){aa&&(aa=!1,_show(I),ca())};this.hide=function(){aa||(aa=!0,_hide(I),Y())};var ha,ca=g(a.api.events.JWPLAYER_COMPONENT_SHOW),
  558. Y=g(a.api.events.JWPLAYER_COMPONENT_HIDE);A();return this}}})(jwplayer);(function(a){var b=a.utils;a.html5.controller=function(c,d,e,f){function m(){try{z=m;if(!s&&(s=!0,H.sendEvent(a.api.events.JWPLAYER_MEDIA_BEFOREPLAY),s=!1,F)){F=!1;z=null;return}p(n.item);0<n.playlist[n.item].levels[0].file.length&&(C||n.state==a.api.events.state.IDLE?(n.getMedia().load(n.playlist[n.item]),C=!1):n.state==a.api.events.state.PAUSED&&n.getMedia().play());return!0}catch(b){H.sendEvent(a.api.events.JWPLAYER_ERROR,
  559. b),z=null}return!1}function l(c){z=null;b.exists(c)||(c=!0);try{return(n.state!=a.api.events.state.IDLE||c)&&n.getMedia()&&n.getMedia().stop(c),s&&(F=!0),!0}catch(d){H.sendEvent(a.api.events.JWPLAYER_ERROR,d)}return!1}function u(){try{0<n.playlist[n.item].levels[0].file.length&&(n.config.shuffle?p(h()):n.item+1==n.playlist.length?p(0):p(n.item+1));if(n.state!=a.api.events.state.IDLE){var b=n.state;n.state=a.api.events.state.IDLE;H.sendEvent(a.api.events.JWPLAYER_PLAYER_STATE,{oldstate:b,newstate:a.api.events.state.IDLE})}m();
  560. return!0}catch(c){H.sendEvent(a.api.events.JWPLAYER_ERROR,c)}return!1}function h(){var a=null;if(1<n.playlist.length)for(;!b.exists(a);)a=Math.floor(Math.random()*n.playlist.length),a==n.item&&(a=null);else a=0;return a}function g(b){if(!n.playlist||!n.playlist[b])return!1;try{return 0<n.playlist[b].levels[0].file.length&&(n.state!==a.api.events.state.IDLE&&(n.playlist[n.item]&&n.playlist[n.item].provider==n.playlist[b].provider?l(!1):l()),p(b),m()),!0}catch(c){H.sendEvent(a.api.events.JWPLAYER_ERROR,
  561. c)}return!1}function p(b){n.playlist[b]&&(n.setActiveMediaProvider(n.playlist[b]),n.item!=b&&(n.item=b,C=!0,H.sendEvent(a.api.events.JWPLAYER_PLAYLIST_ITEM,{index:b})))}function w(b,c){try{return"undefined"==typeof b&&(b=!n.fullscreen),"undefined"==typeof c&&(c=!0),b!=n.fullscreen&&(n.fullscreen="true"==b.toString().toLowerCase(),D.fullscreen(n.fullscreen),c&&H.sendEvent(a.api.events.JWPLAYER_FULLSCREEN,{fullscreen:n.fullscreen}),H.sendEvent(a.api.events.JWPLAYER_RESIZE,{width:n.width,height:n.height})),
  562. !0}catch(d){H.sendEvent(a.api.events.JWPLAYER_ERROR,d)}return!1}function t(a){b.isIOS()||(p(n.item),"true"==n.config.autostart.toString().toLowerCase()&&!b.isIOS()&&m())}function q(){if(n.state==a.api.events.state.IDLE)switch(z=q,n.config.repeat.toUpperCase()){case a.html5.controller.repeatoptions.SINGLE:m();break;case a.html5.controller.repeatoptions.ALWAYS:n.item==n.playlist.length-1&&!n.config.shuffle?g(0):u();break;case a.html5.controller.repeatoptions.LIST:n.item==n.playlist.length-1&&!n.config.shuffle?
  563. (l(),p(0)):u();break;default:l()}}function v(a){return function(){r?x(a,arguments):M.push({method:a,arguments:arguments})}}function x(a,b){var c=[];for(i=0;i<b.length;i++)c.push(b[i]);a.apply(this,c)}var n=e,D=f,C=!0,E=-1,s=!1,F=!1,z,G=[],r=!1;c=b.exists(n.config.debug)&&"console"==n.config.debug.toString().toLowerCase();var H=new a.html5.eventdispatcher(d.id,c);b.extend(this,H);n.addGlobalListener(function(a){r?H.sendEvent(a.type,a):G.push(a)});n.addEventListener(a.api.events.JWPLAYER_MEDIA_BUFFER_FULL,
  564. function(){n.getMedia().play()});n.addEventListener(a.api.events.JWPLAYER_MEDIA_TIME,function(a){a.position>=n.playlist[n.item].start&&0<=E&&(n.playlist[n.item].start=E,E=-1)});n.addEventListener(a.api.events.JWPLAYER_MEDIA_COMPLETE,function(a){setTimeout(q,25)});n.addEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,t);n.addEventListener(a.api.events.JWPLAYER_FULLSCREEN,function(a){w(a.fullscreen,!1)});a.html5.controller.repeatoptions={LIST:"LIST",ALWAYS:"ALWAYS",SINGLE:"SINGLE",NONE:"NONE"};var M=
  565. [];this.play=v(m);this.pause=v(function(){try{if(0<n.playlist[n.item].levels[0].file.length)switch(n.state){case a.api.events.state.PLAYING:case a.api.events.state.BUFFERING:n.getMedia()&&n.getMedia().pause();break;default:s&&(F=!0)}return!0}catch(b){H.sendEvent(a.api.events.JWPLAYER_ERROR,b)}return!1});this.seek=v(function(b){try{if(0<n.playlist[n.item].levels[0].file.length)switch("number"!=typeof b&&(b=parseFloat(b)),n.state){case a.api.events.state.IDLE:0>E&&(E=n.playlist[n.item].start,n.playlist[n.item].start=
  566. b);s||m();break;case a.api.events.state.PLAYING:case a.api.events.state.PAUSED:case a.api.events.state.BUFFERING:n.seek(b)}return!0}catch(c){H.sendEvent(a.api.events.JWPLAYER_ERROR,c)}return!1});this.stop=v(l);this.next=v(u);this.prev=v(function(){try{0<n.playlist[n.item].levels[0].file.length&&(n.config.shuffle?p(h()):0===n.item?p(n.playlist.length-1):p(n.item-1));if(n.state!=a.api.events.state.IDLE){var b=n.state;n.state=a.api.events.state.IDLE;H.sendEvent(a.api.events.JWPLAYER_PLAYER_STATE,{oldstate:b,
  567. newstate:a.api.events.state.IDLE})}m();return!0}catch(c){H.sendEvent(a.api.events.JWPLAYER_ERROR,c)}return!1});this.item=v(g);this.setVolume=v(function(b){try{p(n.item);var c=n.getMedia();switch(typeof b){case "number":c.volume(b);break;case "string":c.volume(parseInt(b,10))}n.setVolume(b);return!0}catch(d){H.sendEvent(a.api.events.JWPLAYER_ERROR,d)}return!1});this.setMute=v(function(b){try{p(n.item);var c=n.getMedia();"undefined"==typeof b?(c.mute(!n.mute),n.setMute(!n.mute)):"true"==b.toString().toLowerCase()?
  568. (c.mute(!0),n.setMute(!0)):(c.mute(!1),n.setMute(!1));return!0}catch(d){H.sendEvent(a.api.events.JWPLAYER_ERROR,d)}return!1});this.resize=v(function(b,c){try{return n.width=b,n.height=c,D.resize(b,c),H.sendEvent(a.api.events.JWPLAYER_RESIZE,{width:n.width,height:n.height}),!0}catch(d){H.sendEvent(a.api.events.JWPLAYER_ERROR,d)}return!1});this.setFullscreen=v(w);this.load=v(function(c){try{if(l(),s&&(F=!1),n.loadPlaylist(c),n.playlist[n.item].provider)return p(n.item),"true"==n.config.autostart.toString().toLowerCase()&&
  569. (!b.isIOS()&&!s)&&m(),!0}catch(d){H.sendEvent(a.api.events.JWPLAYER_ERROR,d)}return!1});this.playerReady=function(b){if(!r){r=!0;H.sendEvent(a.api.events.JWPLAYER_READY,b);a.utils.exists(window.playerReady)&&playerReady(b);if(a.utils.exists(window[e.config.playerReady]))window[e.config.playerReady](b);for(;0<G.length;)b=G.shift(),H.sendEvent(b.type,b);for(e.config.autostart&&!a.utils.isIOS()&&t();0<M.length;)b=M.shift(),x(b.method,b.arguments)}};this.detachMedia=function(){try{return n.getMedia().detachMedia()}catch(a){return null}};
  570. this.attachMedia=function(){try{n.getMedia().attachMedia(),"function"==typeof z&&z()}catch(a){return null}};this.beforePlay=function(){return s};this.destroy=function(){n.getMedia()&&n.getMedia().destroy()}}})(jwplayer);(function(a){a.html5.defaultSkin=function(){this.text='<?xml version="1.0" ?><skin author="LongTail Video" name="Five" version="1.1"><components><component name="controlbar"><settings><setting name="margin" value="20"/><setting name="fontsize" value="11"/><setting name="fontcolor" value="0x000000"/></settings><layout><group position="left"><button name="play"/><divider name="divider"/><button name="prev"/><divider name="divider"/><button name="next"/><divider name="divider"/><text name="elapsed"/></group><group position="center"><slider name="time"/></group><group position="right"><text name="duration"/><divider name="divider"/><button name="blank"/><divider name="divider"/><button name="mute"/><slider name="volume"/><divider name="divider"/><button name="fullscreen"/></group></layout><elements><element name="background" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAIAAABvFaqvAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAElJREFUOI3t1LERACAMQlFgGvcfxNIhHMK4gsUvUviOmgtNsiAZkBSEKxKEnCYkkQrJn/YwbUNiSDDYRZaQRDaShv+oX9GBZEIuK+8hXVLs+/YAAAAASUVORK5CYII="/><element name="blankButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAYCAYAAAAyJzegAAAAFElEQVQYV2P8//8/AzpgHBUc7oIAGZdH0RjKN8EAAAAASUVORK5CYII="/><element name="capLeft" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAYCAYAAAA7zJfaAAAAQElEQVQIWz3LsRGAMADDQJ0XB5bMINABZ9GENGrszxhjT2WLSqxEJG2JQrTMdV2q5LpOAvyRaVmsi7WdeZ/7+AAaOTq7BVrfOQAAAABJRU5ErkJggg=="/><element name="capRight" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAYCAYAAAA7zJfaAAAAQElEQVQIWz3LsRGAMADDQJ0XB5bMINABZ9GENGrszxhjT2WLSqxEJG2JQrTMdV2q5LpOAvyRaVmsi7WdeZ/7+AAaOTq7BVrfOQAAAABJRU5ErkJggg=="/><element name="divider" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAYCAIAAAC0rgCNAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADhJREFUCB0FwcENgEAAw7Aq+893g8APUILNOQcbFRktVGqUVFRkWNz3xTa2sUaLNUosKlRUvvf5AdbWOTtzmzyWAAAAAElFTkSuQmCC"/><element name="playButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAYCAYAAAAVibZIAAAANUlEQVR42u2RsQkAAAjD/NTTPaW6dXLrINJA1kBpGPMAjDWmOgp1HFQXx+b1KOefO4oxY57R73YnVYCQUCQAAAAASUVORK5CYII="/><element name="pauseButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAYCAYAAAAVibZIAAAAIUlEQVQ4jWNgGAWjYOiD/0gYG3/U0FFDB4Oho2AUDAYAAEwiL9HrpdMVAAAAAElFTkSuQmCC"/><element name="prevButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAYCAYAAAAVibZIAAAAQklEQVQ4y2NgGAWjYOiD/1AMA/JAfB5NjCJD/YH4PRaLyDa0H4lNNUP/DxlD59PCUBCIp3ZEwYA+NZLUKBgFgwEAAN+HLX9sB8u8AAAAAElFTkSuQmCC"/><element name="nextButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAYCAYAAAAVibZIAAAAQElEQVQ4y2NgGAWjYOiD/0B8Hojl0cT+U2ooCL8HYn9qGwrD/bQw9P+QMXQ+tSMqnpoRBUpS+tRMUqNgFAwGAADxZy1/mHvFnAAAAABJRU5ErkJggg=="/><element name="timeSliderRail" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAOElEQVRIDe3BwQkAIRADwAhhw/nU/kWwUK+KPITMABFh19Y+F0acY8CJvX9wYpXgRElwolSIiMf9ZWEDhtwurFsAAAAASUVORK5CYII="/><element name="timeSliderBuffer" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAN0lEQVRIDe3BwQkAMQwDMBcc55mRe9zi7RR+FCwBEWG39vcfGHFm4MTuhhMlwYlVBSdKhYh43AW/LQMKm1spzwAAAABJRU5ErkJggg=="/><element name="timeSliderProgress" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAIElEQVRIiWNgGAWjYBTQBfynMR61YCRYMApGwSigMQAAiVWPcbq6UkIAAAAASUVORK5CYII="/><element name="timeSliderThumb" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAYCAYAAAA/OUfnAAAAO0lEQVQYlWP4//8/Awwz0JgDBP/BeN6Cxf/hnI2btiI4u/fsQ3AOHjqK4Jw4eQbBOX/hEoKDYjSd/AMA4cS4mfLsorgAAAAASUVORK5CYII="/><element name="muteButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAYCAYAAADKx8xXAAAAJklEQVQ4y2NgGAUjDcwH4v/kaPxPikZkxcNVI9mBQ5XoGAWDFwAAsKAXKQQmfbUAAAAASUVORK5CYII="/><element name="unmuteButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAYCAYAAADKx8xXAAAAMklEQVQ4y2NgGAWDHPyntub5xBr6Hwv/Pzk2/yfVG/8psRFE25Oq8T+tQnsIaB4FVAcAi2YVysVY52AAAAAASUVORK5CYII="/><element name="volumeSliderRail" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAgMAAACdGdVrAAAACVBMVEUAAACmpqampqbBXAu8AAAAAnRSTlMAgJsrThgAAAArSURBVAhbY2AgErBAyA4I2QEhOyBkB4TsYOhAoaCCUCUwDTDtMMNgRuMHAFB5FoGH5T0UAAAAAElFTkSuQmCC"/><element name="volumeSliderProgress" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAgMAAACdGdVrAAAACVBMVEUAAAAAAAAAAACDY+nAAAAAAnRSTlMAgJsrThgAAAArSURBVAhbY2AgErBAyA4I2QEhOyBkB4TsYOhAoaCCUCUwDTDtMMNgRuMHAFB5FoGH5T0UAAAAAElFTkSuQmCC"/><element name="volumeSliderCapRight" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAYCAYAAAAyJzegAAAAFElEQVQYV2P8//8/AzpgHBUc7oIAGZdH0RjKN8EAAAAASUVORK5CYII="/><element name="fullscreenButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAQklEQVRIiWNgGAWjYMiD/0iYFDmSLbDHImdPLQtgBpEiR7Zl2NijAA5oEkT/0Whi5UiyAJ8BVMsHNMtoo2AUDAIAAGdcIN3IDNXoAAAAAElFTkSuQmCC"/><element name="normalscreenButton" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAP0lEQVRIx2NgGAWjYMiD/1RSQ5QB/wmIUWzJfzx8qhj+n4DYCAY0DyJ7PBbYU8sHMEvwiZFtODXUjIJRMJgBACpWIN2ZxdPTAAAAAElFTkSuQmCC"/></elements></component><component name="display"><elements><element name="background" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyAQMAAAAk8RryAAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlOZpuml+rYAAAASSURBVBhXY2AYJuA/GBwY6jQAyDyoK8QcL4QAAAAASUVORK5CYII="/><element name="playIcon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAiUlEQVR42u3XSw2AMBREURwgAQlIQAISKgUpSEFKJeCg5b0E0kWBTVcD9ySTsL0Jn9IBAAAA+K2UUrBlW/Rr5ZDoIeeuoFkxJD9ss03aIXXQqB9SttoG7ZA6qNcOKdttiwcJh9RB+iFl4SshkRBuLR72+9cvH0SOKI2HRo7x/Fi1/uoCAAAAwLsD8ki99IlO2dQAAAAASUVORK5CYII="/><element name="muteIcon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAVUlEQVR42u3WMQrAIAxAUW/g/SdvGmvpoOBeSHgPsjj5QTANAACARCJilIhYM0tEvJM+Ik3Id9E957kQIb+F3OdCPC0hPkQriqWx9hp/x/QGAABQyAPLB22VGrpLDgAAAABJRU5ErkJggg=="/><element name="errorIcon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAA/0lEQVR42u2U0QmEMBAF7cASLMESUoIlpARLSCkpwRJSgiWkhOvAXD4WsgRkyaG5DbyB+Yvg8KITAAAAAAAYk+u61mwk15EjPtlEfihmqIiZR1Qx80ghjgdUuiHXGHSVsoag0x6x8DUoyjD5KovmEJ9NTDMRPIT0mtdIUkjlonuNohO+Ha99DTmkuGgKCTcvebAzx82ZoCWC3/3aIMWSRucaxcjORSFY4xpFdjYJGp1rFGcyCYZ/RVh6AUnfcNZ2zih3/mGj1jVCdiNDwyrq1rA/xMdeEXvDVdnYc1vDc3uPkDObXrlaxbNHSOohQhr/WOeLEWfWTgAAAAAAADzNF9sHJ7PJ57MlAAAAAElFTkSuQmCC"/><element name="bufferIcon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAACBklEQVR42u3Zv0sCYRzH8USTzOsHHEWGkC1HgaDgkktGDjUYtDQ01RDSljQ1BLU02+rk1NTm2NLq4Nx/0L/h9fnCd3j4cnZe1/U8xiO8h3uurufF0/3COd/3/0UWYiEWYiEWYiGJQ+J8xuPxKhXjEMZANinjIZhkGuVRNioE4wVURo4JkHm0xKWmhRAc1bh1EyCUw5BcBIjHiApKa4CErko6DEJwuRo6IRKzyJD8FJAyI3Zp2zRImiBcRhlfo5RtlxCcE3CcDNpGrhYIT2IhAJKilO0VRmzJ32fAMTpBTS0QMfGwlcuKMRftE0DJ0wCJdcOsCkBdXP3Mh9CEFUBTPS9mDZJBG6io4aqVzMdCokCw9H3kT6j/C/9iDdSeUMNC7DkyyxAs/Rk6Qss8FPWRZgdVtUH4DjxEn1zxh+/zj1wHlf4MQhNGrwqA6sY40U8JonRJwEQh+AO3AvCG6gHv4U7IY4krxkroWoAOkoQMGfCBrgIm+YBGqPENpIJ66CJg3x66Y0gnSUidAEEnNr9jjLiWMn5DiWP0OC/oAsCgkq43xBdGDMQr7YASP/vEkHvdl1+JOCcEV5sC4hGEOzTlPuKgd0b0xD4JkRcOgnRRTjdErkYhAsQVq6IdUuPJtmk7BCL3t/h88cx91pKQkI/pkDx6pmYTIjEoxiHsN1YWYiEWYiEWknhflZ5IErA5nr8AAAAASUVORK5CYII="/></elements></component><component name="dock"><settings><setting name="fontcolor" value="0xffffff"/></settings><elements><element name="button" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyAQMAAAAk8RryAAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlOZpuml+rYAAAASSURBVBhXY2AYJuA/GBwY6jQAyDyoK8QcL4QAAAAASUVORK5CYII="/></elements></component><component name="playlist"><settings><setting name="backgroundcolor" value="0xe8e8e8"/></settings><elements><element name="item" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAIAAAC1nk4lAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHBJREFUaN7t2MENwCAMBEEe9N8wSKYC/D8YV7CyJoRkVtVImxkZPQInMxoP0XiIxkM0HsGbjjSNBx544IEHHnjggUe/6UQeey0PIh7XTftGxKPj4eXCtLsHHh+ZxkO0Iw8PR55Ni8ZD9Hu/EAoP0dc5RRg9qeRjVF8AAAAASUVORK5CYII="/><element name="sliderCapTop" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAHCAYAAADnCQYGAAAAFUlEQVQokWP8//8/A7UB46ihI9hQAKt6FPPXhVGHAAAAAElFTkSuQmCC"/><element name="sliderRail" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAUCAYAAABiS3YzAAAAKElEQVQ4y2P4//8/Az68bNmy/+iYkB6GUUNHDR01dNTQUUNHDaXcUABUDOKhcxnsSwAAAABJRU5ErkJggg=="/><element name="sliderThumb" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAUCAYAAABiS3YzAAAAJUlEQVQ4T2P4//8/Ay4MBP9xYbz6Rg0dNXTU0FFDRw0dNZRyQwHH4NBa7GJsXAAAAABJRU5ErkJggg=="/><element name="sliderCapBottom" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAHCAYAAADnCQYGAAAAFUlEQVQokWP8//8/A7UB46ihI9hQAKt6FPPXhVGHAAAAAElFTkSuQmCC"/></elements></component></components></skin>';
  571. this.xml=null;window.DOMParser?(parser=new DOMParser,this.xml=parser.parseFromString(this.text,"text/xml")):(this.xml=new ActiveXObject("Microsoft.XMLDOM"),this.xml.async="false",this.xml.loadXML(this.text));return this}})(jwplayer);(function(a){_utils=a.utils;_css=_utils.css;_hide=function(a){_css(a,{display:"none"})};_show=function(a){_css(a,{display:"block"})};a.html5.display=function(b,c){function d(b){E=n.display_image.naturalWidth;s=n.display_image.naturalHeight;e();if(x.jwGetState()==a.api.events.state.IDLE||
  572. "sound"==x.jwGetPlaylist()[x.jwGetPlaylistIndex()].provider)_css(n.display_image,{display:"block",opacity:0}),_utils.fadeTo(n.display_image,1,0.1);J=!1}function e(){if(x.jwGetFullscreen()&&x.jwGetStretching()==a.utils.stretching.EXACTFIT){var b=document.createElement("div");_utils.stretch(a.utils.stretching.UNIFORM,b,D,C,P,V);_utils.stretch(a.utils.stretching.EXACTFIT,n.display_image,_utils.parseDimension(b.style.width),_utils.parseDimension(b.style.height),E,s);_css(n.display_image,{left:b.style.left,
  573. top:b.style.top})}else _utils.stretch(x.jwGetStretching(),n.display_image,D,C,E,s)}function f(a,b){var c=document.createElement(a);c.id=x.id+"_jwplayer_"+b;_css(c,T[b].style);return c}function m(){for(var a in n)_utils.exists(T[a].click)&&(n[a].onclick=T[a].click)}function l(a){G?u():(n.display_icon.style.backgroundImage=["url(",x.skin.getSkinElement("display",a).src,")"].join(""),_css(n.display_icon,{width:x.skin.getSkinElement("display",a).width,height:x.skin.getSkinElement("display",a).height,
  574. top:(x.skin.getSkinElement("display","background").height-x.skin.getSkinElement("display",a).height)/2,left:(x.skin.getSkinElement("display","background").width-x.skin.getSkinElement("display",a).width)/2}),!O&&"true"==v.icons.toString()&&(_show(n.display_icon),_show(n.display_iconBackground),B()),_utils.exists(x.skin.getSkinElement("display",a+"Over"))?(n.display_icon.onmouseover=function(b){n.display_icon.style.backgroundImage=["url(",x.skin.getSkinElement("display",a+"Over").src,")"].join("")},
  575. n.display_icon.onmouseout=function(b){n.display_icon.style.backgroundImage=["url(",x.skin.getSkinElement("display",a).src,")"].join("")}):(n.display_icon.onmouseover=null,n.display_icon.onmouseout=null))}function u(){"true"==v.icons.toString()&&(_hide(n.display_icon),_hide(n.display_iconBackground),N())}function h(){I=!1;n.display_image.style.display="none"}function g(b){if((b.type==a.api.events.JWPLAYER_PLAYER_STATE||b.type==a.api.events.JWPLAYER_PLAYLIST_ITEM)&&G)G=!1,_hide(n.display_text);b=x.jwGetState();
  576. b!=L&&(L=b,0<=M&&clearTimeout(M),A||x.jwGetState()==a.api.events.state.PLAYING||x.jwGetState()==a.api.events.state.PAUSED?w(x.jwGetState()):M=setTimeout(p(x.jwGetState()),500))}function p(a){return function(){w(a)}}function w(b){_utils.exists(z)&&(clearInterval(z),z=null,_utils.animations.rotate(n.display_icon,0));switch(b){case a.api.events.state.BUFFERING:_utils.isIPod()?(h(),u()):("sound"==x.jwGetPlaylist()[x.jwGetPlaylistIndex()].provider&&t(),F=0,z=setInterval(function(){F+=r;_utils.animations.rotate(n.display_icon,
  577. F%360)},H),l("bufferIcon"),A=!0);break;case a.api.events.state.PAUSED:_utils.isIPod()||("sound"!=x.jwGetPlaylist()[x.jwGetPlaylistIndex()].provider&&_css(n.display_image,{background:"transparent no-repeat center center"}),l("playIcon"),A=!0);break;case a.api.events.state.IDLE:x.jwGetPlaylist()[x.jwGetPlaylistIndex()]&&x.jwGetPlaylist()[x.jwGetPlaylistIndex()].image?t():h();l("playIcon");A=!0;break;default:x.jwGetPlaylist()[x.jwGetPlaylistIndex()]&&"sound"==x.jwGetPlaylist()[x.jwGetPlaylistIndex()].provider?
  578. _utils.isIPod()?(h(),A=!1):t():(h(),A=!1),x.jwGetMute()&&v.showmute?l("muteIcon"):u()}M=-1}function t(){if(x.jwGetPlaylist()[x.jwGetPlaylistIndex()]){var a=x.jwGetPlaylist()[x.jwGetPlaylistIndex()].image;a&&(a!=U?(U=a,J=!0,n.display_image.src=_utils.getAbsolutePath(a)):!J&&!I&&(I=!0,n.display_image.style.opacity=0,n.display_image.style.display="block",_utils.fadeTo(n.display_image,1,0.1)))}}function q(a){return function(){Q&&(!O&&y!=a)&&(y=a,X.sendEvent(a,{component:"display",boundingRect:_utils.getDimensions(n.display_iconBackground)}))}}
  579. var v=_utils.extend({},{icons:!0,showmute:!1},c),x=b,n={},D,C,E,s,F,z,G,r=!_utils.exists(x.skin.getComponentSettings("display").bufferrotation)?15:parseInt(x.skin.getComponentSettings("display").bufferrotation,10),H=!_utils.exists(x.skin.getComponentSettings("display").bufferinterval)?100:parseInt(x.skin.getComponentSettings("display").bufferinterval,10),M=-1,L=a.api.events.state.IDLE,A=!0,y,J=!1,I=!0,U="",O=!1,Q=!1,S,P,V,X=new a.html5.eventdispatcher;_utils.extend(this,X);var T={display:{style:{cursor:"pointer",
  580. top:0,left:0,overflow:"hidden"},click:function(b){"undefined"!=typeof b.preventDefault?b.preventDefault():b.returnValue=!1;"function"==typeof S?S(b):x.jwGetState()!=a.api.events.state.PLAYING?x.jwPlay():x.jwPause()}},display_icon:{style:{cursor:"pointer",position:"absolute",top:(x.skin.getSkinElement("display","background").height-x.skin.getSkinElement("display","playIcon").height)/2,left:(x.skin.getSkinElement("display","background").width-x.skin.getSkinElement("display","playIcon").width)/2,border:0,
  581. margin:0,padding:0,zIndex:3,display:"none"}},display_iconBackground:{style:{cursor:"pointer",position:"absolute",top:(C-x.skin.getSkinElement("display","background").height)/2,left:(D-x.skin.getSkinElement("display","background").width)/2,border:0,backgroundImage:["url(",x.skin.getSkinElement("display","background").src,")"].join(""),width:x.skin.getSkinElement("display","background").width,height:x.skin.getSkinElement("display","background").height,margin:0,padding:0,zIndex:2,display:"none"}},display_image:{style:{display:"none",
  582. width:D,height:C,position:"absolute",cursor:"pointer",left:0,top:0,margin:0,padding:0,textDecoration:"none",zIndex:1}},display_text:{style:{zIndex:4,position:"relative",opacity:0.8,backgroundColor:0,color:16777215,textAlign:"center",fontFamily:"Arial,sans-serif",padding:"0 5px",fontSize:14}}};x.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,g);x.jwAddEventListener(a.api.events.JWPLAYER_MEDIA_MUTE,g);x.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,function(){L=""});x.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_ITEM,
  583. g);x.jwAddEventListener(a.api.events.JWPLAYER_ERROR,function(a){G=!0;u();n.display_text.innerHTML=a.message;_show(n.display_text);n.display_text.style.top=(C-_utils.getBoundingClientRect(n.display_text).height)/2+"px"});(function(){n.display=f("div","display");n.display_text=f("div","display_text");n.display.appendChild(n.display_text);n.display_image=f("img","display_image");n.display_image.onerror=function(a){_hide(n.display_image)};n.display_image.onload=d;n.display_icon=f("div","display_icon");
  584. n.display_iconBackground=f("div","display_iconBackground");n.display.appendChild(n.display_image);n.display_iconBackground.appendChild(n.display_icon);n.display.appendChild(n.display_iconBackground);m();setTimeout(function(){Q=!0;"true"==v.icons.toString()&&B()},1)})();this.getDisplayElement=function(){return n.display};this.resize=function(a,b){if(!x.jwGetFullscreen()||!_utils.isMobile()){_css(n.display,{width:a,height:b});_css(n.display_text,{width:a-10,top:(b-_utils.getBoundingClientRect(n.display_text).height)/
  585. 2});_css(n.display_iconBackground,{top:(b-x.skin.getSkinElement("display","background").height)/2,left:(a-x.skin.getSkinElement("display","background").width)/2});if(D!=a||C!=b)D=a,C=b,y=void 0,B();x.jwGetFullscreen()||(P=a,V=b);e();g({})}};this.show=function(){O&&(O=!1,w(x.jwGetState()))};this.hide=function(){O||(u(),O=!0)};var B=q(a.api.events.JWPLAYER_COMPONENT_SHOW),N=q(a.api.events.JWPLAYER_COMPONENT_HIDE);this.setAlternateClickHandler=function(a){S=a};this.revertAlternateClickHandler=function(){S=
  586. void 0};return this}})(jwplayer);(function(a){var b=a.utils,c=b.css;a.html5.dock=function(d,e){function f(a){return"url("+a+") no-repeat center center"}function m(c,e){w();if(0<v.length){var f=10,g=-1,l=d.skin.getSkinElement("dock","button").height,h=d.skin.getSkinElement("dock","button").width,m=c-h-10,p,r;t.align==a.html5.view.positions.LEFT&&(g=1,m=10);for(var z=0;z<v.length;z++){var F=Math.floor(f/e);f+l+10>(F+1)*e&&(f=(F+1)*e+10,F=Math.floor(f/e));var u=q[v[z]].div;u.style.top=f%e+"px";u.style.left=
  587. m+(d.skin.getSkinElement("dock","button").width+10)*F*g+"px";F={x:b.parseDimension(u.style.left),y:b.parseDimension(u.style.top),width:h,height:l};if(!p||F.x<=p.x&&F.y<=p.y)p=F;if(!r||F.x>=r.x&&F.y>=r.y)r=F;u.style.width=h+"px";u.style.height=l+"px";f+=d.skin.getSkinElement("dock","button").height+10}E={x:p.x,y:p.y,width:r.x-p.x+r.width,height:p.y-r.y+r.height}}if(C!=d.jwGetFullscreen()||x!=c||n!=e)x=c,n=e,C=d.jwGetFullscreen(),s=void 0,setTimeout(H,1)}function l(a){return function(){!D&&(s!=a&&0<
  588. v.length)&&(s=a,G.sendEvent(a,{component:"dock",boundingRect:E}))}}function u(c){b.isMobile()?c.newstate==a.api.events.state.IDLE?L():A():h()}function h(c){if(!D)if(clearTimeout(z),e.position==a.html5.view.positions.OVER||d.jwGetFullscreen())switch(d.jwGetState()){case a.api.events.state.PAUSED:case a.api.events.state.IDLE:r&&(1>r.style.opacity&&(!e.idlehide||b.exists(c)))&&p();e.idlehide&&(z=setTimeout(function(){g()},2E3));break;default:b.exists(c)&&p(),z=setTimeout(function(){g()},2E3)}else p()}
  589. function g(){D||(M(),1==r.style.opacity&&(b.cancelAnimation(r),b.fadeTo(r,0,0.1,1,0)))}function p(){D||(H(),0==r.style.opacity&&(b.cancelAnimation(r),b.fadeTo(r,1,0.1,0,0)))}function w(){try{F=document.getElementById(d.id),F.addEventListener("mousemove",h)}catch(a){b.log("Could not add mouse listeners to dock: "+a)}}var t=b.extend({},{align:a.html5.view.positions.RIGHT},e);if("FALSE"!=t.align){var q={},v=[],x,n,D=!1,C=!1,E={x:0,y:0,width:0,height:0},s,F,z,G=new a.html5.eventdispatcher;b.extend(this,
  590. G);var r=document.createElement("div");r.id=d.id+"_jwplayer_dock";r.style.opacity=1;w();d.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,u);this.getDisplayElement=function(){return r};this.setButton=function(c,e,g,l){!e&&q[c]?(b.arrays.remove(v,c),r.removeChild(q[c].div),delete q[c]):e&&(q[c]||(q[c]={}),q[c].handler=e,q[c].outGraphic=g,q[c].overGraphic=l,q[c].div||(v.push(c),q[c].div=document.createElement("div"),q[c].div.style.position="absolute",r.appendChild(q[c].div),q[c].div.appendChild(document.createElement("div")),
  591. q[c].div.childNodes[0].style.position="relative",q[c].div.childNodes[0].style.width="100%",q[c].div.childNodes[0].style.height="100%",q[c].div.childNodes[0].style.zIndex=10,q[c].div.childNodes[0].style.cursor="pointer",q[c].div.appendChild(document.createElement("img")),q[c].div.childNodes[1].style.position="absolute",q[c].div.childNodes[1].style.left=0,q[c].div.childNodes[1].style.top=0,d.skin.getSkinElement("dock","button")&&(q[c].div.childNodes[1].src=d.skin.getSkinElement("dock","button").src),
  592. q[c].div.childNodes[1].style.zIndex=9,q[c].div.childNodes[1].style.cursor="pointer",q[c].div.onmouseover=function(){q[c].overGraphic&&(q[c].div.childNodes[0].style.background=f(q[c].overGraphic));d.skin.getSkinElement("dock","buttonOver")&&(q[c].div.childNodes[1].src=d.skin.getSkinElement("dock","buttonOver").src)},q[c].div.onmouseout=function(){q[c].outGraphic&&(q[c].div.childNodes[0].style.background=f(q[c].outGraphic));d.skin.getSkinElement("dock","button")&&(q[c].div.childNodes[1].src=d.skin.getSkinElement("dock",
  593. "button").src)},d.skin.getSkinElement("dock","button")&&(q[c].div.childNodes[1].src=d.skin.getSkinElement("dock","button").src)),q[c].outGraphic?q[c].div.childNodes[0].style.background=f(q[c].outGraphic):q[c].overGraphic&&(q[c].div.childNodes[0].style.background=f(q[c].overGraphic)),e&&(q[c].div.onclick=function(b){b.preventDefault();a(d.id).callback(c);q[c].overGraphic&&(q[c].div.childNodes[0].style.background=f(q[c].overGraphic));d.skin.getSkinElement("dock","button")&&(q[c].div.childNodes[1].src=
  594. d.skin.getSkinElement("dock","button").src)}));m(x,n)};var H=l(a.api.events.JWPLAYER_COMPONENT_SHOW),M=l(a.api.events.JWPLAYER_COMPONENT_HIDE);this.resize=m;var L=function(){c(r,{display:"block"});D&&(D=!1,H())},A=function(){c(r,{display:"none"});D||(M(),D=!0)};this.hide=A;this.show=L;return this}}})(jwplayer);(function(a){a.html5.eventdispatcher=function(b,c){var d=new a.events.eventdispatcher(c);a.utils.extend(this,d);this.sendEvent=function(c,f){a.utils.exists(f)||(f={});a.utils.extend(f,{id:b,
  595. version:a.version,type:c});d.sendEvent(c,f)}}})(jwplayer);(function(a){var b=a.utils;a.html5.instream=function(c,d,e,f){function m(a){z&&z&&G.sendEvent(a.type,a)}function l(a){z&&E.play()}function u(a){z&&setTimeout(function(){H.jwInstreamDestroy(!0)},10)}function h(a){a.metadata.width&&a.metadata.height&&v.resizeMedia()}function g(){var a=q.plugins.object.display.getDisplayElement().style;if(s){var c=q.plugins.object.controlbar.getDisplayElement().style;s.resize(b.parseDimension(a.width),b.parseDimension(a.height));
  596. _css(s.getDisplayElement(),b.extend({},c,{zIndex:1001,opacity:1}))}F&&(F.resize(b.parseDimension(a.width),b.parseDimension(a.height)),_css(F.getDisplayElement(),b.extend({},a,{zIndex:1E3})));v&&v.resizeMedia()}var p={controlbarseekable:"always",controlbarpausable:!0,controlbarstoppable:!0,playlistclickable:!0},w,t,q=d,v=e,x,n,D,C,E,s,F,z=!1,G,r,H=this;this.load=function(d,e){_fakemodel.setMute(q.mute);_fakemodel.setVolume(q.volume);z=!0;t=b.extend(p,e);w=a.html5.playlistitem(d);E||(E=new a.html5.mediavideo(_fakemodel,
  597. q.getMedia()?q.getMedia().getDisplayElement():q.container),E.addGlobalListener(m),E.addEventListener(a.api.events.JWPLAYER_MEDIA_META,h),E.addEventListener(a.api.events.JWPLAYER_MEDIA_COMPLETE,u),E.addEventListener(a.api.events.JWPLAYER_MEDIA_BUFFER_FULL,l));E.attachMedia();r=document.createElement("div");r.id=H.id+"_instream_container";f.detachMedia();x=E.getDisplayElement();C=q.playlist[q.item];D=c.jwGetState();(D==a.api.events.state.BUFFERING||D==a.api.events.state.PLAYING)&&x.pause();n=x.currentTime;
  598. F=new a.html5.display(H,b.extend({},q.plugins.config.display));F.setAlternateClickHandler(function(b){_fakemodel.state==a.api.events.state.PAUSED?H.jwInstreamPlay():z&&G.sendEvent(a.api.events.JWPLAYER_INSTREAM_CLICK,b)});r.appendChild(F.getDisplayElement());b.isMobile()||(s=new a.html5.controlbar(H,b.extend({},q.plugins.config.controlbar,{})),q.plugins.config.controlbar.position==a.html5.view.positions.OVER?r.appendChild(s.getDisplayElement()):q.plugins.object.controlbar.getDisplayElement().parentNode.appendChild(s.getDisplayElement()));
  599. v.setupInstream(r,x);g();E.load(w)};this.jwInstreamDestroy=function(b){if(z){z=!1;D!=a.api.events.state.IDLE?(E.load(C,!1),E.stop(!1)):E.stop(!0);E.detachMedia();v.destroyInstream();if(s)try{s.getDisplayElement().parentNode.removeChild(s.getDisplayElement())}catch(c){}G.sendEvent(a.api.events.JWPLAYER_INSTREAM_DESTROYED,{reason:b?"complete":"destroyed"});f.attachMedia();if(D==a.api.events.state.BUFFERING||D==a.api.events.state.PLAYING)x.play(),q.playlist[q.item]==C&&q.getMedia().seek(n)}};this.jwInstreamAddEventListener=
  600. function(a,b){G.addEventListener(a,b)};this.jwInstreamRemoveEventListener=function(a,b){G.removeEventListener(a,b)};this.jwInstreamPlay=function(){z&&E.play(!0)};this.jwInstreamPause=function(){z&&E.pause(!0)};this.jwInstreamSeek=function(a){z&&E.seek(a)};this.jwInstreamGetState=function(){return!z?void 0:_fakemodel.state};this.jwInstreamGetPosition=function(){return!z?void 0:_fakemodel.position};this.jwInstreamGetDuration=function(){return!z?void 0:_fakemodel.duration};this.playlistClickable=function(){return!z||
  601. "true"==t.playlistclickable.toString().toLowerCase()};this.jwPlay=function(a){"true"==t.controlbarpausable.toString().toLowerCase()&&this.jwInstreamPlay()};this.jwPause=function(a){"true"==t.controlbarpausable.toString().toLowerCase()&&this.jwInstreamPause()};this.jwStop=function(){"true"==t.controlbarstoppable.toString().toLowerCase()&&(this.jwInstreamDestroy(),c.jwStop())};this.jwSeek=function(a){switch(t.controlbarseekable.toLowerCase()){case "always":this.jwInstreamSeek(a);break;case "backwards":_fakemodel.position>
  602. a&&this.jwInstreamSeek(a)}};this.jwGetPosition=function(){};this.jwGetDuration=function(){};this.jwGetWidth=c.jwGetWidth;this.jwGetHeight=c.jwGetHeight;this.jwGetFullscreen=c.jwGetFullscreen;this.jwSetFullscreen=c.jwSetFullscreen;this.jwGetVolume=function(){return q.volume};this.jwSetVolume=function(a){E.volume(a);c.jwSetVolume(a)};this.jwGetMute=function(){return q.mute};this.jwSetMute=function(a){E.mute(a);c.jwSetMute(a)};this.jwGetState=function(){return _fakemodel.state};this.jwGetPlaylist=function(){return[w]};
  603. this.jwGetPlaylistIndex=function(){return 0};this.jwGetStretching=function(){return q.config.stretching};this.jwAddEventListener=function(a,b){G.addEventListener(a,b)};this.jwRemoveEventListener=function(a,b){G.removeEventListener(a,b)};this.skin=c.skin;this.id=c.id+"_instream";(function(){_fakemodel=new a.html5.model(this,q.getMedia()?q.getMedia().getDisplayElement():q.container,q);G=new a.html5.eventdispatcher;c.jwAddEventListener(a.api.events.JWPLAYER_RESIZE,g);c.jwAddEventListener(a.api.events.JWPLAYER_FULLSCREEN,
  604. g)})();return this}})(jwplayer);(function(a){var b={prefix:"",file:"",link:"",linktarget:"_top",margin:8,out:0.5,over:1,timeout:5,hide:!0,position:"bottom-left"};_css=a.utils.css;a.html5.logo=function(c,d){function e(a){"undefined"!=typeof a&&a.stopPropagation();w&&(u.jwPause(),u.jwSetFullscreen(!1),g.link&&window.open(g.link,g.linktarget))}function f(a){g.link&&w&&(p.style.opacity=g.out)}function m(a){w&&(p.style.opacity=g.over)}function l(){"true"==g.hide.toString()&&(p.style.display="block",p.style.opacity=
  605. 0,a.utils.fadeTo(p,g.out,0.1,parseFloat(p.style.opacity)),h=setTimeout(function(){w=!1;"true"==g.hide.toString()&&a.utils.fadeTo(p,0,0.1,parseFloat(p.style.opacity))},1E3*g.timeout));w=!0}var u=c,h,g,p,w=!1;(function(){if(b.prefix){var e=c.version.split(/\W/).splice(0,2).join("/");0>b.prefix.indexOf(e)&&(b.prefix+=e+"/")}d.position==a.html5.view.positions.OVER&&(d.position=b.position);try{0==window.location.href.indexOf("https")&&(b.prefix=b.prefix.replace("http://l.longtailvideo.com","https://securel.longtailvideo.com"))}catch(f){}g=
  606. a.utils.extend({},b,d)})();u.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,function(b){b.newstate==a.api.events.state.BUFFERING&&(clearTimeout(h),l())});(function(){p=document.createElement("img");p.id=u.id+"_jwplayer_logo";p.style.display="none";p.onload=function(a){a=_css;var b=p,c={textDecoration:"none",position:"absolute",cursor:"pointer"};c.display="true"==g.hide.toString()&&!w?"none":"block";var d=g.position.toLowerCase().split("-"),e;for(e in d)c[d[e]]=parseInt(g.margin);a(b,c);f()};
  607. g.file&&(0<=g.file.indexOf("/")?p.src=g.file:p.src=g.prefix+g.file)})();(function(){g.link?(p.onmouseover=m,p.onmouseout=f,p.onclick=e):this.mouseEnabled=!1})();if(g.file)return this.resize=function(a,b){},this.getDisplayElement=function(){return p},this}})(jwplayer);(function(a){var b={ended:a.api.events.state.IDLE,playing:a.api.events.state.PLAYING,pause:a.api.events.state.PAUSED,buffering:a.api.events.state.BUFFERING},c=a.utils,d=c.isMobile(),e,f,m={};a.html5.mediavideo=function(l,u){function h(a,
  608. b){s[a]||(s[a]=function(a){c.exists(a.target.parentNode)&&b(a)});return s[a]}function g(b){if(!(b==a.api.events.state.PAUSED&&H==a.api.events.state.IDLE)){if(d)switch(b){case a.api.events.state.PLAYING:n();break;case a.api.events.state.BUFFERING:case a.api.events.state.PAUSED:D()}if(H!=b){var c=H;z.state=H=b;C(a.api.events.JWPLAYER_PLAYER_STATE,{oldstate:c,newstate:b})}}}function p(a){}function w(b){if(I){var d;c.exists(b)&&b.lengthComputable&&b.total?d=100*(b.loaded/b.total):c.exists(r.buffered)&&
  609. 0<r.buffered.length&&(b=r.buffered.length-1,0<=b&&(d=100*(r.buffered.end(b)/r.duration)));c.useNativeFullscreen()&&c.exists(r.webkitDisplayingFullscreen)&&z.fullscreen!=r.webkitDisplayingFullscreen&&C(a.api.events.JWPLAYER_FULLSCREEN,{fullscreen:r.webkitDisplayingFullscreen},!0);!1===Q&&H==a.api.events.state.BUFFERING&&(C(a.api.events.JWPLAYER_MEDIA_BUFFER_FULL),Q=!0);O||(100==d&&(O=!0),c.exists(d)&&d>z.buffer&&(z.buffer=Math.round(d),C(a.api.events.JWPLAYER_MEDIA_BUFFER,{bufferPercent:Math.round(d)})))}}
  610. function t(a){I&&(e&&f&&(r.style.width=e,r.style.height=f,e=_previousHieght=0),b[a.type]&&("ended"==a.type?x():g(b[a.type])))}function q(b){if(I){b=Math.round(10*r.duration)/10;var c={height:r.videoHeight,width:r.videoWidth,duration:b};if(!U&&(z.duration<b||isNaN(z.duration))&&Infinity!=r.duration)z.duration=b;C(a.api.events.JWPLAYER_MEDIA_META,{metadata:c})}}function v(){c.exists(A)||(A=setInterval(function(){w()},100))}function x(){H==a.api.events.state.PLAYING&&(P(!1),C(a.api.events.JWPLAYER_MEDIA_BEFORECOMPLETE),
  611. C(a.api.events.JWPLAYER_MEDIA_COMPLETE))}function n(){setTimeout(function(){r.setAttribute("controls","controls")},100)}function D(){setTimeout(function(){r.removeAttribute("controls")},250)}function C(a,b,c){if(I||c)b?F.sendEvent(a,b):F.sendEvent(a)}var E={abort:p,canplay:t,canplaythrough:t,durationchange:q,emptied:p,ended:t,error:function(b){if(I&&H!=a.api.events.state.IDLE){var d="There was an error: ";if(b.target.error&&"video"==b.target.tagName.toLowerCase()||b.target.parentNode.error&&"video"==
  612. b.target.parentNode.tagName.toLowerCase())switch(b=!c.exists(b.target.error)?b.target.parentNode.error:b.target.error,b.code){case b.MEDIA_ERR_ABORTED:c.log("User aborted the video playback.");return;case b.MEDIA_ERR_NETWORK:d="A network error caused the video download to fail part-way: ";break;case b.MEDIA_ERR_DECODE:d="The video playback was aborted due to a corruption problem or because the video used features your browser did not support: ";break;case b.MEDIA_ERR_SRC_NOT_SUPPORTED:d="The video could not be loaded, either because the server or network failed or because the format is not supported: ";
  613. break;default:d="An unknown error occurred: "}else if("source"==b.target.tagName.toLowerCase()){S--;if(0<S)return;if(c.userAgentMatch(/firefox/i)){c.log("The video could not be loaded, either because the server or network failed or because the format is not supported.");P(!1);return}d="The video could not be loaded, either because the server or network failed or because the format is not supported: "}else{c.log("An unknown error occurred.  Continuing...");return}P(!1);b=d;var d="",e;for(e in L.levels){var f=
  614. L.levels[e];G.ownerDocument.createElement("source");d+=a.utils.getAbsolutePath(f.file);e<L.levels.length-1&&(d+=", ")}_error=!0;C(a.api.events.JWPLAYER_ERROR,{message:b+d})}},loadeddata:q,loadedmetadata:q,loadstart:t,pause:t,play:p,playing:t,progress:w,ratechange:p,seeked:t,seeking:t,stalled:t,suspend:t,timeupdate:function(b){if(I){if(c.exists(b)&&c.exists(b.target)){if(0<U&&!isNaN(b.target.duration)&&(isNaN(z.duration)||1>z.duration))z.duration=Infinity==b.target.duration?0:Math.round(10*b.target.duration)/
  615. 10;!M&&0<r.readyState&&g(a.api.events.state.PLAYING);if(H==a.api.events.state.PLAYING){if(0<r.readyState&&(-1<y||!M)){M=!0;try{r.currentTime!=y&&-1<y&&(r.currentTime=y,y=-1)}catch(d){}r.volume=z.volume/100;r.muted=z.mute}z.position=0<z.duration?Math.round(10*b.target.currentTime)/10:0;C(a.api.events.JWPLAYER_MEDIA_TIME,{position:z.position,duration:z.duration});if(z.position>=z.duration&&(0<z.position||0<z.duration)){x();return}}}w(b)}},volumechange:function(b){b=Math.round(100*r.volume);C(a.api.events.JWPLAYER_MEDIA_VOLUME,
  616. {volume:b},!0);C(a.api.events.JWPLAYER_MEDIA_MUTE,{mute:r.muted},!0)},waiting:t,canshowcurrentframe:p,dataunavailable:p,empty:p,load:function(a){},loadedfirstframe:p,webkitfullscreenchange:function(b){c.exists(r.webkitDisplayingFullscreen)&&z.fullscreen&&!r.webkitDisplayingFullscreen&&C(a.api.events.JWPLAYER_FULLSCREEN,{fullscreen:!1},!0)}},s={},F=new a.html5.eventdispatcher;c.extend(this,F);var z=l,G=u,r,H,M,L,A,y,J=!1,I=!1,U=!1,O,Q,S;H=a.api.events.state.IDLE;I=!0;r=function(){var a=m[z.id];a||
  617. (a="video"==G.tagName.toLowerCase()?G:document.createElement("video"),m[z.id]=a,a.id||(a.id=G.id));for(var b in E)a.addEventListener(b,h(b,E[b]),!0);return a}();r.setAttribute("x-webkit-airplay","allow");G.parentNode&&(r.id=G.id,G.parentNode.replaceChild(r,G));this.load=function(b,l){"undefined"==typeof l&&(l=!0);if(I){L=b;U=0<L.duration;z.duration=L.duration;c.empty(r);r.style.display="block";r.style.opacity=1;e&&f&&(r.style.width=e,r.style.height=f,e=_previousHieght=0);S=0;var h=b.levels;if(0<h.length&&
  618. c.userAgentMatch(/Safari/i)&&!c.userAgentMatch(/Chrome/i)){for(var m=-1,p=0;p<h.length;p++)switch(c.extension(h[p].file)){case "mp4":0>m&&(m=p);break;case "webm":h.splice(p,1)}0<m&&(m=h.splice(m,1)[0],h.unshift(m))}if(b.levels&&0<b.levels.length)if(1==b.levels.length||c.isIOS())r.src=b.levels[0].file;else{r.src&&r.removeAttribute("src");for(h=0;h<b.levels.length;h++)m=r.ownerDocument.createElement("source"),m.src=b.levels[h].file,r.appendChild(m),S++}else r.src=b.file;r.volume=z.volume/100;r.muted=
  619. z.mute;d&&n();O=Q=M=!1;z.buffer=0;c.exists(b.start)||(b.start=0);y=0<b.start?b.start:-1;C(a.api.events.JWPLAYER_MEDIA_LOADED);(!d&&1==b.levels.length||!J)&&r.load();J=!1;l&&(g(a.api.events.state.BUFFERING),C(a.api.events.JWPLAYER_MEDIA_BUFFER,{bufferPercent:0}),v());0<r.videoWidth&&0<r.videoHeight&&q()}};this.play=function(){I&&(v(),Q?g(a.api.events.state.PLAYING):(r.load(),g(a.api.events.state.BUFFERING)),r.play())};this.pause=function(){I&&(r.pause(),g(a.api.events.state.PAUSED))};this.seek=function(a){if(I)if(!M&&
  620. 0<r.readyState){if(!(0>=z.duration||isNaN(z.duration))&&!(0>=z.position||isNaN(z.position)))r.currentTime=a,r.play()}else y=a};var P=this.stop=function(b){if(I){c.exists(b)||(b=!0);clearInterval(A);A=null;if(b){Q=!1;if(r.webkitSupportsFullscreen)try{r.webkitExitFullscreen()}catch(d){}r.style.opacity=0;D();c.isIE()?r.src="":r.removeAttribute("src");c.empty(r);r.load();J=!0}if(c.isIPod())e=r.style.width,f=r.style.height,r.style.width=0,r.style.height=0;else if(c.isIPad()){r.style.display="none";try{r.webkitExitFullscreen()}catch(n){}}g(a.api.events.state.IDLE)}};
  621. this.fullscreen=function(a){!0===a?this.resize("100%","100%"):this.resize(z.config.width,z.config.height)};this.resize=function(a,b){};this.volume=function(b){d||(r.volume=b/100,C(a.api.events.JWPLAYER_MEDIA_VOLUME,{volume:b/100}))};this.mute=function(b){d||(r.muted=b,C(a.api.events.JWPLAYER_MEDIA_MUTE,{mute:b}))};this.getDisplayElement=function(){return r};this.hasChrome=function(){return d&&H==a.api.events.state.PLAYING};this.detachMedia=function(){I=!1;return this.getDisplayElement()};this.attachMedia=
  622. function(){I=!0};this.destroy=function(){if(r&&r.parentNode){clearInterval(A);A=null;for(var a in E)r.removeEventListener(a,h(a,E[a]),!0);c.empty(r);G=r.parentNode;r.parentNode.removeChild(r);delete m[z.id];r=null}}}})(jwplayer);(function(a){var b=a.utils.css;a.html5.mediayoutube=function(c,d){function e(b){if(u!=b){var c=u;u=m.state=b;f.sendEvent(a.api.events.JWPLAYER_PLAYER_STATE,{oldstate:c,newstate:b})}}var f=new a.html5.eventdispatcher;a.utils.extend(this,f);var m=c,l=document.getElementById(d.id),
  623. u=a.api.events.state.IDLE,h,g;this.getDisplayElement=this.detachMedia=function(){return l};this.attachMedia=function(){};this.play=function(){u==a.api.events.state.IDLE?(f.sendEvent(a.api.events.JWPLAYER_MEDIA_BUFFER,{bufferPercent:100}),f.sendEvent(a.api.events.JWPLAYER_MEDIA_BUFFER_FULL),e(a.api.events.state.PLAYING)):u==a.api.events.state.PAUSED&&e(a.api.events.state.PLAYING)};this.pause=function(){e(a.api.events.state.PAUSED)};this.seek=function(a){};this.stop=function(c){_utils.exists(c)||(c=
  624. !0);m.position=0;e(a.api.events.state.IDLE);c&&b(l,{display:"none"})};this.volume=function(b){m.setVolume(b);f.sendEvent(a.api.events.JWPLAYER_MEDIA_VOLUME,{volume:Math.round(b)})};this.mute=function(b){l.muted=b;f.sendEvent(a.api.events.JWPLAYER_MEDIA_MUTE,{mute:b})};this.resize=function(a,b){0<a*b&&h&&(h.width=g.width=a,h.height=g.height=b)};this.fullscreen=function(a){!0===a?this.resize("100%","100%"):this.resize(m.config.width,m.config.height)};this.load=function(c){c=c.levels[0].file;for(var d=
  625. c.split(/\?|\#\!/),m="",q=0;q<d.length;q++)"v="==d[q].substr(0,2)&&(m=d[q].substr(2));""==m&&(m=0<=c.indexOf("/v/")?c.substr(c.indexOf("/v/")+3):0<=c.indexOf("youtu.be")?c.substr(c.indexOf("youtu.be/")+9):c);-1<m.indexOf("?")&&(m=m.substr(0,m.indexOf("?")));-1<m.indexOf("&")&&(m=m.substr(0,m.indexOf("&")));c=["http://www.youtube.com/v/",m,"&amp;hl=en_US&amp;fs=1&autoplay=1"].join("");h=document.createElement("object");h.id=l.id;h.style.position="absolute";var d={movie:c,allowfullscreen:"true",allowscriptaccess:"always"},
  626. v;for(v in d)m=document.createElement("param"),m.name=v,m.value=d[v],h.appendChild(m);g=document.createElement("embed");h.appendChild(g);v={src:c,type:"application/x-shockwave-flash",allowfullscreen:"true",allowscriptaccess:"always",width:h.width,height:h.height};for(var x in v)g.setAttribute(x,v[x]);h.appendChild(g);h.style.zIndex=2147483E3;l!=h&&l.parentNode&&l.parentNode.replaceChild(h,l);l=h;b(h,{display:"block"});e(a.api.events.state.BUFFERING);f.sendEvent(a.api.events.JWPLAYER_MEDIA_BUFFER,
  627. {bufferPercent:0});f.sendEvent(a.api.events.JWPLAYER_MEDIA_LOADED);this.play()};this.hasChrome=function(){return u!=a.api.events.state.IDLE};this.embed=g;return this}})(jwplayer);(function(a){var b="width height start duration volume mute fullscreen item plugins stretching".split(" "),c=a.utils;a.html5.model=function(d,e,f){function m(b){var c=new a.html5.playlistloader;c.addEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,function(b){g.playlist=new a.html5.playlist(b);l(!0)});c.addEventListener(a.api.events.JWPLAYER_ERROR,
  628. function(b){g.playlist=new a.html5.playlist({playlist:[]});l(!1)});c.load(b)}function l(){if(g.config.shuffle){var b=g,c=null;if(1<g.playlist.length)for(;!a.utils.exists(c);)c=Math.floor(Math.random()*g.playlist.length),c==g.item&&(c=null);else c=0;b.item=c}else g.config.item>=g.playlist.length?g.config.item=g.playlist.length-1:0>g.config.item&&(g.config.item=0),g.item=g.config.item;g.position=0;g.duration=0<g.playlist.length?g.playlist[g.item].duration:0;w.sendEvent(a.api.events.JWPLAYER_PLAYLIST_LOADED,
  629. {playlist:g.playlist});w.sendEvent(a.api.events.JWPLAYER_PLAYLIST_ITEM,{index:g.item})}function u(b){switch(b.type){case a.api.events.JWPLAYER_MEDIA_LOADED:h=p.getDisplayElement();break;case a.api.events.JWPLAYER_MEDIA_MUTE:this.mute=b.mute;break;case a.api.events.JWPLAYER_MEDIA_VOLUME:this.volume=b.volume}w.sendEvent(b.type,b)}var h=e;e=c.getCookies();var g={id:h.id,playlist:[],state:a.api.events.state.IDLE,position:0,buffer:0,container:h,config:{width:480,height:320,item:-1,skin:void 0,file:void 0,
  630. image:void 0,start:0,duration:0,bufferlength:5,volume:e.volume?e.volume:90,mute:e.mute&&"true"==e.mute.toString().toLowerCase()?!0:!1,fullscreen:!1,repeat:"",stretching:a.utils.stretching.UNIFORM,autostart:!1,debug:void 0,screencolor:void 0}},p,w=new a.html5.eventdispatcher;a.utils.extend(g,w);for(var t in f){"string"==typeof f[t]&&(e=/color$/.test(t)?"color":null,f[t]=a.utils.typechecker(f[t],e));e=g.config;var q=t.split("."),v;for(v in q)v==q.length-1?e[q[v]]=f[t]:(a.utils.exists(e[q[v]])||(e[q[v]]=
  631. {}),e=e[q[v]])}for(var x in b)f=b[x],g[f]=g.config[f];x=["display","logo","controlbar","playlist","dock"].concat([]);if(a.utils.exists(g.plugins)&&"string"==typeof g.plugins){f=g.plugins.split(",");for(var n in f)"string"==typeof f[n]&&x.push(f[n].replace(/^\s+|\s+$/g,""))}a.utils.isMobile()?(x=["display","logo","dock","playlist"],a.utils.exists(g.config.repeat)||(g.config.repeat="list")):g.config.chromeless&&(x=["logo","dock","playlist"],a.utils.exists(g.config.repeat)||(g.config.repeat="list"));
  632. g.plugins={order:x,config:{},object:{}};if("undefined"!=typeof g.config.components)for(var D in g.config.components)g.plugins.config[D]=g.config.components[D];n=!1;for(var C in g.plugins.order)D=g.plugins.order[C],x=!a.utils.exists(g.plugins.config[D])?{}:g.plugins.config[D],g.plugins.config[D]=!a.utils.exists(g.plugins.config[D])?x:a.utils.extend(g.plugins.config[D],x),a.utils.exists(g.plugins.config[D].position)?("playlist"==D&&(n=!0),g.plugins.config[D].position=g.plugins.config[D].position.toString().toUpperCase()):
  633. g.plugins.config[D].position="playlist"==D?a.html5.view.positions.NONE:a.html5.view.positions.OVER;g.plugins.config.controlbar&&n&&(g.plugins.config.controlbar.hideplaylistcontrols=!0);if("undefined"!=typeof g.plugins.config.dock&&("object"!=typeof g.plugins.config.dock&&(C=g.plugins.config.dock.toString().toUpperCase(),g.plugins.config.dock={position:C}),"undefined"!=typeof g.plugins.config.dock.position&&(g.plugins.config.dock.align=g.plugins.config.dock.position,g.plugins.config.dock.position=
  634. a.html5.view.positions.OVER),"undefined"==typeof g.plugins.config.dock.idlehide))try{g.plugins.config.dock.idlehide=g.plugins.config.controlbar.idlehide}catch(E){}g.loadPlaylist=function(b){var c;if("string"==typeof b)if(0==b.indexOf("[")||"0"==b.indexOf("{"))try{c=eval(b)}catch(d){c=b}else c=b;else c=b;switch(a.utils.typeOf(c)){case "object":b=c;break;case "array":b={playlist:c};break;default:b={file:c}}g.playlist=new a.html5.playlist(b);g.item=0<=g.config.item?g.config.item:0;!g.playlist[0].provider&&
  635. g.playlist[0].file?m(g.playlist[0].file):l()};var s={};g.setActiveMediaProvider=function(b){"audio"==b.provider&&(b.provider="sound");b=b.provider;var c=p?p.getDisplayElement():null;if("sound"==b||"http"==b||""==b)b="video";if(a.utils.exists(s[b]))p!=s[b]&&(p&&p.stop(),p=s[b]);else{switch(b){case "video":p=new a.html5.mediavideo(g,c?c:h);break;case "youtube":p=new a.html5.mediayoutube(g,c?c:h)}if(!a.utils.exists(p))return!1;p.addGlobalListener(u);s[b]=p}return!0};g.getMedia=function(){return p};g.seek=
  636. function(b){w.sendEvent(a.api.events.JWPLAYER_MEDIA_SEEK,{position:g.position,offset:b});return p.seek(b)};g.setVolume=function(a){c.saveCookie("volume",a);g.volume=a};g.setMute=function(a){c.saveCookie("mute",a);g.mute=a};g.setupPlugins=function(){if(!a.utils.exists(g.plugins)||!a.utils.exists(g.plugins.order)||0==g.plugins.order.length)return a.utils.log("No plugins to set up"),g;for(var b=0;b<g.plugins.order.length;b++)try{var c=g.plugins.order[b];a.utils.exists(a.html5[c])?g.plugins.object[c]=
  637. "playlist"==c?new a.html5.playlistcomponent(d,g.plugins.config[c]):new a.html5[c](d,g.plugins.config[c]):g.plugins.order.splice(plugin,plugin+1);"function"==typeof g.plugins.object[c].addGlobalListener&&g.plugins.object[c].addGlobalListener(u)}catch(e){a.utils.log("Could not setup "+c)}};return g}})(jwplayer);(function(a){a.html5.playlist=function(b){var c=[];if(b.playlist&&b.playlist instanceof Array&&0<b.playlist.length)for(var d in b.playlist)isNaN(parseInt(d))||c.push(new a.html5.playlistitem(b.playlist[d]));
  638. else c.push(new a.html5.playlistitem(b));return c}})(jwplayer);(function(a){var b={size:180,position:a.html5.view.positions.NONE,itemheight:60,thumbs:!0,fontcolor:"#000000",overcolor:"",activecolor:"",backgroundcolor:"#f8f8f8",font:"_sans",fontsize:"",fontstyle:"",fontweight:""},c={_sans:"Arial, Helvetica, sans-serif",_serif:"Times, Times New Roman, serif",_typewriter:"Courier New, Courier, monospace"};_utils=a.utils;_css=_utils.css;_hide=function(a){_css(a,{display:"none"})};_show=function(a){_css(a,
  639. {display:"block"})};a.html5.playlistcomponent=function(d,e){function f(a){return function(){var b=C.getElementsByClassName("item")[a],c=q.fontcolor,d=s.item?"url("+s.item.src+")":"";a==t.jwGetPlaylistIndex()&&(""!==q.activecolor&&(c=q.activecolor),s.itemActive&&(d="url("+s.itemActive.src+")"));_css(b,{color:""!==q.overcolor?q.overcolor:c,backgroundImage:s.itemOver?"url("+s.itemOver.src+")":d})}}function m(a){return function(){var b=C.getElementsByClassName("item")[a],c=q.fontcolor,d=s.item?"url("+
  640. s.item.src+")":"";a==t.jwGetPlaylistIndex()&&(""!==q.activecolor&&(c=q.activecolor),s.itemActive&&(d="url("+s.itemActive.src+")"));_css(b,{color:c,backgroundImage:d})}}function l(b){var c=D[b],d=document.createElement("li");d.className="item";_css(d,{height:q.itemheight,display:"block",cursor:"pointer",backgroundImage:s.item?"url("+s.item.src+")":"",backgroundSize:"100% "+q.itemheight+"px"});d.onmouseover=f(b);d.onmouseout=m(b);var e=document.createElement("div"),g=new Image,l=b=0,h=0;if("true"==
  641. q.thumbs.toString().toLowerCase()&&(c.image||c["playlist.image"]||s.itemImage))g.className="image",s.itemImage?(b=(q.itemheight-s.itemImage.height)/2,l=s.itemImage.width,h=s.itemImage.height):(l=4*q.itemheight/3,h=q.itemheight),_css(e,{height:h,width:l,"float":"left",styleFloat:"left",cssFloat:"left",margin:"0 5px 0 0",background:"black",overflow:"hidden",margin:b+"px",position:"relative"}),_css(g,{position:"relative"}),e.appendChild(g),g.onload=function(){a.utils.stretch(a.utils.stretching.FILL,
  642. g,l,h,this.naturalWidth,this.naturalHeight)},c["playlist.image"]?g.src=c["playlist.image"]:c.image?g.src=c.image:s.itemImage&&(g.src=s.itemImage.src),d.appendChild(e);var p=x-l-2*b;n<q.itemheight*D.length&&(p-=15);e=document.createElement("div");_css(e,{position:"relative",height:"100%",overflow:"hidden"});var v=document.createElement("span");0<c.duration&&(v.className="duration",_css(v,{fontSize:(q.fontsize?q.fontsize:11)+"px",fontWeight:q.fontweight?q.fontweight:"bold",width:"40px",height:q.fontsize?
  643. q.fontsize+10:20,lineHeight:24,"float":"right",styleFloat:"right",cssFloat:"right"}),v.innerHTML=_utils.timeFormat(c.duration),e.appendChild(v));v=document.createElement("span");v.className="title";_css(v,{padding:"5px 5px 0 "+(b?0:"5px"),height:q.fontsize?q.fontsize+10:20,lineHeight:q.fontsize?q.fontsize+10:20,overflow:"hidden","float":"left",styleFloat:"left",cssFloat:"left",width:(0<c.duration?p-50:p)-10+"px",fontSize:(q.fontsize?q.fontsize:13)+"px",fontWeight:q.fontweight?q.fontweight:"bold"});
  644. v.innerHTML=c?c.title:"";e.appendChild(v);c.description&&(b=document.createElement("span"),b.className="description",_css(b,{display:"block","float":"left",styleFloat:"left",cssFloat:"left",margin:0,paddingLeft:v.style.paddingLeft,paddingRight:v.style.paddingRight,lineHeight:(q.fontsize?q.fontsize+4:16)+"px",overflow:"hidden",position:"relative"}),b.innerHTML=c.description,e.appendChild(b));d.appendChild(e);return d}function u(a){v.innerHTML="";a=t.jwGetPlaylist();for(var b=[],d=0;d<a.length;d++)a[d]["ova.hidden"]||
  645. b.push(a[d]);if(D=b){items=[];a=document.createElement("ul");_css(a,{width:v.style.width,minWidth:v.style.width,height:v.style.height,backgroundColor:q.backgroundcolor,backgroundImage:s.background?"url("+s.background.src+")":"",color:q.fontcolor,listStyle:"none",margin:0,padding:0,fontFamily:c[q.font]?c[q.font]:c._sans,fontSize:(q.fontsize?q.fontsize:11)+"px",fontStyle:q.fontstyle,fontWeight:q.fontweight,overflowY:"auto"});C=a;for(a=0;a<D.length;a++)b=l(a),b.onclick=h(a),C.appendChild(b),items.push(b);
  646. E=t.jwGetPlaylistIndex();m(E)();v.appendChild(C);_utils.isIOS()&&window.iScroll&&(C.style.height=q.itemheight*D.length+"px",new iScroll(v.id))}}function h(a){return function(){t.jwPlaylistItem(a);t.jwPlay(!0)}}function g(a){0<=E&&(m(E)(),E=a.index);m(a.index)();C.scrollTop=t.jwGetPlaylistIndex()*q.itemheight}function p(){if(q.position==a.html5.view.positions.OVER)switch(t.jwGetState()){case a.api.events.state.IDLE:_show(v);break;default:_hide(v)}}function w(){for(var a in s)s[a]=t.skin.getSkinElement("playlist",
  647. a)}var t=d,q=a.utils.extend({},b,t.skin.getComponentSettings("playlist"),e);if(!(q.position==a.html5.view.positions.NONE||"undefined"==typeof a.html5.view.positions[q.position])){var v,x,n,D,C,E=-1,s={background:void 0,item:void 0,itemOver:void 0,itemImage:void 0,itemActive:void 0};this.getDisplayElement=function(){return v};this.resize=function(a,b){x=a;n=b;t.jwGetFullscreen()?_hide(v):_css(v,{display:"block",width:x,height:n})};this.show=function(){_show(v)};this.hide=function(){_hide(v)};v=document.createElement("div");
  648. v.id=t.id+"_jwplayer_playlistcomponent";v.style.overflow="hidden";switch(q.position){case a.html5.view.positions.RIGHT:case a.html5.view.positions.LEFT:v.style.width=q.size+"px";break;case a.html5.view.positions.TOP:case a.html5.view.positions.BOTTOM:v.style.height=q.size+"px"}w();s.item&&(q.itemheight=s.item.height);v.style.backgroundColor="#C6C6C6";t.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,u);t.jwAddEventListener(a.api.events.JWPLAYER_PLAYLIST_ITEM,g);t.jwAddEventListener(a.api.events.JWPLAYER_PLAYER_STATE,
  649. p);return this}}})(jwplayer);(function(a){function b(b){if(a.utils.isYouTube(b.file))return"youtube";var d=a.utils.extension(b.file),e;if(d&&a.utils.extensionmap[d]){if("m3u8"==d)return"video";e=a.utils.extensionmap[d].html5}else b.type&&(e=b.type);if(e){b=e.split("/")[0];if("audio"==b)return"sound";if("video"==b)return b}return""}a.html5.playlistitem=function(c){c=a.utils.extend({},{author:"",date:"",description:"",image:"",link:"",mediaid:"",tags:"",title:"",provider:"",file:"",streamer:"",duration:-1,
  650. start:0,currentLevel:-1,levels:[]},c);c.type&&(c.provider=c.type,delete c.type);0===c.levels.length&&(c.levels[0]=new a.html5.playlistitemlevel(c));c.provider=c.provider?c.provider.toLowerCase():b(c.levels[0]);return c}})(jwplayer);(function(a){a.html5.playlistitemlevel=function(b){var c={file:"",streamer:"",bitrate:0,width:0},d;for(d in c)a.utils.exists(b[d])&&(c[d]=b[d]);return c}})(jwplayer);(function(a){a.html5.playlistloader=function(){function b(b){var f=[];try{f=a.utils.parsers.rssparser.parse(b.responseXML.firstChild),
  651. d.sendEvent(a.api.events.JWPLAYER_PLAYLIST_LOADED,{playlist:new a.html5.playlist({playlist:f})})}catch(m){c("Could not parse the playlist")}}function c(b){d.sendEvent(a.api.events.JWPLAYER_ERROR,{message:b?b:"Could not load playlist an unknown reason."})}var d=new a.html5.eventdispatcher;a.utils.extend(this,d);this.load=function(d){a.utils.ajax(d,b,c)}}})(jwplayer);(function(a){a.html5.skin=function(){var b={},c=!1;this.load=function(d,e){new a.html5.skinloader(d,function(a){c=!0;b=a;e()},function(){new a.html5.skinloader("",
  652. function(a){c=!0;b=a;e()})})};this.getSkinElement=function(d,e){if(c)try{return b[d].elements[e]}catch(f){a.utils.log("No such skin component / element: ",[d,e])}return null};this.getComponentSettings=function(a){return c&&b&&b[a]?b[a].settings:null};this.getComponentLayout=function(a){return c?b[a].layout:null}}})(jwplayer);(function(a){a.html5.skinloader=function(b,c,d){function e(b){b=b.getElementsByTagName("component");if(0!==b.length)for(var c=0;c<b.length;c++){var d=b[c].getAttribute("name");
  653. l[d]={settings:{},elements:{},layout:{}};for(var e=b[c].getElementsByTagName("elements")[0].getElementsByTagName("element"),h=0;h<e.length;h++)m(e[h],d);if((e=b[c].getElementsByTagName("settings")[0])&&0<e.childNodes.length){e=e.getElementsByTagName("setting");for(h=0;h<e.length;h++){var p=e[h].getAttribute("name"),t=e[h].getAttribute("value"),s=/color$/.test(p)?"color":null;l[d].settings[p]=a.utils.typechecker(t,s)}}if((e=b[c].getElementsByTagName("layout")[0])&&0<e.childNodes.length){e=e.getElementsByTagName("group");
  654. for(h=0;h<e.length;h++){p=e[h];l[d].layout[p.getAttribute("position")]={elements:[]};for(t=0;t<p.attributes.length;t++)s=p.attributes[t],l[d].layout[p.getAttribute("position")][s.name]=s.value;t=p.getElementsByTagName("*");for(s=0;s<t.length;s++){var u=t[s];l[d].layout[p.getAttribute("position")].elements.push({type:u.tagName});for(var w=0;w<u.attributes.length;w++){var G=u.attributes[w];l[d].layout[p.getAttribute("position")].elements[s][G.name]=G.value}a.utils.exists(l[d].layout[p.getAttribute("position")].elements[s].name)||
  655. (l[d].layout[p.getAttribute("position")].elements[s].name=u.tagName)}}}g=!1;f()}}function f(){clearInterval(p);t||(p=setInterval(function(){a:{for(var a in l)if("properties"!=a)for(var b in l[a].elements)if(!l[a].elements[b].ready)break a;!1===g&&(clearInterval(p),u(l))}},100))}function m(b,c){var d=new Image,e=b.getAttribute("name"),g=b.getAttribute("src");if(0!==g.indexOf("data:image/png;base64,"))var m=a.utils.getAbsolutePath(w),g=[m.substr(0,m.lastIndexOf("/")),c,g].join("/");l[c].elements[e]=
  656. {height:0,width:0,src:"",ready:!1,image:d};d.onload=function(b){l[c]&&l[c].elements[e]?(l[c].elements[e].height=d.height,l[c].elements[e].width=d.width,l[c].elements[e].src=d.src,l[c].elements[e].ready=!0,f()):a.utils.log("Loaded an image for a missing element: "+c+"."+e)};d.onerror=function(a){t=!0;f();h()};d.src=g}var l={},u=c,h=d,g=!0,p,w=b,t=!1;(function(){"string"!=typeof w||""===w?e(a.html5.defaultSkin().xml):a.utils.ajax(a.utils.getAbsolutePath(w),function(b){try{if(a.utils.exists(b.responseXML)){e(b.responseXML);
  657. return}}catch(c){for(var d in l){b=l[d];for(var f in b.elements){var g=b.elements[f],h=g.image;h.onload=null;h.onerror=null;delete g.image;delete b.elements[f]}delete l[d]}}e(a.html5.defaultSkin().xml)},function(b){e(a.html5.defaultSkin().xml)})})()}})(jwplayer);(function(a){a.html5.api=function(b,c){function d(){p.state==a.api.events.state.PLAYING||p.state==a.api.events.state.BUFFERING?t.pause():t.play()}function e(a){return function(){return p[a]}}function f(a,b,c){return function(){var d=p.plugins.object[a];
  658. d&&(d[b]&&"function"==typeof d[b])&&d[b].apply(d,c)}}function m(a){return function(){if(q&&"function"==typeof q[a])return q[a].apply(this,arguments);_utils.log("Could not call instream method - instream API not initialized")}}function l(){p.config.playlistfile?(p.addEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,u),p.loadPlaylist(p.config.playlistfile)):"string"==typeof p.config.playlist?(p.addEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,u),p.loadPlaylist(p.config.playlist)):(p.loadPlaylist(p.config),
  659. setTimeout(u,25))}function u(b){p.removeEventListener(a.api.events.JWPLAYER_PLAYLIST_LOADED,u);p.setupPlugins();w.setup();b={id:h.id,version:h.version};t.playerReady(b)}var h={},g=document.createElement("div");b.parentNode.replaceChild(g,b);g.id=b.id;h.version=a.version;h.id=g.id;var p=new a.html5.model(h,g,c),w=new a.html5.view(h,g,p),t=new a.html5.controller(h,g,p,w);h.skin=new a.html5.skin;h.jwPlay=function(a){"undefined"==typeof a?d():"true"==a.toString().toLowerCase()?t.play():t.pause()};h.jwPause=
  660. function(a){"undefined"==typeof a?d():"true"==a.toString().toLowerCase()?t.pause():t.play()};h.jwStop=t.stop;h.jwSeek=t.seek;h.jwPlaylistItem=function(a){if(q){if(q.playlistClickable())return q.jwInstreamDestroy(),t.item(a)}else return t.item(a)};h.jwPlaylistNext=t.next;h.jwPlaylistPrev=t.prev;h.jwResize=t.resize;h.jwLoad=t.load;h.jwDetachMedia=t.detachMedia;h.jwAttachMedia=t.attachMedia;h.jwGetPlaylistIndex=e("item");h.jwGetPosition=e("position");h.jwGetDuration=e("duration");h.jwGetBuffer=e("buffer");
  661. h.jwGetWidth=e("width");h.jwGetHeight=e("height");h.jwGetFullscreen=e("fullscreen");h.jwSetFullscreen=t.setFullscreen;h.jwGetVolume=e("volume");h.jwSetVolume=t.setVolume;h.jwGetMute=e("mute");h.jwSetMute=t.setMute;h.jwGetStretching=function(){return p.stretching.toUpperCase()};h.jwGetState=e("state");h.jwGetVersion=function(){return h.version};h.jwGetPlaylist=function(){return p.playlist};h.jwAddEventListener=t.addEventListener;h.jwRemoveEventListener=t.removeEventListener;h.jwSendEvent=t.sendEvent;
  662. h.jwDockSetButton=function(a,b,c,d){p.plugins.object.dock&&p.plugins.object.dock.setButton&&p.plugins.object.dock.setButton(a,b,c,d)};h.jwControlbarShow=f("controlbar","show");h.jwControlbarHide=f("controlbar","hide");h.jwDockShow=f("dock","show");h.jwDockHide=f("dock","hide");h.jwDisplayShow=f("display","show");h.jwDisplayHide=f("display","hide");var q;h.jwLoadInstream=function(b,c){q||(q=new a.html5.instream(h,p,w,t));setTimeout(function(){q.load(b,c)},10)};h.jwInstreamDestroy=function(){q&&q.jwInstreamDestroy()};
  663. h.jwInstreamAddEventListener=m("jwInstreamAddEventListener");h.jwInstreamRemoveEventListener=m("jwInstreamRemoveEventListener");h.jwInstreamGetState=m("jwInstreamGetState");h.jwInstreamGetDuration=m("jwInstreamGetDuration");h.jwInstreamGetPosition=m("jwInstreamGetPosition");h.jwInstreamPlay=m("jwInstreamPlay");h.jwInstreamPause=m("jwInstreamPause");h.jwInstreamSeek=m("jwInstreamSeek");h.jwDestroy=function(){t.destroy()};h.jwGetLevel=function(){};h.jwGetBandwidth=function(){};h.jwGetLockState=function(){};
  664. h.jwLock=function(){};h.jwUnlock=function(){};p.config.chromeless&&!a.utils.isIOS()?l():h.skin.load(p.config.skin,l);return h}})(jwplayer)}function GameLoadObserver(a){this.initialize(a)}
  665. GameLoadObserver.prototype=function(){return{initialize:function(a){this._loaded=!1;this._startTime=(new Date).getTime();this._timeout=a.timeout||3E3;this._interval=null;this._debug=a.debug;this._queue=[];this.startObserving.bind(this).runWhenDomLoaded()},percentLoaded:function(){if($("gamediv"))try{return $("gamediv").PercentLoaded()}catch(a){return-1}},observeGameLoad:function(){var a=(new Date).getTime()-this._startTime,b=a>=this._timeout,c=this.percentLoaded();0<c||b?(this._debug&&console.log("Firing onGameLoaded, percentLoaded: "+
  666. c+", timeElapsed: "+a+", timedOut: "+b),this.onGameLoaded()):0>c&&(this._debug&&console.log("Firing onGameLoaded, no flash gamediv found, percentLoaded: "+c+", timeElapsed: "+a),this.onGameLoaded())},onGameLoaded:function(){this._loaded||(this._loaded=!0,clearInterval(this._interval),this._queue.each(function(a){a.defer()}),this._queue=[])},runWhenGameLoaded:function(a){this._loaded?a.defer():this._queue.push(a)},startObserving:function(){this._interval&&clearInterval(this._interval);this._interval=
  667. setInterval(this.observeGameLoad.bind(this),100)}}}();Function.prototype.runWhenGameLoaded=function(){window.gameLoadObserver?window.gameLoadObserver.runWhenGameLoaded(this):this.runWhenDomLoaded()};window.gameLoadObserver=new GameLoadObserver({timeout:2E3,debug:!1});function ShareWithUsersTab(a,b,c){this.initialize(a,b,c)}
  668. ShareWithUsersTab.prototype={initialize:function(a,b,c){this._share_dialog=b;this._tab_id=a;this._current_page=0;this._request_more_func=c;(a=$(a+"_tab"))&&a.observe("click",this.handleShowTab.bindAsEventListener(this))},getMore:function(){this._current_page++;this._request_more_func();$(this._tab_id+"_indicator").show()},handleShowTab:function(a){this.refreshSelected()},handleScroll:function(a){$(this._tab_id).scrollTop+$(this._tab_id).getHeight()>=$(this._tab_id).scrollHeight&&(Event.stopObserving($(this._tab_id),
  669. "scroll"),this.getMore())},onRequestSuccess:function(){$(this._tab_id).observe("scroll",this.handleScroll.bindAsEventListener(this))},onRequestComplete:function(){$(this._tab_id+"_indicator").hide();this.refreshSelected()},refreshSelected:function(){for(var a=$(this._tab_id).select(".user"),b=0;b<a.length;++b){var c=a[b].select("#recipient_ids_").first();c.checked=this._share_dialog.isSelected(c.value);this._share_dialog.isSelected(c.value)?a[b].addClassName("selected"):a[b].removeClassName("selected")}}};
  670. function ShareWithFriendsDialog(a){this.initialize(a)}
  671. ShareWithFriendsDialog.prototype={initialize:function(a){this._selected_users=[];this._user_limit=a;this._error_msg_timer=this._search_box_timer=null;$("max_users_error").hide();$("new_game_invite_feed_item").setAttribute("action","javascript:;")},setRequestFunctions:function(a,b,c){this._friends_tab=new ShareWithUsersTab("share_with_friends",this,a);this._friends_tab.getMore();this._fans_tab=new ShareWithUsersTab("share_with_fans",this,b);this._fans_tab.getMore();this._chat_members_tab=new ShareWithUsersTab("share_with_chat_members",
  672. this,c);this._chat_members_tab.getMore()},toggleSelected:function(a,b){var c=this.findSelected(a),d=!1;-1<c?(this._selected_users.splice(c,1),d=!0,$("error_messages").update("")):this._selected_users.length<this._user_limit?(this._selected_users.push({user_id:a,username:b}),d=!0,$("error_messages").update("")):this._selected_users.length>=this._user_limit&&($("max_users_error").show(),$("max_users_error").removeClassName("hidden"),null!==this._error_msg_timer&&clearTimeout(this._search_box_timer),
  673. this._error_msg_timer=setTimeout(function(){this._error_msg_timer=null;$("max_users_error").hide()},2500));this.friends_tab&&this._friends_tab.refreshSelected();this._fans_tab&&this._fans_tab.refreshSelected();this._chat_members_tab&&this._chat_members_tab.refreshSelected();$("selected_users").update(this.selectedUsersMessage());$("recipients").value=this.getSelectedUserIds();return d},selectedUsersMessage:function(){var a=this._selected_users.length;return 0===a?"no users selected":1==a?this._selected_users[0].username+
  674. " selected":2==a?this._selected_users[0].username+" and "+this._selected_users[1].username+" selected":3==a?this._selected_users[0].username+", "+this._selected_users[1].username+" and "+this._selected_users[2].username+" selected":4==a?this._selected_users[0].username+", "+this._selected_users[1].username+", "+this._selected_users[2].username+" and 1 other user selected":this._selected_users[0].username+", "+this._selected_users[1].username+", "+this._selected_users[2].username+" and "+(a-3)+" other users selected"},
  675. refreshSearchDropdown:function(){for(var a=$$(".recipient_chooser").first().select(".user"),b=0;b<a.length;++b){var c=eval("("+a[b].down(".metadata").innerHTML+")");this.isSelected(c.user_id)?a[b].addClassName("chosen"):a[b].removeClassName("chosen")}},searchUserSelected:function(a){var b=shareWithFriendsDialog.toggleSelected(a.user_id,a.username);$("recipient_search").value="";b&&($("recipient_search_container").hide(),this.isSelected(a.user_id)?$("recipient_list_updated_msg").innerHTML=a.username+
  676. " was added to the recipient list":$("recipient_list_updated_msg").innerHTML=a.username+" was removed from the recipient list",$("recipient_list_updated_msg").show(),null!==this._search_box_timer&&clearTimeout(this._search_box_timer),this._search_box_timer=setTimeout(function(){this._search_box_timer=null;$("recipient_list_updated_msg").hide();$("recipient_search_container").show()},2500))},findSelected:function(a){for(var b=0;b<this._selected_users.length;b++)if(this._selected_users[b].user_id==
  677. a)return b;return-1},isSelected:function(a){return-1<this.findSelected(a)},getSelectedUserIds:function(){for(var a="",b=0;b<this._selected_users.length;++b)a+=this._selected_users[b].user_id,b+1<this._selected_users.length&&(a+=",");return a}};
  678. SharedLinksController=function(a){this.container=$(a.id);this.select=this.container.down("select");this.checkbox=this.container.down("input[type=checkbox]");this.reload=this.container.down(".shared_link_reload");this.url=a.url;this.out_of_links=this.fetching=!1;this.shown_items=0;this.addFormHandlers();this.addShowMoreHandler();this.addScrollHandler()};
  679. SharedLinksController.prototype={fetch:function(a){if(!this.fetching){this.fetching=!0;var b=this,c=this.container.down("ul");$("shared_link_list_container");var d=this.select.getValue();a||(a={});"All"!=d&&(a.shared_link_type_id=d);new Ajax.Request(b.url,{method:"get",parameters:a,onCreate:function(){c.insert((new Element("li",{id:"shared_links_loading"})).insert((new Element("span",{"class":"spinner spinner_big"})).update("Loading...")));b.hideShowMoreLink()},onComplete:function(){$("shared_links_loading").remove();
  680. b.fetching=!1},onSuccess:function(a){a=$A(a.responseJSON);var d;a.each(function(a){d=b.renderLink(a);c.insert(d);(b.showHidden()||!d.hasClassName("visited"))&&b.shown_items++});0<a.length&&(b.maxId=a.last().id);b.showShowMoreLink();25>a.length?(b.out_of_links=!0,b.shown_items=0):(b.out_of_links=!1,17>b.shown_items?(b.fetching=!1,b.fetch({max_id:b.maxId})):b.shown_items=0)}})}},renderLink:function(a){var b=$.jStorage.get(this.storageKey(a)),c=new Element("li",{id:"shared_link_"+a.id,"class":"shared_link"}),
  681. d=(new Element("a",{"class":"shared_title_link"})).update(a.name),e;b&&(c.addClassName("visited"),this.showHidden()||c.hide());d.observe("click",this.handleClick.bindAsEventListener(this,a,c));c.insert((new Element("div",{"class":"shared_link_title truncate_one_line"})).insert(d));c.observe("click",function(){c.hasClassName("open")?c.removeClassName("open"):c.addClassName("open")});a.additional_params&&(c.addClassName("expandable"),e=new Element("dl",{"class":"link_info mvm"}),$H(a.additional_params.evalJSON()).each(function(a){e.insert((new Element("dt",
  682. {"class":"truncate_one_line"})).update(a.key.stripTags()));e.insert((new Element("dd",{"class":"truncate_one_line"})).update(a.value.toString().stripTags()))}),c.insert(e));return c},handleClick:function(a,b,c){$("gameiframe")?activateGame(b.link_params):(a=$H(document.location.search.toQueryParams()).merge(b.link_params.toQueryParams()).toQueryString(),window.open(document.location.pathname+"?"+a,"_blank"));$.jStorage.set(this.storageKey(b),!0,{TTL:b.ttl});c.addClassName("visited");this.showHidden()||
  683. c.hide()},addFormHandlers:function(){var a=this.container.down("ul");this.select.observe("change",function(){a.update();this.maxId=0;this.hideShowMoreLink();this.fetch()}.bind(this));this.reload.observe("click",function(){a.update();this.maxId=0;this.hideShowMoreLink();this.fetch()}.bind(this));this.checkbox.observe("change",function(){a.select("li.visited").invoke("Y"==this.checkbox.getValue()?"show":"hide")}.bind(this))},addShowMoreHandler:function(){$("shared_link_show_more").observe("click",function(){this.fetch({max_id:this.maxId});
  684. this.hideShowMoreLink()}.bind(this))},showShowMoreLink:function(){$("shared_link_show_more").show()},hideShowMoreLink:function(){$("shared_link_show_more").hide()},storageKey:function(a){return active_user.gameId()+"-"+a.id},addScrollHandler:function(){var a=$("shared_link_show_more"),b=0,c=$("shared_link_list_container");c.observe("scroll",function(){var d=0==c.scrollTop?c.parentNode.scrollTop:c.scrollTop;!this.out_of_links&&(d+window.innerHeight>a.positionedOffset().top&&d>b)&&this.fetch({max_id:this.maxId});
  685. b=d}.bind(this))},showHidden:function(){return"Y"==this.checkbox.getValue()}};
Add Comment
Please, Sign In to add comment