/*
 *  © 2000-2010 deviantART, Inc. All rights reserved.
 */
if(!window.AutoExec){AutoExec=[]}Bug={the_window:null,the_rows:{},window:function(){if(!this.the_window){document.body.appendChild(this.the_window=Tree.create("textarea",{style:{position:"absolute",top:"4px",right:"4px",width:"550px",height:"200px",background:"#222",color:"#EEE",font:"8.25pt Verdana",zIndex:200}}))}return this.the_window},row:function(A){if(!this.the_rows[A]){this.the_rows[A]=Tree.create("tr",{},[Tree.create("th",{style:{textAlign:"right",padding:"0 8px",color:"#D42",width:"10ex"}},A),Tree.create("td",{style:{maxHeight:"120px",overflow:"auto"}})]);this.window().appendChild(this.the_rows[A])}return this.the_rows[A]},get:function(A,B){return"";return Tree.get(this.row(A),"td").innerHTML},update2:function(A,B){if(A=="go to"){this.window().value=A+": "+B+"\n"+this.window().value}return },bump:function(A){return Bug.update(A,(Number(Bug.get(A))||0)+1)},log:function(A,B){return Bug.update(A,B)},coords:function(A,C){var B;if(C.x!=undefined){B="("+C.x+", "+C.y+")";if(C.x2){B+="-("+C.x2+", "+C.y2+")";if(C.w){if(C.w!=(C.x2-C.x)||C.h!=(C.y2-C.y)){B+=" *** != "+C.w+"x"+C.h}}}}else{if(C.w!=undefined){B=C.w+"x"+C.h}else{B="(???, ???)"}}return Bug.update(A,B)}};Bug.update=new Function;debug=new Function;debug2=new Function;if(!window.Tasks){Tasks={}}Page={};FlashTalk=new Task();FlashTalk.receive=function(){this.milestone.apply(this,Task.argSlice(arguments,1))};function Film(D){var A,C,B;if(window.Popup){Popup.go(true)}A=Tree.get(D,"film");DRE.assert(A,"Film element should not be missing during Keeper call");this.pageData={deviation_id:A.getAttribute("deviationid"),film_length:A.getAttribute("filmlength"),creator:A.getAttribute("creator").toLowerCase(),creator_symbol:A.getAttribute("creator_symbol"),creator_usericon:Number(A.getAttribute("creator_usericon"))};Bug.update("Hi","sista");DRE.assert(this.pageData.deviation_id);this.node=D;Keeper2.infect(this);this.on();FlashTalk.listen(this.flashTalk,this);DDD.hookMouse(Refunction(this,this.mouseDown));Events.hook(window,"resize",Refunction(this,this.resized));Events.hook(this.getNode("film-button"),"click",Refunction(this,this.playClick));this.play_mode_timer=setInterval(Refunction(this,this.invalidateProp,"film_play_format"),1500);this.devious_comments=!Page.deviation_no_comments;this.creator_comments=false;if(A.getAttribute("creator").toLowerCase()==Page.deviant.username.toLowerCase()){this.creator_comments=true}else{for(C=0;Page.creator_list[C];C++){if(Page.creator_list[C].username.toLowerCase()==Page.deviant.username.toLowerCase()){this.creator_comments=true;break}}}if(B=String(window.location.hash||"").match(/^#?c([0-9]+)$/)){this.get("command","comment jump",B[1])}this.seconds_per_annotation=this.getProp("film_duration")>Film.ANNOTATION_SIZE_TRESHOLD?Film.SECONDS_PER_LARGE_ANNOTATION:Film.SECONDS_PER_SMALL_ANNOTATION;if(Page.film_width&&Page.film_height){this.getNode("filmspot").style.backgroundImage="url(http://sh.deviantart.net/shadow/"+(Shadows.getBackground(this.getNode("filmspot"))||"alpha")+"-000000/2.6667-0.35/"+Page.film_width+"/"+Page.film_height+"/null.png)"}}Film.prototype={debug_label:"Film",on:function(){this.get("ui","volume")},off:function(A){if(this.getProp("film_play_state")=="playing"){this.setProp("film_play_state","paused")}DDD.unhookMouse(Refunction.lastCall(this,this.mouseDown));Events.unhook(window,"resize",Refunction.lastCall(this,this.resized));Events.unhook(this.getNode("film-button"),"click",Refunction.lastCall(this,this.playClick));clearInterval(this.play_mode_timer)},stuff:{ui:{player:{get:function(){}},volume:{needs:[["ui","player"]],get:function(){this.getNode("slidezone").appendChild(this.spawn(FilmVolume).node)}},"clear annotations":{think:function(B){var A,E,C,D;if(Browser.isIE){Tree.get("div.bubbleview").style.height=Ruler.screen.rect().y2}else{Tree.get("div.bubbleview").style.minHeight=Ruler.screen.rect().y2+"px"}A=this.getNode("talk-space");arguments.callee.ebx.clearout.call(this,B,A);return ;if(parseInt(Station.read(A,"left"))){B.done();return }if(A.firstChild){D=this.getPropHistory("film_time_annotations");C=(D[1]||[])[0]||0;E=0;if(C<D[0][0]||C>D[0][0]){E=(D[0][0]-C);Station.push(A.firstChild,"left",{from:0,to:E<0?900:-900,f:Station.f.inversion(Interpolators.sineCurve),time:200},Refunction(this,arguments.callee.ebx.clearout,B,A))}else{B.done()}}else{B.done()}},clearout:function(B,A){this._KP_clear(TalkTower);while(A.firstChild){A.removeChild(A.firstChild)}B.done()}},annotations:{needs:[["ui","clear annotations"],["data","comments"]],think:function(B,A,J){var K,D,L,G,M,F,H,C,I,E;M=this.getProp("film_time_annotations");K=this.getNode("talk-space");if(K.firstChild){return B.done()}E=0;if(this.getNode("ddbox")){this.getNode("ddbox").style.display=M==0?"block":"none"}if(!J[M]){J[M]={creators:{},deviants:{},total:0}}F=J[M];if(Browser.isIE){K.innerHTML='<table class="f" align="center"><tr class="f"><td class="creator-comments f"></td><td class="deviant-comments f"></td></tr></table>'}else{K.appendChild(Tree.create("table.f",{align:"center",style:{position:"relative",left:E+"px"}},Tree.create("tr.f",{},[Tree.create("td.creator-comments f"),Tree.create("td.deviant-comments f")])))}tower=Tree.get(K,"td.creator-comments");C=this.mutations.TalkTower.creators;C.comments=F.creators;C.typeid=1;C.itemid=this.pageData.deviation_id;C.time_index=this.getProp("film_time_seconds");C.storage_handle=F;if(M==0){C.STRING_header_a="Creator Comments";C.STRING_empty="No creator comments";C.STRING_header_b=this.creator_comments?"Write a Creator Comment":""}else{C.STRING_header_a="Official Annotations";C.STRING_empty="";C.STRING_header_b=this.creator_comments?"Write an Official Annotation":""}tower.appendChild(this.spawn(TalkTower,C).node);if(M==0){D=this.getNode("dev-credits").cloneNode(true);H=['<table class="f credits">'];H.push('<td class="f first">Creator</td>');H.push('<td class="f">'+PHP.userlink(this.pageData.creator,this.pageData.creator_symbol)+"</td>");for(G=0;Page.creator_list[G];G++){H.push('<tr><td class="f first">'+Page.creator_list[G].job+"</td>");H.push('<td class="f">'+PHP.userlink(Page.creator_list[G])+"</td></tr>")}H.push("</table>");Tree.gets(D,"div").pop().innerHTML=H.join("");tower.appendChild(D);D.style.display="block"}tower=Tree.get(K,"td.deviant-comments");if(M==0){D=this.getNode("dev-stats").cloneNode(true);tower.appendChild(D);D.style.display="block";if(D=Tree.get(D,"span.comment-count")){L=D.innerHTML.match(/([0-9]+)/);if(L&&L[1]){L=(Number(L[1])||0)+1;D.innerHTML="Comments: "+(J[0].total)+"<br/>Annotations: "+Math.max(0,(L-(J[0].total)))+"<br/>"}}}C={};C.comments=F.deviants;C.typeid=1;C.itemid=this.pageData.deviation_id;C.time_index=this.getProp("film_time_seconds");C.storage_handle=F;if(M==0){C.STRING_header_a="Devious Comments";C.STRING_empty=this.devious_comments?"No comments yet":"";C.STRING_header_b=this.devious_comments&&!this.creator_comments?(Page.film_comment_preference||"Write a Comment"):""}else{C.STRING_header_a="Devious Annotations";C.STRING_empty="";C.STRING_header_b=this.devious_comments&&!this.creator_comments?(Page.film_comment_preference||"Write a Film Annotation"):""}C.owner_control=Page.deviant.username.toLowerCase()==this.pageData.creator;tower.appendChild(D=this.spawn(TalkTower,C).node);B.done();if(E){Station.push(K.firstChild,"left",{from:E>0?900:-900,to:0,f:Interpolators.sineCurve,time:200})}this.getNode("talk-space").style.display="block";this.getNode("talk-shh").style.display="none"}},"annotation map":{needs:[["data","comments"]],think:function(C,E){var B,F,D,G,K,J,H,A,I;B=this.getNode("slidezone");G=Tree.gets(B,"span");while(G.length){B.removeChild(G.pop())}K=B.offsetWidth;H=K/this.getProp("film_duration");I=Math.ceil(this.getProp("film_duration")/this.seconds_per_annotation)+this.seconds_per_annotation;for(F=0;F!=I;F++){if(!(F in E)||E[F].total==0){continue}Bug.log("go to","WOW "+F);J=A=Math.max(0,(F*this.seconds_per_annotation)-(this.seconds_per_annotation-1))*H;if(F==0){continue}else{A+=H*this.seconds_per_annotation;if(A>K){A=K-H;if(A<=J){Bug("Comments","Comment not mapped at "+F);continue}}}D=0;for(D in E[F].creators){break}B.appendChild(Tree.create(D?"span.up":"span",{style:{left:Math.floor(J)+"px",width:Math.floor(A-J)+"px",borderLeftWidth:F>1&&E[F-1]?"1px":"0"}}))}C.done()}}},data:{moods:{get:function(A){DiFi.pushPrivateGet("Mood","getMoodsFlattened",[],A.cbDiFi,A);DiFi.timer(1)}},comments:{get:function(B){var A,C;A=new Task();C=new Task();Bug.update("Fetching");DiFi.pushPrivateGet("Comments","getArtistComment",[this.pageData.deviation_id],A.cbDiFi,A);DiFi.pushPrivateGet("Comments","getThread",[1,this.pageData.deviation_id,50],C.cbDiFi,C);DiFi.timer(1);B.wait(A,C,[arguments.callee.ebx.extractComments,this])},extractComments:function(){var C,J,G,E,H,F,B,D,I,A;F=Task.station.data[0].thread;A=Task.station.data[0].bodies||{};Bug.update("Well","At least I'm here");if(F instanceof Array){Bug.update("It was an array!","!");F={};Bug.update("It's not an array anymore",!(F instanceof Array))}else{Bug.update("It was an array!","NOT")}H={0:{creators:{},deviants:{},total:1}};H[0].creators[-1]={commentid:-1,parentid:0,typeid:1,itemid:this.pageData.deviation_id,username:this.pageData.creator,symbol:this.pageData.creator_symbol,usericon:this.pageData.creator_usericon,ts:0,attributes:0,depth:0,text:Task.station.data[1],signature:""};for(G in F){if(!(F[G].attributes&4294901760)&&Number(F[G].parentid)){if(F[F[G].parentid].attributes&4294901760){F[G].attributes|=F[F[G].parentid].attributes&4294901760}}}I=this.secondsToAnnotation(Math.floor(this.getProp("film_duration")))-1;for(G in F){Bug.log("i",G);if(A[G]){F[G].text=A[G].text;F[G].signature=A[G].signature}D=false;C=(F[G].attributes&4294901760)>>>16;C=this.secondsToAnnotation(C);if(C>=I){C=0}J=(F[G].attributes&2040)>>>3;if(!H[C]){H[C]={creators:{},deviants:{},total:0}}B=F[G].username.toLowerCase();if(!J&&!Number(F[G].parentid)){if(B==this.pageData.creator){D=true}else{for(E=0;Page.creator_list[E];E++){if(B==Page.creator_list[E].username.toLowerCase()){D=true;break}}}}if(D){H[C].creators[G]=F[G];for(E=0;Page.creator_comments[E];E++){if(Page.creator_comments[E].commentid==G){H[C].creators[G].files=H[C].creators[G].files||[];H[C].creators[G].files.push(Page.creator_comments[E])}}}else{H[C].deviants[G]=F[G]}H[C].total++}this.comment_storage=H;return H}}},code:{extras:{get:function(A){var B;if(window.Prototype){A.done();return }B=document.createElement("script");B.setAttribute("type","text/javascript");B.setAttribute("src","http://s.deviantart.com/css/deck.js");(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(B);arguments.callee.ebx.checkIt.call(this,A)},checkIt:function(A){if(window.Prototype){setTimeout(Refunction(A,A.done,null),1)}else{setTimeout(Refunction(this,arguments.callee,A),150)}}},deck:{needs:[["code","extras"]],get:function(B){var A;A=new DndDeck();A.error_details=true;A.loadDeck(Page.deckData);B.done(A)}}},command:{"comment jump":{needs:[["data","comments"]],think:function(B,F,E){var C,A,D;DRE.assert(F&&E,"Expect id param and comments call");for(C in E){if(E[C]["deviants"][F]||E[C]["creators"][F]){D=E[C]["deviants"][F]?true:false;A=C;break}}if(A==undefined){return }this.setProp("film_time_precision",(A*this.seconds_per_annotation)/this.getProp("film_duration"));Task.station(this.peek("ui","annotations"),[function(H){var G;G=Keeper2.get(Tree.get(Tree.get(this.getNode("talk-space"),"td."+(D?"deviant-comments":"creator-comments")),"div.talk-tower"));DRE.assert(G instanceof TalkTower,"talk tower");Task.station(G.peek("ui","comments"),[function(L){var J,I,K;DRE.assert(this instanceof TalkTower,"don't forget ;)");DRE.assert(this.nest_cache,"I expect a nest cache");K=0;I=0;for(J=0;J!=this.nest_cache.length;J++){if(this.nest_cache[J].depth==0&&I>=Film.COMMENTS_PER_PAGE){K++;I=0}I++;if(this.nest_cache[J].commentid==L){break}}Task.station(Task.Delay(100),[this.setProp,this,"page",K],Task.Delay(1),[function(M){if(!this.comment_nodes[M]){return }if(Browser.isGecko){document.documentElement.scrollTop=Ruler.document.node(this.comment_nodes[M]).y}else{document.body.scrollTop=Ruler.document.node(this.comment_nodes[M]).y}Station.push(this.comment_nodes[M],"visibility",{to:"hidden",time:350},{to:"visible",time:150},{to:"hidden",time:150},{to:"visible",time:150},{to:"hidden",time:150},{to:"visible",time:150},{to:"hidden",time:150},{to:"visible",time:150})},this,L])},G,H])},this,F])}},player:{needs:[["ui","player"]],think:function(A,C){var B,D;DRE.assert(arguments.length>=3,"Expected minimum task, command, and player");B=arguments[arguments.length-1];D=Task.argSlice(1).slice(0,arguments.length-2);C="js"+C;DRE.assert(B[C],"Player must support "+C);Bug.log("CMD."+C,D.join(", "));A.done(B[C](D[0],D[1],D[2],D[3]))}},player2:{think:function(A,C){var B;B=Tree.get(this.getNode("filmspot2"),"object");if(!Browser.isIE){if(!B.GoFullscreen){B=Tree.get(this.getNode("filmspot2"),"embed");if(!B.GoFullscreen){return }}}switch(C){case"full":try{B.GoFullscreen();B.Play()}catch(D){}break;case"clear":try{B.SetBannerEnabled(false)}catch(D){}break;default:Bug.log("uhh",C)}}}}},nodeMap:{player:{render:KEEPER_RENDER_IMMEDIATE,get:function(){var A;A=Tree.get("#flash_target_1");if(Tree.get(A,"img")){return A}return A?Tree.get(A,"embed")||Tree.get(A,"object"):this.getNode("filmspot")},watches_props:{film_play_format:function(C,A){if(C.length<=1&&A!="dark"){return }if(C[1]&&C[1][0]=="dark"){return }if(A!="small"){try{this.get("command","player","Pause")}catch(B){}this.getNode("filmspot").style.display="none";this.getNode("slidezone").style.display="none";this.getNode("talk-space").style.display="none"}else{this.getNode("filmspot").style.display="block";this.getNode("slidezone").style.display="block";this.getNode("talk-space").style.display="block"}}}},player2:{get:function(){return Tree.get(this.node,"div.filmspot2")},render:KEEPER_RENDER_IMMEDIATE,watches_props:{film_play_format:function(C,A){if(C.length<=1&&A!="dark"){return }this.getTask("screen blast").reset();this.getTask("screen clear").reset();if(A=="dark"||(C[1]&&C[1][0]=="dark")){if(A=="dark"){try{this.get("command","player","Pause")}catch(B){}this.getNode("player").style.display="none";Task.station(this.getTask("screen blast"),[function(){var D;this.getNode("filmspot").style.display="none";this.getNode("slidezone").style.display="none";this.getNode("talk-space").style.display="none";Tree.addClass(document.body,"theatre");Events.hook(document,"mousemove",Refunction(this,this.darkMouse));if(Tree.get("#filter-warning")){this.getNode("filmspot2").appendChild(Tree.get("#filter-warning").cloneNode(true))}else{if(Page.film_divx_film_url){D=Browser.isMac?"":('<input class="fullscreen" style="margin-left:-'+(Math.floor(Number(Page.film_divx_width)/2)+(Browser.isIE?21:0))+"px;top:"+(Number(Page.film_divx_height)+24)+'px" value="Fullscreen" type="button" onclick="Keeper2.get(this).get(\'command\', \'player2\', \'full\')"/>');this.getNode("filmspot2").innerHTML=D+'<object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="'+Page.film_divx_width+'" height="'+(Number(Page.film_divx_height)+20)+'" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab"><param name="autoPlay" value="false" /><param name="allowContextMenu" value="true" /><param name="bannerEnabled" value="false" /><param name="previewImage" value="'+Page.film_divx_preview_url+'" /><param name="src" value="'+Page.film_divx_film_url+'" /><embed type="video/divx" src="'+Page.film_divx_film_url+'" previewImage="'+Page.film_divx_preview_url+'" width="'+Page.film_divx_width+'" height="'+(Number(Page.film_divx_height)+20)+'" autoPlay="false" bannerEnabled="false" allowContextMenu="true" pluginspage="http://go.divx.com/plugin/download/"></embed></object>'}else{this.getNode("filmspot2").innerHTML='<div class="hh"><div style="position:relative;width:640px;min-height:300px;margin:auto;overflow:hidden;background:#000;text-align:center"><img class="rejected" src="http://s.deviantart.com/minish/film/notready.png" alt=""/><img src="'+Page.film_divx_preview_url+'" alt=""/></div></div>'}}if(Browser.isIE){setTimeout(Refunction(function(){var E;E=Tree.get(this,".fullscreen");E.parentNode.removeChild(E);this.appendChild(E)},this.getNode("filmspot2"),null),100)}},this],this.getTask("screen clear"))}else{Events.unhook(document,"mousemove",Refunction(this,this.darkMouse));if(this.dark_timer){clearTimeout(this.dark_timer);this.dark_timer=null}Task.station(this.getTask("screen blast"),[function(){this.getNode("player2").innerHTML="";Tree.removeClass(document.body,"theatre");Station.apply(Tree.get(this.node,"div.magic"),"opacity",1);this.getNode("player").style.display="block";this.getNode("filmspot").style.display="block";this.getNode("slidezone").style.display="block";this.getNode("talk-space").style.display="block"},this],this.getTask("screen clear"))}}else{if(A!="small"){try{this.get("command","player","Pause")}catch(B){}this.getNode("filmspot").style.display="none";this.getNode("slidezone").style.display="none";this.getNode("talk-space").style.display="none";if(C[1]&&C[1][0]=="small"){this.getNode("filmspot2").innerHTML='<object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="'+Page.film_divx_width+'" height="'+(Number(Page.film_divx_height)+20)+'" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab"><param name="autoPlay" value="false" /><param name="allowContextMenu" value="true" /><param name="bannerEnabled" value="false" /><param name="previewImage" value="'+Page.film_divx_preview_url+'" /><param name="src" value="'+Page.film_divx_film_url+'" /><embed type="video/divx" src="'+Page.film_divx_film_url+'" previewImage="'+Page.film_divx_preview_url+'" width="'+Page.film_divx_width+'" height="'+(Number(Page.film_divx_height)+20)+'" autoPlay="false" bannerEnabled="false" allowContextMenu="true" pluginspage="http://go.divx.com/plugin/download/"></embed></object>'}}else{this.getNode("player2").innerHTML=""}}}}},slidezone:{renderCall:function(A,B){B.appendChild(Tree.create("i.loading"));this.get("ui","annotation map")},render:KEEPER_RENDER_IMMEDIATE},load:{get:function(){return Tree.get(this.getNode("slidezone"),"i.loading")},renderCall:function(B,C){var A;A=setInterval(Refunction.runOnce(this,function(){var D;try{D=this.getNode("player").jsGetPercentLoaded()}catch(E){}if(D==1){C.style.display="none";clearInterval(A)}else{if(D){C.style.display="block";C.style.width=(100-Math.round(D*100))+"%"}}}),500)}},scrubber:{watches_props:{film_time_precision:function(D,C,F,B){var A,E;A=this.getNode("slidezone").offsetWidth;if(!this.hubbering){if(this.getProp("film_time_annotations")>0&&(this.getProp("film_play_state")=="playing"||this.getProp("scrubbing"))&&this.comment_storage&&this.comment_storage[this.getProp("film_time_annotations")]){E=this.comment_storage[this.getProp("film_time_annotations")].total}if(this.getProp("film_loading")){this.getNode("hint").firstChild.nodeValue="Loading"}else{if(!E){this.getNode("hint").firstChild.nodeValue=this.formatTime(this.getProp("film_time_seconds"))}else{this.getNode("hint").firstChild.nodeValue=E+" annotation"+(E==1?"":"s")}}}this.getNode("scrubber").style.left=this.getNode("hint").style.left=A*C+"px";this.getNode("hint").style.marginLeft=-Math.round(this.getNode("hint").offsetWidth/2)+"px"},film_play_state:function(B,A){Bug.update("HEY HEY HEY HEY",1);if(A!="playing"){this.scrubberHintText(this.formatTime(this.getProp("film_time_seconds")))}},film_loading:function(B,A){if(A){if(this.getProp("film_play_state")=="playing"&&this.getProp("film_time_precision")>0){this.getNode("load")}this.scrubberHintText("Loading")}else{this.scrubberHintText(this.formatTime(this.getProp("film_time_seconds")))}}},render:KEEPER_RENDER_IMMEDIATE},"film-button":{watches_props:{film_play_state:function(C,B,D,A){Bug.update("HEY HEY HEY HEY",2);Bug.log("Changing to "+B);if(B=="playing"){Tree.addClass(this.getNode("film-button"),"film-pause");Tree.removeClass(this.getNode("film-button"),"film-play")}else{Tree.addClass(this.getNode("film-button"),"film-play");Tree.removeClass(this.getNode("film-button"),"film-pause")}},film_loading:function(C,B,D,A){if(!B){Tree.removeClass(this.getNode("film-button"),"film-button-stuck")}}},render:KEEPER_RENDER_IMMEDIATE},"talk-shh":{render:KEEPER_RENDER_PRERENDERED},"talk-space":{render:KEEPER_RENDER_IMMEDIATE,watches_props:{film_play_state:function(C,B,D,A){if(B=="playing"){if(Browser.isIE){Tree.get("div.bubbleview").style.height=Ruler.screen.rect().y2}else{Tree.get("div.bubbleview").style.minHeight=Ruler.screen.rect().y2+"px"}this.getNode("talk-space").style.display="none";if(this.getNode("ddbox")){this.getNode("ddbox").style.display="none"}if(this.creator_comments||this.devious_comments){this.getNode("talk-shh").style.display="block"}}else{this.get("ui","annotations")}},film_time_annotations:function(B,A){if(this.getProp("film_play_state")!="playing"){this.get("ui","annotations")}}}},"film-format-options":{get:function(){return Tree.gets(Tree.get(Tree.get(this.node,"div.magic"),"form"),"input")},watches_props:{film_play_format:function(B,A){if(B.length<=1||A=="small"){return }this.setProp("film_play_format_wait",true);setTimeout(Refunction(this,this.setProp,"film_play_format_wait",false),4000)}}},"talk-tower":{contextualGet:function(B,A){return Tree.get(A,"div.talk-tower")},contextualRenderCall:function(B,A){return Tree.create("div.talk-tower")},shortcuts:{}}},propMap:{film_play_format_wait:{get:function(){return false}},film_time_annotations:{get:function(){return this.secondsToAnnotation(Math.min(this.getProp("film_duration")-1,this.getProp("film_time_seconds"))%(this.getProp("film_duration")-1))||0},watches_props:{film_time_seconds:function(){this.invalidateProp("film_time_annotations")}}},film_time_seconds:{get:function(){return Math.round(this.getProp("film_time_precision")*this.getProp("film_duration"))},watches_props:{film_time_precision:function(C,B){var A;A=this.getNode("player");this.setProp("film_time_seconds",Math.round(B*this.getProp("film_duration")));this.invalidateProp("film_time_seconds")}},invalidate:KEEPER_INVALIDATE_MANUAL},scrubbing:{get:function(){return false}},film_time_precision:{get:function(A){try{Bug.update("go to","at "+this.getNode("player").jsGetCurrentTime());return this.getNode("player").jsGetCurrentTime()||(this.getPropHistory("film_time_precision")[0]||[])[0]||0}catch(B){return 0}},setupTimer:(tmp=function(D,C,E,A){var B;Bug.update("HEY HEY HEY HEY",5);if(A=="film_play_state"){B=this.getProp("scrubbing")}else{B=C;C=this.getProp("film_play_state")}if(C=="playing"&&B==false){if(!this.film_time_precision_interval){this.film_time_precision_interval=setInterval(Refunction(this,this.invalidateProp,"film_time_precision"),250)}}else{if(this.film_time_precision_interval){clearInterval(this.film_time_precision_interval);this.film_time_precision_interval=null}}}),watches_props:{film_play_state:tmp,scrubbing:tmp},invalidate:KEEPER_INVALIDATE_MANUAL,change:function(C,B){if(B==1){try{this.get("command","player","FullscreenOff")}catch(A){}}}},film_play_format:{get:function(){var A;A=this.getNode("film-format-options");if(A[0].checked&&!this.getProp("film_play_format_wait")){return"small"}else{if(A[2]&&A[2].checked){return"dark"}else{return"full"}}}},film_duration:{get:function(){return Number(Page.film_duration)/1000}},film_play_state:{get:function(A){return"paused"},render:KEEPER_RENDER_IMMEDIATE},film_loading:{get:function(){return false}},slider_rect:{get:function(A){return Ruler.document.node(this.getNode("slidezone"))}}},taskMap:{"screen blast":function(A){var B;if(Browser.isIE){Tree.get("div.bubbleview").style.height=Ruler.screen.rect().y2}else{Tree.get("div.bubbleview").style.minHeight=Ruler.screen.rect().y2+"px"}B=Tree.create("div.screenblaster",{style:{position:"absolute",left:0,top:0,width:Ruler.screen.rect().w+"px",height:Math.max(Ruler.screen.rect().h+200,Ruler.document.node(Tree.get("#depths")).x2)+"px",zIndex:1337,opacity:0.01,background:"#313D3D"}});document.body.appendChild(B);Station.push(B,"opacity",{from:0.01,to:1,f:Interpolators.sineCurve,time:150},Refunction(A,A.done,null))},"screen clear":function(A){blaster=Tree.get("div.screenblaster");Station.push(blaster,"opacity",{from:1,to:0.01,f:Interpolators.sineCurve,time:150},function(){document.body.removeChild(blaster)},Refunction(A,A.done,null))}},mutations:{TalkTower:{creators:{spawnHooks:[function(A,C){var B;if(A==TalkPost){for(B in this.mutations.TalkPost){C[B]=this.mutations.TalkPost[B]}}return C}],mutations:{TalkPost:{template:'<div class="talk-post"><div class="talk-attach"><img class="cx" src="http://s.deviantart.com/minish/widgets/neutral-x.gif" alt="x"/><div class="name"></div><div class="h"><div class="previewbox" style="display:none"></div><textarea class="text" tabindex="1337"></textarea></div><div class="inputs"><input class="preview" type="button" value="Preview" tabindex="1337" />&nbsp;&nbsp;<input class="post" type="button" value="Send" tabindex="1337" /></div><div class="talk-files"><a href="#" class="empty">add picture or file</a><a href="#" class="empty">add picture or file</a></div></div></div>',on:function(){Events.hook(this.getNode("files"),"click",Refunction(this,this.fileClick))},off:function(){Events.unhook(this.getNode("files"),"click",Refunction.lastCall(this,this.fileClick))},nodeMap:{files:{get:function(){return Tree.get(this.node,"div.talk-files")}}},fileClick:function(B){var A;A=Tree.ancestor(B.srcElement||B.target,"a");if(!A||!Tree.hasClass(A,"empty")){return false}this.active_file_widget=A;if(this.up(Film).peek("code","deck").status.active&&!this.up(Film).peek("code","deck").status.result){return false}Task.station(this.up(Film).peek("code","deck"),[function(){Task.station.data[0].modalizeDeck("deck_modal_file_layout",{addfile:true,restoreselection:true,ieforms:[]},Task.station.data[0].newPreviewSelectHandler,Refunction(this,this.fileDone))},this]);return false},updateAttachments:function(){if(Tree.gets(this.getNode("files"),"a.image").length==0){Tree.removeClass(Tree.get(this.node,"div.talk-attach"),"talk-attach-expanded")}else{if(!Tree.hasClass(Tree.get(this.node,"div.talk-attach"),"talk-attach-expanded")){Tree.addClass(Tree.get(this.node,"div.talk-attach"),"talk-attach-expanded")}}this.node.style.display="none";this.node.style.display="block"},fileDone:function(A){this.active_file_widget.setAttribute("attachdeckid",A.deckId);if(A.is_displayable){this.active_file_widget.className="image";this.active_file_widget.innerHTML='<img src="'+A.thumbUrl+'" alt=""/><img class="x" src="http://s.deviantart.com/minish/widgets/neutral-x.gif" alt="x" onclick="Keeper2.get(this).fileOff(Tree.ancestor(this, \'a\'));return false"/>'}else{this.active_file_widget.className="file";this.active_file_widget.innerHTML=(A.name.split(".").pop().toUpperCase()||"FILE")+'<img class="x" src="http://s.deviantart.com/minish/widgets/neutral-x.gif" alt="x" onclick="Keeper2.get(this).fileOff(Tree.ancestor(this, \'a\'));return false"/>'}Refunction.lastCall(this,this.fileDone);this.updateAttachments()},fileOff:function(A){A.setAttribute("attachdeckid","");A.innerHTML="add picture or file";A.className="empty";this.updateAttachments()}}}}}},flashTalk:function(D,C,B){var A;Bug.log("FlashTalk",D);switch(D){case"newGui":A=this.peek("ui","player");setTimeout(Refunction(A,A.done,this.getNode("player")),1);break;case"videoEnd":this.setProp("film_play_state","paused");this.setProp("film_time_precision",1);break;case"stateStop":case"statePause":case"setStateStop":case"setStatePause":case"UIPauseRequest":case"onUIPauseRequest":this.setProp("film_play_state","paused");break;case"statePlay":case"setStatePlay":case"UIResumeRequest":case"onUIResumeRequest":this.setProp("film_play_state","playing");break;case"stateLoad":case"onBuffer":case"onBuffering":if((this.getProp("film_time_seconds")+1)>=this.getProp("film_duration")){Task.station(this.peek("command","player","Pause"),[this.setProp,this,"film_time_precision",1])}else{this.setProp("film_loading",true)}break;case"onUnBuffer":case"onUnBuffering":this.setProp("film_loading",false);break}},scrubberHintText:function(){with(this.getNode("hint")){firstChild.nodeValue=arguments[0];style.marginLeft=-Math.round(offsetWidth/2)+"px"}},resized:function(){this.invalidateProp("slider_rect")},playClick:function(B){var A;Bug.log("***********************************************","***");this.getNode("film-button").blur();if(this.getProp("film_play_state")!="playing"){A=this.getProp("film_time_precision");if(A==1){try{this.getNode("player").jsSetCurrentTime(0)}catch(B){}A=0}if(this.getProp("film_time_precision")==0){Tree.addClass(this.getNode("film-button"),"film-button-stuck");this.setProp("film_loading",true)}this.get("command","player","Play")}else{this.get("command","player","Pause")}return false},darkMouse:function(C){var E,B,A,F;function D(H,G){H.x-=G;H.y-=G;H.x2+=G;H.y2+=G;return H}A=(Browser.isKHTML?0.99:1);B=Tree.get(this.node,"div.magic");F=Tree.get("#table-deviation-nav");if(this.dark_timer){clearTimeout(this.dark_timer);this.dark_timer=null}if(Station.read(B,"opacity")<A){Station.push(B,"opacity",{from:Station.read(B,"opacity"),to:A,f:Interpolators.sineCurve,time:500});Station.push(Tree.get(Tree.get("#theatre-husher"),"img"),"opacity",{from:Station.read(B,"opacity"),to:A,f:Interpolators.sineCurve,time:500});if(F){Station.push(F,"opacity",{from:Station.read(B,"opacity"),to:A,f:Interpolators.sineCurve,time:500})}}if(Ruler.hitTest(Ruler.document.pointer(C),D(Ruler.document.node(B),6))==null){this.dark_timer=setTimeout(TakeOver(F?Refunction(Station,Station.push,F,"opacity",{from:A,to:0,f:Interpolators.sineCurve,time:500}):null,Refunction(Station,Station.push,B,"opacity",{from:A,to:0,f:Interpolators.sineCurve,time:500}),Refunction(Station,Station.push,Tree.get(Tree.get("#theatre-husher"),"img"),"opacity",{from:A,to:0,f:Interpolators.sineCurve,time:500})),1000)}},dark_timer:null,mouseDown:function(B){var A;A=(B.srcElement||B.target);if(Tree.tag(A)=="span"||Tree.tag(A)=="i"){A=A.parentNode}if(Tree.hasClass(A,"slidezone")){A=A.firstChild;while(A&&A.nodeType!=1){A=A.nextSibling}DRE.assert(Tree.hasClass(A,"scrubber"),"div.slider's first child element must be div.scrubber")}if(Tree.hasClass(A,"scrubber")){this.invalidateProp("slider_rect");if(DDD.mouseDown.call(A,B,this,0)){return false}}return true},ddd:{snap:function(A){try{this.getNode("player").jsScrubStart()}catch(A){}this.setProp("scrubbing",true)},drag:function(C){var B,D,A,B;D=Ruler.document.pointer(C);A=D.x-Ruler.document.node(this.getNode("slidezone")).x;B=this.getNode("slidezone").offsetWidth;A=Math.min(B,Math.max(0,A));this.ddd.node.style.left=A+"px";try{Bug.update("go to","go to "+(A/B));this.getNode("player").jsSetCurrentTime(A/B);if(this.getProp("film_play_state")=="playing"&&Number(this.getNode("player").jsGetPercentLoaded())<(A/B)){this.getNode("load")}}catch(C){}this.setProp("film_time_precision",A/B)},drop:function(A){try{this.getNode("player").jsScrubStop()}catch(A){}this.setProp("scrubbing",false)}},formatTime:function(C){var A;function B(D){var E;E="0"+Math.floor(D);return E.substr(Math.max(0,E.length-2))}A="";if(C>3600){A=Math.floor(C/3600)+":";if(A.length>3){return"??:??"}}return A+B(C/60)+":"+B(C%60)},secondsToAnnotation:function(A){return Math.floor((A+(this.seconds_per_annotation-1))/this.seconds_per_annotation)}};Film.COMMENTS_PER_PAGE=25;Film.SECONDS_PER_SMALL_ANNOTATION=3;Film.SECONDS_PER_LARGE_ANNOTATION=10;Film.ANNOTATION_SIZE_TRESHOLD=400;Film.isEmpty=function(B){var A;if(B instanceof Array){return B.length==0}for(A in B){return false}return true};function HTMLPager(){}HTMLPager.prototype={template:'<div class="alink nav"></div>',debug_label:"HTMLPager",on:function(){var C,D,E,A,B;C=[];C.push('<span class="shadow"><span>');if(this.page>0){C.push('<a href="#" htmlpage="'+(this.page-1)+'">Previous Page</a>')}else{C.push("<del>Previous Page</del>")}C.push("&nbsp;&nbsp;&nbsp;&nbsp;");this.pages--;D=Math.max(0,this.page-1);E=Math.min(D+4,this.pages);D=Math.max(0,Math.min(D,E-4));if(D!=E){for(B=D;B<=E;++B){if(B==this.page){C.push("<strong>"+(B+1)+"</strong>")}else{C.push('<a href="#" htmlpage="'+B+'">');if(B==D&&B>0){C.push("...");C.push(B+1)}else{if(B==E&&B<this.pages){C.push(B+1);C.push("...")}else{C.push(B+1)}}C.push("</a>")}}}C.push("&nbsp;&nbsp;&nbsp;&nbsp;");if(this.page<this.pages){C.push('<a href="#" htmlpage="'+(this.page+1)+'">Next Page</a>')}else{C.push("<del>Next Page</del>")}C.push("</span></span>");this.node.innerHTML=C.join("");A=Tree.gets(this.node,"a");for(B=0;A[B];B++){Events.hook(A[B],"click",Refunction(this,this.clicked,Number(A[B].getAttribute("htmlpage"))))}},off:function(){},clicked:function(A){this.owner.setProp("page",A);if(Browser.isGecko){document.documentElement.scrollTop=Ruler.document.node(this.owner.node).y}else{document.body.scrollTop=Ruler.document.node(this.owner.node).y}return false}};function FilmVolume(){}FilmVolume.prototype={on:function(){DDD.hookMouse(Refunction(this,this.mouseDown));this.uiVolume(this.up(Film).getNode("player").jsGetVolume()/100);if(Page.deviant_subscriber){this.getNode("rv").firstChild.nodeValue=11}},off:function(){DDD.unhookMouse(Refunction.lastCall(this,this.mouseDown))},nodeMap:{},template:'<div class="vol"><div class="lv">0</div><div class="rv">10</div><tt></tt><b></b></div>',mouseDown:function(C){var B,A;B=(C.srcElement||C.target);if(B.parentNode==this.node){B=B.parentNode}if(B==this.node){A=Ruler.document.pointer(C).x;A-=Ruler.document.node(this.node).x;if(A<67&&DDD.mouseDown.call(B,C,this,0)){return false}}return true},uiVolume:function(A){Tree.get(this.node,"b").style.left=(23+Math.round(A*24))+"px"},ddd:{snap:function(A){},drag:function(B){var A;A=Ruler.document.pointer(B).x;A-=Ruler.document.node(this.node).x;A-=22;A/=24;A=Math.max(0,Math.min(1,A));this.uiVolume(A);this.up(Film).getNode("player").jsSetVolume(Math.round(A*100))},drop:function(A){}}};if(window.DWait){DWait.run("jms/pages/film.js")};