/*
 *  © 2000-2010 deviantART, Inc. All rights reserved.
 */
if(!window.AutoExec){AutoExec=[]}DWait.ready(["jms/lib/popup.js","jms/lib/tree.js","jms/lib/difi.js"],function(){Popup.clicks.friends={create:function(){var A;DWait.ready("cssms/minish/friends.css",function(){});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/"},"Manage Friends")]),Tree.create("div.readout")]);DiFi.pushPrivateGet("Friends","getFriendsMenu",[1],this.downloadReady,A);DiFi.pushPrivateGet("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/quantcast.js","jms/lib/dtlocal.js"],function(){DWait.ready("jms/lib/gmi.js",function(){window.TalkPostWrapper=GMIBase.extend({gmiConstructor:function(){var A;this.talkpost=new TalkPost(this);this.talkpost.node=this.gmi_node;this.talkpost.comment=this.gmi_args;this.reset=bind(this.talkpost,this.talkpost.reset);Tree.setObject(this.gmi_node,"TalkPost",this.talkpost);this.textarea=this.gmi_node.getElementsByTagName("textarea")[0];A=this.getCacheName();if(TalkPostWrapper.textCache[A]){this.textarea.value=TalkPostWrapper.textCache[A].shift()||""}this.refreshTextareaState();this.textarea.onfocus=bind(this,this.textareaFocus);this.textarea.onblur=bind(this,this.textareaBlur);this.stdPostHook()},gmiDestructor:function(){var A;if(this.textarea){A=this.getCacheName();if(!TalkPostWrapper.textCache[A]){TalkPostWrapper.textCache[A]=[]}TalkPostWrapper.textCache[A].push(this.textarea.value||"")}this.talkpost.localDestroy()},previewClick:function(){this.talkpost.confirmPreview()},sendClick:function(){if(window.event){event.cancelBubble=true}this.talkpost.confirmPost();return false},getCacheName:function(){return[this.gmi_args.typeid||"",this.gmi_args.itemid||"",this.gmi_args.parentid||"",this.gmi_args.time_index||""].join(":")},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,F;TalkPostWrapper.one_comment_posted=1;if(D!="posted"){return }A=(GMI.up(this.gmi_node)||this).gmiQuery("CCommentThread")[0]||GMI.query("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})}if(Number(A.gmi_args.order)==2){A.gmi_node.insertBefore(F=E.firstChild,A.gmi_node.firstChild)}else{A.gmi_node.appendChild(F=E.firstChild)}this.gmi_node.style.display="none";if(window.scrollTo){window.scrollTo(0,Ruler.document.node(F).y-30)}else{document.body.scrollTop=Ruler.document.node(F).y-30}this.gmi_node.style.display="block"}delete E;this.reset(false);if(window.pageTracker){pageTracker._setDomainName(".deviantart.com");pageTracker._trackPageview("/difi/commentpost")}if(window.QuantcastHelper){QuantcastHelper.replaceLabelAll("Dynamic.Comment")}},refreshTextareaState:function(){var B,A;if(this.textarea_focused||this.textarea.value||this.mood_hovered||this.drawPlz_hovered||this.talkpost.commentDrawing){if(!this.moods){this.moods=this.talkpost.renderMoodBox();if(this.moods){this.moods.onmouseover=bind(this,this.moodHover);this.moods.onmouseout=bind(this,this.moodOut)}A=this.gmi_node.getElementsByTagName("a");A=A[A.length-1];if((A.className||"").indexOf("emoticons")>=0){A.onmouseover=bind(this,this.moodHover);A.onmouseout=bind(this,this.moodOut)}}if(this.gmi_node.className.indexOf("ccexpanded")<0){this.gmi_node.className+=" ccexpanded"}if(!(document.body.scrollTop||document.documentElement.scrollTop)){if(window.scrollTo){window.scrollTo(0,1)}else{document.body.scrollTop=1}B=Ruler.document.node(this.gmi_node).y2+10-Ruler.screen.rect().y2;if(B>0){if(window.scrollTo){window.scrollTo(0,B)}else{document.body.scrollTop=B}}}}else{this.gmi_node.className=this.gmi_node.className.replace(/\s*\bccexpanded\b/g,"")}},textareaFocus:function(){this.textarea_focused=1;this.refreshTextareaState()},textareaBlur:function(){this.textarea_focused=0;this.refreshTextareaState()},moodHover:function(){this.mood_hovered=1},moodOut:function(){this.mood_hovered=0}});TalkPostWrapper.textCache={}});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){A.parentNode.style.display="none"}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(){DWait.ready("jms/lib/pager.js.mood.js",bind(this,this.renderMoodBox2));return Tree.get(this.node,".moodbox")},renderMoodBox2: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;return C},getText:function(){return Tree.get(this.node,".text").value},setPreviewText:function(A){Tree.get(this.node,".previewbox").innerHTML=('<strong onclick="GMI.up(this).talkpost.goMode(\'normal\')" style="cursor:pointer">Preview <img src="http://st.deviantart.com/minish/messages/neutral-x.gif" style="position:relative;top:2px"></strong><br/><br/>'+A+"</div>")},focus:function(){if(this.current_mode=="normal"){Tree.get(this.node,".text").focus()}},current_mode:null,goMode:function(D,A){var B;if(D==this.current_node){return }B=this.current_mode;this.current_mode=D;switch(D){case"busy":Tree.get(this.node,".text").disabled=true;Tree.get(this.node,".preview").disabled=true;Tree.get(this.node,".post").disabled=true;Tree.get(this.node,".preview").className+=" disabledbutton";Tree.get(this.node,".post").className+=" disabledbutton";break;case"normal":Tree.get(this.node,".text").disabled=false;Tree.get(this.node,".preview").value="Preview";try{Tree.get(this.node,".preview").innerHTML="Preview"}catch(C){}Tree.get(this.node,".preview").disabled=false;Tree.get(this.node,".post").disabled=false;Tree.get(this.node,".preview").className=Tree.get(this.node,".preview").className.replace(/\bdisabledbutton\b/g,"");Tree.get(this.node,".post").className=Tree.get(this.node,".post").className.replace(/\bdisabledbutton\b/g,"");Tree.get(this.node,".previewbox").style.display="none";Tree.get(this.node,".text").style.visibility="visible";if(A!==false){Tree.get(this.node,".text").focus()}break;case"preview":Tree.get(this.node,".preview").value="Preview Off";try{Tree.get(this.node,".preview").innerHTML="Preview Off"}catch(C){}Tree.get(this.node,".preview").disabled=false;Tree.get(this.node,".post").disabled=false;Tree.get(this.node,".preview").className=Tree.get(this.node,".preview").className.replace(/\bdisabledbutton\b/g,"");Tree.get(this.node,".post").className=Tree.get(this.node,".post").className.replace(/\bdisabledbutton\b/g,"");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":DiFi.stdErr(null,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(),this.comment.typeid==39?1: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(I,D,A){var G,H,F,C,J,B;if(!I){this.last_fail_reason=(typeof (D.response.content||{}).error)=="string"?D.response.content.error:"There was an error while posting the comment.\n\nPlease try again soon.";this.goMode(A?"normal":"fail");return }G=D.response.content;H={commentid:G.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:(D.request.args[5]<<16)|(D.request.args[4]<<3),depth:undefined,text:G.body,signature:null,files:G.files,html:G.html};try{HALT()}catch(E){}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",H)}if(this.owner){this.off()}if(this.up&&this.up(TalkTower)){this.up(TalkTower).add(H)}},reset:function(B){var A,D,C;this.goMode("normal",B);this.node.getElementsByTagName("textarea")[0].value="";if(this.pager){Pager.select(this.pager,"");Pager.loadPage(this.pager,"mood")}if(this.exo_files){for(C=0;C!=this.exo_files.length;C++){if(this.exo_files[C]&&this.exo_files[C].file){this.exo_files[C].deckNuke()}}}}};if(window.DWait){DWait.run("jms/pages/talkpost.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.CCommentMaster=CCommentMaster=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")}});DWait.ready(["jms/lib/Base.js","jms/lib/browser.js","jms/lib/tree.js","jms/lib/gmi.js"],function(){HTMLPager_prototype={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;B=B||this.gmi_args;this.offset_param={name:"offset"};this.alt=true;if(this.alt){this.template=this.template_alt}if(typeof A=="function"){this.auto_scroll=true;return }this.owner=A;if(this.gmi_node){this.node=this.gmi_node}else{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.backup_query_string||"")+this.offset_param.name+"="+(Number(A)*Number(this.offset_param.count||this.count_per_page||24))}return"#"},on:function(){var C,D,F,A,B,E;if(this.gmi_node&&!this.backup_query_string&&(E=(this.gmi_node.getElementsByTagName("a")||[])[0])){this.backup_query_string=(E.href||"").split("?")[1]+"&amp;"}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);F=Math.min(D+4,this.pages);D=Math.max(0,Math.min(D,F-4));if(D!=F){for(B=D;B<=F;++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==F&&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{if(this.owner){this.owner.setProp("page",A)}else{return true}}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},update:function(B){var A;for(A in B){this[A]=B[A]}if(B.offset!=undefined&&this.count_per_page){this.page=Math.floor(B.offset/this.count_per_page)}this.on()}};window.HTMLPager=Base.extend(HTMLPager_prototype);HTMLPager_prototype.gmiConstructor=HTMLPager_prototype.constructor;HTMLPager_prototype.constructor=null;delete HTMLPager_prototype.constructor;window.GPager=GMIBase.extend(HTMLPager_prototype);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,Browser.isTouch?"touchstart":"mousedown",A)},unhookMouse:function(A){Events.unhook(document,Browser.isTouch?"touchstart":"mousedown",A)},mouseDown:function(D,B,A,C){if(DDD.subject||Browser.isTouch){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,Browser.isTouch?"touchmove":"mousemove",DDD.mouseDrag);Events.hook(document,Browser.isTouch?"touchend":"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,Browser.isTouch?"touchmove":"mousemove",DDD.mouseDrag);Events.unhook(document,Browser.isTouch?"touchend":"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||Ruler.document.pointer(G));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")}function pluralize(C,A,B){return(C?C:"no")+" "+A+(C==1?"":(B||"s"))}function htmlspecialchars(A){DRE.assert(typeof A=="string","REJECTED");return A.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\&/g,"&amp;").replace(/"/g,"&quot;")}function thumbHTML(D){var C,B,E,A,G,F;G=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sep","Oct","Nov","Dec"];C=[];C.push('<div class="tt-a" hakkadeviationid='+D.id+">");if(D.is_film){C.push('<keeper for="FilmBox2"></keeper>')}C.push('<span class="tt-w"><span class="');if(D.is_transparent){C.push("mild shadow")}else{C.push("shadow")}C.push('">');if(D.is_mature&&D.mature_filter_on){if(D.url){C.push("<a");if(D.option_link){C.push(' style="cursor:default" target="_blank"')}C.push(' href="');C.push(htmlspecialchars(D.url));C.push('" class="ismature" style="width:');C.push(D["thumb"+D.size]["width"]);C.push("px;height:");C.push(D["thumb"+D.size]["height"]);C.push('px"');C.push(">")}C.push('<i></i><img width="');C.push(D["thumb"+D.size]["width"]);C.push('" height="');C.push(D["thumb"+D.size]["height"]);C.push('" src="');C.push('"/>');if(D.url){C.push("</a>")}}else{if(D.is_film&&D.size=="150"&&D.url){C.push("<a");if(D.option_link){C.push(' target="_blank"')}C.push(' style="_margin-top:');C.push(Math.floor((165-D.thumbfilm.height)/2));C.push(";width:");C.push(D.thumbfilm.width);C.push("px;height:");C.push(D.thumbfilm.height);C.push('px" href="');C.push(htmlspecialchars(D.url));C.push('" class="film"><i></i><img style="_position:absolute;_top:0;_left:0" src="http://sh.deviantart.net/shadow/alpha-8B928B/0-1/');C.push(D.thumbfilm.width);C.push("/");C.push(D.thumbfilm.height);C.push('/null.png" width="');C.push(D.thumbfilm.width);C.push('" height="');C.push(D.thumbfilm.height);C.push('"/><b class="film"><img');if(!D.option_link){C.push(' onclick="if (this.attachEvent && navigator.cpuClass)this.parentNode.parentNode.click()"')}C.push(' alt="" src="');C.push(D.thumbfilm.src);C.push('"/></b></a>')}else{if(D.excerpt&&Number(D.size)>=150){C.push("<a");if(D.option_link){C.push(' style="cursor:default" target="_blank"')}C.push(' href="');C.push(htmlspecialchars(D.url));C.push('" class="lit" onmouseover="LitBox.hover(this)" onmouseout="LitBox.out(this)"><i></i>');C.push('<img style="_position:absolute;_top:0" src="http://sh.deviantart.net/shadow/alpha-ABB2AB/0-1/');C.push(D.thumb150.width);C.push("/");C.push(D.thumb150.height);C.push('/null.png" width="');C.push(D.thumb150.width);C.push('" height="');C.push(D.thumb150.height);C.push('"/><img class="lit" src="');C.push(D.excerpt_icon);C.push('"/><q><strong>');C.push(D.title);C.push("</strong>");C.push(D.excerpt);C.push("</q></a>")}else{if(D.url){C.push("<a");if(D.option_link){C.push(' style="cursor:default" target="_blank"')}C.push(' href="');C.push(htmlspecialchars(D.url));C.push('" title="');C.push(htmlspecialchars(D.tooltip));C.push('">')}C.push('<i></i><img width="');C.push(D["thumb"+D.size]["width"]);C.push('" height="');C.push(D["thumb"+D.size]["height"]);C.push('" src="');C.push(D["thumb"+D.size]["src"]);C.push('"');if(D.is_transparent){C.push(' class="transparent"')}C.push("/>");if(D.url){C.push("</a>")}}}}C.push("</span>");if(D.checkbox_mode){C.push('<input type="checkbox" class="checkbox" name="deviationids[]" value="');C.push(D.id);C.push('"/>')}A="";if(D.film_time){E=D.film_time;A+='<b class="filmtime" title="Film: ';A+=pluralize(Math.floor(E/60),"minute");if(E%60){A+=", "+pluralize(E%60,"second")}A+='">';if((E/60)>99){A+="Long"}else{A+=Math.floor(E/60)+":"+(((E%60)>10)?(E%60):"0"+(E%60))}A+="</b>"}if(D.option_link){C.push('<a href="" class="thumbmenu"><img src="http://s.deviantart.com/minish/gallery/menu-button-b.gif" alt="[menu]"/></a>')}else{if(D.title){C.push(' <a href="'+D.url+'" title="'+htmlspecialchars(D.tooltip)+'">'+D.title);C.push(A);A="";C.push("</a><br/><small>")}if(D.artist){C.push(" by ");C.push(D.artist_symbol+'<a href="http://'+D.artist+'.deviantart.com/">'+D.artist+"</a>")}if(D.category){C.push(" in ");if(D.category_url){F=D.category_url;F=F.replace(/^h[t]tp:\/\/browse\.deviantart\.com[\/]/,"#_browse/");C.push('<a title="');C.push(htmlspecialchars(D.tooltip));C.push('" href="');C.push(htmlspecialchars(F));C.push('">')}C.push(htmlspecialchars(D.category));C.push("</a>")}if(D.ts){B=new Date();B.setTime(Number(D.ts)*1000);C.push(", "+G[B.getMonth()]);C.push(" '"+String(B.getFullYear()).substr(Math.max(String(B.getFullYear()).length-2,0)))}if(D.search_score){C.push(" at "+D.search_score)}C.push(A);A="";if(D.title){C.push("</small>")}}C.push("</span></div>");return C.join("")}if(window.DWait){DWait.run("jms/lib/thumbhtml.js")}DWait.ready(["jms/lib/bind.js","jms/lib/gwebpage.js","jms/lib/popup.js"],function(){(function(A){window.GiveMenu={show:function(C,D){var B=Popup.create({className:"givemenu",callback:bind(this,this.jobDone),no_screen_adjust:"y",no_shadow:A.browser.msie});A(B.node).html('<div class="pager2"><div class="blockmenu"><div class="loading">Loading</div></div></div>');Popup.show(B,Ruler.screen.node(C),false);DiFi.pushPublicGet("User","getGiveMenu",[D],bind(this,this.difiCallback,C,B));DiFi.send()},difiCallback:function(D,C,H,F,B){if(!H||!F.response.content.html){return B?null:DiFi.stdErr("Failed to load give menu",F.response.content)}gWebPage.update(F.response.content);var G=A(F.response.content.html);var E=this;G.find("a.morelink").click(function(I){G.find(A(this).attr("rel")).show();A(this).remove();E.heightCalc(C)});setTimeout(bind(this,this.actualDisplay,G,D,C),50)},actualDisplay:function(D,C,B){A(B.node).html(D.show());this.heightCalc(B)},heightCalc:function(B){A(B.node).height(A(B.node).find("div.blockmenu").height()+(A.browser.msie?4:0))},jobDone:function(B){delete B.node}};A("[givemenu]").live("click",function(B){B.preventDefault();B.stopPropagation();GiveMenu.show(this,A(this).attr("givemenu"))})})(jQuery);if(window.DWait){DWait.run("jms/pages/givemenu.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")}DWait.ready(["jms/pages/lub/lub_constants.js","jms/pages/lub/lub_scroll_manager.js","jms/pages/lub/lub_collection.js","jms/pages/lub/lubble.js","jms/pages/lub/lub_attention_notice.js","jms/lib/app.js.resource_cache.js","jms/lib/bind.js","jms/lib/dtlocal.js","jms/lib/tree.js","jms/lib/difi.js","jms/lib/ddd.js","jms/lib/station.js","jms/lib/surfer.js","jms/lib/liquidswitch.js","jms/lib/thumbhtml.js","jms/lib/jquery/jquery-1.4.2.js",".domready"],function(){window.Lub=function(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-collect");Lub.newschool=document.getElementById("logindock")||document.getElementById("overhead-collect");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://st.deviantart.com/minish/widgets/favup.gif)"></span></div>'))}if(document.getElementById("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")}if(!Browser.isTouch){this.localEventHook(document.documentElement,"mousedown",bind(this,this.mouseDown))}B=Tree.get("div.bubbleview")||document.getElementById("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(document.getElementById("menulink")){this.localEventHook(document.getElementById("menulink"),"click",B)}if(document.getElementById("friendslink")&&!Lub.newschool){this.localEventHook(document.getElementById("friendslink"),"click",B)}if(document.getElementById("top-friends")){this.localEventHook(document.getElementById("top-friends"),"click",B)}if(document.getElementById("menuDropArrow")){this.localEventHook(document.getElementById("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=[document.getElementById("top-55")?this.collect_link_node:null,this.lub_node,document.getElementById("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&&!document.getElementById("overhead")){A=Tree.hasClass(document.body,"chatroom")?0:(document.getElementById("top-55")?34:34);B=Ruler.screen.rect();this.lub_node.style.width=B.x2-A;document.getElementById("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){var A=B.target||B.srcElement;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&&!document.getElementById("overhead")&&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){var G,K,H,I=J.target||J.srcElement;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(K,B){var C,L,J,A,G,E,D;if(!K&&!B.request){da_minish_lub.bluescreen();return }if(!--da_minish_lub.active_saves){da_minish_lub.save_notice.change("off",0,500)}if(K){da_minish_lub.modCookie(false);switch(B.request.method){case"add_resource":if(Number(B.request.args[4])==RESOURCE_DEVIATION&&Number(deviantART.pageData.deviationid)==Number(B.request.args[5])){if(window.Deviation){Deviation.favedOver();D=GMI.query("ResourceViewFaveButton")[0];if(D){setTimeout(bind(D,D.popupReminder),25)}}}if(window.LOTCC){var H=this.collectionFromRID([B.request.args[2],B.request.args[3]]);var I=(H&&H.collection.title=="Featured")?"add favorite":"add collection";LOTCC.bcpw("act",I)}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(F){}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(D,B){var E,A,C;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){E=Tree.get("iframe");if(E&&!Tree.ancestor(E,"div.bubbleview")){E.style.visibility="hidden"}}if(!this.slide_timer){if(C=document.getElementById("deviant-commands")){C.style.zIndex=24}if(C=((document.body.className.indexOf("with-apps")>=0)&&document.getElementById("oh-mainmenu"))){C.style.display="none"}this.slide_timer=setTimeout(function(){var F;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,document.getElementById("overhead")?"active":"lub-active");this.collect_link_node.blur()}F=document.getElementById("menulink");if(F){Tree.addClass(F,"menulink-lub-active")}document.getElementById("lubber").style.visibility="visible";this.lub_node.style.visibility="visible";A=document.getElementById("overhead")?-62:-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),D)}if(this.save_notice.state=="anticipation"){this.save_notice.node.style.display="none";this.save_notice.change("off",0,1000)}jQuery(".popup-unfriendly").hide()},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=document.getElementById("overhead")?-52:-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));jQuery(".popup-unfriendly").show()},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;document.getElementById("lubber").style.visibility="hidden";node=document.getElementById("menulink");if(node){Tree.removeClass(node,"menulink-lub-active")}node=(document.body.className.indexOf("with-apps")>=0)&&document.getElementById("oh-mainmenu");if(node){node.style.display="block"}this.lub_node.style.visibility="hidden";if(this.collect_link_node){Tree.removeClass(this.collect_link_node,document.getElementById("overhead")?"active":"lub-active");this.collect_link_node.blur()}this.localClean("scrollmanager");if(document.getElementById("deviant-commands")){document.getElementById("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(document.getElementById("dailyDevTopNav")){return }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(H){var F,E,A,C,B,I,D,J,G=H.target||H.srcElement;while(G&&G!=document.documentElement){if(G.tagName=="A"&&G.getAttribute("href")){if((" "+G.className+" ").indexOf(" no-lub ")>=0){break}if(Tree.hasClass(document.body,"maturefilter")&&(" "+G.className+" ").indexOf(" ismature ")>=0){break}F=G.getAttribute("href").match(REG_DEVIATION_2)||G.getAttribute("href").match(REG_OLD_DEVIATION_2);if(F){E=Tree.get(G,"img");if(!E||Number(E.width)>150||Number(E.height)>150){break}}else{F=G.getAttribute("href").match(REG_COLLECTION)}if(F&&(F[1]||"").toLowerCase()!=((this.deviant.username||"!").toLowerCase())){J=[RESOURCE_DEVIATION,F[3]];A=(E||G).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(H.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}G=G.parentNode}return true},mouseDown:function(H){var E,D,B,A,F,C,G=H.target||H.srcElement;if(H.ctrlKey||H.metaKey||H.altKey||H.shiftKey||H.button>1){return true}E=Tree.ancestor(G,"a");if(E&&document.body.className.indexOf("maturefilter")>=0&&(" "+E.className+" ").indexOf(" ismature ")>=0){return true}if(this.liquid_drag_notice){this.liquid_drag_notice.change("off",125,75)}if(String(G.tagName).toLowerCase()=="img"&&((G.getAttribute("collect_rid")||"").indexOf("1:")==0)){this.dragged_deviant_hint=null;this.dragged_rid=G.getAttribute("collect_rid").split(":");this.dragged_rid=[Number(this.dragged_rid[0]),Number(this.dragged_rid[1])];if(DDD.mouseDown.call(G,H,this,16)){return false}}else{if(String(G.tagName).toLowerCase()=="img"&&G.getAttribute("collect_fullview")){this.dragged_deviant_hint=(deviantART&&deviantART.pageData&&deviantART.pageData.deviation_artist_username)||"";this.dragged_rid=[RESOURCE_DEVIATION,G.getAttribute("collect_fullview")];if(DDD.mouseDown.call(Tree.ancestor(G,"a")||G.parentNode,H,this,16)){return false}}}if(!E){return true}B=E.getAttribute("href");this.dragged_deviant_hint=null;A=E.parentNode;while((A.tagName!="DIV"||!A.getAttribute("collect_rid"))&&(A=A.parentNode)){}if(A){C=String(A.getAttribute("collect_rid")).split(":");C[0]=Number(C[0]);this.dragged_deviant_hint=A.getAttribute("collect_dv")}else{A=Tree.ancestor(E,"div");C=[]}if(C.length<2||Number(C[0])==RESOURCE_DEVIATION){if(!B){return true}F=B.match(REG_DEVIATION_2);if(!F){F=B.match(REG_OLD_DEVIATION_2)}D=Tree.get(E,"img");if(!D){return true}if(C.length<2){if(!F){return true}C=[RESOURCE_DEVIATION,F[3]]}}if(this.liquid_drag_notice){this.liquid_drag_notice.change("off",0,1500)}switch(Number(C[0])){case RESOURCE_DEVIATION:break;case RESOURCE_GALLERIES:case RESOURCE_FAVCOLLECTIONS:E=Tree.get(A,"div.stackctrl")||Tree.get(A,"div.tv150")||(Tree.hasClass(A,"tv200")?A:Tree.get(A,"div.tv200"));if(!E){return true}break;default:return true}if(Tree.ancestor(A,"div.modal")){return true}switch(Number(C[0])){case RESOURCE_DEVIATION:if(F&&F[1]){this.dragged_deviant_hint=F[1]}else{F=(E.getAttribute("title")||"").match(/^.+ by .([a-zA-Z0-9_\-]+).*$/);if(F){this.dragged_deviant_hint=F[1]}else{F=(D.getAttribute("src")||"").match(/^.+_by_([a-zA-Z0-9_\-]+)\.[^\.]+$/);if(F){this.dragged_deviant_hint=F[1]}}}break}this.dragged_rid=C;if(Number(C[0])==RESOURCE_DEVIATION||(this.dragged_deviant_hint||"").toLowerCase()!=this.deviant.username.toLowerCase()){if(DDD.mouseDown.call(E,H,this)){return false}}return true},masterClick:function(B){var A=B.target||B.srcElement;if(this.locks||this.out){if(Tree.ancestor(A,"div.bubbleview")||Tree.ancestor(A,"div.output-primary")){console.log("target",A);if(A.id=="collect-button"||Tree.ancestor(A,"#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")||document.getElementById("output"),"textarea").concat(Tree.gets(Tree.get("div.bubbleview")||document.getElementById("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(document.getElementById("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")){if(this.drag_data.surfer){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.getAttribute("href").match(REG_COLLECTION)){F=F.getAttribute("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}if(this.drag_data.surfer){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);if(this.drag_data.surfer){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")||(D.tagName=="IMG"?D:null);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")||document.getElementById("output"),"textarea.put-art-here").concat(Tree.gets(Tree.get("div.bubbleview")||document.getElementById("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.collectButton=function(C){var D=$("#deviation-collect-bubble");if(D.length==0){return false}D=D.clone();$("#collect-button").parent().css("padding-top","110px");var A=Popup.create({callback:function(){$("#collect-button").parent().css("padding-top","0")},className:"clear",no_screen_adjust:"y",no_shadow:$.browser.msie});D.show().appendTo(A.node);var B=Ruler.screen.node(C);B.y2=B.y2-30;B.x=B.x+$("#collect-button").width()+10;Popup.show(A,B,false,true);da_minish_lub.slide();return false};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();$j("#collectlink").click(bind(da_minish_lub,da_minish_lub.buttonClicked));window.da_minish_lub=da_minish_lub}};Lub.go();if(window.DWait){DWait.run("jms/pages/lub.js")}});function LubScrollManager(A){var B;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:Math.max(2500,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")}DWait.count();