/*
 *  © 2000-2010 deviantART, Inc. All rights reserved.
 */
if(!window.AutoExec){AutoExec=[]}DWait.ready(["jms/lib/bind.js","jms/lib/popup.js","jms/lib/ruler.js"],function(){function A(B){this.si=B}A.prototype={link:function(D,C){var B;if(window.event){window.event.cancelBubble=true}if(!(B=this.cached_popup_menu)){B=this.cached_popup_menu=Popup.create({className:"loginmenu",callback:bind(this,this.hide,D),ontop:true});B.node.appendChild(document.getElementById("sitemap-"+this.si+"-menu").cloneNode(true));B.node.firstChild.style.display="block";B.node.firstChild.onclick=Popup.completeAll}D.className+=" active";if(!C){C=Ruler.document.node(D);C.y=30}Popup.show(B,C)},hide:function(B){B.className=B.className.replace(/\bactive\b/g,"")}};window.LoginMenu=A;window.da_login_menu=da_login_menu=new A("login");window.da_group_menu=da_group_menu=new A("groups");if(window.DWait){DWait.run("jms/chrome/loginmenu.js")}});DWait.ready(["jms/lib/popup.js","jms/lib/tree.js","jms/lib/difi.js"],function(){Popup.clicks.friends={create:function(){var A;A=Tree.create("div.friendmachine friendmachine-new",{},[Tree.create("div.controls",{},[Tree.create("i.icon i1"),String((deviantART.deviant||{}).symbol)+String((deviantART.deviant||{}).username),Tree.create("small",{},"Logged In"),Tree.create("select",{disabled:true,onchange:'Popup.clicks["friends"].statusChange(this)',style:{}},[Tree.create("option",{value:0},"Online"),Tree.create("option",{value:1},"Invisible")]),Tree.create("label",{title:"Be invisible in private group areas"},[Tree.create("input.reallyinvisible",{type:"checkbox",value:1,onchange:'Popup.clicks["friends"].statusChange(Tree.get(Tree.ancestor(this, "div.friendmachine"), "select"))'}),"Even on Private Pages"]),Tree.create("a.edit",{href:"http://my.deviantart.com/deviants/"},"Add/Remove")]),Tree.create("div.readout")]);DiFi.pushGet("Friends","getFriendsMenu",[1],this.downloadReady,A);DiFi.pushGet("User","getStatus",[],this.statusReady,A);DiFi.send();return A},statusReady:function(D,C){var A,B;A=Tree.get(this,"select");if(D){B=Number(C.response.content);A.disabled=false;if(C.request.method!="setStatus"){if(B>=1){Tree.addClass(this,"friendmachine-invisible");if(B==2){Tree.get(this,"input.reallyinvisible").checked=true}A.selectedIndex=1}else{A.selectedIndex=0}}else{B=C.request.args[0]}Tree.get(this,"i.icon").className="icon i"+[1,4,4][B]}else{A.disabled=true}},statusChange:function(A){var B=A.value,C=Tree.ancestor(A,"div.friendmachine"),D=Tree.get(C,"input.reallyinvisible");if(B==0){Tree.removeClass(C,"friendmachine-invisible");D.checked=false}else{Tree.addClass(C,"friendmachine-invisible");if(D.checked){B=2}}DiFi.pushPost("User","setStatus",[B],Popup.clicks.friends.statusReady,Tree.ancestor(A,"div.friendmachine"));DiFi.send()},downloadReady:function(I,D){var E,H,G,L,C,K="",J,F,A,B;H=D.response.content;if(I){F=Tree.get(this,"div.readout");F.innerHTML='<dl class="online deviants"></dl><dl class="offline deviants"></dl>';L=F.getElementsByTagName("dl");C=L[1];L=L[0];if(eax=document.getElementById("sitemap-groups-menu")){F.insertBefore(eax.getElementsByTagName("dl")[0].cloneNode(true),F.firstChild)}if(D.response.content[0]=="Error"){D.response.content=[]}for(E=0;H=D.response.content[E];E++){switch(H.lastvisit){case"Online":case"Idle":A=1;B="";break;case"Invisible":A=4;B="";break;default:A=2;B='<span title="away '+H.lastvisit+'">away '+(H.lastvisit.split(" ")[0])+"</span>"}J=Tree.create("dd.f");J.innerHTML='<i class="i'+A+' icon"></i>'+H.symbol+"<a onclick=\"return Popup.complete(this, '"+H.username+"')\" "+(A==1?' class="a" ':"")+' href="http://'+H.username+'.deviantart.com/">'+H.username+"</a>"+B;if(A==1){L.appendChild(J)}else{C.appendChild(J)}}H=Tree.gets(F,"dd");for(E=1;H[E];E+=2){Tree.addClass(H[E],"a")}if(D.response.content.length==0){L.appendChild(Tree.create("dd.f",{},Tree.create("div.c",{},"no friends online")))}}else{DiFi.stdErr(null,D.response.content)}}};if(window.DWait){DWait.run("jms/lib/popup.js.friends.js")}});DWait.ready(["jms/lib/dtlocal.js","jms/lib/pager.js"],function(){DWait.ready("jms/lib/gmi.js",function(){window.TalkPostWrapper=GMIBase.extend({gmiConstructor:function(){this.talkpost=new TalkPost(this);this.talkpost.node=this.gmi_node;this.talkpost.comment=this.gmi_args;this.talkpost.renderMoodBox();this.reset=bind(this.talkpost,this.talkpost.reset);Tree.setObject(this.gmi_node,"TalkPost",this.talkpost)},gmiDestructor:function(){this.talkpost.localDestroy(callback)},previewClick:function(){this.talkpost.confirmPreview()},sendClick:function(){if(window.event){event.cancelBubble=true}this.talkpost.confirmPost();return false},setCallback:function(A){this.talkpost.callback=A},hookSend:function(){var A,B;A=this.talkpost.node.getElementsByTagName("input");A[A.length-1].onclick=bind(this,this.sendClick)},stdPostHook:function(A){this.setCallback(bind(this,this.stdPostHookDone));this.hookSend();if(A){var B=document.createElement("div");B.innerHTML=('<table class="f full"><tr><td class="f"><div class="exofilo" style="float:left;margin-top:20px;margin-right:12px"><div id="gmi-ExoFilo" name="gmi-ExoFilo"></div><div id="gmi-ExoFilo" name="gmi-ExoFilo"></div></div></td><td class="f"></tr></table>');this.gmi_node.parentNode.insertBefore(B.firstChild,this.gmi_node);this.talkpost.exo_files=GMI.query(this.gmi_node.parentNode,"ExoFilo");this.gmi_node.previousSibling.getElementsByTagName("td")[1].appendChild(this.gmi_node)}},stdPostHookDone:function(D,B){var A,E,C;if(D!="posted"){return }A=GMI.up(this.gmi_node).gmiQuery("CCommentThread")[0];if(A.gmi_node.firstChild&&(A.gmi_node.firstChild.className||"").indexOf("expendable")>=0){A.gmi_node.innerHTML=""}E=document.createElement("div");E.innerHTML=B.html;while(E.firstChild){if(E.firstChild.nodeType==1&&window.Station){Station.run(E.firstChild,"opacity",{from:0.01,to:Browser.isKHTML?0.99:1,time:400,f:Interpolators.sineCurve})}A.gmi_node.appendChild(E.firstChild)}delete E;this.reset()}})});window.TalkPost=function(A,E,D,B){var C;DTLocal.infect(this);if(typeof A=="function"){return }this.owner=A;this.current_mode="normal";if(window.TalkPostWrapper&&(A instanceof TalkPostWrapper)){return }this.node=Tree.createFragment(this.template,true);this.comment=E;this.callback=D;DRE.assert(!(B instanceof Array));for(C in (B||{})){this[C]=B[C]}this.on()};TalkPost.prototype={debug_label:"TalkPost",on:function(){DRE.assert(this.node);DRE.assert(this.comment);DRE.assert(this.comment.typeid);DRE.assert(this.comment.itemid);Tree.setObject(this.node,"TalkPost",this);if(Number(this.comment.parentid)){Tree.addClass(this.node,"talk-post-reply")}this.localEventHook(Tree.get(this.node,".cx"),"click",bind(this,this.confirmExit));this.localEventHook(Tree.get(this.node,".post"),"click",bind(this,this.confirmPost));this.localEventHook(Tree.get(this.node,".preview"),"click",bind(this,this.confirmPreview));Tree.get(this.node,".name").innerHTML=deviantART.deviant&&deviantART.deviant.username?this.PHP_userlink(deviantART.deviant):"Your Comment";this.current_mode="normal";Tree.get(this.node,".text").value=this.constructor.localCache["text"+(Number(this.comment.parentid)||"t"+(this.comment.time_index||0))]||"";if(!deviantART.deviant||!deviantART.deviant.username){this.node.style.display="none"}var A=Tree.get(this.node,"div.moodbox");if(A){if(this.hide_moods){$j(A).parent().hide()}else{this.renderMoodBox()}}},off:function(){if(this.owner.local){this.owner.localClean(TalkPost)}},localRecv:function(A){if(A=="destroy"){this.constructor.localCache["text"+(Number(this.comment.parentid)||"t"+(this.comment.time_index||0))]=Tree.get(this.node,".text").value;if(this.owner.local){if(this.local_tie){this.owner.localClean(this.local_tie)}if(this.node.parentNode){this.node.parentNode.removeChild(this.node)}}}},PHP_userlink:function(B,A){if(typeof B=="object"){A=B.symbol;B=B.username}return A+'<a class="u" href="http://'+B.toLowerCase()+'.deviantart.com/">'+B+"</a>"},template:'<div class="talk-post" keeper="TalkPost"><img class="cx" src="http://st.deviantart.com/minish/messages/neutral-x.gif" alt="x"/><div class="name"></div><div class="h"><div class="previewbox" style="display:none"></div><table class="f"><tr><td class="f"><textarea class="text" tabindex="1337"></textarea></td><td class="f rr"><div class="moodbox"></div></td></tr></table></div><div class="inputs" style="position:relative"><input class="preview" type="button" value="Preview" tabindex="1338"> &nbsp;<input class="post" type="button" value="Send" tabindex="1337"><div style="position:absolute;right:0;top:4px;font-size:8.25pt"><a class="emoticons" href="http://comments.deviantart.com/emoticons" onclick="return popup(this.href, \'emoticons\', 400, 600);">Emoticons</a></div></div></div>',nodeMap:{files:{get:function(){return Tree.get(this.node,"div.talk-files")}}},renderMoodBox:function(){var C,D,A,B;C=Tree.get(this.node,".moodbox");if(!C){return false}DRE.assert(C.childNodes.length==0,"First post!");B=this.constructor.localCache["mood"+(Number(this.comment.parentid)||"t"+(this.comment.time_index||0))];A=Pager.create({more_links:true,rootri:"mood",theme:this.pager_theme||(Tree.hasClass(document.body,"deviant")?"deviant":"light"),selection:B,class_name:"pager2 talk-pager",icon_base_url:"http://e.deviantart.com/emoticons/moods/",callback:bind(this,function(F,E){var G;this.constructor.localCache["mood"+(Number(this.comment.parentid)||"t"+(this.comment.time_index||0))]=F;this.mood=F.split("/").pop();if(G=Tree.get("input.mood")){G.value=this.mood}this.focus();return false})});C.appendChild(A.node);Pager.loadPage(A,B?B.split("/").reverse().slice(1).reverse().join("/")||"mood":"mood");if(B){this.mood=B.split("/").pop()}DiFi.timer(10);this.pager=A},getText:function(){return Tree.get(this.node,".text").value},setPreviewText:function(A){Tree.get(this.node,".previewbox").innerHTML=('<div class="pp"><a class="a" href="#" onclick="Tree.getObject(Tree.ancestor(this, \'div.talk-post\'), \'TalkPost\').goMode(\'normal\');(window.event || {}).cancelBubble = true;return false">Back to Editing</a><br/><br/><strong>Preview</strong><br/><br/>'+A+"</div>")},focus:function(){if(this.current_mode=="normal"){Tree.get(this.node,".text").focus()}},current_mode:null,goMode:function(B){var A;if(B==this.current_node){return }A=this.current_mode;this.current_mode=B;switch(B){case"busy":Tree.get(this.node,".text").disabled=true;Tree.get(this.node,".preview").disabled=true;Tree.get(this.node,".post").disabled=true;break;case"normal":Tree.get(this.node,".text").disabled=false;Tree.get(this.node,".preview").value="Preview";Tree.get(this.node,".preview").disabled=false;Tree.get(this.node,".post").disabled=false;Tree.get(this.node,".previewbox").style.display="none";Tree.get(this.node,".text").style.visibility="visible";Tree.get(this.node,".text").focus();break;case"preview":Tree.get(this.node,".preview").value="Preview Off";Tree.get(this.node,".preview").disabled=false;Tree.get(this.node,".post").disabled=false;Tree.get(this.node,".previewbox").style.visibility="hidden";Tree.get(this.node,".previewbox").style.display="block";Tree.get(this.node,".previewbox").style.height=Tree.get(this.node,".text").offsetHeight+"px";Tree.get(this.node,".text").style.visibility="hidden";Tree.get(this.node,".previewbox").style.visibility="visible";break;case"fail":alert(this.last_fail_reason);this.goMode("normal");break}},confirmExit:function(A){if(this.callback){this.callback("closed")}this.off();return false},confirmPost:function(){var C,B,A,D;D=this.getText();if(D.search(/[^\s]/g)==-1){this.focus();return false}this.goMode("busy");C=0;B=0;if(this.exo_files){if(this.exo_files[0]&&this.exo_files[0].file){C=this.exo_files[0].file.deckId}if(this.exo_files[1]&&this.exo_files[1].file){B=this.exo_files[1].file.deckId}}else{if(Tree.get(this.node,".talk-files")){A=Tree.gets(Tree.get(this.node,".talk-files"),"a");DRE.assert(A.length==2);C=Number(A[0].getAttribute("attachdeckid")||0);B=Number(A[1].getAttribute("attachdeckid")||0)}}if(this.comment.time_index||C||B){DiFi.pushPost("Comments","filmPost",[this.getText(),this.comment.itemid,this.comment.parentid||0,this.comment.typeid,this.mood||0,this.comment.time_index||0,C,B],this.posted,this)}else{DiFi.pushPost("Comments","post",[this.getText(),this.comment.itemid,this.comment.parentid||0,this.comment.typeid,this.mood||0],this.posted,this)}DiFi.send()},confirmPreview:function(){if(this.current_mode=="preview"){this.goMode("normal");return }this.setPreviewText("Loading preview");DiFi.pushPublicGet("Comments","preview",[this.getText(),0],this.preview,this);DiFi.send();this.goMode("preview")},preview:function(B,A){if(!B){if(this.current_mode=="preview"){this.goMode("normal");this.setPreviewText("")}return }this.setPreviewText(A.response.content)},posted:function(H,C){var F,G,E,B,I,A;if(!H){try{HOLDTHEPHONE()}catch(D){}this.last_fail_reason=(typeof (C.response.content||{}).error)=="string"?C.response.content.error:"There was an error while posting the comment.\n\nPlease try again soon.";this.goMode("fail");return }F=C.response.content;G={commentid:F.id,parentid:this.comment.parentid,typeid:this.comment.typeid,itemid:this.comment.itemid,username:deviantART.deviant.username,symbol:deviantART.deviant.symbol,usericon:deviantART.deviant.usericon,ts:Math.floor((new Date).valueOf()/1000),attributes:(C.request.args[5]<<16)|(C.request.args[4]<<3),depth:undefined,text:F.body,signature:null,files:F.files,html:F.html};try{HALT()}catch(D){}this.constructor.localCache["text"+(Number(this.comment.parentid)||"t"+(this.comment.time_index||0))]=null;this.constructor.localCache["mood"+(Number(this.comment.parentid)||"t"+(this.comment.time_index||0))]=null;Tree.get(this.node,".text").value="";if(this.callback){this.callback("posted",G)}if(this.owner){this.off()}if(this.up&&this.up(TalkTower)){this.up(TalkTower).add(G)}},reset:function(){var A,C,B;this.goMode("normal");this.node.getElementsByTagName("textarea")[0].value="";if(this.pager){Pager.select(this.pager,"");Pager.loadPage(this.pager,"mood")}if(this.exo_files){for(B=0;B!=this.exo_files.length;B++){if(this.exo_files[B]&&this.exo_files[B].file){this.exo_files[B].deckNuke()}}}}};if(window.DWait){DWait.run("jms/pages/talkpost.js")}});function getCommentNode(A){if(!(A.tagName=="DIV"&&Tree.hasClass(A,"thought"))){A=Tree.ancestor(A,"div.thought")}return A}_forcePageLayout=function(){if(Browser.isGecko||Browser.isOpera){document.body.style.height="1px";document.body.style.height="auto"}else{if(!Browser.isKHTML){document.body.style.display="none";document.body.style.display="block"}}};if(!window.encodeString){window.encodeString=function(A){A=escape(A);A=A.replace(/\+/g,"%2B");A=A.replace(/\%u([\dABCDEF]{4})/g,"%26%23x$1%3B");return A}}Comment={nodes:{submit:null},applicationReady:function(){var A;if(A=Tree.get("#commentsubmit")){A=Tree.get(A,"div.thought");ScrollThreshold.register(A,Comment.prepareForm,-300);Comment.nodes.submit=A.cloneNode(true)}}};AutoExec.push(Comment.applicationReady);Comment.uniqueid=1;Comment.init=function(B,D,A){var C={parentid:D,parenthref:A?A.href:"",link:A,box:B,nest:B.parentNode,send:Tree.get(B,"input.button replysend"),cancel:Tree.get(B,"input.button replycancel"),preview:Tree.get(B,"input.replypreview"),textarea:Tree.get(B,"textarea"),itemid:document.getElementsByName("itemid")[0].value,typeid:document.getElementsByName("typeid")[0].value,splitid:document.getElementsByName("splitid")[0].value,moodid:Tree.get(B,"input.mood"),body:Tree.get(B,"div.body"),time:Tree.get(B,"span.time"),links:Tree.get(B,"span.links"),url:"comments/post",busy:false};Tree.setObject(B,"comment",C);return C};Comment.create=function(F,A){var E,D;var C=Comment.nodes.submit;E=C.cloneNode(true);E.setAttribute("id","EasyReplyBox"+Comment.uniqueid++);D=Tree.create("div",null,E);if(A){Tree.insertBefore(D,A.nextSibling)}else{var B=Tree.ancestor(F,"div.thought");Tree.addClass(D,"nest");Tree.insertBefore(D,B.nextSibling);if(self.Admin&&Admin.active&&!E.adminTemplateActive){Comment.setupAdminTemplates(E)}if(Browser.isIE){_forcePageLayout()}}Comment.prepareForm(E);return E};Comment.setup=function(A){A.send.onclick=function(B){Comment.post(this);return false};Tree.get(A.box,"a.x").style.display="block";A.textarea.setAttribute("tabIndex","4");A.send.setAttribute("tabIndex","5");A.preview.setAttribute("tabIndex","6");A.textarea.focus()};Comment.setupAdminTemplates=function(A){if(A.adminTemplateActive){return }DiFi.pushGet("Comments","getTemplates",[],Comment.adminTemplatesReady,A);DiFi.send()};Comment.adminTemplatesReady=function(G,F){if(!G){return alert("Error in retrieving Templates. Aborting...")}var C=F.response.content;var B,E,A;A=Tree.create("div.comment-templates",null,[B=Tree.create("select",{style:{fontSize:"10px"},id:"ctemplate-select"}),E=Tree.create("select",{style:{fontSize:"10px"},id:"ctemplate-subselect"})]);B.innerHTML='<option style="font-weight: bold;">Admin Templates...</option>';for(var D in C){B.options[B.options.length]=new Option(D.replace("templates","").toUpperCase(),D)}B.onchange=function(){E.options.length=0;var H=C[this.value];E.options[0]=new Option("Select...");for(var I in H){if(Admin.hasPriv(H[I][2])){E.options[E.options.length]=new Option(H[I][0],H[I][1])}}};E.onchange=function(){var H=Tree.get(Tree.ancestor(this,"div.thought"),"textarea");H.value=this.options[this.selectedIndex].value};Tree.insertBefore(A,Tree.get(this,"span.id").nextSibling);this.adminTemplateActive=true};Comment.removeAdminTemplates=function(B){var A=Tree.get(B,"div.comment-templates");if(A&&A.parentNode){A.parentNode.removeChild(divTemplate)}};Comment.add=function(A){if(Tree.get("#commentsubmit")){setTimeout('with(Tree.get(Tree.get("#commentsubmit"),"textarea")){if (!disabled)focus()}',100)}else{alert("Sorry, you cannot add a comment here.");if(window.event){event.cancelBubble=true}return false}};Comment.embed=function(A){Comment.add(A)};Comment.reply=function(F,D,C,A){if(C&&(C.shiftKey||C.ctrlKey)){return true}var E,B;if(D.hasOpenReply){if(window.event){C.cancelBubble=true}return false}D.hasOpenReply=true;B=Comment.create(D,A);E=Comment.init(B,F,D);Comment.setup(E);if(window.event){C.cancelBubble=true}return false};Comment.post=function(G){var D=Tree.getObject(Tree.ancestor(G,"div.thought"),"comment");var C,B,F,A,E;if(!D||D.busy||D.textarea.value.length==0){return }E={ref:"xml",body:encodeString(D.textarea.value),itemid:D.itemid,typeid:D.typeid};if(D.parentid){E.parentid=D.parentid}if(D.moodid){E.moodid=D.moodid.value}Comment.busy(D);D.send.value="(sending)";D.link.hasOpenReply=false;if(deviantART.isLocal&&false){Comment.ready(true,null,D)}else{var E=[D.textarea.value,D.itemid,D.parentid||0,D.typeid,D.moodid?D.moodid.value:0];DiFi.pushPost("Comments","post",E,Comment.postReady,D);DiFi.send()}};Comment.busy=function(A){A.busy=true;A.send.disabled=true;A.textarea.disabled=true;A.box.style.cursor="wait";A.textarea.style.cursor="wait"};Comment.idle=function(A){A.busy=false;A.send.disabled=false;A.textarea.disabled=false;A.box.style.cursor="default";A.textarea.style.cursor="text"};Comment.postReady=function(E,C){var A,G,F,B;Comment.idle(this);if(!E){return alert("An error occurred while posting your comment.\n\n"+((C.response.content||{}).error||""))}try{F=C.response.content.body;G=C.response.content.id;A="http://comments.deviantart.com/"+C.response.content.typeid+"/"+C.response.content.itemid+"/"+G;this.body.innerHTML=F;this.time.innerHTML="<a href='"+A+"'>Posted!</a>";this.links.style.display="inline";this.links.firstChild.href=A+"#reply";this.links.firstChild.onclick=function(){return Comment.reply(G,this)};Tree.get(this.box,"a.x").style.display="none";var B=Tree.get(this.box,"input.mood");if(B&&B.getAttribute("moodsrc")){this.box.appendChild(Tree.create("img.mood",{src:B.getAttribute("moodsrc")}))}this.box.id="";Tree.removeClass(this.box,"deviousthought");Tree.removeClass(this.box,"smallthought")}catch(D){alert("A problem occurred while submitting your comment.\n\nPlease try again after a short while.");this.send.value="Send";return }};Comment.preview=function(C){var A=Tree.ancestor(C,"div.thought");var B=Tree.getObject(A,"comment")||Comment.init(A);if(B.textarea.value.length==0){return }if(B.previewdiv){B.textarea.style.display="inline";if(typeof (B.previewdiv)!="boolean"){B.previewdiv.style.display="none"}delete B.previewdiv;B.preview.value="Preview";B.textarea.focus();Comment.idle(B);return }B.previewdiv=true;Comment.busy(B);DiFi.pushPost("Comments","preview",[B.textarea.value,0],Comment.previewReady,B);DiFi.send()};Comment.previewReady=function(B,A){if(!B){return alert("A problem occurred with posting your comment.")}this.textarea.style.display="none";this.previewdiv=Tree.get(this.box,"div.preview");this.previewdiv.innerHTML="<strong>Preview:</strong><br/>"+A.response.content;this.previewdiv.style.display="block";this.preview.value="Edit";Comment.idle(this);Comment.setLight(this.box,1)};Comment.cancel=function(B){var A=Tree.getObject(Tree.ancestor(B,"div.thought"),"comment");if(A.busy){if(A.xmlhttp){A.xmlhttp.abort();delete A.xmlhttp}Comment.idle(A);return }if(A.previewdiv&&A.preview.value=="Preview"){Comment.preview(B)}else{if(A.nest.parentNode){A.nest.parentNode.removeChild(A.nest)}A.link.hasOpenReply=false;if(Browser.isIE){_forcePageLayout()}}Comment.idle(A)};loadXML=function(A){return(new DOMParser()).parseFromString(A,"text/xml")};Comment.hideDone=function(C,B){if(C){var A=B.request.method=="hide";if(A){this.innerHTML="Unhide Comment"}else{this.innerHTML="Hide"}this.style.cursor="pointer"}else{alert("deviantART was unable to toggle the comment at this time. Please try again shortly.")}};Comment.toggleHide=function(B){var C,A;if(B.innerHTML.indexOf("...")>=0){if(window.event){event.cancelBubble=true}return false}C=getCommentNode(B);A=!Tree.hasClass(C,"collapsed-thought");if(A){Tree.addClass(C,"collapsed-thought");B.className="always a"}else{Tree.removeClass(C,"collapsed-thought");B.className="h"}B.innerHTML="...";B.style.cursor="wait";DiFi.pushPost("CommentAttributes",A?"hide":"unhide",[C.id.substr(1),C.getAttribute("itemid"),C.getAttribute("typeid")],Comment.hideDone,B);DiFi.timer(800);if(window.event){event.cancelBubble=true}return false};Comment.removeDone=function(B,A){if(B){this.innerHTML="Marked as spam.";alert("The process of removing the spam on your deviations, user page, journals, etc, has begun.\nYou will be notified by note when this is complete.")}else{alert("deviantART was unable to start the process of removing all spam by this user. \nWe appreciate your effort, and ask you to please try again shortly.")}};Comment.reportDone=function(E,D){if(E){this.setAttribute("title","Thank you for your report");this.setAttribute("onclick","Comment.toggleViewSpam(this); return false;");Comment.toggleViewSpam(this);var A=Tree.get(getCommentNode(this),"a.u");var B=A.firstChild.nodeValue;var C=A.previousSibling.nodeValue;if(confirm("Would you also like to hide all comments by "+C+B+" on all your deviations, user page, journals, etc?")&&B){DiFi.pushPost("CommentAttributes","removeSpamOnUser",[B],Comment.removeDone,this);DiFi.send()}}else{this.innerHTML="Report Failed";alert("deviantART was unable to file the report. \nWe appreciate your effort, and ask you to please try again shortly.")}this.style.cursor="pointer"};Comment.reportSpam=function(A){if(!confirm("Are you sure you want to flag this comment as spam?")){return }var B;if(A.innerHTML.indexOf("...")>=0){if(window.event){event.cancelBubble=true}return false}B=getCommentNode(A);A.innerHTML="...";A.style.cursor="wait";DiFi.pushPost("CommentAttributes","reportSpam",[B.id.substr(1),B.getAttribute("itemid"),B.getAttribute("typeid")],Comment.reportDone,A);DiFi.timer(2000);if(window.event){event.cancelBubble=true}return false};Comment.toggleViewSpam=function(A){var B=getCommentNode(A);B=getCommentNode(A);collapsed=Tree.hasClass(B,"collapsed-thought");if(collapsed){Tree.removeClass(B,"collapsed-thought");A.className="h";A.innerHTML="Collapse"}else{Tree.addClass(B,"collapsed-thought");A.className="always a";A.innerHTML=A.getAttribute("title")}};Comment.toggleCollapse=function(A){var B=getCommentNode(A);if(B){Tree.hasClass(B,"collapsed-thought")?Comment.uncollapse(B,A):Comment.collapse(B,A)}return false};Comment.collapse=function(B,A){if(!B){return false}Tree.addClass(B,"collapsed-thought");if(A){A.innerHTML="View"}_forcePageLayout();return false};Comment.uncollapse=function(B,A){if(!B){return false}Tree.removeClass(B,"collapsed-thought");if(A){A.innerHTML="Collapse"}_forcePageLayout();return false};Comment.setMood=function(node,ri){node=getCommentNode(node);with(Tree.get(node,"input.mood")){value=ri.split("/").pop()}with(Tree.get(node,"textarea")){if(value==""&&!disabled){focus()}}};Comment.setLight=function(B,A){if(!Tree.hasClass(B,"browser")){B=Tree.get(getCommentNode(B),"div.browser")}if(A){Tree.removeClass(B,"dim")}else{Tree.addClass(B,"dim")}};Comment.prepareForm=function(B){var C,A;B=getCommentNode(B);if(B.offsetWidth<520){Tree.addClass(B,"smallthought")}if(C=Tree.get(B,"div.browser")){A=Pager.create({more_links:true,callback_immediately:true,rootri:"mood",theme:document.body.className.indexOf("deviant")==-1?"light":"deviant",class_name:"pager2 mood-pager",icon_base_url:"http://e.deviantart.com/emoticons/moods/",callback:function(E,D){Comment.setMood(Tree.ancestor(D.node,"div.thought"),E);return false}});C.appendChild(A.node);Pager.loadPage(A,"mood");DiFi.send()}};if(window.DWait){DWait.run("jms/lib/comment.js")}ScrollThreshold={registry:[],register:function(A,B,C){if(!A){throw new Error("ScrollThreshold.register: node must be provided")}if(!B||typeof B!="function"){throw new Error("ScrollThreshold.register: callback must be provided")}this.registry.push([A,A.offsetTop+(C||0),B]);this.scrolled()},resized:function(){var A,B=-1;while(A=ScrollThreshold.registry[++B]){A[1]=A[0].offsetTop}ScrollThreshold.scrolled()},scrolled:function(){var A,C=-1,B;if(!document.body){return }B=(window.pageYOffset||document.body.scrollTop)+(window.innerHeight||document.body.clientHeight);while(A=ScrollThreshold.registry[++C]){if(B>A[1]){ScrollThreshold.registry.splice(C--,1);A[2](A[0])}}}};AutoExec.push(function(){Events.hook(window,"resize",ScrollThreshold.resized);Events.hook(window,"scroll",ScrollThreshold.scrolled);if(!Browser.isOpera){Events.hook(window,"mousewheel",ScrollThreshold.scrolled)}});if(window.DWait){DWait.run("jms/lib/scrollthreshold.js")}DWait.ready(["jms/lib/pager.js"],function(){Pager.overrides.push(function(E,J,F,B){function A(K){K=K.toLowerCase();K=K.replace(/ /g,"_");K=K.replace(/[^a-zA-Z0-9''\-_]/g,"");if(K=="wow"){K="surprise"}return K}var H,I,C,D,G;if(E.path[0]=="mood"){C="";for(D=1;D!=E.path.length;D++){C+=A(MenuTraffic.cache[E.path.slice(0,D+1).join("/")].title)+"/"}for(D=0;H=E.children[D];D++){if(H.children){F.push('<a menuri="'+H.path.join("/")+'" href="/" onmouseover="if (!Browser.isIE)this.style.height = this.nextSibling.offsetHeight + \'px\';Tree.addClass(this.nextSibling, \'highlight\')" onmouseout="Tree.removeClass(this.nextSibling, \'highlight\')" class="rr f more" '+B+'>more</a><a menuri="'+H.path.join("/")+'" href="/" class="ll f" '+B+">")}else{if(H.path){F.push('<a menuri="'+H.path.join("/")+'" ')}else{F.push("<a ")}F.push('href="/" class="f" '+B+">")}G=C+A(H.title)+".gif";J.icon_base_url=J.icon_base_url||"http://e.deviantart.com/emoticons/moods/";F.push('<img src="'+J.icon_base_url+G+'" alt=""/> ');F.push(H.title+"</a>")}return F}return false});if(window.DWait){DWait.run("jms/lib/pager.js.mood.js")}});DWait.ready(["jms/lib/gmi.js","jms/lib/dtlocal.js"],function(){CANCEL_CLICK=";if (window.event)event.cancelBubble=true;return false;";window.CCommentThread=CCommentThread=GMIBase.extend({gmiConstructor:function(){}});window.CComment=CComment=GMIBase.extend({gmiConstructor:function(){DTLocal.infect(this);this.permahidden=this.gmi_args.permahidden},dmiDestructor:function(){this.localDestroy()},replyClick:function(){var C,A,B;if(window.event){event.cancelBubble=true}if(this.local.talkpost){this.local.talkpost.focus();return false}this.local.talkpostnode=C=document.createElement("div");C.className="nest";C.innerHTML=('<div class="ccomment ccomment-post ch"><i class="tl c"><i></i><b></b></i><i class="tr c"><i></i><b></b></i><i class="bl c"><i></i><b></b></i><i class="br c"><i></i><b></b></i><div class="ch-ctrl"><br/></div></div>');this.local.talkpost=A=new TalkPost(this,{typeid:this.gmi_args.typeid||-1,itemid:this.gmi_args.itemid||-1,parentid:this.gmi_args.commentid},bind(this,this.replyCallback),{pager_theme:"light",show_icon:true,hide_moods:this.gmi_args.hidemoods});A.local_tie="talkpostnode";B=C.getElementsByTagName("br")[0];B.parentNode.replaceChild(A.node,B);this.gmi_node.className+=" ccomment-activereply";if(this.gmi_node.nextSibling){this.gmi_node.parentNode.insertBefore(C,this.gmi_node.nextSibling)}else{this.gmi_node.parentNode.appendChild(C)}A.focus();return false},replyCallback:function(B,A){if(!this.local.talkpost){return }switch(B){case"posted":var C;if(this.callback_post){this.callback_post(A)}this.local.talkpost.local_tie=null;this.localClean(TalkPost);Station.push(this.local.talkpostnode,"opacity",{from:0.01,to:Browser.isKHTML?0.99:1,time:400,f:Interpolators.sineCurve});this.local.talkpostnode.innerHTML=A.html;this.local.talkpostnode=null;case"closed":this.gmi_node.className=this.gmi_node.className.replace(/\bactivereply\b/g,"");break}},unhideClick:function(){if(this.permahidden){this.setHideState(false)}else{this.difi("unhide","displaying this comment")}if(window.event){event.cancelBubble=true}return false},hideClick:function(){if(this.permahidden){this.setHideState(true)}else{this.difi("hide","hiding this comment")}},reportClick:function(){if(this.permahidden){alert("This comment has already been reported.")}else{if(!this.loading&&confirm("Report this comment as spam?")){this.difi("reportSpam","reporting this comment as spam")}}},difi:function(B,A){var A;if(this.loading){return }this.loading=true;this.gmi_node.className+=" ccomment-loading";DiFi.pushPost("CommentAttributes",B,[this.gmi_args.commentid,this.gmi_args.itemid,this.gmi_args.typeid],bind(this,this.difiDone,A));DiFi.timer(1)},difiDone:function(B,F,E){this.gmi_node.className=this.gmi_node.className.replace(/\bccomment.loading\b/g,"");this.loading=false;if(!F){alert("There was an error while "+B+".\n\nPlease try again soon.");return }switch(E.request.method){case"reportSpam":this.permahidden=true;if(!CComment.SPAM_REPORT_DONE){var A,C,D;CComment.SPAM_REPORT_DONE=true;A=Tree.get(this.gmi_node,"a.u");C=A.firstChild.nodeValue;D=A.previousSibling.nodeValue;if(E.response.content.can_report_all&&C&&(confirm("Would you also like to scan for comments by "+D+C+" on your user page, deviations, journals, etc.?"))){DiFi.pushPost("CommentAttributes","removeSpamOnUser",[C],function(H,G){if(H){alert("The process of removing spam from your user page, deviations, journals, etc., has started.\nYou will be notified with a note once this is complete.")}else{alert("deviantART was unable to start the process of removing all spam by this user.\nWe appreciate your effort, and ask you to please try again shortly.")}});DiFi.timer(1)}else{alert("Thank you for your report.")}}case"hide":this.makeUnhideLink();this.setHideState(true);break;case"unhide":this.setHideState(false);break}},makeUnhideLink:function(){var A,B;A=(this.gmi_node.getElementsByTagName("a")||[])[0];if(!A||A.className!="creason"){A=document.createElement("a");A.onclick=bind(this,this.unhideClick);A.href="#";A.className="creason";B=this.gmi_node.getElementsByTagName("div")[0];B.insertBefore(A,B.firstChild)}A.innerHTML="<span>"+(this.permahidden?"Flagged as Spam":"Hidden by Owner")+"</span><em>"+(this.permahidden?"Peek":"Undo Hide")+"</em>"},setHideState:function(A){if(A){this.gmi_node.className+=" ccomment-hidden"}else{this.gmi_node.className=this.gmi_node.className.replace(/\bccomment.hidden\b/g,"")}}});if(window.DWait){DWait.run("jms/pages/ccomment.js")}});HTMLPager=Base.extend({template:'<div class="alink nav"></div>',template_alt:'<div class="alink nav2" ondblclick="return false" onselectstart="return false"></div>',debug_label:"HTMLPager",prev_label:"Previous Page",next_label:"Next Page",constructor:function(A,D,E,B){var C;this.alt=(B||{}).alt||(" "+document.body.className+" ").indexOf(" gruze ")>-1||(" "+document.body.className+" ").indexOf(" pickle ")>-1;if(this.alt){this.template=this.template_alt}if(typeof A=="function"){this.auto_scroll=true;return }this.owner=A;this.node=Tree.createFragment(this.template,true);this.callback=E;DRE.assert(!(D instanceof Array));DRE.assert(!(B instanceof Array));for(C in (D||{})){this[C]=D[C]}for(C in (B||{})){this[C]=B[C]}this.on()},makeLink:function(A){if(this.offset_param){return"?"+this.offset_param.name+"="+(Number(A)*Number(this.offset_param.count))}return"#"},on:function(){var C,D,E,A,B;C=[];C.push('<span class="shadow"><span>');if(this.page>0){C.push('<a class="l page" href="'+this.makeLink(this.page-1)+'" htmlpage="'+(this.page-1)+'">'+this.prev_label+"</a>")}else{C.push('<del class="l">'+this.prev_label+"</del>")}if(!this.alt){C.push("&nbsp;&nbsp;&nbsp;&nbsp;")}if(typeof this.pages=="boolean"){C.push("&nbsp;&nbsp;&nbsp;&nbsp;");C.push("&nbsp;&nbsp;&nbsp;&nbsp;")}else{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="'+this.makeLink(B)+'" 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>")}}}}if(!this.alt){C.push("&nbsp;&nbsp;&nbsp;&nbsp;")}if(this.pages===true||this.page<this.pages){C.push('<a class="r page" href="'+this.makeLink(this.page+1)+'" htmlpage="'+(this.page+1)+'">'+this.next_label+"</a>")}else{C.push('<del class="r">'+this.next_label+"</del>")}C.push("</span></span>");this.node.innerHTML=C.join("");A=Tree.gets(this.node,"a");for(B=0;A[B];B++){A[B].onclick=bind(this,this.clicked,Number(A[B].getAttribute("htmlpage")))}},off:function(){},clicked:function(A){if(this.callback){this.callback(A)}else{this.owner.setProp("page",A)}if(this.auto_scroll){if(Browser.isGecko){document.documentElement.scrollTop=Ruler.document.node(this.owner.node).y}else{document.body.scrollTop=Ruler.document.node(this.owner.node).y}}if(window.event){window.event.cancelBubble=true}return false}});if(window.DWait){DWait.run("jms/pages/htmlpager.js")}DTLocal={};DTLocal.infect=function(B){var A;if(B.constructor&&!B.constructor.localCache){B.constructor.localCache={}}for(A in DTLocal.infection){B[A]=DTLocal.infection[A]}B.local={}};DTLocal.infection={localUID:function(){if(!this.local_uid_counter){this.local_uid_counter=100}return this.local_uid_counter++},localDestroy:function(){if(this.localRecv){this.localRecv("lastcall")}this.localClean();if(this.localRecv){this.localRecv("destroy")}},localClean:function(C,D){var A,F,B;for(A in this.local){if(typeof C=="function"||(C instanceof RegExp)){if(C instanceof RegExp){if(!A.match(C)){continue}}else{if(!(this.local[A] instanceof C)){continue}}B=A}else{B=C||A}if(B in this.local){if(D||!this.local[B]){this.local[B]=null;continue}if(!(this.local[B] instanceof Array)){if(this.local[B].nodeType){if(this.local[B].parentNode){this.local[B].parentNode.removeChild(this.local[B])}}else{if(typeof this.local[B].localDestroy!="function"&&typeof this.local[B].gmiConstructor!="function"){try{DRE.breakpoint()}catch(E){}continue}else{F=this.local[B];this.local[B]=null;F.localDestroy?F.localDestroy():GMI._delete(F);delete F}}}else{if(this.local[B][0]==clearInterval){clearInterval(this.local[B][1])}else{if(this.local[B][0]==clearTimeout){clearTimeout(this.local[B][1])}else{this.local[B][0].apply(this,this.local[B].slice(1))}}}delete this.local[B]}if(typeof C=="string"){return }}},getLocalEventHook:function(A,C,B){Events.hook(A,C,B);return[Events.unhook,A,C,B]},getLocalSetTimeout:function(A,B){return[clearTimeout,setTimeout(A,B)]},getLocalSetInterval:function(A,B){return[clearInterval,setInterval(A,B)]},localEventHook:function(A,C,B){this.local[this.localUID()]=this.getLocalEventHook.apply(this,arguments)},localSetTimeout:function(A,B){this.local[this.localUID()]=this.getSetTimeout.apply(this,arguments)},localSetInterval:function(A,B){this.local[this.localUID()]=this.getSetInterval.apply(this,arguments)}};if(window.DWait){DWait.run("jms/lib/dtlocal.js")}DDD={DEFAULT_SNAP_TRESHOLD:4,subject:null,subject_snap_treshold:null,p_down:null,mod_down:null,snapped:false,hookMouse:function(A){Events.hook(document,"mousedown",A)},unhookMouse:function(A){Events.unhook(document,"mousedown",A)},mouseDown:function(D,B,A,C){if(DDD.subject){return false}DRE.assert(B);DRE.assert(B.ddd);DRE.assert(typeof B.ddd.snap=="function");DRE.assert(typeof B.ddd.drag=="function");DRE.assert(typeof B.ddd.drop=="function");B.ddd.node=this;DDD.subject=B;DDD.subject_snap_treshold=A==Number(A)?A:DDD.DEFAULT_SNAP_TRESHOLD;DDD.p_down=Ruler.document.pointer(D);DDD.mod_down=Ruler.clickMod(Ruler.document.node(DDD.subject.ddd.node,C),DDD.p_down);Events.hook(document,"mousemove",DDD.mouseDrag);Events.hook(document,"mouseup",DDD.mouseDrop);DDD.p_current=null;if(DDD.subject_snap_treshold==0){DDD.mouseDrag(D)}return true},mouseDrop:function(A){if(DDD.snapped){DDD.subject.ddd.drop.call(DDD.subject,A)}DDD.mouseUp(A)},mouseUp:function(A){DDD.p_down=null;DDD.snapped=false;DDD.subject=null;Events.unhook(document,"mousemove",DDD.mouseDrag);Events.unhook(document,"mouseup",DDD.mouseDrop)},mouseDrag:function(B){var A;if(!DDD.subject){return dre_notice("DDD.mouseDrag without DDD.subject")}DDD.p_previous=DDD.p_current;DDD.p_current=A=Ruler.document.pointer(B);if(!DDD.snapped){if(Math.abs(DDD.p_down.x-A.x)>=DDD.subject_snap_treshold||Math.abs(DDD.p_down.y-A.y)>=DDD.subject_snap_treshold){DDD.snapped=true;DDD.subject.ddd.snap.call(DDD.subject,B)}else{return true}}DDD.subject.ddd.drag.call(DDD.subject,B);return false},eventKeys:function(A){if(Browser.isMac&&!Browser.isOpera){return{range:A.shiftKey,multiple:A.metaKey}}else{return{range:A.shiftKey,multiple:A.ctrlKey}}}};if(window.DWait){DWait.run("jms/lib/ddd.js")}Surfer={create:function(G,E,D,C,H){var A,F,B;A=E.cloneNode(H||false);A.className="surfer";document.body.appendChild(A);B=Ruler.clickMod(Ruler.document.node(E),DDD.p_down);F=Ruler.document.pointer(G,B);Station.apply(A,"left",F.x);Station.apply(A,"top",F.y);if(C&&C!=1){Station.apply(A,"opacity",C)}A.style.display="block";if(D!=1){Station.apply(E,"opacity",D||0.3)}return{node:A,ddd_node:E,ddd_node_opacity:D||0.3,node_opacity:C||1,mod_down:B}},update:function(A,C){var B;B=Ruler.document.pointer(C,A.mod_down);Station.apply(A.node,"left",B.x);Station.apply(A.node,"top",B.y)},flyHome:function(B,F,D,C){var E,C,A;E=Ruler.document.pointer(F,B.mod_down);if(!C){C=Ruler.document.node(B.ddd_node)}if(vms_feature("pachunkajunk")){B.node.style.border="none transparent";C.x+=2;C.y+=2;E.x+=2;E.y+=2}Station.push(B.node,"left",vms_feature("pachunkajunk")?{from:E.x,to:C.x,f:Vadavadavada.spring,velocity:DDD.p_previous?Ruler.document.pointer(F).x-DDD.p_previous.x:null}:{from:E.x,to:C.x,time:300,f:Interpolators.pulse});A=[B.node,"top"];if(!vms_feature("pachunkajunk")){A.push({from:E.y,to:C.y,time:300,f:Interpolators.pulse})}else{A.push({from:E.y,to:C.y,f:Vadavadavada.spring})}A.push(bind(this,function(G){if(G){G()}if(B.ddd_node_opacity!=1){Station.apply(B.ddd_node,"opacity",1)}setTimeout(function(){Tree.destroy(B.node)},1)},D));Station.push.apply(Station,A)},sinkInto:function(C,G,E,D,B){var F,A;F=Ruler.document.pointer(G,C.mod_down);Station.push(C.node,"left",{from:F.x,to:E.x,time:300,f:Interpolators.pulse});Station.push(C.node,"width",{from:C.node.offsetWidth,to:E.w?E.w:E.x2-E.x,time:300,f:Interpolators.pulse});Station.push(C.node,"height",{from:C.node.offsetHeight,to:E.h?E.h:E.y2-E.y,time:300,f:Interpolators.pulse});A=[C.node,"top"];A.push({from:F.y,to:E.y,time:300,f:Interpolators.pulse});A.push(bind(this,function(H){if(H){H()}if(C.ddd_node_opacity!=1){setTimeout(bind(Station,Station.push,C.ddd_node,"opacity",{from:C.ddd_node_opacity,to:1,time:500,f:Interpolators.sineCurve}),B||1)}setTimeout(bind(Tree,Tree.destroy,C.node),1)},D));Station.push.apply(Station,A)},dissolve:function(B,D,C,A){Station.push(B.node,"opacity",{from:Station.read(B.node,"opacity")||B.node_opacity,to:0,time:300,f:Interpolators.sineCurve},{from:0,to:0,time:A||25},function(){if(B.ddd_node_opacity!=1){Station.push(B.ddd_node,"opacity",{from:B.ddd_node_opacity,to:1,time:500,f:Interpolators.sineCurve})}setTimeout(function(){Tree.destroy(B.node)},1)},C||undefined)}};if(window.DWait){DWait.run("jms/lib/surfer.js")}function Renamer(A,C,B){DTLocal.infect(this);this.node=Tree.createFragment(this.template,true);this.owner=A;this.callback=C;this.localEventHook(this.node,"blur",bind(this,this.blurred));this.localEventHook(this.node,"keypress",bind(this,this.keyd));this.localEventHook(this.node,"click",bind(this,this.clicked));this.previous_name=B;this.node.value=B;setTimeout(bind(this,this.focus),1)}Renamer.prototype={template:'<input type="text" class="itext renamer"/>',localRecv:function(B){var A;if(B=="destroy"){A=this.node.value;if(this.node.parentNode){this.node.parentNode.removeChild(this.node)}this.callback.call(this.owner,A,this.previous_name)}},clicked:function(A){A.cancelBubble=true;if(A.stopPropogation){A.stopPropogation()}return true},focus:function(){this.node.focus();this.node.select()},blurred:function(A){this.done()},done:function(){if(this.dead){return }this.dead=true;setTimeout(bind(this,this.localDestroy),1)},keyd:function(A){if(A.keyCode==13){this.done();return false}else{if(A.keyCode==27){this.node.value="";this.done();return false}}}};if(window.DWait){DWait.run("jms/lib/renamer.js")}if(!window.App){window.App=App={}}App.cacheResourceView=function(D,G,B,C,F){var H,E,A;if(typeof C=="string"){A=C}else{A=[];for(E in C){A.push(E+":"+Number(C[E]))}A.sort();A=A.join(",")}H=D+":"+G+":"+B+":"+A;if(!App.resources_by_rid_cache){App.resources_by_rid_cache={}}if(F!==undefined){if(F==0&&!A){DRE.breakpoint()}Bug.log("cache","PUT "+H+" ("+String(F).substr(0,9)+")");App.resources_by_rid_cache[H]=F}else{Bug.log("cache",(App.resources_by_rid_cache[H]?"HIT":"MISS")+" "+H);return App.resources_by_rid_cache[H]}};if(!App.stuff){App.stuff={}}if(window.DWait){DWait.run("jms/lib/app.js.resource_cache.js")}REG_OLD_DEVIATION_2=/^h[t]tp:\/\/()www.deviantart\....\/(?:deviation|view)\/()([0-9]+)\/?$/;REG_DEVIATION_2=/^h[t]tp:\/\/([^\.]+)\.deviantart\....\/(?:art\/)?([0-9A-Za-z\-\.]+)\-([0-9]+)\/?$/;REG_COLLECTION=/^h[t]tp:\/\/([^\.]+)\.deviantart\....\/(?:gallery|favourites)\/\#_?()([0-9A-Za-z\-]+)\/?$/;RESOURCE_DEVIATION=1;RESOURCE_GALLERIES=20;RESOURCE_FAVCOLLECTIONS=21;MYSTERY=0;if(window.DWait){DWait.run("jms/pages/lub/lub_constants.js")}function Lub(C){var A,B;this.groups_on=document.getElementById("loginbar-group");DTLocal.infect(this);A=document.getElementById("top-deviant")||document.getElementById("top-collect")||document.getElementById("overhead");Lub.newschool=document.getElementById("logindock")||document.getElementById("overhead");this.node=A;if(document.getElementById("favourites-preload")){Lub.shutdown();return null}this.ready=true;this.deviant=deviantART.deviant;if(!this.deviant||!this.deviant.username){Lub.shutdown();return null}if(String(window.location.href).indexOf("https:")!=0){this.node.appendChild(Tree.createFragment('<div class="preload"><span style="background:url(http://e.deviantart.com/emoticons/moods/joy/optimism/eager.gif)"></span><span style="background:url(http://st.deviantart.com/minish/widgets/favup.gif)"></span><span style="background:url(http://st.deviantart.com/minish/widgets/luvup.gif)"></span><span style="background:url(http://st.deviantart.com/minish/gallery/lub-buttons.gif)"></span><span style="background:url(http://e.deviantart.com/emoticons/d/deviation.gif)"></span></div>'))}if(Tree.get("#rockdock")){B=Tree.createFragment('<a href="" class="dockrocker" id="top-collections"><span class="i"></span><span class="i edge"></span>Collect<span class="arrow"></span></a>',true);this.node.appendChild(B);this.localEventHook(B,"click",bind(this,this.buttonClicked));this.collect_link_node=B}else{this.collect_link_node=document.getElementById("collectlink")}this.localEventHook(document.documentElement,"mousedown",bind(this,this.mouseDown));B=Tree.get("div.bubbleview")||Tree.get("#output");if(B){this.liquid_drag_notice=new LiquidSwitch(bind(this,this.liquidDragNotice),"off");this.local.liquid_drag_notice=this.liquid_drag_notice;f=bind(this,this.mouseJiggle);this.localEventHook(B,Browser.isGecko?"mousemove":"mouseover",f);this.localEventHook(B,"mouseout",f)}this.localEventHook(document.documentElement,"click",bind(this,this.masterClick));this.localEventHook(window,"focus",bind(this,this.masterFocus))}Lub.RESVIEW_OPTIONS={title:false,artist:false};Lub.shutdown=function(){if(window.da_minish_lub){da_minish_lub.localDestroy();delete da_minish_lub}};Lub.reboot=function(){Lub.shutdown();setTimeout(function(){da_minish_lub=new Lub();window.da_minish_lub=da_minish_lub},800)};Lub.prototype={init:function(){var B,A;if(this.init_already){return }this.init_already=true;this.art_listeners=[];this.delayed_difi_saves={};this.active_saves=0;this.noun="Collection";bind.cache(this,this.saver);this.first_drop=true;this.save_notice=new LiquidSwitch(bind(this,this.saveSwitcher),"off");this.local[this.localUID()]=this.save_notice;this.save_notice.node=Tree.create("div",{id:"lub-saving"},"?");if(Browser.isMac){Tree.addClass(this.save_notice.node,"mac")}this.node.parentNode.insertBefore(this.save_notice.node,this.node.nextSibling);A=Tree.createFragment('<div id="lubber" style="background:#AFC81C"><i></i><i class="b"></i></div>',true);this.node.appendChild(A);A=Tree.createFragment('<div id="lub" style="background:#212A2A"><div class="collection-head"><strong class="h1">Collections</strong> <span class="collect-tagline">Drag and drop art to collect</span></div><div class="collections"><div class="collectionzone"></div></div>',true);this.local[this.localUID()]=A;this.node.appendChild(A);this.lub_node=A;this.head_node=this.lub_node.firstChild;this.collect_node=this.lub_node.firstChild.nextSibling.firstChild;B=bind(this,this.resized);Events.hook(window,"resize",B);this.local[this.localUID()]=[Events.unhook,window,"resize",B];B=bind(this,this.lubClickOrMouseHover);Events.hook(this.lub_node,"mousedown",B);Events.hook(this.lub_node,"click",B);this.local[this.localUID()]=[Events.unhook,this.lub_node,"mousedown",B];this.local[this.localUID()]=[Events.unhook,this.lub_node,"click",B];B=bind(this,this.otherMenuClick);if(Tree.get("#menulink")){this.localEventHook(Tree.get("#menulink"),"click",B)}if(Tree.get("#friendslink")&&!Lub.newschool){this.localEventHook(Tree.get("#friendslink"),"click",B)}if(Tree.get("#top-friends")){this.localEventHook(Tree.get("#top-friends"),"click",B)}if(Tree.get("#menuDropArrow")){this.localEventHook(Tree.get("#menuDropArrow"),"click",B)}this.resized()},guid:function(){if(!this.guid_counter){this.guid_counter=100}return this.guid_counter++},localRecv:function(C){var B,A;if(C=="destroy"){this.hidden();for(B=0;A=[Tree.get("#top-55")?this.collect_link_node:null,this.lub_node,Tree.get("#lubber"),(this.save_notice||{}).node][B];B++){if(A&&A.parentNode){A.parentNode.removeChild(A)}}}bind.release(this,this.saver)},saveSwitcher:function(B,A){if(A=="off"){Lub.scrollHack(1);Station.apply(this.save_notice.node,"opacity",1)}if(B=="off"){if(this.save_notice.timer){clearInterval(this.save_notice.timer)}Station.push(this.save_notice.node,"opacity",{from:1,to:0,time:600,f:Interpolators.sineCurve},bind(this,function(){Lub.scrollHack(0);this.save_notice.node.style.display="none"}));return true}if(B.charAt(0)==B.charAt(0).toUpperCase()){this.save_notice.node.style.backgroundColor="InfoBackground";this.save_notice.node.style.color="InfoText";this.save_notice.timer=setInterval(bind(this,function(){if(String(this.save_notice.node.style.color).toLowerCase()=="infobackground"){this.save_notice.node.style.color="InfoText"}else{this.save_notice.node.style.color="InfoBackground"}}),600);this.save_notice.node.innerHTML=B+"..."}this.save_notice.node.style.display="block"},otherMenuClick:function(){if(this.local.scrollmanager&&(!this.local.scrollmanager.top_floating||(document.body.scrollTop||document.documentElement.scrollTop)==0)){this.locks=0;this.hide(false)}return true},resized:function(C){var B,A;if(Browser.isIE){A=Tree.hasClass(document.body,"chatroom")?0:(Tree.get("#top-55")?34:34);B=Ruler.screen.rect();this.lub_node.style.width=B.x2-A;Tree.get("#lubber").style.width=B.x2-A;if(this.collect_node.parentNode.scrollWidth>this.collect_node.parentNode.offsetWidth){if(!Tree.hasClass(this.collect_node,"collectionzone-iehack")){Tree.addClass(this.collect_node,"collectionzone-iehack")}}else{if(Tree.hasClass(this.collect_node,"collectionzone-iehack")){Tree.removeClass(this.collect_node,"collectionzone-iehack")}}}},lubClickOrMouseHover:function(B,A){if(!this.locks){this.slide(0,0)}if(B.type=="click"&&this.local.activelubble&&!Tree.ancestor(A,"div.lubble")){this.localClean(/activelubble.*/);return false}},buttonClicked:function(){if(!this.ready){return }if(!this.locks&&!this.out){this.slide(0,0)}else{if(this.local.activelubble){this.localClean(/activelubble.*/)}else{this.locks=0;this.hide(false);if(Browser.isKHTML&&this.local.scrollmanager&&this.local.scrollmanager.top_floating){this.lub_node.style.display="none";setTimeout(bind(this,function(){this.lub_node.style.display="block"}),1)}}}return false},reload:function(){if(this.initial_call_active){return }this.localClean(/activelubble.*/);this.initial_call_active=true;if(this.initial_call_history){this.art_query_cache={};f=DiFi.pushPost}else{f=DiFi.pushPrivateGet}if(this.collections_data){for(i=0;this.collections_data[i];i++){this.collections_data[i].localDestroy();this.collect_node.removeChild(this.collections_data[i].node);delete this.collections_data[i]}}this.collect_node.innerHTML='<span class="lubload"></span>';this.local.timer_loading=[clearTimeout,setTimeout(function(){if(Tree.get(this.collect_node,".lubload")){Tree.get(this.collect_node,".lubload").style.backgroundImage="url(http://e.deviantart.com/emoticons/moods/joy/optimism/eager.gif)"}if(Tree.get(this.collect_node,".lubload")){Tree.get(this.collect_node,".lubload").innerHTML="loading"}}.bindTo(this),800)];this.collections_data=[];this.subfolder_counts=[];DiFi.pushPost("Gallections","create_featured",[this.deviant.id,RESOURCE_FAVCOLLECTIONS]);f.call(DiFi,"Aggregations","get_galleries_initial",[this.deviant.id,RESOURCE_FAVCOLLECTIONS,1],bind(this,function(F,E){var D,C,A,B;this.localClean("timer_loading");this.modCookie(true);if(Tree.get(this.collect_node,".lubload")){this.collect_node.removeChild(Tree.get(this.collect_node,".lubload"))}if(!F){Lub.reboot();return }this.initial_call_active=false;this.initial_call_history=true;for(A=0;E.response.content[A];A++){if(E.response.content[A].title=="Featured"){this.noun=(E.response.content[A].attributes&1)?"devPack":"Collection";this.lub_node.getElementsByTagName("strong")[0].innerHTML=this.noun+"s"}if(Number(E.response.content[A].parentid)){this.subfolder_counts[E.response.content[A].parentid]=(this.subfolder_counts[E.response.content[A].parentid]||0)+1;continue}this.introducing(this.formatRawCollection(E.response.content[A]),false,false)}if(!Tree.get(this.node,".new-button")){B=Tree.create("div.new-button",{title:"New "+this.noun});this.collect_node.appendChild(B);this.localEventHook(B,"click",function(J,I){var G,K,H;this.localClean("refresh_new_timer");if(Tree.hasClass(I,"pew-button")){H=Tree.gets(this.collect_node,"div.stackzone").pop();K=Number(H.getAttribute("collect_rid").split(":")[1]);for(G=0;this.collections_data[G];G++){if(Number(this.collections_data[G].collection.galleryid)==K){if(this.collections_data[G].collection.rids.length>0){this.refreshButton();return }if(this.collections_data[G].collection.galleryid>0||this.collections_data[G].processing){this.difiSave("delete",[deviantART.deviant.id,MYSTERY,RESOURCE_FAVCOLLECTIONS,K])}this.collections_data.splice(G,1);Station.push(H,"marginLeft",{from:0,to:-140,time:250,f:Station.f.inversion(Interpolators.pulse)},bind(this,function(){this.refreshCollectTargets();this.refreshButton();H.parentNode.removeChild(H)}));break}}}else{this.introducing(null,false,true);this.collections_data[this.collections_data.length-1].askName();this.refreshButton()}}.bindTo(this))}this.refreshCollectTargets();this.refreshButton()}));if(this.groups_on){DiFi.pushPrivateGet("Grusers","fetchGroupListForLub",[],bind(this,function(F,E){var H,D,C,B,A,G;if(F&&!(E.response.content instanceof Array)){this.stored_groups=E.response.content;B=0;for(H in E.response.content){B++}A=E.response.content;if(B>2&&(G=document.getElementById("loginbar-group"))){this.primary_group_name=G.getElementsByTagName("a")[0].firstChild.nodeValue;G=">"+this.primary_group_name+"<";for(H in A){if(A[H].link.indexOf(G)>0){A={};A[H]=E.response.content[H];break}}}for(H in A){if(B>2){D={imperative:"",read_only:true,title:"<br>Other Groups",is_group:true,group_id:-1,owner_id:-1};this.introducing(D,true,false);C=true}D={imperative:"Send to<br>",read_only:true,title:E.response.content[H].link,is_group:true,group_id:H,owner_id:H,module_id:E.response.content[H].module_id,target_aggregations:E.response.content[H].target_aggregations};this.introducing(D,true,false);if(C){break}C=true}if(H){this.refreshCollectTargets()}}}))}DiFi.send()},introducing:function(A,C,B){var D;this.collect_node.style.width=((((this.collections_data.length?this.collect_node.firstChild.offsetWidth:140)+13)*(1+this.collections_data.length))+40)+"px";void (this.collect_node.offsetWidth);D=new LubCollection(this,A);if(B){Station.apply(D.node,"marginLeft",-140);Station.push(D.node,"marginLeft",{from:-140,to:0,time:700,f:Interpolators.pulse},bind(this,this.refreshCollectTargets));Station.push(this.collect_node.parentNode,"scrollLeft",{from:this.collect_node.parentNode.scrollLeft,to:this.collect_node.parentNode.scrollLeft+200,time:700,f:Interpolators.pulse})}if(C){this.collections_data.unshift(D);if(this.collect_node.firstChild){this.collect_node.insertBefore(D.node,this.collect_node.firstChild)}else{this.collect_node.appendChild(D.node)}}else{this.collections_data.push(D);this.collect_node.appendChild(D.node)}this.resized()},refreshButton:function(){var B,A;B=this.collectionFromRID([RESOURCE_FAVCOLLECTIONS,Tree.gets(this.collect_node,"div.stackzone").pop().getAttribute("collect_rid").split(":")[1]]);A=Tree.get(this.collect_node,".new-button");if(this.collections_data&&this.collections_data.length>1||this.collections_data[0].collection.rids.length>0){A.style.visibility="visible"}else{A.style.visibility="hidden"}this.collect_node.appendChild(A);if(B&&B.collection.title!="Featured"&&!B.collection.is_group&&B.collection.rids.length<1){Tree.addClass(A,"pew-button");A.setAttribute("title","Remove New "+this.noun)}else{Tree.removeClass(A,"pew-button");A.setAttribute("title","New "+this.noun)}},refreshNewCollections:function(){var A;this.localClean("refresh_new_timer");for(A=0;this.collections_data[A];A++){if(this.collections_data[A].collection.galleryid<0&&!this.collections_data[A].processing){this.collections_data[A].create()}}},stayFresh:function(){var A;for(A=0;this.collections_data[A];A++){if(!this.collections_data[A].ready){return }}this.introducing(null,true,true)},difiSave:function(C,B,A){var D;switch(C){case"delete":case"rename":case"reposition":case"add_resource":case"copy_resource":case"remove_resource":case"set_attributes":DRE.assert(B[2]==RESOURCE_FAVCOLLECTIONS);if(B[3]<0){if(!this.delayed_difi_saves[B[2]+":"+B[3]]){this.delayed_difi_saves[B[2]+":"+B[3]]=[]}this.delayed_difi_saves[B[2]+":"+B[3]].push(arguments);return }break}this.active_saves++;this.save_notice.change("Saving",1000,800);DiFi.pushPost("Aggregations",C,B,bind.cache(A||this,this.saver))},difiFree:function(C,A){var B;if(this.delayed_difi_saves[C]){for(B=0;this.delayed_difi_saves[C][B];B++){this.delayed_difi_saves[C][B][1][3]=A;this.difiSave.apply(this,this.delayed_difi_saves[C][B])}}DiFi.timer(2)},saver:function(J,B){var C,K,I,A,F,D;if(!J&&!B.request){da_minish_lub.bluescreen();return }if(!--da_minish_lub.active_saves){da_minish_lub.save_notice.change("off",0,500)}if(J){da_minish_lub.modCookie(false);switch(B.request.method){case"add_resource":if(B.request.args[2]==RESOURCE_DEVIATION&&(deviantART&&deviantART.pageData&&deviantART.pageData.deviationid)==B.request.args[3]){if(window.Deviation&&Deviation.nodes&&Deviation.nodes.favButton){Deviation.favedOver()}}if(window.LOTCC){var G=this.collectionFromRID([B.request.args[2],B.request.args[3]]);var H=(G&&G.collection.title=="Featured")?"add favorite":"add collection";LOTCC.bcpw("act",H)}break;case"create":for(C=0;this.ths.collections_data[C];C++){if(this.oldid==this.ths.collections_data[C].collection.galleryid){this.ths.collections_data[C].collection.galleryid=B.response.content;this.ths.collections_data[C].processing=false;this.ths.collections_data[C].render();break}}this.ths.difiFree(RESOURCE_FAVCOLLECTIONS+":"+this.oldid,B.response.content);break}return }try{DRE.breakpoint()}catch(E){}if(B.request&&(B.request.method in {save:1,submitFaveFromLub:1})){DiFi.stdErr("Unable to send favourite.",B.response.content);return }A=this.difi_retry_mode;if(A==null){A=confirm("Collections:\n\nSome changes were not saved because the deviantART server could not be reached.\n\nTry again?");this.difi_retry_mode=A;setTimeout(bind(this,function(){this.difi_retry_mode=null}),700)}if(A){DiFi.pushPost(B.request["class"],B.request.method,B.request.args,arguments.callee,this);DiFi.timer(100);return }switch(B.request.method){case"create":setTimeout(bind(this.ths,this.ths.reboot),200);break;default:setTimeout(Lub.reboot,200)}},bluescreen:function(){this.lub_node.style.background="#212A2A url(http://e.deviantart.com/emoticons/c/confused.gif) no-repeat center";this.collect_node.parentNode.style.height="140px";this.collect_node.parentNode.firstChild.style.display="none";setTimeout(Lub.reboot,2300)},checkCookie:function(){var A;if(!this.collections_data){return }A=((document.cookie+";").match(/\blubfavexp=(.*?);/)||[])[1];if((A||1)>(this.last_cookie_check||0)){this.last_cookie_check=Math.max(A||0,Math.floor((new Date()).valueOf()/1000));this.art_query_cache={};this.reload()}else{}},modCookie:function(A){this.last_cookie_check=Math.floor((new Date()).valueOf()/1000);if(!A){document.cookie="lubfavexp="+this.last_cookie_check+"; path=/; domain=.deviantart.com"}else{}},slide:function(C,B){var D,A;this.init();if(this.out){return }this.resized();if(!this.collections_data){this.reload()}else{if(!this.locks){this.checkCookie()}}if(!B){if(!this.locks){this.locks=0}this.locks++}if(Browser.isIE&&!Tree.get(this.lub_node,"iframe")&&Tree.get("iframe")){this.lub_node.appendChild(Tree.create("iframe"))}if(Browser.isGecko){D=Tree.get("iframe");if(D&&!Tree.ancestor(D,"div.bubbleview")){D.style.visibility="hidden"}}if(!this.slide_timer){if(Tree.get("#deviant-commands")){Tree.get("#deviant-commands").style.zIndex=24}this.slide_timer=setTimeout(function(){var E;delete this.slide_timer;if(!this.local.scrollmanager&&!(window.dAmnChats&&window.dAmnChatTab_active)){this.local.scrollmanager=new LubScrollManager(this)}if(this.collect_link_node){Tree.addClass(this.collect_link_node,"lub-active");this.collect_link_node.blur()}E=Tree.get("#menulink");if(E){Tree.addClass(E,"menulink-lub-active")}Tree.get("#lubber").style.visibility="visible";this.lub_node.style.visibility="visible";A=Tree.get("#top-55")?-72:-72;Station.push(this.lub_node,"top",{from:(parseInt(Station.read(this.lub_node,"top"))||0)+A,to:72+A,time:100,f:Interpolators.pulse},this.slidden.bindTo(this))}.bindTo(this),C)}if(this.save_notice.state=="anticipation"){this.save_notice.node.style.display="none";this.save_notice.change("off",0,1000)}},hide:function(B){var A;if(B&&this.locks){return }if(this.locks){this.locks--;if(this.locks){return }}if(this.slide_timer){clearTimeout(this.slide_timer);delete this.slide_timer}this.localClean(/activelubble.*/);if(Browser.isGecko){this.collect_node.parentNode.style.overflow="hidden"}A=Tree.get("#top-55")?-72:-72;Station.push(this.lub_node,"top",{from:(parseInt(Station.read(this.lub_node,"top"))||0)+A,to:-122+A,time:100,f:Interpolators.pulse},this.hidden.bindTo(this))},slidden:function(){if(Browser.isGecko){this.collect_node.parentNode.style.overflow="auto"}this.refreshCollectTargets();if(!this.out){this.dragNotices()}this.out=true},hidden:function(){var A;Tree.get("#lubber").style.visibility="hidden";node=Tree.get("#menulink");if(node){Tree.removeClass(node,"menulink-lub-active")}this.lub_node.style.visibility="hidden";if(this.collect_link_node){Tree.removeClass(this.collect_link_node,"lub-active");this.collect_link_node.blur()}this.localClean("scrollmanager");if(Tree.get("#deviant-commands")){Tree.get("#deviant-commands").style.zIndex=100}DiFi.timer(40);this.noDragNotices();this.out=false;if(Browser.isGecko){A=Tree.get("iframe");if(A&&!Tree.ancestor(A,"div.bubbleview")){A.style.visibility="visible"}}},showLubble:function(A,C){var B;B=A.scrollLeft;A.style.overflow="hidden";A.scrollLeft=B;Tree.addClass(A,"tucked-away");Station.apply(C,"height",1);this.lub_node.appendChild(C);Station.push(C,"height",{from:1,to:200,f:Interpolators.pulse,time:150});Station.push(this.head_node.parentNode,"marginTop",{from:0,to:-30,f:Interpolators.pulse,time:150});Station.push(A,"marginTop",{from:0,to:-112,f:Interpolators.pulse,time:150})},hideLubble:function(A,C){var B;B=A.scrollLeft;if(!(Browser.isGecko&&Browser.isWin)){A.style.overflow="auto";A.scrollLeft=B}Tree.removeClass(A,"tucked-away");Station.push(C,"height",{from:200,to:1,f:Interpolators.pulse,time:150});Station.push(this.head_node.parentNode,"marginTop",{from:-30,to:0,f:Interpolators.pulse,time:150});Station.push(A,"marginTop",{from:-112,to:0,f:Interpolators.pulse,time:150},bind(this,function(D){if(Browser.isGecko&&Browser.isWin){A.style.overflow="auto";A.scrollLeft=B}this.refreshCollectTargets();if(D.parentNode){D.parentNode.removeChild(D)}},C))},formatRawCollection:function(E,D){var C,B,A;E.top_resources=E.top_resources||[];if(Browser.isGecko){C=[];for(B=0;B!=Math.max(E.approx_total,E.top_resources.length);B++){if(E.top_resources[B]){C.push([E.top_resources[B][0],E.top_resources[B][1]]);App.cacheResourceView(E.top_resources[B][0],E.top_resources[B][1],"stacktile",{},E.top_resources[B][2])}else{C.push(null)}}}else{C=new Array(Number(E.approx_total));A=0;for(B=0;B!=E.top_resources.length;B++){C[A++]=[E.top_resources[B][0],E.top_resources[B][1]];App.cacheResourceView(E.top_resources[B][0],E.top_resources[B][1],"stacktile",{},E.top_resources[B][2])}delete E.top_resources}E.rids=C;if(D){E.group_id=D.group_id;E.group_featuredid=D.group_featuredid;E.owner_id=D.owner_id;E.module_id=D.module_id;E.target_aggid=D.target_aggid}if(!E.owner_id){E.owner_id=deviantART.deviant.id}return E},requestArt:function(B){var A;A=App.cacheResourceView(B[0],B[1],"thumb150",Lub.RESVIEW_OPTIONS);if(A!==undefined){if(A!=0){this.artBroadcast(B,A)}return }App.cacheResourceView(B[0],B[1],"thumb150",Lub.RESVIEW_OPTIONS,0);DiFi.pushPrivateGet("Resources","htmlFromRID",[B[0],B[1],"thumb150","artist:0,title:0"],bind(this,this.artDiFi));DiFi.timer(10)},requestArtSlice:function(B,E,C){var D,A;D="favby:"+this.deviant.username+"/"+B;A=[D,E,C,"thumb150","artist:0,title:0"];if(!this.art_query_cache){this.art_query_cache={}}if(this.art_query_cache[A.join(",")]!==undefined){if(this.art_query_cache[A.join(",")]!=0){this.artBroadcast(A.slice(0,3).join(","),this.art_query_cache[A.join(",")])}return }this.art_query_cache[A.join(",")]=0;DiFi.pushPrivateGet("Resources","htmlFromQuery",A,bind(this,this.artDiFi));DiFi.timer(10)},artDiFi:function(D,C){var B,E,A;if(!this.art_query_cache){this.art_query_cache={}}if(!D&&!C.request){this.bluescreen();return }if(C.request.method=="htmlFromRID"){if(D){App.cacheResourceView.apply(App,C.request.args.concat([C.response.content]))}else{if(App.cacheResourceView.apply(App,C.request.args)==0){App.cacheResourceView.apply(App,C.request.args.concat([undefined]))}}this.artBroadcast([C.request.args[0],C.request.args[1]],D?C.response.content:null)}else{if(C.request.method=="htmlFromQuery"){if(D){A=[];for(B=0;E=C.response.content.resources[B];B++){if(!C.request.args[4]){document.title+="!"}App.cacheResourceView(E[0],E[1],C.request.args[3],C.request.args[4],E[2]);this.artBroadcast([E[0],E[1]],E[2]);A.push([E[0],E[1]])}this.art_query_cache[C.request.args.join(",")]=A}else{if(this.art_query_cache[C.request.args.join(",")]==0){delete this.art_query_cache[C.request.args.join(",")]}}this.artBroadcast([C.request.args[0],C.request.args[1],D?A.length:C.request.args[2]].join(","),D?A:null)}else{DRE.halt("Umm.. "+C.request.method)}}},artBroadcast:function(A,C){var B;for(B=0;B!=this.art_listeners.length;B++){if(this.art_listeners[B]){this.art_listeners[B](A,C)}}},liquidDragNotice:function(B,A){var C;if(!this.liquid_drag_node){this.liquid_drag_node=Tree.create("div.drag-and-collect");this.liquid_drag_node.style.display="none";document.body.appendChild(this.liquid_drag_node)}if(B!="off"){C=bind(this,function(E){var D;D=Ruler.document.node(E);this.liquid_drag_node.style.left=(D.x+Math.round(D.w/2))+"px";this.liquid_drag_node.style.top=(D.y-30)+"px";Station.run(this.liquid_drag_node,"opacity",{from:0,to:1,time:125,f:Interpolators.sineCurve});this.liquid_drag_node.style.display="block"},B)}if(A=="off"){C()}else{Station.run(this.liquid_drag_node,"opacity",{from:1,to:0,time:125,f:Interpolators.sineCurve},C||bind(this,function(){this.liquid_drag_node.style.display="none"}))}},mouseJiggle:function(G,H){var F,E,A,C,B,I,D,J;while(H&&H!=document.documentElement){if(H.tagName=="A"){if((" "+H.className+" ").indexOf(" no-lub ")>=0){break}F=H.href.match(REG_DEVIATION_2)||H.href.match(REG_OLD_DEVIATION_2);if(F){E=Tree.get(H,"img");if(!E||Number(E.width)>150||Number(E.height)>150){break}}else{F=H.href.match(REG_COLLECTION)}if(F&&(F[1]||"").toLowerCase()!=((this.deviant.username||"!").toLowerCase())){J=[RESOURCE_DEVIATION,F[3]];A=(E||H).parentNode;while(A&&A!=document.documentElement){if(A.tagName=="DIV"&&A.getAttribute("collect_rid")){J=A.getAttribute("collect_rid").split(":");J[0]=Number(J[0]);break}A=A.parentNode}if(J[0]==RESOURCE_DEVIATION){C=E}else{C=Tree.get(A,"div.tv150")||A}switch(G.type){case"mouseover":case"mousemove":this.liquid_drag_notice.change(C,625,250);break;case"mouseout":this.liquid_drag_notice.change("off",125,75);break}}break}H=H.parentNode}return true},mouseDown:function(G,F){var D,C,A,E,B;if(G.ctrlKey||G.metaKey||G.altKey||G.shiftKey||G.button>1){return true}if(this.liquid_drag_notice){this.liquid_drag_notice.change("off",125,75)}if(String(F.tagName).toLowerCase()=="img"&&F.getAttribute("collect_fullview")){this.dragged_deviant_hint=(deviantART&&deviantART.pageData&&deviantART.pageData.deviation_artist_username)||"";this.dragged_rid=[RESOURCE_DEVIATION,F.getAttribute("collect_fullview")];if(DDD.mouseDown.call(Tree.ancestor(F,"a")||F.parentNode,G,this,16)){return false}}D=Tree.ancestor(F,"a");if(!D){return true}this.dragged_deviant_hint=null;A=D.parentNode;while((A.tagName!="DIV"||!A.getAttribute("collect_rid"))&&(A=A.parentNode)){}if(A){B=String(A.getAttribute("collect_rid")).split(":");B[0]=Number(B[0]);this.dragged_deviant_hint=A.getAttribute("collect_dv")}else{A=Tree.ancestor(D,"div");B=[]}if(B.length<2||Number(B[0])==RESOURCE_DEVIATION){E=D.href.match(REG_DEVIATION_2);if(!E){E=D.href.match(REG_OLD_DEVIATION_2)}C=Tree.get(D,"img");if(!C){return true}if(B.length<2){if(!E){return true}B=[RESOURCE_DEVIATION,E[3]]}}if(this.liquid_drag_notice){this.liquid_drag_notice.change("off",0,1500)}switch(Number(B[0])){case RESOURCE_DEVIATION:break;case RESOURCE_GALLERIES:case RESOURCE_FAVCOLLECTIONS:D=Tree.get(A,"div.stackctrl")||Tree.get(A,"div.tv150")||(Tree.hasClass(A,"tv200")?A:Tree.get(A,"div.tv200"));if(!D){return true}break;default:return true}if(Tree.ancestor(A,"div.modal")){return true}switch(Number(B[0])){case RESOURCE_DEVIATION:if(E&&E[1]){this.dragged_deviant_hint=E[1]}else{E=(D.getAttribute("title")||"").match(/^.+ by .([a-zA-Z0-9_\-]+).*$/);if(E){this.dragged_deviant_hint=E[1]}else{E=(C.getAttribute("src")||"").match(/^.+_by_([a-zA-Z0-9_\-]+)\.[^\.]+$/);if(E){this.dragged_deviant_hint=E[1]}}}break}this.dragged_rid=B;if(Number(B[0])==RESOURCE_DEVIATION||(this.dragged_deviant_hint||"").toLowerCase()!=this.deviant.username.toLowerCase()){if(DDD.mouseDown.call(D,G,this)){return false}}return true},masterClick:function(B,A){if(this.locks||this.out){if(Tree.ancestor(A,"div.bubbleview")||Tree.ancestor(A,"div.output-primary")){if(A.id=="collect-button"){return true}this.hide(false);if(Browser.isKHTML){this.lub_node.style.display="none";setTimeout(bind(this,function(){this.lub_node.style.display="block"}),1)}}}if(this.locks){this.checkCookie()}return true},masterFocus:function(A){if(this.locks){this.checkCookie()}},getDragExtras:function(){var C,A=[],B=[];if(window.GResourceStream){A=A.concat(GMI.query("GResourceStream"))}if(window.GResourceTV){A=A.concat(GMI.query("GResourceTV"))}if(window.GResourceStack){A=A.concat(GMI.query("GResourceStack"))}for(C=0;C!=A.length;C++){B=B.concat(A[C].commsAskForTargets())}return B},ddd:{snap:function(G,I,C,A){var B,E,J,K,D,H,F,L;document.body.scrollLeft=document.documentElement.scrollLeft=0;this.slide(100+Math.max(0,Math.min(300,Ruler.screen.pointer(G).y/2)-300),true);this.drag_data={surfer:A||null,rid:I?C:this.dragged_rid};this.drag_snap_time=(new Date()).valueOf();this.drag_source_collection=null;this.drag_source_lubble=null;if(this.local.activelubble&&Tree.ancestor(this.ddd.node,"div.lubble")){this.drag_source_lubble=this.local.activelubble;DDD.p_down.x+=this.local.activelubble.node.firstChild.scrollLeft;if(!Browser.isIE){DDD.p_down.y-=window.pageYOffset;DDD.p_down.y2-=window.pageYOffset}}else{if(this.local.activelubble&&!this.local.activelubble.collection.is_group){this.localClean(/activelubble.*/)}if(this.drag_data.rid[0]==RESOURCE_FAVCOLLECTIONS&&Tree.ancestor(this.ddd.node,"div.collectionzone")){this.drag_source_collection=Tree.ancestor(this.ddd.node,"div.stackzone");DDD.p_down.x+=this.collect_node.parentNode.scrollLeft;if(!Browser.isIE){DDD.p_down.y-=window.pageYOffset;DDD.p_down.y2-=window.pageYOffset}}}if(!I){switch(this.drag_data.rid[0]){case RESOURCE_DEVIATION:D=Tree.get(this.ddd.node,"img")||this.ddd.node;this.drag_data.surfer=Surfer.create(G,D);H=D.width||D.offsetWidth;F=D.height||D.offsetHeight;if(H>150||F>150){this.drag_data.surfer.modified=true;this.drag_data.surfer.node.style.width=(150/Math.max(H,F))*H+"px";this.drag_data.surfer.node.style.height=(150/Math.max(H,F))*F+"px";this.drag_data.surfer.mod_down.x*=150/Math.max(H,F);this.drag_data.surfer.mod_down.y*=150/Math.max(H,F)}break;case RESOURCE_GALLERIES:case RESOURCE_FAVCOLLECTIONS:if(Tree.hasClass(this.ddd.node,"tv150")||Tree.hasClass(this.ddd.node,"tv200")){this.drag_data.surfer=Surfer.create(G,this.ddd.node,1,undefined,true);Tree.addClass(this.drag_data.surfer.node,Tree.hasClass(this.ddd.node,"tv150")?"surfer-tv150 tv150":"surfer-tv200 tv200");if(Tree.get(this.drag_data.surfer.node,"div.a-stream")){Tree.addClass(Tree.get(this.drag_data.surfer.node,"div.a-stream"),"stream")}if(Tree.get(this.drag_data.surfer.node,"div.tv200-fazoom")){Tree.get(this.drag_data.surfer.node,"div.tv200-fazoom").style.left=0}}else{this.drag_data.surfer=Surfer.create(G,this.ddd.node,undefined,undefined,true);Tree.addClass(this.drag_data.surfer.node,"surfer-stack stackctrl")}break}}B=Tree.gets(Tree.get("div.bubbleview")||Tree.get("#output"),"textarea").concat(Tree.gets(Tree.get("div.bubbleview")||Tree.get("#output"),"intput.put-art-here"));K=[];for(E=0;B[E];E++){K.push(Ruler.document.node(B[E]))}if(window.dAmnChats&&window.dAmnChatTab_active){B.push(Tree.get(Tree.get(dAmnChats[dAmnChatTab_active].room_el,"div.damncrc-input"),"input"));if(this.drag_source_collection||this.drag_source_lubble){L=Ruler.document.node(Tree.get("#window"));L.y=Math.max(L.y,240);K.push(L)}else{K.push(Ruler.document.node(B[E]))}}this.drag_data.text_targets={nodes:B,rects:K};if(this.drag_data.surfer){J=Tree.gets(this.drag_data.surfer.node,"a");for(E=0;J[E];E++){J[E].removeAttribute("href")}}this.refreshCollectTargets();this.drag_data.scroll_node=this.local.activelubble?this.local.activelubble.node.firstChild:this.collect_node.parentNode},drag:function(F,B){var C,I,G,E,D,A,H;C=(new Date()).valueOf();if(!this.ddd.node){return }if(typeof F=="object"){this.drag_event_cache={clientX:F.clientX,clientY:F.clientY,x:F.x,y:F.y}}else{F=this.drag_event_cache;if(!F){try{}catch(F){}return }}if(this.drag_data.surfer){Surfer.update(this.drag_data.surfer,F)}if(!this.drag_source_collection&&!this.locks&&C-this.drag_snap_time<500){return }if(C-(this.drag_lores_time||0)<100&&!B){if(!this.drag_lores_timer){this.drag_lores_timer=setTimeout(bind.cache(this,this.ddd.drag),100)}return }this.drag_lores_timer=null;this.drag_lores_time=C;if(this.lub_node.style.visibility=="hidden"){this.slide(0,true)}A=Ruler.document.pointer(F);if(this.drag_data.collect_targets){if((this.drag_data.scroll_node.scrollLeft>0)&&(A.x>this.drag_data.collect_targets.master_rect.x)&&(A.x-this.drag_data.collect_targets.master_rect.x<48)){if(this.drag_data.collect_targets.hover){Tree.removeClass(this.drag_data.collect_targets.hover,"maybedrop");this.drag_data.collect_targets.hover=null}if(!this.local.lubscrolltimer){this.local.lubscrolltimer=[clearInterval,setInterval(bind(this,this.lubScrollTimer,false),200)]}return }else{if((this.drag_data.scroll_node.scrollLeft<this.collect_node.scrollWidth)&&(A.x<this.drag_data.collect_targets.master_rect.x2)&&(this.drag_data.collect_targets.master_rect.x2-A.x<48)){if(this.drag_data.collect_targets.hover){Tree.removeClass(this.drag_data.collect_targets.hover,"maybedrop");this.drag_data.collect_targets.hover=null}if(!this.local.lubscrolltimer){this.local.lubscrolltimer=[clearInterval,setInterval(bind(this,this.lubScrollTimer,true),125)]}return }else{if(this.local.lubscrolltimer){clearInterval(this.local.lubscrolltimer[1]);this.local.lubscrolltimer=null;delete this.local.lubscrolltimer}if(!this.drag_source_collection&&(E=Ruler.hitTest(A,this.drag_data.collect_targets.rects))!=null){if(this.drag_data.collect_targets.hover){Tree.removeClass(this.drag_data.collect_targets.hover,"maybedrop")}if(this.drag_data.collect_targets.hover!=this.drag_data.collect_targets.nodes[E]){this.drag_data.collect_targets.hover=this.drag_data.collect_targets.nodes[E]}Tree.addClass(this.drag_data.collect_targets.hover,"maybedrop");if(this.drag_data.collect_target_arrow){document.body.removeChild(this.drag_data.collect_target_arrow);this.drag_data.collect_target_arrow=null;this.drag_data.collect_target_index=null}return }if(this.drag_data.collect_targets.hover){Tree.removeClass(this.drag_data.collect_targets.hover,"maybedrop")}this.drag_data.collect_targets.hover=null;if(this.drag_source_collection&&E==null){H={x:A.x+12,y:A.y};E=Ruler.hitTest(H,this.drag_data.collect_targets.rects);if(E!=null){for(D=0;D!=E;D++){if(this.drag_data.collect_targets.nodes[D]==this.drag_source_collection){E++;if(!this.drag_data.collect_targets.nodes[E]){E=null}break}}}if((E!=null&&this.drag_data.collect_targets.nodes[E]!=this.drag_source_collection)||(A.x>this.drag_data.collect_targets.rects[this.drag_data.collect_targets.rects.length-1].x2&&this.drag_data.collect_targets.nodes[this.drag_data.collect_targets.nodes.length-1]!=this.drag_source_collection)){if(!this.drag_data.collect_target_arrow){this.drag_data.collect_target_arrow=Tree.create("div.tragic-arrow")}this.drag_data.collect_target_index=E==null?this.drag_data.collect_targets.rects.length:E;this.drag_data.collect_target_arrow.style.top=(this.drag_data.collect_targets.rects[0]||{}).y+"px";if(this.drag_data.collect_targets.rects[E]){this.drag_data.collect_target_arrow.style.left=(this.drag_data.collect_targets.rects[E].x-9)+"px"}else{this.drag_data.collect_target_arrow.style.left=(this.drag_data.collect_targets.rects[this.drag_data.collect_targets.rects.length-1]||{}).x2+"px"}document.body.appendChild(this.drag_data.collect_target_arrow);return }}}}}if(this.drag_data.collect_target_arrow){document.body.removeChild(this.drag_data.collect_target_arrow);this.drag_data.collect_target_arrow=null;this.drag_data.collect_target_index=null}if(this.drag_data.text_targets){if((E=Ruler.hitTest(A,this.drag_data.text_targets.rects))!=null){if(this.drag_data.text_targets.hover!=this.drag_data.text_targets.nodes[E]){if(this.drag_data.surfer){Tree.addClass(this.drag_data.surfer.node,"excited-surfer")}this.drag_data.text_targets.hover=this.drag_data.text_targets.nodes[E]}return }this.drag_data.text_targets.hover=null;if(this.drag_data.surfer&&Tree.hasClass(this.drag_data.surfer.node,"excited-surfer")){Tree.removeClass(this.drag_data.surfer.node,"excited-surfer")}}this.localClean("lubscrolltimer")},drop:function(O,L,I){var K,F,C,Q;if(this.drag_event_cache){try{this.ddd.drag.call(this,this.drag_event_cache,true)}catch(O){}}delete this.drag_event_cache;if(this.drag_lores_timer){clearTimeout(this.drag_lores_timer)}if(this.local.lubscrolltimer){clearInterval(this.local.lubscrolltimer[1]);this.local.lubscrolltimer=null;delete this.local.lubscrolltimer}bind.release(this,this.ddd.drag);if(this.drag_data.text_targets&&this.drag_data.text_targets.hover){if(this.drag_data.text_targets.hover){if(this.drag_data.text_targets.hover.getAttribute("gmindex")){Surfer.dissolve(this.drag_data.surfer,O);this.hide(true);this.noDragNotices();var D=GMI.getOne(this.drag_data.text_targets.hover);var Q,A=(Tree.ancestor(this.ddd.node,"div.stackzone")||Tree.ancestor(this.ddd.node,"div.tt-a")).cloneNode(true);if(Q=A.getElementsByTagName("img")[0]){Station.apply(Q,"opacity",1)}D.commsRecvDrop([[this.drag_data.rid[0],this.drag_data.rid[1],A]]);return true}}switch(this.drag_data.rid[0]){case RESOURCE_DEVIATION:this.drag_data.text_targets.hover.value+=(this.drag_data.text_targets.hover.value?" ":"")+(":thumb"+this.drag_data.rid[1]+":");try{this.drag_data.text_targets.hover.focus()}catch(O){}break;case RESOURCE_GALLERIES:case RESOURCE_FAVCOLLECTIONS:F=Tree.get(this.ddd.node,"a");if(F&&F.href.match(REG_COLLECTION)){F=F.href}else{F=this.collectionFromRID([RESOURCE_FAVCOLLECTIONS,this.drag_data.rid[1]]);if(!F){break}F="http://"+this.deviant.username+".deviantart.com/favourites/#_"+this.drag_data.rid[1]}this.drag_data.text_targets.hover.value+=(this.drag_data.text_targets.hover.value?" ":"")+F;try{this.drag_data.text_targets.hover.focus()}catch(O){}break}Surfer.dissolve(this.drag_data.surfer,O);this.hide(true);this.noDragNotices();return true}if(this.drag_data.collect_targets){if(this.drag_data.collect_target_arrow){document.body.removeChild(this.drag_data.collect_target_arrow)}if(this.drag_data.collect_target_index!=null){if(this.drag_data.collect_targets.nodes[this.drag_data.collect_target_index]){this.drag_source_collection.parentNode.insertBefore(this.drag_source_collection,this.drag_data.collect_targets.nodes[this.drag_data.collect_target_index])}else{this.drag_source_collection.parentNode.appendChild(this.drag_source_collection)}this.refreshButton();this.refreshNewCollections();this.difiSave("reposition",[deviantART.deviant.id,MYSTERY,RESOURCE_FAVCOLLECTIONS,this.drag_source_collection.getAttribute("collect_rid").split(":")[1],this.drag_data.collect_target_index]);DiFi.timer(1500)}if(this.drag_data.collect_targets.hover){Tree.removeClass(this.drag_data.collect_targets.hover,"maybedrop");App.cacheResourceView(this.drag_data.rid[0],this.drag_data.rid[1],"stacktile","",this.stacktileFromThumb150(this.drag_data.rid,this.ddd.node));this.first_drop=false;F=this.collectionFromRID([RESOURCE_FAVCOLLECTIONS,(this.drag_data.collect_targets.hover.getAttribute("collect_rid")||"").split(":")[1]],this.drag_data.collect_targets.hover.getAttribute("group_lookup")||0);DRE.assert(F,"You are definitely not reading this.");if(F.collection.is_group){var E,G,P;if(F.collection.group_id<0){E=true}else{P=false;for(G in F.collection.target_aggregations){if(P){E={};E[F.collection.group_id]=this.stored_groups[F.collection.group_id];break}P=true}}this.popped_collection=F;this.popped_drag_data=this.drag_data;if(E){if(this.drag_data.rid[0]!=RESOURCE_DEVIATION){Surfer.flyHome(this.drag_data.surfer,O);return true}var M,P,H,N,B,R,J;N=E===true?this.stored_groups:E;B=Popup.create({className:"",no_shadow:true});H=[];B.node.style.height=E===true?"260px":"auto";B.node.style.width="270px";if(E===true){B.node.style.overflow="auto";B.node.style.overflowX="hidden"}P=0;for(M in N){R=N[M].link.replace(/<.*?>/g,"");if((F.collection.group_id<0)&&this.primary_group_name&&this.primary_group_name==R.replace(/^#/,"")){continue}if(!(N[M].target_aggregations instanceof Array)){H.push('<div style="padding:3px 3px 1px 8px;font-size:8.25pt;color:#999;font-weight:bold">'+R+":</div>");for(G in N[M].target_aggregations){J=N[M].target_aggregations[G];H.push('<a href="" class="f" onclick="da_minish_lub.lateSubmission('+M+","+N[M].module_id+","+J.id+');Popup.completeAll();return GMI.evCancel()">'+J.title+"</a>")}}}B.node.innerHTML=('<div style="padding:3px 8px;color:#999">Send to...</div><div class="pager2 pager-dark" style="height:auto !important"><div class="page2" style="overflow:visible !important;height:auto !important">'+H.join("")+"</div></div>");B.node.style.zIndex=300;Popup.show(B,{x:200,y:50,x2:1300,y2:131},false,true);Surfer.dissolve(this.drag_data.surfer,O);return true}this.active_saves++;this.save_notice.change("Saving",1000,800);if(this.drag_data.rid[0]!=RESOURCE_DEVIATION){Surfer.flyHome(this.drag_data.surfer,O);return true}for(G in F.collection.target_aggregations){DiFi.pushPost("Grusers","submitFaveFromLub",[F.collection.group_id,F.collection.target_aggregations[G].id,this.drag_data.rid[0],this.drag_data.rid[1]],bind(this,this.saver));break}DiFi.timer(10);F.doSentAni();C=Ruler.document.node(F.node);C.x+=43;C.y+=52;C.w=3;C.h=3;C.x2=C.x+3;C.y2=C.y+3}else{if(!F.collection.group_id){setTimeout(bind(this,this.plusFav,this.drag_data.collect_targets.hover,"favup"),300)}F.moveResource(this.drag_data.rid,0,false);Q=Tree.get(Tree.get(F.node,".icon-iii"),"img")}if((C||Q)&&this.drag_data.rid[0]==RESOURCE_DEVIATION&&this.drag_data.surfer){if(Q){Q.style.visibility="hidden"}if(!C){C=Ruler.document.node(Q)}if(!Browser.isIE&&this.local.scrollmanager&&this.local.scrollmanager.top_floating){C.y+=window.pageYOffset;C.y2+=window.pageYOffset}C.x-=this.drag_data.scroll_node.scrollLeft;C.x2-=this.drag_data.scroll_node.scrollLeft;if(this.drag_data.surfer){if(Browser.isIE){this.drag_data.surfer.node.style.border="1 solid #111";this.drag_data.surfer.node.style.margin=0}Surfer.sinkInto(this.drag_data.surfer,O,C,bind(this,function(S){if(S){S.style.visibility="visible"}},Q),800)}return true}if(this.drag_data.surfer){Surfer.dissolve(this.drag_data.surfer,O)}return true}}if(this.drag_data.surfer){K=Ruler.document.node(this.drag_data.surfer.ddd_node);if(this.drag_source_collection){K.x-=this.drag_data.scroll_node.scrollLeft;if(!Browser.isIE){K.y+=window.pageYOffset;K.y2+=window.pageYOffset}}else{if(this.local.activelubble&&Tree.ancestor(this.ddd.node,"div.lubble")){K.x-=this.local.activelubble.node.firstChild.scrollLeft;if(!Browser.isIE){K.y+=window.pageYOffset;K.y2+=window.pageYOffset}}}if(Browser.isKHTML){K.x+=1}if(this.drag_data.surfer.modified){Surfer.dissolve(this.drag_data.surfer,O)}else{if(window.ResourceComms&&L==window.ResourceComms){}else{Surfer.flyHome(this.drag_data.surfer,O,null,K)}}}setTimeout(bind(this,this.hide,true),200);return false}},lateSubmission:function(B,C,A){this.active_saves++;this.save_notice.change("Saving",1000,800);DiFi.pushPost("Grusers","submitFaveFromLub",[B,A,this.popped_drag_data.rid[0],this.popped_drag_data.rid[1]],bind(this,this.saver));DiFi.timer(10);this.popped_collection.doSentAni()},collectionFromRID:function(C,D){var B,A;DRE.assert(Number(C[0])==RESOURCE_FAVCOLLECTIONS);A=(this.local.activelubble||this).collections_data;for(B=0;A[B];B++){if(D&&!C[1]){if(Number(A[B].collection.group_id)==Number(D)){return A[B]}continue}if(Number(A[B].collection.galleryid)==Number(C[1])){return A[B]}}return null},stacktileFromThumb150:function(F,D){var C,B,E,A,H,G;switch(F[0]){case RESOURCE_DEVIATION:if(0&&Tree.hasClass(D,"film")){C=Tree.gets(D,"img")[1];if(!C){return""}B=150;E=C.height||C.offsetHeight}else{C=Tree.get(D,"img");if(!C){return""}B=C.width||C.offsetWidth;E=C.height||C.offsetHeight}A=Math.max(B,E);if(A>75){B*=75/A;E*=75/A}return thumbHTML({id:F[1],url:D.getAttribute("href"),tooltip:"",thumb75:Tree.get(D,"q")?{width:75,height:63,src:"http://th09.deviantart.com/images/150/shared/poetry.jpg"}:{width:B,height:E,src:C.src},size:75});case RESOURCE_GALLERIES:case RESOURCE_FAVCOLLECTIONS:if(!Tree.ancestor(D,"div.tt-tv150")){if(Tree.ancestor(D,"div.tv200")){G=Tree.get(Tree.ancestor(D,"div.tv200"),"table");G=Tree.get(G,"td");H=null;if(G){if(H=Tree.get(G,"div.maturity-rules")&&Tree.hasClass(document.body,"maturefilter")){H=H.parentNode.innerHTML}else{if(H=Tree.get(G,"div.tv-replacement")){H='<div style="margin:31px 0 0 40px !important;width:72px;height:72px;background:'+Station.read(H,"background")+'">'}}}if(!H){H=Tree.get(Tree.get(Tree.ancestor(D,"div.tv200"),"div.tv200-fazoom"),"img");if(H){H='<div class="tt-w" style="text-align:left !important;margin:31px 0 0 40px !important"><img style="margin:0" src="'+H.src+'" src="'+Math.ceil(Number(H.width)*0.35)+'" height="'+Math.ceil(Number(H.height)*0.35)+'"></div>'}else{H="?"}}}else{H=[""].concat(Tree.gets(D,"div.icon")).pop();if(H){H=Tree.get(H,"div.tt-aa")||"";if(H){H=H.parentNode.innerHTML;H=H.replace(/\btt-a\b/g,"tt-aa");H=H.replace(/ (?:width|height)\=/g," hack_the_planet=")}}}}else{H=Tree.get(D,"div.tt-a");H=H?H.innerHTML:""}return('<div class="tt-aa tt-tv70"><div class="tt-ww"><div class="tv70"><div class="tv70-tag">'+(F[0]==RESOURCE_FAVCOLLECTIONS?"Collection":"Gallery")+'</div><a href="/" class="tv70-cover"></a><div class="a-stream"><div class="tt-a">'+H+"</div></div></div></div></div>");default:return null}},uniqueName:function(C,B){var D,E,A;if(C.toLowerCase() in {featured:0,favourites:0,favorites:0}){C=this.nameBump(C," ")}A=true;while(A){A=false;for(D=0;E=this.collections_data[D];D++){if(E.collection.galleryid!=B){if(C==E.collection.title){A=true;C=this.nameBump(C," ")}}}}return C},nameBump:function(A,B){number=(A.match(/(\d+)$/)||[])[1];if(number){return A.substr(0,A.length-number.length)+(parseInt(number)+1)}else{return A+B+"2"}},refreshCollectTargets:function(){var C,H,D,A,F,B,I,G,E;if(!this.ddd.node||!this.drag_data||!this.collections_data){return }if(this.drag_source_lubble){this.drag_data.collect_targets=null;return }if(this.local.activelubble){G=this.local.activelubble.art_node;E=this.local.activelubble.node.firstChild;I=this.local.activelubble.collections_data;if(!I){this.drag_data.collect_targets=null;return }}else{I=this.collections_data;G=this.collect_node;E=G.parentNode}if(!this.drag_source_collection&&G.offsetWidth<G.parentNode.offsetWidth){for(D=0;I[D];D++){if(I[D].collection.title=="Featured"){F=Number(I[D].collection.galleryid);break}}}C=Tree.gets(G,"div.stackzone");H=[];for(D=0;C[D];D++){A=Ruler.document.node(C[D]);if(!Browser.isIE&&this.local.scrollmanager&&this.local.scrollmanager.top_floating){A.y+=window.pageYOffset;A.y2+=window.pageYOffset}A.x-=E.scrollLeft;A.x2-=E.scrollLeft;H.push(A);if(C[D].getAttribute("collect_rid")&&Number(C[D].getAttribute("collect_rid").split(":")[1])==F){B=C[D]}}if(B){C.push(B);A=Ruler.document.node(G);A.x=A.x2-20;A.x2=Ruler.document.node(E).x2;if(!Browser.isIE&&this.local.scrollmanager&&this.local.scrollmanager.top_floating){A.y+=window.pageYOffset;A.y2+=window.pageYOffset}H.push(A)}this.drag_data.collect_targets={master_rect:Ruler.screen.node(this.lub_node),nodes:C,rects:H}},plusFav:function(C,B){var A;DRE.assert(B in {favup:0,luvup:0});A=Tree.create("span."+B);C.appendChild(A);Station.push(A,"top",{from:36,to:0,f:Interpolators.sineCurve,time:650},bind(this,function(D){if(D.parentNode){D.parentNode.removeChild(D)}},A))},dragNotices:function(){var B,A;B=Tree.gets(Tree.get("div.bubbleview")||Tree.get("#output"),"textarea.put-art-here").concat(Tree.gets(Tree.get("div.bubbleview")||Tree.get("#output"),"intput.put-art-here"));for(A=0;B[A];A++){this.local[this.localUID()]=new LubAttentionNotice(B[A])}},noDragNotices:function(){var A;for(A in this.local){if(this.local[A] instanceof LubAttentionNotice){this.localClean(A)}}},lubScrollTimer:function(A){var B;B=this.drag_data.scroll_node;B.scrollLeft+=A?36:-36;this.refreshCollectTargets()},countSubfolders:function(A){return this.subfolder_counts[A]||0}};Lub.scrollHack=function(A){if(Browser.isIE){if(Lub.scrollHack.hacks==undefined){Lub.scrollHack.hacks=0}Lub.scrollHack.hacks+=A?1:-1;if(Lub.scrollHack.hacks){document.body.style.backgroundRepeat="no-repeat";document.body.runtimeStyle.backgroundImage="url(http://st.deviantart.com/minish/main/blank.gif)";document.body.runtimeStyle.backgroundAttachment="fixed"}else{document.body.runtimeStyle.backgroundImage="none";document.body.runtimeStyle.backgroundAttachment="scroll"}}};Lub.go=function(A){if(window.da_minish_lub){return }if(document.getElementById("logindock")||(document.getElementById("top-deviant")&&document.getElementById("top-deviant").nextSibling)||document.getElementById("collectlink")){da_minish_lub=new Lub();window.da_minish_lub=da_minish_lub}};AutoExec.push(Lub.go);if(window.DWait){DWait.run("jms/pages/lub.js")}function LubScrollManager(A){var B;if(document.getElementById("overhead")){return }DTLocal.infect(this);this.owner=A;B=bind.cache(this,this.scrolled);for(i in this.SCROLL_EVENTS){Events.hook(window,i,B)}this.stay_valid_interval=setInterval(bind(this,this.stayValid),1000);this.stayValid();this.scrolled()}LubScrollManager.prototype={SCROLL_EVENTS:{load:0,scroll:0,keydown:0,keyup:0,mouseup:0,keypress:0,mousewheel:0},localRecv:function(C){var A,B;if(C=="destroy"){this.off();B=bind.release(this,this.scrolled);for(A in this.SCROLL_EVENTS){Events.unhook(window,A,B)}clearInterval(this.stay_valid_interval)}},off:function(){Lub.scrollHack(0);if(Lub.newschool){if(Browser.isIE){this.owner.node.style.removeExpression("top");this.owner.node.style.top=0}this.owner.node.style.position="absolute"}else{if(Browser.isIE){this.owner.node.className="top-deviant-dontmove"}else{this.owner.node.className=""}}},scrolled:function(A){if((window.pageYOffset||document.body.scrollTop)>=this.min_top){if(!this.top_floating){Lub.scrollHack(1);if(Lub.newschool){if(Browser.isIE&&this.owner.node.style.setExpression){try{this.owner.node.style.setExpression("top","(Math.random() * 0) + document.body.scrollTop")}catch(A){this.owner.node.style.position="fixed"}}else{this.owner.node.style.position="fixed"}}else{this.owner.node.className="top-deviant-float"}this.top_floating=true}}else{if(this.top_floating){this.off();this.top_floating=false}}return true},stayValid:function(){this.min_top=0}};if(window.DWait){DWait.run("jms/pages/lub/lub_scroll_manager.js")}LubCollection=function(A,B){this.owner=A;if(!B){this.ready=false;B={galleryid:-this.owner.localUID(),title:"Devious "+this.owner.noun,rids:[],owner_id:deviantART.deviant.id}}else{this.ready=true}this.collection=B;this.node=Tree.createFragment('<div class="stackzone"><div class="customicon" style="display:none"></div><div class="stackctrl"><div class="stack"><div class="icon icon-i"></div><div class="icon icon-ii"></div><div class="icon icon-iii"></div></div></div><div class="label"></div></div>',true);if(this.collection.is_group){this.node.className+=" groupstack"}Events.hook(this.node,"click",bind.cache(this,this.clicked));Events.hook(Tree.get(this.node,".label"),"mouseover",bind.cache(this,this.labelHover));Events.hook(Tree.get(this.node,".label"),"mouseout",bind.cache(this,this.labelHover));Events.hook(Tree.get(this.node,".label"),"click",bind.cache(this,this.askName));this.render()};LubCollection.prototype={localRecv:function(A){if(A=="destroy"){Events.unhook(this.node,"click",bind.release(this,this.clicked));Events.unhook(Tree.get(this.node,".label"),"mouseover",bind.release(this,this.labelHover));Events.unhook(Tree.get(this.node,".label"),"mouseout",bind.release(this,this.labelHover));Events.unhook(Tree.get(this.node,".label"),"click",bind.release(this,this.askName))}},clicked:function(B){var A;if(A=Tree.get(this.owner.collect_node,"input.renamer")){A.blur();return false}if(this.owner.local.activelubble){this.owner.localClean("activelubble");return false}if((this.collection.is_group&&!this.collection.read_only)||(this.collection.rids&&this.collection.rids.length&&!this.collection.group_id)){this.owner.local.activelubble=new Lubble(this.owner,this.owner.collect_node.parentNode,this.collection,Ruler.document.node(this.node))}else{if((B.target||B.srcElement).tagName=="A"){return true}var C=Tree.get(this.node,".notice");Station.stopAnimation(C);Station.push(C,"opacity",{from:1,to:0,f:Interpolators.sineCurve,time:200},{from:0,to:1,f:Interpolators.sineCurve,time:200},{from:1,to:0,f:Interpolators.sineCurve,time:200},{from:0,to:1,f:Interpolators.sineCurve,time:200})}return false},renamed:function(C,A,B){delete this.renamer;B=B.replace(/[^a-zA-Z0-9\-_\ \.\?\\$'\":\/,\+]/g," ");B=B.replace(/(?:^\s+|\s+$)/g,"");B=B.replace(/\s{2,}/g," ");B=B.slice(0,44);if(!B){B=this.collection.title}if(this.collection.galleryid<0||B!=this.collection.title){B=this.owner.uniqueName(B,this.collection.galleryid);if(this.collection.galleryid<0||B!=this.collection.title){this.collection.title=B;if(!C){if(this.collection.galleryid>0){this.owner.difiSave("rename",[deviantART.deviant.id,MYSTERY,RESOURCE_FAVCOLLECTIONS,this.collection.galleryid,B])}else{this.owner.localClean("refresh_new_timer");this.owner.local.refresh_new_timer=setTimeout(bind(this.owner,this.owner.refreshNewCollections),5000);if(this.owner.locks>1){this.owner.locks--}}DiFi.timer(10)}}}this.render()},create:function(){if(this.collection.galleryid<0&&!this.processing){this.owner.difiSave("create",[deviantART.deviant.id,MYSTERY,RESOURCE_FAVCOLLECTIONS,this.collection.title,50000],{oldid:this.collection.galleryid,ths:this.owner});this.processing=true}DiFi.timer(10)},labelHover:function(A){if(A.type=="mouseover"){Tree.addClass(Tree.get(this.node,".label"),"label-hover")}else{if(A.type=="mouseout"){Tree.removeClass(Tree.get(this.node,".label"),"label-hover")}}},askName:function(A){if(this.owner.local.activelubble||this.collection.is_group){return true}if(this.renamer||this.collection.title=="Featured"||this.collection.is_group||(A&&A.type=="click"&&this.collection.galleryid<0)){return false}this.owner.slide(0,0);label=Tree.get(this.node,".label");while(label.firstChild){label.removeChild(label.firstChild)}this.renamer=new Renamer(this,null,this.collection.title);this.renamer.callback=bind(this,this.renamed,false,this.renamer);label.appendChild(this.renamer.node);return false},render:function(){var E,D,H,F,A,I,G,C,B,J;if(this.collection.galleryid){this.node.setAttribute("collect_rid",RESOURCE_FAVCOLLECTIONS+":"+this.collection.galleryid)}if(this.collection.group_id){this.node.setAttribute("group_lookup",this.collection.group_id)}B=Tree.get(this.node,"div.label");if(!this.renamer){B.innerHTML=this.collection.title=="Featured"?"Favourites":(this.collection.imperative||"")+this.collection.title}B=Tree.get(this.node,".notice");if(this.collection.is_group){if(!B){this.node.appendChild(Tree.create("div.notice",{},"drop art here"));this.node.appendChild(Tree.create("div.notice notice-sent",{},"sending"))}this.node.style.zIndex=5}else{if(!this.collection.rids.length){if(!B){this.node.appendChild(Tree.create("div.notice",{},"drop art here"))}this.node.style.zIndex=5}else{this.node.style.zIndex=10;if(B){this.node.removeChild(B)}}}H=Tree.gets(this.node,"div.icon");if(this.collection.rids){for(E=0;J=this.collection.rids[E];E++){if(F=H.pop()){F.innerHTML=App.cacheResourceView(J[0],J[1],"stacktile",{}).replace(/ class="tt-a\b/,' class="tt-aa').replace(/ class="tt-w\b/,' class="tt-ww')}else{break}}}while(F=H.pop()){F.innerHTML=""}},moveResource:function(D,A,C){var B;for(B=0;B!=this.collection.rids.length;B++){if(this.collection.rids[B]&&Number(this.collection.rids[B][0])==Number(D[0])&&Number(this.collection.rids[B][1])==Number(D[1])){this.collection.rids.splice(B,1);break}}if(A>=0){this.collection.rids.splice(A,0,D)}this.render();if(!C){if(A>=0){if(this.collection.galleryid<0&&this.collection.rids.length<2){this.create()}if(this.collection.group_featuredid){DiFi.pushPost("GrusersModules","save",[this.collection.group_id,this.collection.module_id,"button",{submission_type:D[0],submission_id:D[1]}],bind(this.owner,this.owner.saver));target_aggid=this.collection.target_aggid||this.collection.group_featuredid;if(Number(this.collection.galleryid)!=Number(target_aggid)){this.owner.difiSave("copy_resource",[this.collection.owner_id,MYSTERY,RESOURCE_FAVCOLLECTIONS,this.collection.galleryid,target_aggid,D[0],D[1],A]);this.owner.difiSave("remove_resource",[this.collection.owner_id,MYSTERY,RESOURCE_FAVCOLLECTIONS,target_aggid,D[0],D[1]])}}else{this.owner.difiSave("add_resource",[this.collection.owner_id,MYSTERY,RESOURCE_FAVCOLLECTIONS,this.collection.galleryid,D[0],D[1],A])}}else{this.owner.difiSave("remove_resource",[this.collection.owner_id,MYSTERY,RESOURCE_FAVCOLLECTIONS,this.collection.galleryid,D[0],D[1]])}DiFi.timer(10)}this.owner.refreshButton()},doSentAni:function(){Station.push(Tree.get(this.node,"div.notice"),"display",{to:"none"},"opacity",{to:0.01,time:1300},"display",{to:"block"},"opacity",{from:0.01,to:1,time:100,f:Interpolators.sineCurve});Station.push(Tree.get(this.node,"div.notice-sent"),"opacity",{to:0.01},"display",{to:"block"},"opacity",{from:0.01,to:1,time:200,f:Interpolators.sineCurve},{from:1,to:1,time:850},{from:1,to:0,time:100,f:Interpolators.sineCurve},"display",{to:"none"});Station.push(Tree.get(this.node,"div.notice-sent"),"bottom",{from:70,to:70,time:950},{from:70,to:130,time:300,f:Station.f.inversion(Interpolators.pulse)})}};if(window.DWait){DWait.run("jms/pages/lub/lub_collection.js")}function Lubble(A,B,C){DTLocal.infect(this);this.owner=A;this.owner_node=B;this.collection=C;this.owner.art_listeners.push(bind(this,this.artReceived));this.art_listener=this.owner.art_listeners.length-1;this.node=Tree.createFragment('<div class="lubble"><div class="scrollzone"><div class="welcome"></div><div class="artzone"><div class="stream"></div></div></div></div>',true);this.art_node=Tree.get(this.node,"div.stream");this.owner.showLubble(B,this.node);this.renderNotice();if(this.collection.is_group){this.bootGroup()}else{this.bootCollection()}}Lubble.prototype={localRecv:function(A){if(A=="destroy"){delete this.owner.art_listeners[this.art_listener];clearInterval(this.scroll_timer);this.owner.hideLubble(this.owner_node,this.node)}},bootCollection:function(){this.layContainers();this.node.firstChild.scrollLeft=this.collection.last_scroll_offset||0;this.collection.last_scroll_offset=undefined;this.scroll_timer=setInterval(bind(this,this.scrolled),50);this.scrolled(null)},bootGroup:function(){DiFi.pushPost("Gallections","create_featured",[this.collection.group_id,RESOURCE_FAVCOLLECTIONS]);DiFi.pushPost("Aggregations","get_galleries_initial",[this.collection.group_id,RESOURCE_FAVCOLLECTIONS,1],bind(this,function(F,E){var D,C,A,B;if(!F){this.localDestroy();return }this.collections_data=[];this.art_node.innerHTML="";for(A=0;E.response.content[A];A++){if(E.response.content[A].title=="Featured"){this.collection.group_featuredid=E.response.content[A].galleryid}}for(A=0;E.response.content[A];A++){if(!Number(E.response.content[A].parentid)&&(E.response.content[A].title=="Featured"||(E.response.content[A].behavior||{}).blue_buttons)){this.introducing(this.owner.formatRawCollection(E.response.content[A],this.collection))}}this.owner.refreshCollectTargets()}));DiFi.timer(1)},layContainers:function(){var B,A,C;A=[];if(Browser.isOpera){}for(B=0;B!=(this.collection.is_group?1:this.collection.rids.length);B++){A.push('<div class="placeholder tt-a"><span class="tt-w"><span class="shadow"><img src="" width="149" height="92" style="visibility:hidden"/></span></span></div>')}this.art_node.innerHTML=A.join("")||"&nbsp;";setTimeout(bind(Shadows,Shadows.nodes,this.art_node),1)},renderNotice:function(){var A,B;B=this.owner.countSubfolders(this.collection.galleryid);A=Tree.get(this.node,".welcome");A.innerHTML=("<h2>"+(this.collection.title=="Featured"?"Favourites":this.collection.title)+'</h2><span class="filler"></span><br/><br/><span class="buttons"><a href="http://'+this.owner.deviant.username+".deviantart.com/favourites/"+(this.collection.title=="Featured"?"":"#_"+this.collection.galleryid)+'" class="h">Full&nbsp;View</a>'+(B?" ("+B+" sub"+this.owner.noun.toLowerCase().replace(/^dev/,"")+(B>1?"s":"")+")":"")+'<br/><a href="http://'+this.owner.deviant.username+".deviantart.com/favourites/#_edit__"+(this.collection.title=="Featured"?"featured":this.collection.galleryid)+'" class="h">Edit</a></span>');if(!this.collection.is_group){Tree.get(A,".filler").innerHTML=("A "+this.owner.noun.substr(0,1).toLowerCase()+this.owner.noun.substr(1)+" by "+this.owner.deviant.symbol+this.owner.deviant.username)}else{Tree.get(A,".buttons").innerHTML=""}if(A.offsetWidth>170){A.style.width="170px";this.art_node.parentNode.style.marginLeft="170px"}else{this.art_node.parentNode.style.marginLeft=A.offsetWidth}if(Browser.isOpera){A.parentNode.style.position="relative";A.style.position="absolute"}},scrolled:function(F,A){var D,C,G,H,E,B,I;if(A||this.collection.last_scroll_offset!==this.node.firstChild.scrollLeft){E=Math.ceil(this.node.offsetWidth/210)+1;D=Math.floor((this.node.firstChild.scrollLeft/Math.max(1,this.node.firstChild.scrollWidth))*this.art_node.childNodes.length);G={};H=[];DRE.assert(E>1,"Why wouldn't it be?");B=true;for(C=D;C!=D+E;C++){if(C>=this.collection.rids.length){break}if(!this.collection.rids[C]){G[C]=true;B=false}else{H.push(this.collection.rids[C]);if(!App.cacheResourceView(this.collection.rids[C][0],this.collection.rids[C][1],"thumb150",Lub.RESVIEW_OPTIONS)){B=false}}}setTimeout(bind(this,function(K,J){if(K!=this.node.firstChild.scrollLeft&&!J){return }for(C in G){if(J){return }this.owner.requestArtSlice(this.collection.galleryid,Math.floor(C/24)*24,24)}for(C=0;H[C];C++){this.owner.requestArt(H[C])}},this.node.firstChild.scrollLeft,B||A),A||this.collection.last_scroll_offset===undefined?1:(B?250:500));this.collection.last_scroll_offset=this.node.firstChild.scrollLeft}},artReceived:function(G,E){var C,B,A,F,D;if(!E){return }if(G instanceof Array){D=G;for(C=0;C!=this.collection.rids.length;C++){if(this.collection.rids[C]&&Number(this.collection.rids[C][0])==Number(D[0])&&Number(this.collection.rids[C][1])==Number(D[1])){if(!Tree.hasClass(this.art_node.childNodes[C],"placeholder")){continue}Tree.removeClass(this.art_node.childNodes[C],"placeholder");this.art_node.replaceChild(Tree.createFragment(String(E).replace(/<a /g,'<a target="_blank" ')),this.art_node.childNodes[C]);setTimeout(bind(Shadows,Shadows.nodes,this.art_node.childNodes[C]),1)}}}else{G=G.split(",");G[0]=String(G[0]).replace(/^favby:.+?\//,"");B=Number(G[1]);if(Number(G[0])==Number(this.collection.galleryid)){for(C=0;C!=Number(G[2]);C++){if(this.collection.rids[C+B]&&this.collection.rids[C+B][0]!=E[C][0]&&this.collection.rids[C+B][1]!=E[C][1]){Bug.log("DiFi","That can't be right: "+this.collection.rids[C+B].join(":")+" != "+E[C].join(":")+" (at "+C+" / "+(C+B)+")")}this.collection.rids[C+B]=E[C]}this.scrolled(null,true)}}},introducing:function(A){var B;this.art_node.style.width=((((this.collections_data.length?this.art_node.firstChild.offsetWidth:140)+13)*(2+this.collections_data.length))+40)+"px";B=new LubCollection(this.owner,A);this.collections_data.push(B);this.art_node.appendChild(B.node)}};if(window.DWait){DWait.run("jms/pages/lub/lubble.js")}function LubAttentionNotice(B){var A;DTLocal.infect(this);this.node=Tree.create("div.lub-notice",{style:{position:"absolute",marginTop:(B.offsetHeight-25)+"px",marginLeft:"3px",border:"1px solid #84A8B6",color:"#84A8B6",background:"#374341",lineHeight:"22px",padding:"0 8px"}},"drag art here");B.parentNode.insertBefore(this.node,B);this.pulse()}LubAttentionNotice.prototype={localRecv:function(A){if(A=="destroy"){if(this.node.parentNode){this.node.parentNode.removeChild(this.node)}this.node=null}},pulse:function(){if(this.node){Station.push(this.node,"opacity",{from:0.99,to:0.99,time:900},{from:0.99,to:0,time:300,f:Interpolators.sineCurve},{from:0,to:0.99,time:400,f:Interpolators.sineCurve},{from:0.99,to:0.99,time:3400},bind(this,arguments.callee))}}};if(window.DWait){DWait.run("jms/pages/lub/lub_attention_notice.js")}var SkinInstaller={skinType:"journal",deviationid:0,installDone:false,installToID:0,showModal:function(D,C){if(SkinInstaller.installDone){return false}this.skinType=D;this.deviationid=C;$j("#Install_Skin").addClass("install_active");var B=$j("<div></div>");var A=$j(".skinInstallModal").clone().attr("id","skinInstallModal").css({display:"block"});B.prepend(A);var E=function(){var F=Modals.push.call({},B.get(0),SkinInstaller.modalCallback);$j("#skinInstallModal .agree_install").attr({id:"agree_install"})};if(vms_feature("cruisers")){SkinInstaller.getInstallableGroups(A,E)}else{E()}return true},modalCallback:function(B,A){if(B=="install"){}else{$j("#Install_Skin").removeClass("install_active")}},doInstall:function(){DiFi.pushPost("CSS","installskin",[SkinInstaller.installToID,SkinInstaller.skinType,SkinInstaller.deviationid],SkinInstaller.installResult);DiFi.send();return false},getInstallableGroups:function(C,B){var A=C.find(".bottom-bit .gmbutton2town");var D=$j('<div class="loading" style="padding:12px;float:right;margin-right:20px"><img src="http://st.deviantart.net/minish/deviation/loading-modal.gif?2"/></div>');C.find(".bottom-bit").prepend(D);A.hide();C.css("width","650px");DiFi.pushPost("CSS","group_installable",[],function(L,K){if(L){var I='<select name="skin_group" class="skin_group">';I+='<option value="0">My Journal</option>';var F=K.response.content;for(var H in F){var E=F[H];var G='<option value="'+E.userid+'">'+E.symbol+E.username+"</option>";I+=G}I+="</select>";var J=A.find(".install").html("Install To:<b></b>");$j(I).appendTo(A).selectpager({maxHeight:120});A.find("select.skin_group").change(function(){SkinInstaller.installToID=this.value});A.find(".select_pager").insertAfter(J).css({top:"1px",left:"-3px","float":"left"})}D.remove();A.show()});DiFi.send();B()},installResult:function(C,A){$j("#Install_Skin").removeClass("install_active");if(C){SkinInstaller.installDone=true;var B=A.response.content;var D="http://"+deviantART.deviant.username+".deviantart.com/journal/?edit=1&skinid="+B.itemid;$j("#Install_Skin").addClass("install_success");document.getElementById("skinInstallModal").className=document.getElementById("skinInstallModal").className.replace(/\bphone.modal\b/,"");$j("#skinInstallModal").html('<div style="margin:120px auto 92px auto;text-align:center"><strong style="vertical-align:middle"><img style="vertical-align:middle;position:relative;top:-1px" src="http://st.deviantart.com/minish/gruzecontrol/icons/journal.gif?2" alt=""/> Your new skin is installed</strong><br/><br/>Try it out! Write a <a class="a" href="'+D+'">journal entry</a> and use the <em>Journal Skin</em> button!<br/><br/><br/><span style="color:#8F9A94">Don\'t forget to read the artist\'s comments!<br/>Some skins require advanced <em>Options</em> editing.</span></div><input type="button" value="Close" class="iclose" onclick="Modals.pop()" />')}else{$j("#Install_Skin").addClass("install_error");Modals.pop("failed")}},installClick:function(){var A=$j("#skinInstallModal .agree_install").is(":checked");if(A){SkinInstaller.doInstall()}else{alert("You must read and accept the terms to install this skin.")}return false},cancelClick:function(){Modals.pop("cancel");return false}};if(window.DWait){DWait.run("jms/pages/skin-installer.js")}window.ManageFriends=function(D){var I;var H,J,F;var B=false;function G(K,L){if(!K){K=0}return(K&L)==L}function C(K,L){}var E={f:1,d:2,s:4,j:8,c:16,z:32,1:"f",2:"d",4:"s",8:"j",16:"c",32:"z"};function A(K){I.userIndex[K.username]=K}I={alphaIndex:{},groupIndex:{},userIndex:{},data:null,cache:[],templateRow:null,grouping:"alpha",cancelEventHandler:function(K){K.preventDefault()},groupFunctions:{alpha:function(M){var L=I.alphaIndex;var K=M.username.toLowerCase().charAt(0);if(!K.match("[a-z]")){K="1"}I.makeGroup(K);return L[K]},user:function(L){var M=I.groupIndex;var K=L.groupname||"Ungrouped";if(!M[K]){M[K]=I.makeGroup(K)}return M[K]}},init:function(){J=$j("#friends-loading .msg");H=$j("#friends-loading");F=$j(".deviantscroller");I.onResize();$j(window).resize(I.onResize);$j("#deviantlist").click(I.clickHandler);$j("#friends-save").click(I.save);$j("#friends-cancel").click(function(L){L.preventDefault();I.load();return false});$j(".groupByUser").click(I.cancelEventHandler).mousedown(function(L){L.preventDefault();I.load(true);return false});$j(".groupByAlpha").click(I.cancelEventHandler).mousedown(function(L){L.preventDefault();I.load(false);return false});var K=$j(".alphaindex");$j(["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]).each(function(){K.append('<div><a href="#grp'+this+'" accesskey="'+this.toUpperCase()+'">'+this+"</a></div>")});$j(".selectMenuIcon").click(I.showSelectMenu);$j("body").click(function(){$j(".popup").hide()});$j(".selAll").click(I.selectAll);$j(".selNone").click(I.selectNone)},onResize:function(){var K=$j(window).height()-340;if(K<420){K=420}F.height(K)},makeGroup:function(K){if(!I.groupIndex[K]){I.groupIndex[K]=$j("<tbody class='grp' id='grp"+K+"'><tr><th class='grpheading' colspan='7'>"+K+"</th></tr></tbody>").appendTo("#deviantlist")}return I.groupIndex[K]},setStatus:function(L,K){J.html(L);if(K){if(B){return }B=true;H.fadeIn("fast");$j("#deviantlist").hide()}else{if(!B){return }$j("#deviantlist").show();B=false;setTimeout(function(){$j("#friends-loading").fadeOut(1000)},800)}},load:function(K){I.setStatus("Fetching Deviants",true);I.cache=[];I.groupIndex=[];K=K?true:false;if(K){$j(".alphaindex div").hide()}else{$j(".alphaindex div").show()}$j("#deviantlist tbody.grp").remove();DiFi.pushPrivateGet("Friends","getFriendsList",[K],function(O,M){if(O){var M=M.response.content;for(var L in M){var N=M[L];M[L]=N.sort().reverse()}I.data=M;I.loaded()}});DiFi.send()},regroup:function(K){I.setStatus("Rebuilding List",true);if(K=="alpha"){$j(".alphaindex div").show()}else{$j(".alphaindex div").hide()}$j("#deviantlist tbody.grp").remove();I.grouping=K;I.data=I.cache;I.cache=[];I.alphaIndex={};I.loaded()},makeNewFriendRow:function(O,N,L,M){var P=$j(M.cloneNode(true)).attr("id",O.id).attr("username",O.username).addClass(L);P.find(".dn").html("<span class='a'>"+O.symbol+"<a class='u' href='http://"+O.username.toLowerCase()+".deviantart.com/'>"+O.username+"</a></span>");P.deviant=O;O.domNode=P;N.append(P);P.show();var K=O.attributes;P.find(".checkbox").each(function(){var R=$j(this);var Q=R.attr("v");var S=E[Q];if((Q=="f"||Q=="c"||Q=="s")&&O.isagroup){R.hide()}S=(K&S)==S;if(S^(Q=="c"||Q=="z")){R.addClass("checked")}});return P},loaded:function(R){R=R||0;if(R==0){I.setStatus("Building list",true)}var N=I.data;var Q=I.templateRow||$j("#deviantlist tbody.template tr:last-child").hide().clone();if(!I.templateRow){I.templateRow=Q}var K=Q[0];var V=I.makeNewFriendRow;var O=["even","odd"];var M=R||0;for(var P in N){var U=N[P];var T=I.makeGroup(P);var L=false;while(L=U.pop()){A(L);V(L,T,O[M++%2],K);if(M-R>60){I.setStatus("Building list ("+M+")",true);return setTimeout(function(){I.loaded(M)},50)}}delete N[P]}var S="s";if(M==1){S=""}$j(".gr-deviantslist .gm-controls").html('You have <em><strong id="totalFriendCount">'+M+"</strong> Friend"+S+"</em>");setTimeout(function(){I.setStatus("Done",false)},70);$j(".alphaindex a").click(I.cancelEventHandler).mousedown(I.showGroup);if(location.hash){setTimeout(function(){I.scrollToElement(location.hash,true)},100)}},selectNone:function(L){L.preventDefault();var K=$j(this.parentNode.parentNode).attr("v");if(!K){return }setTimeout(function(){$j(".popup").hide();$j(".checked.checkbox[v="+K+"]").click()},20)},selectAll:function(L){L.preventDefault();var K=$j(this.parentNode.parentNode).attr("v");if(!K){return }setTimeout(function(){$j(".popup").hide();$j(".checkbox[v="+K+"]").each(function(){var M=$j(this);if(!M.hasClass("checked")){M.click()}})},20)},showSelectMenu:function(K){K.stopPropagation();K.preventDefault();$j(".popup").hide();$j(this).find(".popup").show()},showGroup:function(K){K.preventDefault();I.scrollToElement(K.target.hash);return false},scrollToElement:function(Q,L){var M=$j(Q);if(!M.length){return false}if(L){M.addClass("highlight")}var O=M.position().top;var P=$j(".deviantscroller");var N=P.scrollTop();var K=Math.max(N+O-76,0);P.scrollTop(K);return false},clickHandler:function(M){var L=$j(M.target);var K;if(L[0].tagName=="A"&&L.hasClass("rem")){K=$j(L[0].parentNode.parentNode);var N=K.attr("username");if(N){I.removeFriend(N,K)}}else{if(L.hasClass("checkbox")){K=$j(L[0].parentNode.parentNode);I.checkHandler(K,L)}}},checkHandler:function(K,L){K.addClass("unsaved").attr("title","Unsaved");L.toggleClass("checked").attr("title","Unsaved")},removeFriend:function(L,K){if(confirm("Are you sure you want to remove "+L+"?")){DiFi.pushPost("Friends","removeFriend",[L],function(P,N){if(P){K.nextAll("tr").each(function(){$j(this).toggleClass("even").toggleClass("odd")});K.remove();var M=$j("#totalFriendCount");var O=parseInt(M.html());M.html(O-1)}else{alert("Failed to remove "+L)}});DiFi.send()}},save:function(L){L.preventDefault();var K=[];$j("#deviantlist tr.unsaved").each(function(){var N=$j(this);var M=0;N.find(".checkbox").each(function(){var P=$j(this);var O=P.attr("v");var R=parseInt(E[O]);var Q=P.hasClass("checked")^(O=="c"||O=="z");if(Q){M|=R}else{M&=~R}});K.push({id:N.attr("id"),attr:M})});if(K.length){DiFi.pushPost("Friends","setFriendAttributes",[K],function(N,M){if(N){alert("Changes saved!");$j("#deviantlist tr.unsaved").removeClass("unsaved")}else{alert("An error occured.")}});DiFi.send()}return false}};return I}(jQuery);if(window.DWait){DWait.run("jms/pages/mydeviants.js")};