/*
 *  © 2000-2010 deviantART, Inc. All rights reserved.
 */
if(!window.AutoExec){AutoExec=[]}GruserAvatarChange={show:function(){if(!this.deck){this.deck=new DndDeck();this.deck.loadDeck(deviantART.pageData.deckData)}this.deck.modalizeDeck("deck_avatar",{addfile:true,filter:"displayable",restoreselection:true,ieforms:[]},this.deck.newPreviewSelectHandler,function(A){GruserAvatarChange.deck_item=A;GruserAvatarChange.done("ok")})},done:function(value){switch(value){case"reset":if(!confirm("Reset to the default avatar?")){break}with(document.getElementById("deck_avatar_submit")){getElementsByTagName("input")[0].value="";getElementsByTagName("input")[1].checked=true;submit()}break;case"ok":if(this.deck_item.is_displayable&&this.deck_item.filewidth==100&&this.deck_item.fileheight==50){with(document.getElementById("deck_avatar_submit")){getElementsByTagName("input")[0].value=this.deck_item.deckId;getElementsByTagName("input")[1].checked=false;submit()}break}setTimeout("alert('Please select a 100x50 pixel icon.');GruserAvatarChange.show();",1);break}}};if(window.DWait){DWait.run("jms/pages/gruzecontrol/change_avatar.js")}DWait.ready(["jms/lib/gmi.js","jms/lib/selection.js","jms/lib/events.js"],function(){window.HonkBoard=GMIBase.extend({gmiConstructor:function(){this.spikeIt();this.gmi_node.className=""},gmiDestructor:function(){this.unspikeIt()},spikeIt:function(){var B,A;A=this.gmi_node.getElementsByTagName("select");for(B=0;B!=A.length;B++){A[B].parentNode.insertBefore(GMI.create("HonkSelect",{select:A[B]}).gmi_node,A[B])}},unspikeIt:function(){var B,A;B=this.gmiQuery("HonkSelect");for(A=0;A!=B.length;A++){GMI._delete(B[A])}}});window.HonkSelect=GMIBase.extend({gmiConstructor:function(){if(!(this.select=this.gmi_args.select)){this.select=this.gmi_node.getElementsByTagName("select")[0]}if(!this.select){throw new Error("Bad HonkSelect call")}this.select.style.display="none";this.create();this.on_select_change=bind(this,this.on_select_change);Events.hook(this.select,"change",this.on_select_change);this.readFromSelect()},gmiDestructor:function(){Events.unhook(this.select,"change",this.on_select_change);this.destroy();this.select.style.display="inline"},create:function(){if(this.div){throw new Error("Cannot create() twice. Use recreate()")}this.div=document.createElement("div");this.createOptions(this.div);this.selector=new Selection(this.div,bind(this,this.on_main_click));this.selector.hook();this.gmi_node.appendChild(this.div)},recreate:function(){this.destroy();this.create()},destroy:function(){if(this.div){this.div.innerHTML="";this.div.parentNode.removeChild(this.div);this.selector.unhook()}},createOptions:function(D){var A,C,B;A=this.select.getElementsByTagName("option");B=[];for(C=0;C!=A.length;C++){B.push('<a class="f" honk_index="'+C+'" href="'+this.generateHRef(A[C])+'">'+(A[C].textContent||A[C].innerText)+"</a>")}this.div.innerHTML=B.join("")},generateHRef:function(A){return"?"+(this.select.name||"debug_me")+"="+(A.value||"")},readFromSelect:function(){this.reading_from_select=true;this.selector.setSelection(this.selector.getAllSelectable()[this.select.selectedIndex]);this.reading_from_select=false},writeToSelect:function(){var A;A=this.selector.getSelection()[0];if(A){this.select.selectedIndex=Number(A.getAttribute("honk_index"))}else{this.select.selectedIndex=0}},on_select_change:function(){this.readFromSelect()},on_main_click:function(){if(this.reading_from_select){return }Events.unhook(this.select,"change",this.on_select_change);this.writeToSelect();Events.hook(this.select,"change",this.on_select_change);this.select.form.submit()}});if(window.DWait){DWait.run("jms/pages/gruzecontrol/honkboard.js")}});DWait.ready(["jms/lib/bind.js","jms/lib/difi.js"],function(){DWait.DiFi=function(D,C,E,A){var B=DWait.token();(D?DiFi.pushPublicGet:DiFi.pushPrivateGet)(C,E,A,bind(DWait,DWait.DiFi.done,B));DiFi.timer(1);return B};DWait.DiFi.done=function(A,C,B){DWait.run(A,[C,B])};if(window.DWait){DWait.run("jms/dwait/difi.js")}});DWait.token=function(){return"dw"+ ++DWait.last_token};DWait.last_token=99;if(window.DWait){DWait.run("jms/dwait/token.js")}DWait.ready(["jms/lib/Base.js","jms/lib/events.js","jms/lib/simple_selection.js","jms/lib/browser.js","jms/lib/wo.js"],function(){window.Selection=SimpleSelection.extend({constructor:function(A,B){this.base(A,B);this.ieonmousedown=bind(this,this.ieonmousedown);this.onmousedown=bind(this,this.onmousedown);this.onclick=bind(this,this.onclick);this.ie_last_button=null},fnull:function(){},hook:function(A){var A;if(typeof arguments[0]!="object"){A={include_keyboard:arguments[0],allow_multiple:arguments[1]}}this.options=A;if(this.options.include_click!==false){Events.hook(this.root,"click",this.onclick)}if(this.options.include_keyboard){if(this.options.include_keyboard=="h"){this.options.include_keyboard={37:true,39:true}}else{this.options.include_keyboard={38:true,40:true}}Events.hook(document.documentElement,Browser.isGecko?"keypress":"keydown",this.onkeydown=bind(this,this.onkeydown))}if(this.options.allow_multiple){if(!window.DDD){throw new Error("Cannot hook multiple without ddd.js present")}Events.hook(this.root,"mousedown",this.onmousedown);this.root.onselectstart=this.cancelEvent}else{if(this.options.fast_clicks){Events.hook(this.root,"mousedown",this.onclick)}}if(Browser.isIE&&this.options.ieOnClickMouseButtonHack){Events.hook(this.root,"mousedown",this.ieonmousedown)}if(this.options.global_mouse_cancel){Selection.mouseInit().addListener(this._bound_sel=bind(this,this.setSelection,null,"mousedown"))}this.drag_rect_ruler=this.options.drag_rect_ruler||Ruler.document.node},cancelEvent:function(A){(A||window.event).cancelBubble=true;return false},unhook:function(){Events.unhook(this.root,"click",this.onclick);if(Browser.isIE){Events.unhook(this.root,"mousedown",this.ieonmousedown)}if(this.options.include_keyboard){Events.unhook(document.documentElement,Browser.isGecko?"keypress":"keydown",this.onkeydown)}if(this.options.allow_multiple){Events.unhook(this.root,"mousedown",this.onmousedown);this.root.onselectstart=null}else{if(this.options.fast_clicks){Events.unhook(this.root,"mousedown",this.onclick)}}if(this.options.global_mouse_cancel){Selection.mouseInit().removeListener(this._bound_sel)}},onclick:function(E){var F,B,D,A;E=E||window.event;if(window.Popup&&Popup.cancel_next_click){E.cancelBubble=true;Popup.cancel_next_click=false;return false}D=(this.options.allow_multiple&&this.options.allow_multiple!="ignore")||this.options.ignore_keyclicks?Selection.eventKeys(E):{};if(this.options.ignore_keyclicks&&(D.multiple||D.range)){return true}var C=Browser.isIE?this.ie_last_button:E.button;if(C>(Browser.isGecko||Browser.isKHTML?0:1)){return true}if(window.Admin&&Admin.active){return }Selection.focused=this;F=E.target||E.srcElement;do{if(this.isSelectable(F)){A=this.isSelected(F);if(D.multiple||D.range){if(A){this.deselect(F)}else{this.select(F)}this.callback(this.getSelection(),[],"click");B=true}else{if(this.options.ignore_clicks){B=A&&!this.next_sel_click_volatile;this.next_sel_click_volatile=true;break}this.setSelection(F,"click");B=true}break}}while(F!=this.root&&(F=F.parentNode));if(!B&&!this.options.sticky_selection){this.setSelection(null,"click")}if(this.options.ignore_clicks){return true}if(F&&F.blur){try{F.blur()}catch(E){}}return E.returnValue=false},onkeydown:function(C){var A,B;C=C||event;if(C.ctrlKey||C.metaKey||C.altKey||C.shiftKey){return true}if((C.target||C.srcElement).tagName in {TEXTAREA:1,INPUT:1}){return true}if(Selection.focused==this){if(C.keyCode in this.options.include_keyboard){A=(C.keyCode in {37:1,38:1})?-1:1;this.setRelativeSelection(A,1);this.scroll(A);return false}else{if(C.keyCode==27){if(this.cancel_next_esc){this.cancel_next_esc=0;return true}setTimeout(bind(this,this.setSelection,null,"keyboard"),1)}}}return true},ieonmousedown:function(A){A=A||window.event;this.ie_last_button=A.button},onmousedown:function(B){var A;B=B||window.event;if(B.button>(Browser.isGecko?0:1)){}else{A=B.target||B.srcElement;while(A&&A!=document.documentElement&&A.tagName!="DIV"){if(A.tagName=="A"){return true}A=A.parentNode}if(window.event){window.event.cancelBubble=true}if(B.stopPropagation){B.stopPropagation()}if(DDD.mouseDown.call(this.root,B,this,12,true)){if(B.preventDefault){B.preventDefault()}if(window.Popup){Popup.completeAll()}return false}}return true},getAllSelectableRects:function(B,H,G){var F,D,K,C,E,J,A,I=0;C=this.getAllSelectable();K=[];for(F=0;D=C[F];F++){if(this.options.skip_first_item&&!I++){continue}if(H&&(this.isSelected(D)||G===D)){J=true;continue}A=this.drag_rect_ruler(D,true);A.index=F;A.owner=B;A.node=D;if(H&&J){A.offset_mark=1}K.push(A)}return K},ddd:{snap:function(F){var A,B,E,C,D;E=Selection.eventKeys(F);if(window.Popup&&Browser.isIE){Popup.cancel_next_click=true}this.drag_data={surfer2:Surfer2.create(F,Ruler.document.pointer(F)),rects:[],initial_selection:[]};this.drag_data.rects=this.options.allow_multiple=="ignore"?[]:this.getAllSelectableRects();for(C=0;D=(this.drag_data.rects[C]||{}).node;C++){if(E&&(E.multiple||E.range)){this.drag_data.initial_selection[C]=this.isSelected(D)}}if(this.options.allow_multiple=="rectangle"){this.drag_data.surfer2.node.style.display="block"}if(window.DDDUtils){DDDUtils.mix(this)}if(this.dddTickStart){this.dddTickStart(F)}},drag:function(E){var D,B,C,A;if(this.dddTickUpdate){this.dddTickUpdate(E)}D=Surfer2.update(this.drag_data.surfer2,E);for(B=0;msg_rect=this.drag_data.rects[B];B++){A=((D.x<msg_rect.x2&&msg_rect.x<D.x2)&&(D.y<msg_rect.y2&&msg_rect.y<D.y2));if(A^this.drag_data.initial_selection[B]){this.next_sel_click_volatile=false;this.select(this.drag_data.rects[B].node)}else{this.deselect(this.drag_data.rects[B].node)}}},drop:function(A){if(this.dddTickEnd){this.dddTickEnd(A)}Surfer2.clear(this.drag_data.surfer2);this.drag_data.surfer2={}}},scroll:function(A,B){var C;C=this.getSelection();if(C.length){rect=Ruler.document.node(this.root);if(A>0){if(!B||B=="y"){this.root.scrollTop=Math.max(this.root.scrollTop,0,Ruler.document.node(C[C.length-1]).y2-(rect.y+rect.h-8))}if(!B||B=="x"){this.root.scrollLeft=Math.max(this.root.scrollLeft,0,Ruler.document.node(C[C.length-1]).x2-(rect.x+rect.w-8))}}else{if(!B||B=="y"){this.root.scrollTop=Math.min(this.root.scrollTop,Math.max(0,Ruler.document.node(C[0]).y-rect.y))}if(!B||B=="x"){this.root.scrollLeft=Math.min(this.root.scrollLeft,Math.max(0,Ruler.document.node(C[0]).x-rect.x))}}}}});Selection.eventKeys=function(A){if(Browser.isMac&&!Browser.isOpera){return{range:A.shiftKey,multiple:A.metaKey}}else{return{range:A.shiftKey,multiple:A.ctrlKey}}};Selection.mouseInit=function(){if(window.Popup){Popup.go()}if(!this._mouse){this._mouse=new WatchableObject()}return this._mouse};Selection.mouseCancel=function(){if(this._mouse){this._mouse.broadcast()}};window.DivOnlySelection=Selection.extend({getAllSelectable:function(){var B,A;B=[];for(A=0;A!=this.root.childNodes.length;A++){if((this.root.childNodes[A].tagName||"").toLowerCase()=="div"){B.push(this.root.childNodes[A])}}return B},isSelectable:function(A){return A.parentNode==this.root&&A.tagName=="DIV"}});window.LinkOnlySelection=Selection.extend({getAllSelectable:function(){return this.root.getElementsByTagName("a")},isSelectable:function(A){return A.parentNode==this.root&&A.tagName=="A"}});if(window.DWait){DWait.run("jms/lib/selection.js")}});DWait.ready(["jms/lib/gmi.js","jms/lib/bind.js","jms/lib/difi.js","jms/lib/cbc.js","jms/lib/popup.js","jms/lib/station.js","jms/lib/deviation_picker.js","jms/pages/gruzecontrol/widgets/utils.js","jms/pages/gruzecontrol/bluesbar.js"],function(){RESOURCE_GALLERIES=20;RESOURCE_FAVCOLLECTIONS=21;window.GroupMemberZone=GMIBase.extend({gmiConstructor:function(){this.gruser=this.gmiUp("Gruser")||GMI.query("Gruser")[0];this.gruser_id=this.gruser.gmi_args.id},recursoFind:function(D,B){var A,C;for(A in D){if(typeof D[A]=="object"){C=this.recursoFind(D[A],B);if(C){return C}}else{if(Number(A)&&D[A]==B){return A}}}},showInvite:function(){if(this.privs.manage_privs){GroupEdit.modal(1)}else{GroupInvitation.modal()}},setGallery:function(A){this.gallery=A},showSubmit:function(F,G){var D,L,E;if(window.GalleryEditor&&(L=GMI.query("GalleryEditor")[0])){this.gallery_moduleid=Number(L.gmi_args.mod_id)}else{if(!this.gallery&&window.Gallery){this.gallery=Gallery.getInstance()}}if(!window.DeviationPicker){alert("Deviation Submission is currently unavailable due to an error.\n\nPlease try again shortly!");return }if(!(D=this["cached_deviation_picker"+F])){floater_devpicker_submission=function(O){if(!O.getAttribute("floaterresult")){return }var N=$j(O).closest("div.deepee-box").data("picker");N.search("by:"+O.getAttribute("floaterresult"))};var B,M,I,C,K,J,A;A={master_links:true,theme:"browse",auto_height:true,adjust_height_callback:function(O,P,N){D.$container.find("div.deepee-sidebar").height(N);D._size()}};C=Pager.create(jQuery.extend({},A,{rootri:"art",href_base:"http://browse.deviantart.com/",callback:function(O,N){O=O.replace(/^art\/?/,"");D.query_string=D.query_string.replace("meta:all","").replace(/in:\S+/,"")+(O?(" in:"+O):"meta:all");D.options.search_query=D.options.search_query.replace("meta:all","").replace(/in:\S+/,"")+(O?(" in:"+O):"meta:all");D.search(true)}}));K=Pager.create(jQuery.extend({},A,{rootri:"gallections/"+window.deviantART.deviant.username+"/20",href_base:"http://"+window.deviantART.deviant.username+".deviantart.com/gallery/",callback:function(O,N){var O=/gallections\/([^\/]+)\/(\d+)\/?.*?\/??(\d*)$/.exec(O);if(!O){return }var P=/(?:gallery|by|favby):[^ ]+/;var Q=(O[2]==20?"gallery":"favby")+":"+O[1]+(O[3]?("/"+O[3]):"");D.query_string=D.query_string.replace(P,Q);D.options.search_query=D.options.search_query.replace(P,Q);D.search(true)}}));J=Pager.create(jQuery.extend({},A,{rootri:"gallections/"+window.deviantART.deviant.username+"/21",href_base:"http://"+window.deviantART.deviant.username+".deviantart.com/favourites/",callback:K.options.callback}));B={label:"Your Favourites",query:"favby:"+deviantART.deviant.username+" sort:time",search:false,browsebar:true,browsebar_custom:function(N){N.find(".browse-bar-left,.browse-bar-right").hide().end().find(".browse-bar-custom").html("<b>Collections</b>").show()},sidebar:function(N){N.html(J.node);Pager.loadPage(J,J.options.rootri);DiFi.send()},callback:function(){if(J.ri){Pager.adjustHeight(J)}}};M={label:"Your Gallery",query:"gallery:"+deviantART.deviant.username+" sort:time",search_query:"by:"+deviantART.deviant.username,nav_extra:"",browsebar:true,browsebar_custom:"<b>Folders</b>",sidebar:function(N){N.html(K.node);Pager.loadPage(K,K.options.rootri);DiFi.send()},callback:function(){if(K.ri){Pager.adjustHeight(K)}}};I={label:"All of deviantART",query:"boost:popular max_age:24h meta:all",search_query:"boost:popular",nav_extra:'<a href="#" class="a dropdown" onclick="DWait.readyLink([\'jms/lib/popup.js.friends.js\', \'cssms/minish/friends.css\'], this, DWait.bind(this, function () {if (!Browser.isGecko)Popup.documentClick.call(this, {target:this})}));return false;" popup="friends">Friends &#9662;</a>',browsebar:true,browsebar_custom:"<b>Categories</b>",sidebar:function(N){N.html(C.node);Pager.loadPage(C,C.options.rootri);DiFi.send()},callback:function(){if(C.ri){Pager.adjustHeight(C)}}};this["cached_deviation_picker"+F]=D=new DeviationPicker(F==RESOURCE_FAVCOLLECTIONS?[B,M,I]:[M,B,I],bind(this,function(O,N){var Q,P;if(!O||O.length==0){return }$j(".modal .deepee-box .action-buttons a").addClass("disabledbutton");Q=$j(".modal .deepee-box .deepee-title .folder-select").val();P=new CBC(bind(this,function(){$j(".modal .deepee-box .action-buttons a").removeClass("disabledbutton")}),bind(this,function(X,W,S){var Z,U,T;if(W){T=(S.response.content||{}).html||"";if(T=="auto-approved"||Number(T)){submission_message="Your submission has been accepted!"}else{if(T=="pending-approval"){submission_message="Your submission is being reviewed."}else{if(T=="pending-approval-byartist"){submission_message="The group must now wait for the original artist to confirm the submission."}else{var Y,R;R=T.replace(/\s*<.*?>\s*/g,"\n").replace(/^\n*/,"").replace(/\n*$/,"").replace(/\n/,"<br/>");if(T.indexOf("submission_id")==-1){Y="retry";R=jQuery("<div>"+R+'<br><br><a href="#">Retry?</a></div>').find("a").click(function(a){a.preventDefault();a.stopPropagation();D.submit([X])}).end()}else{Y="error";D.toggle_selection(X,false);N[X].attr("block_select","1")}D.add_message(X,Y,R,true);W=false}}}if(W){D.toggle_selection(X,false);N[X].attr("block_select","1");D.add_message(X,"ok",submission_message,true)}}else{var V=N[X].find("a.t").text();DiFi.stdErr("An error occurred during submission of "+(V||"unknown deviation")+".",S.response.content)}}));$j.each(O,bind(this,function(S,R){DiFi.pushPost("GrusersModules","save",[this.gruser_id||this.gmi_args.gruser_id,this.gallery_moduleid||this.gallery.moduleid,"button",{submission_type:R[0],submission_id:R[1],submission_folderid:Q}],bind(this,P.pull(),R))}));P.start();DiFi.timer(1);return false}),{search_query:"by:"+deviantART.deviant.username,subtitle:' <span class="sections_select"></span>',multiple:true,page_size:8,page_size_options:[8,16,32],width:0.92,height:0.92,ok_label:"Submit",cancel_label:"Done",only_submit_when_selection:true,select_across_pages:false,onselect:function(O,N){if(N[O].find("div.deepee-error-error, div.deepee-error-ok").length>0){this.toggle_selection(O)}}});DiFi.pushPost("Grusers","findSubmittableFolders",[this.gruser_id||this.gmi_args.gruser_id,F==RESOURCE_FAVCOLLECTIONS?"favourites":"gallery"],function(T,S){if(!T){return }if(S.response.content.length<=1){D.$container.find("span.sections_select").html(' - submitting<span class="deepee-submit-count"></span> to: <input class="folder-select" value="'+S.response.content[0][0]+'" type="hidden" />'+S.response.content[0][1])}else{var R,N=[' - submitting<span class="deepee-submit-count"></span> to: <select style="font-size:100%;" class="folder-select">'];for(var O=0;O<S.response.content.length;O++){var Q=S.response.content[O];var P='<option value="'+Q[0]+'"';if(G){if(G==Number(Q[0])){P+=' selected="selected"';R=1}}else{if(Q[1]=="Featured"){P+=' selected="selected"'}}P+=">"+Q[1]+"</option>";N.push(P)}N.push("</select>");D.$container.find("span.sections_select").html(N.join(""));if(G&&!R){alert("Sorry! This folder is currenly not open to submissions.");Modals.pop("cancel")}}});DiFi.timer(1)}else{if(G){if(D.$container.find("select.folder-select").length){var H=D.$container.find("option[value="+G+"]").attr("selected","selected");if(!H.length){alert("Sorry! This folder is currenly not open to submissions.");Modals.pop("cancel")}}}}D.show();D.$container.find("span.deepee-tabnavextra").insertAfter(D.$container.find("div.deepee-search")).css({position:"absolute",right:"300px",top:"15px"})},leave:function(A){WidgetUtils.modal("GrusersModules",this.gruser_id,"frontroom","joinrequest","leave",{},{w:450,h:196})},close:function(B){var A=[GMI.query("Gruser")[0].gmi_args.id];DiFi.pushPost("Grusers","checkExistingGroupKill",A,bind(this,function(C,E,D){if(E){window.location.href=D.response.content}else{WidgetUtils.modal("GrusersModules",this.gruser_id,"frontroom","joinrequest","close",{},{w:500,h:336})}},B));DiFi.send()},primary:function(A){WidgetUtils.modal("GrusersModules",this.gruser_id,"frontroom","joinrequest","primary",{},{w:640,h:200})},invite:function(A){WidgetUtils.modal("GrusersModules",this.gruser_id,"backroom","recruitment","generic",{},{w:500,h:353})},issueDiFiCmd:function(E,F,A,D){var B,C;B=E.className;E.className+=" active";if(F=="leaveGroup"&&!confirm("Are you sure?")){E.className=B;return }E.style.cursor="wait";C=[GMI.query("Gruser")[0].gmi_args.id];if(A!=undefined){C.push(A)}if(D!=undefined){C.push(D)}DiFi.pushPost("Grusers",F,C,bind(this,function(G,I,H){if(I){if(H.response.content=="requestGroupKill"){Modals.pop();alert("Your request to close this group has been sent successfully. A staff member will contact you.")}else{window.location.href="/"}}else{if(((H.response.content||{}).error||{}).code=="ERR_MUST_NOMINATE_FOUNDER"){G.className=G.className.replace(/\bactive\b/,"");G.style.cursor="pointer";WidgetUtils.modal("GrusersModules",this.gruser_id,"frontroom","joinrequest","successor",{},{w:380,h:248});return }Modals.pop();DiFi.stdErr("",H.response.content)}},E));DiFi.send()},leave2:function(A){this.issueDiFiCmd(A,"leaveGroup")},leave3:function(B,A){this.issueDiFiCmd(B,"leaveGroupFounder",A)},primary2:function(A){this.issueDiFiCmd(A,"setPrimaryGroup")},close2:function(C,A,B){this.issueDiFiCmd(C,"requestGroupKill",A,B)}});GroupMemberZone.MAP=["max","med","gone"];GroupMemberZone.up=function(C){var A,B=GroupMemberZone.MAP;for(A=0;A!=B.length;A++){document.getElementById("indifade-"+B[A]).style.display=(A==C)?"block":"none"}DiFi.pushPost("Grusers","setGroupAttribute",[GMI.query("Gruser")[0].gmi_args.id,C||3,Math.min(1,C)]);DiFi.timer(1000)};GroupMemberZone.down=GroupMemberZone.up;if(window.DWait){DWait.run("jms/pages/gruzecontrol/gmemzone.js")}});function RecordVisit(){RecordVisit.last_instance=this}window.RecordVisit=RecordVisit;RecordVisit.getInstance=function(){return RecordVisit.last_instance};RecordVisit.prototype={track:function(){var C=6;var A=location.href;var G=A.match(/\/([^.\/]+)\./);var D=A.match(/\/[^.\/]+\.([^.]+)\.([^\/]+)\//);if(G&&G.length==2&&D&&D.length==3){var H=false;var B=Array();var J=document.cookie;var I=J.match(/__utmg=([0-9\-a-zA-Z:,]+)/);if(I&&I.length==2){var K=I[1].split(",");var F=new Date().getTime();for(key in K){var E=K[key].split(":");if(E[1]<F){F=E[1]}}for(key in K){var E=K[key].split(":");if(E[0]!=G[1]){if(K.length<=C&&E[1]!=F){B.push(K[key])}else{if(K.length<C){B.push(K[key])}}}}if(B.length>=C){B.length=C-1}}B.push(G[1]+":"+new Date().getTime());var L="__utmg="+B.join(",")+";domain=."+D[1]+"."+D[2]+";";document.cookie=L}},getGroups:function(){var B=Array();var D=document.cookie;var C=D.match(/__utmg=([0-9\-a-zA-Z:,]+)/);if(C&&C.length==2){var A=C[1].split(",");for(key in A){var E=A[key].split(":");B.push(E[0])}}return B}};if(window.DWait){DWait.run("jms/pages/gruzecontrol/recordvisit.js")}DWait.ready(["jms/lib/bind.js","jms/lib/wo.js","jms/lib/gmi.js","jms/lib/cbc.js","jms/lib/selection.js","jms/lib/gwebpage.js","jms/lib/station.js","jms/pages/gruzecontrol/groupedit/apps_mutant.js"],function(){window.GroupMutant=GMIBase.extend({gmiConstructor:function(){this.process_list={};this.construct_main()},gmiDestructor:function(){},clearSidebar:function(){while(this.nodes.sidebar.nextSibling){this.nodes.sidebar.parentNode.removeChild(this.nodes.sidebar.nextSibling)}return this.nodes.sidebar.parentNode},get3rdColumn:function(){return this.nodes.output.previousSibling},slide4thColumn:function(F,B){var E,D,C,A=300;this.fourth_callback=F;B=B!==false;D=B?"block":"none";E=this.nodes.output.previousSibling.previousSibling;if((E.style.display||"none")==D){return E.firstChild}C=-this.colResizeGet();Station.run(E.parentNode,"left",{from:B?0:C,to:B?C:0,time:A,f:Interpolators.pulse});Station.stopAnimation(E);if(D=="none"){Station.push(E,"display",{to:"block",time:A},{to:"none",time:1})}else{E.style.display=D}if(this.col_resize_watcher_on&&!B){Events.unhook(window,"resize",this.colResizeWatcher)}this.col_resize_watcher_on=B;if(B){Events.hook(window,"resize",this.colResizeWatcher)}return E.firstChild},colResizeWatcher:function(){this.nodes.output.parentNode.style.left=(-this.colResizeGet())+"px"},colResizeGet:function(){return Ruler.screen.rect().x2-(24+(this.gmi_args.stand_alone?0:140)+218+24+(Browser.isIE?-1:0))},hide4thColumn:function(){this.fourth_callback=null;return this.slide4thColumn(null,false)},modal:function(){var B,A;B=Modals.push(this.gmi_node,bind(this,this.modalDone));B.className+=" modalfunk";(document.getElementById("top")||document.getElementById("overhead")).style.display="none";document.getElementById("output").style.display="none";A=document.getElementById("modalspace").getElementsByTagName("a")[0];A.parentNode.removeChild(A)},modalDone:function(C){var A,B;if(C=="save_probably_done"){if(this.fourth_callback){this.fourth_callback();this.fourth_callback=null;return false}B=0;C="save_done";for(A in this.process_list){if(B++>6){if(confirm("Exit without saving?")){break}else{return false}}}}else{if(C=="cancel"){for(A in this.error_highlights){if(confirm("Some data was not saved. Exit anyway?")){C="save_done"}break}}}if(C!="save_done"){this.saveButton("save_done");return false}(document.getElementById("top")||document.getElementById("overhead")).style.display="block";document.getElementById("output").style.display="block";GMI._delete(this)},template:('<table class="f" style="width:100%;height:100%"><tr style="height:46px;overflow:hidden"><td style="height:46px;overflow:hidden"><h3 style="padding-left:10px;font-weight:normal"><b>Customize</b> this App</h3></td></tr><tr><td class=f style="_position:relative"><div class="modalfox-hack" style="top:46px;height:100%"><div class="iconset-gruser modalfunk-left"><div class="guideblock guidemenu" style="display:none"></div></div><div class="modalfunk-righthack"><div class="modalfunk-secretbar" style="margin-left:-82px"><div class="modalfunk-secretbar-ctrl" style="border:0"></div></div><div class="modalfunk-lastbar"></div><div style="height:100%;overflow:auto"></div></div><tr><td style="height:44px" class="f"><div class="bottom-bit" style="text-align:center;padding:9px;height:auto"><div class="hh"><a href="" class="gmbutton2 gmbutton2c" style="dddisplay:none;float:right;width:80px;margin:0 10px" onclick="Modals.pop(\'save_probably_done\');return GMI.evCancel()">Cancel<b></b></a> <a href="" class="gmbutton2 gmbutton2s" style="width:170px;margin:0 10px;float:right" onclick="Modals.pop();return GMI.evCancel()">Save Changes and Close<b></b></a></div></td></tr></table>'),construct_main:function(){var C,B,A;this.gmi_node.className="phone-modal";this.gmi_node.style.height="100%";this.gmi_node.innerHTML=this.template;if(this.gmi_args.page_title){this.gmi_node.getElementsByTagName("h3")[0].innerHTML="<b>Customize</b> "+this.gmi_args.page_title}C=this.gmi_node.getElementsByTagName("td");this.nodes={sidebar:C[1].firstChild.firstChild.firstChild,output:this.gmi_args.inline||C[1].firstChild.firstChild.nextSibling.firstChild.nextSibling.nextSibling};if(!this.gmi_args.stand_alone){A=[];for(B in this.NAV){if(this.NAV[B].gmi){A.push('<a href="#" class="f iconh">'+(this.NAV[B].icon?'<i class="icon i'+this.NAV[B].icon+'"></i>':"")+B+"</a>")}else{A.push('<label class="g">'+B+"</label>")}}this.nodes.sidebar.innerHTML=A.join("")}},sideClick:function(B){if(!B.length){return }var C,A;C=B[0].lastChild.nodeValue;A=this.NAV[C];this.activateProcess(C,null,A.gmi[0],A.gmi[1],B[0])},createProcess:function(B,F,A,C,E){var H,G,D;if(!this.process_list[B]){H=document.createElement("div");H.style.display="none";this.nodes.output.appendChild(H);G={gruser_id:this.gmi_args.gruser_id,gruser_proxy:this.gmi_args.gruser,ops_mutant:true,ops_proxy:this,ops_pid:B,ops_owner_pid:F,ops_inline:this.gmi_args.inline,owner_proxy:this.process_list[F]};for(D in C){if(D in G){throw new Error("param clash on "+D)}G[D]=C[D]}this.process_list[B]=GMI.apply(H,A,G);if(E){this.declareProcessLink(B,E)}}return this.process_list[B]},killProcess:function(A){var B;if(B=this.process_list[A]){this.process_list[A]=null;GMI._delete(B);delete this.process_list[A]}},activateProcess:function(B,E,A,C,D){var F;if(this.current_process_pid){if(this.current_process_pid==B){return this.process_list[B]}this.clearSaveError();F=this.process_list[this.current_process_pid];if(F.opsDeleteSafe&&F.opsDeleteSafe()){this.killProcess(this.current_process_pid)}else{this._sleepProcess(F)}}this.current_process_pid=B;this._wakeProcess(this.createProcess(B,E,A,C,D));return this.process_list[B]},_wakeProcess:function(A){if(A.__ops_in_trouble){return }if(A.opsAfterWake){A.opsAfterWake()}},_sleepProcess:function(A){if(A.opsBeforeSleep){A.opsBeforeSleep()}}});GroupMutant.layoutModal=function(A,D){var C,B,G,F,E;GroupMutant.inline(A,D);return ;if(D){F=document.getElementById("edit-layout-popup-menu");if(F){if(!GroupMutant.layout_modal_menu){F=F.cloneNode(true);F.style.display="block";GroupMutant.layout_modal_menu=Popup.create({className:"cruiser",no_shadow:true,callback:bind(this,function(H){H.className=H.className.replace(/\bactive\b/,"")},D)});GroupMutant.layout_modal_menu.node.appendChild(F)}D.className+=" active";Popup.show(GroupMutant.layout_modal_menu,Ruler.screen.node(D,true));return }}G=document.createElement("div");G.style.display="none";document.body.appendChild(G);C=GMI.query("Gruser")[0];B=GMI.apply(G,"GroupMutant",{gruser:C,gruser_id:C.gmi_args.id,stand_alone:true,page_title:A});E=GMI.query("GPage")[0];B.activateProcess("layout",null,"Mutant_AppEditor",{page_id:E.gmi_args.id,page_name:E.gmi_args.name,page_title:A},null);B.modal()};GroupMutant.inline=function(B,I){var H,A,G,J,E,C,K,D,F;H=(I&&GMI.up(I,"GPage"))||GMI.query("GPage")[0];F=document.getElementById("gruze-columns")||H.gmi_node.getElementsByTagName("table")[0];if(!(J=GroupMutant.page_instance)){A=document.createElement("div");A.style.display="none";document.body.appendChild(A);G=H.gmiUp("Gruser");GroupMutant.page_instance=J=GMI.apply(A,"GroupMutant",{gruser:G,gruser_id:G.gmi_args.id,page:H,inline:H.gmi_node.parentNode})}else{D=F.style.display=="none"}F.style.display=D?(F.tagName=="TABLE"&&!Browser.isIE?"table":"block"):"none";J.activateProcess("layout",null,"Mutant_AppEditor",{page_id:H.gmi_args.id,page_name:H.gmi_args.name,page_title:B,inline:true},null).gmi_node.style.display=D?"none":"block";var K;if(K=GMI.query("GMFrame_BluesBar")[0]){K.setLockedMode(!D)}I=I||GroupMutant.previous_link;if(I){GroupMutant.previous_link=I;if(D){I.className=I.className.replace(/\bdisabledbutton\b/,"")}else{I.className+=" disabledbutton"}}};if(window.DWait){DWait.run("jms/pages/gruzecontrol/groupedit/mutant.js")}});DWait.ready(["jms/lib/gmi.js","jms/lib/bind.js","jms/lib/difi.js","jms/pages/gruzecontrol/widgets/arranger.js","jms/pages/gruzecontrol/widgets/layout.js","jms/pages/gruzecontrol/modulecatalog.js"],function(){window.GroupEdit_AppEditor=GMIBase.extend({gmiConstructor:function(){this.gmi_node.className="roomlayouteditor";this.nodes=[];this.extractPage(bind(this,this.pageReady))},gmiDestructor:function(){var A;this.dead=true;if(this.ma){GMI._delete(this.ma)}if(this.mc){GMI._delete(this.mc)}if(this.lc){GMI._delete(this.lc)}if(this.page){GMI._delete(this.page)}this.opsBeforeSleep();for(A=0;A!=this.nodes.length;A++){document.body.removeChild(this.nodes[A])}},opsBeforeSleep:function(){this.asleep=true;if(this.mc){this.mc.clearSelection();this.mc.gmi_node.style.display="none"}this.gmi_args.ops_proxy.get3rdColumn().style.display="none"},opsAfterWake:function(){this.asleep=false;if(this.mc){this.mc.gmi_node.style.display="block"}this.gmi_args.ops_proxy.get3rdColumn().style.display="block"},extractPage:function(A){var C,B;B=GMI.query("GPage")[0];C=new CBC(bind(this,this.difiDone,A));this.fail=false;if(Number(B.gmi_args.id)==Number(this.gmi_args.page_id)){this.page=this.gmi_args.gruser_proxy.gmiQuery("GPage")[0];this.zones=this.gmi_args.gruser_proxy.gmiQuery("GZone");this.gmi_args.page_layout_id=B.gmi_args.layout_id}else{throw new Error("Current page only")}C.start()},difiItem:function(C,A){var D;if(C&&!this.dead){D=document.createElement("div");D.innerHTML=A.response.content.html;D.style.display="none";document.body.appendChild(D);this.zones=this.zones.concat(GMI.query(D,"GZone"));var B=GMI.query(D,"GPage")[0];this.gmi_args.page_layout_id=B.gmi_args.layout_id;this.nodes.push(D)}else{if(!A.request||A.request.args[2]!="sidebar"){this.fail=true}}},difiDone:function(A){A(!this.fail,this.zones)},pageReady:function(C,B){if(!C||this.dead){return this.gmi_node.innerHTML="[x]"}var D;D=document.createElement("div");D.className="roomlayoutprefix";this.gmi_node.appendChild(D);if(!this.page){this.page=GMI.create("GPage",{id:this.gmi_args.page_id,name:this.gmi_args.page_name,layout_id:this.gmi_args.page_layout_id})}this.ma=GMI.create("ModuleArranger",{no_buttons:true,no_tabs:true,in_group_ops:true,layout_changer:true,live_preview:false,zones:B,page:this.page,page_title:this.gmi_args.page_title});this.ma.gmi_node.style.padding="8px 0";this.gmi_node.appendChild(this.ma.gmi_node);var A=true;this.lc=GMI.create("RoomLayoutChanger",{arranger:this.ma,gruser_id:this.gmi_args.gruser_id,page_name:this.gmi_args.page_name,gruser_proxy:this.gmi_args.gruser_proxy,minimized:A});if(this.gmi_args.page_name=="frontroom"){this.gmi_node.appendChild(this.lc.gmi_node)}this.mc=GMI.create("ModuleCatalog",{groups_mode:true,arranger:this.ma,inline:false,override_height:true,page:this.page,zones:B});this.mc.gmi_node.style.display="none";this.gmi_args.ops_proxy.get3rdColumn().appendChild(this.mc.gmi_node);if(!this.asleep){this.opsAfterWake()}this.mc.link()},opsOfferSave:function(D,A){var C,B;if(this.lc){this.lc.offerSave(D)}if(this.ma){this.ma.offerDelay(D);C=this.ma.gmiQuery("MAMiniModule");first=true;for(B=0;B!=C.length;B++){if(C[B].link&&C[B].link.uncommitted){C[B].link.uncommitted=false;DiFi.pushPost("GrusersModules","addModuleCommit",[this.gmi_args.gruser_id,this.gmi_args.page_id,C[B].link.gmi_args.id],D.pull())}}DiFi.timer(1)}},opsNeedsReload:function(){return true}});if(window.DWait){DWait.run("jms/pages/gruzecontrol/groupedit/apps_editor.js")}});DWait.ready(["jms/lib/gmi.js","jms/lib/bind.js","jms/lib/difi.js","jms/pages/gruzecontrol/widgets/arranger.js","jms/pages/gruzecontrol/widgets/layout.js","jms/pages/gruzecontrol/modulecatalog.js"],function(){window.Mutant_AppEditor=GMIBase.extend({gmiConstructor:function(){this.gmi_node.className="roomlayouteditor";this.nodes=[];this.extractPage(bind(this,this.pageReady))},gmiDestructor:function(){var A;this.dead=true;if(this.ma){GMI._delete(this.ma)}if(this.mc){GMI._delete(this.mc)}if(this.lc){GMI._delete(this.lc)}if(this.page){GMI._delete(this.page)}for(A=0;A!=this.nodes.length;A++){document.body.removeChild(this.nodes[A])}},template:('<div class="indifade" style="padding:12px"><h3>Customize with widgets!</h3>Below are the widgets that make up your page.<br><strong>Drag & Drop</strong> them to rearrange, or add brand new widgets to spice up your group!</div>'),extractPage:function(A){var C,B;B=GMI.query("GPage")[0];C=new CBC(bind(this,this.difiDone,A));this.fail=false;if(Number(B.gmi_args.id)==Number(this.gmi_args.page_id)){this.page=this.gmi_args.gruser_proxy.gmiQuery("GPage")[0];this.zones=this.gmi_args.gruser_proxy.gmiQuery("GZone");this.gmi_args.page_layout_id=B.gmi_args.layout_id}else{throw new Error("Current page only")}C.start()},difiItem:function(C,A){var D;if(C&&!this.dead){D=document.createElement("div");D.innerHTML=A.response.content.html;D.style.display="none";document.body.appendChild(D);this.zones=this.zones.concat(GMI.query(D,"GZone"));var B=GMI.query(D,"GPage")[0];this.gmi_args.page_layout_id=B.gmi_args.layout_id;this.nodes.push(D)}else{if(!A.request||A.request.args[2]!="sidebar"){this.fail=true}}},difiDone:function(A){A(!this.fail,this.zones)},pageReady:function(D,B){if(!D||this.dead){return this.gmi_node.innerHTML="[x]"}var E,C;E=document.createElement("div");E.className="roomlayoutprefix";this.gmi_node.appendChild(E);if(!this.page){this.page=GMI.create("GPage",{id:this.gmi_args.page_id,name:this.gmi_args.page_name,layout_id:this.gmi_args.page_layout_id})}if(this.gmi_args.inline){C=document.createElement("div");C.style.display="none";C.className="inline-catalog-holder";C.innerHTML=('<div class="indizone modalfunk" style="position:relative"><div style="position:absolute;left:20px;top:18px;color:#ECF5F1;font-size:8.25pt"><h3 style="color:white;display:inline">Widgets You Can Add:</h3> &nbsp; <em>Click any widget to preview!</em></div><table class=f><tr><td class="f widget-categories" style="padding-top:50px"><td class="f indizone-vr"><div class="indizone-vr"></div><td class="f" style="padding-top:50px"><div class="inline-catalog"></div></table></div>')}this.ma=GMI.create("ModuleArranger",{no_buttons:true,no_tabs:true,in_group_ops:false,layout_changer:true,live_preview:this.gmi_args.inline,zones:B,page:this.page,page_title:this.gmi_args.page_title,editor_proxy:this,inline:this.gmi_args.inline,additional_div_hook:C});if(this.gmi_args.inline){this.gmi_node.style.display="block"}this.ma.gmi_node.style.padding="8px 0";this.gmi_node.appendChild(this.ma.gmi_node);var A=true;this.lc=GMI.create("RoomLayoutChanger",{arranger:this.ma,gruser_id:this.gmi_args.gruser_id,page_name:this.gmi_args.page_name,gruser_proxy:this.gmi_args.gruser_proxy,minimized:A,inline:true});if(this.gmi_args.inline){}if(this.gmi_args.page_name=="frontroom"){this.gmi_node.appendChild(this.lc.gmi_node)}this.mc=GMI.create("ModuleCatalog",{editor_proxy:this,groups_mode:true,ops_proxy:this.gmi_args.ops_proxy,arranger:this.ma,inline:this.gmi_args.inline,override_height:true,no_pager:true,page:this.page,zones:B,category_placeholder:C?C.getElementsByTagName("td")[0]:this.gmi_args.ops_proxy.clearSidebar()});this.mc.gmi_node.className+=" catalog2";if(this.gmi_args.inline){E=C;E.getElementsByTagName("td")[2].firstChild.appendChild(this.mc.gmi_node);this.gmi_node.appendChild(E)}else{this.mc.gmi_node.style.display="none";this.gmi_node.parentNode.appendChild(this.mc.gmi_node)}this.mc.link()},opsOfferSave:function(D,A){var C,B;if(this.lc){this.lc.offerSave(D)}if(this.ma){this.ma.offerDelay(D);C=this.ma.gmiQuery("MAMiniModule");first=true;for(B=0;B!=C.length;B++){if(C[B].link&&C[B].link.uncommitted){C[B].link.uncommitted=false;DiFi.pushPost("GrusersModules","addModuleCommit",[this.gmi_args.gruser_id,this.gmi_args.page_id,C[B].link.gmi_args.id],D.pull())}}DiFi.timer(1)}},opsNeedsReload:function(){return true}});if(window.DWait){DWait.run("jms/pages/gruzecontrol/groupedit/apps_mutant.js")}});DWait.ready(["jms/lib/gmi.js","jms/lib/popup.js","jms/lib/difi.js"],function(){GroupEdit_AppMenuItem=GMIBase.extend({gmiConstructor:function(){var A;if(!this.gmi_args.gruser_id){this.gmi_args.gruser_id=this.gmiUp("Gruser").gmi_args.id}this.page_id=this.gmi_args.id||Number(this.gmi_node.getAttribute("gpage_id")||this.gmi_node.getAttribute("rel"));this.page_name=this.gmi_args.name||this.gmi_node.getAttribute("gpage_name")||this.gmi_node.getAttribute("g-pagetypename");if(this.gmi_args.in_group_ops){this.gmi_node.style.position="relative";this.gmi_node.className="f iconh";A=document.createElement("span");A.className="gm-controls";A.style.top="-7px";A.innerHTML='<span class="gmb-menu" title="Menu"><span class="menua" onclick="return DWait.readyLink(DWait.DiFi(false, \'GrusersPages\', \'fetchPageList\', ['+this.gmi_args.gruser_id+']), this, DWait.bind(GMI.up(this), GMI.up(this).menu, [this]))">Menu</span></span>';this.gmi_node.appendChild(A)}},gmiDestructor:function(){delete this.cached_popup;Popup.completeAll();if(this.gmi_args.selector&&this.gmi_node.className.indexOf("selected")>0){this.gmi_args.selector.setSelection(null)}},menu:function(I,H,K){var A,E,D,F,G,L,B,J;if(!(B=(this.gmi_args.app_spec||this.app_spec))){if(!DiFi.stdErrCallback.apply(DiFi,H)){return }L=H[1].response.content;for(D in L){if(L[D].name==this.page_name){this.app_spec=B=L[D]}}if(!B){return alert("An error has occurred.\n\nApp not found")}}if(!(A=this.cached_popup)){A=Popup.create({className:"cruiser",no_shadow:true,callback:bind(this,this.menuDone,I)});A.node.setAttribute("gmi-redirect",this.gmi_node.getAttribute("gmindex"));this.cached_popup=A}function C(P,Q,N,M,O){if(M){return'<a class="f'+(O?" iconh":"")+'" href="#" onclick="GMI.up(this).menuClick(this, \''+P+"', '"+(Q||"")+"');return GMI.evCancel()\">"+(O?'<i class="icon i'+O+'"></i> ':"")+N.replace(/</g,"&lt;")+"</a>"}return'<div class="blockdisabled">'+N.replace(/</g,"&lt;")+"</div>"}F=[];switch(K){case"icon":break;case"name":F.push(C("rename",null,"Change Name to:",false));allowed=GMI.query("Gruser")[0].gmi_args["super"];for(D=0;D!=B.allowed_titles.length;D++){var J=B.allowed_titles[D];F.push(C("rename",J,J,allowed,J==((this.getTextNode()||{}).nodeValue||"").replace(/(^\s+|\s+$)/g,"")?"44":"43"))}if(!allowed){F.push("<div class=blockmenu-hr></div>");F.push('<a class="f" href="http://www.deviantart.com/supergroup/?forgroupid='+GMI.query("Gruser")[0].gmi_args.id+'">Upgrade to a Super Group<br>to Change App Names</a>')}break;default:Popup.completeAll();if(!this.gmi_args.in_group_ops&&!(B.name in {gallery:"",faves:""})&&!(this.page_name in {gallery:"",faves:""})){F.push(C("layout",null,"Edit Layout",B.layout))}if((B.allowed_titles||[]).length){F.push(C("rename",null,"Change Name...",true));if(!this.gmi_args.in_group_ops){F.push('<div class="blockmenu-hr"></div>')}}F.push(C("uninstall",null,"Uninstall...",B.installable))}A.node.innerHTML=('<div><div class="blockmenu iconset-gruser">'+F.join("")+"</div></div>");A.node.style.height="auto";A.node.style.width="120px";if(this.gmi_args.in_group_ops){document.body.scrollTop=document.documentElement.scrollTop=0}if(I){I.className+=" active"}Popup.show(A,Ruler.screen.node(this.gmi_args.in_group_ops?this.gmi_node.lastChild.lastChild:this.gmi_node.parentNode,false));if(window.event){event.cancelBubble=true}return false},menuClick:function(B,C,A){Popup.completeAll();switch(C){case"icon":this.menu(null,null,"icon");break;case"rename":if(A){this.setBusy(true);DiFi.pushPost("GrusersPages","renamePage",[this.gmi_args.gruser_id,this.page_id,B.lastChild.nodeValue.replace(/^\s+/,"")],bind(this,this.difiDone));DiFi.timer(1);return }this.menu(null,null,"name");break;case"layout":GroupMutant.layoutModal();break;case"uninstall":if(confirm("This will remove this application from the group.\n\nAre you sure?")){this.setBusy(true);DiFi.pushPost("GrusersPages","removePage",[this.gmi_args.gruser_id,this.page_id],bind(this,this.difiDone));DiFi.timer(1)}break;default:throw new Error(C+" --whut?")}},setBusy:function(A){this.busy=A;Station.apply(this.gmi_node,"opacity",this.busy?0.5:1)},difiDone:function(B,A){Popup.completeAll();if(!B){this.setBusy(false);return DiFi.stdErr(null,A)}switch(A.request.method){case"renamePage":this.getTextNode().nodeValue=A.request.args[2];break;case"removePage":if(!this.gmi_args.in_group_ops){window.location.href="/";return }this.getMasterNode().parentNode.removeChild(this.getMasterNode());GMI._delete(this);return }this.setBusy(false)},getTextNode:function(){if(this.gmi_args.in_group_ops){return this.gmi_node.firstChild.nextSibling}if(this.gmi_args.sidebar){return this.gmi_node.parentNode.previousSibling.firstChild.nextSibling}return this.gmi_node.parentNode.nextSibling.lastChild.previousSibling},getMasterNode:function(){if(this.gmi_args.in_group_ops){return this.gmi_node}if(this.gmi_args.sidebar){return this.gmi_node.parentNode.previousSibling}return this.gmi_node.parentNode.parentNode.parentNode},menuDone:function(A){A.className=A.className.replace(/\bactive\b/g,"")}});if(window.DWait){DWait.run("jms/pages/gruzecontrol/groupedit/apps_menu_item.js")}});DWait.ready(["jms/lib/bind.js","jms/lib/gmi.js","jms/pages/gruzecontrol/groupedit/apps_menu_item.js","jms/pages/gruzecontrol/groupedit/apps_editor.js"],function(){window.GroupEdit_AppsMain=GMIBase.extend({gmiConstructor:function(){var C,A,B,D,E;B=this.extractAppLinks();this.sidebar_node=document.createElement("div");this.sidebar_node.setAttribute("gmi-redirect",this.gmi_node.getAttribute("gmindex"));this.sidebar_node.innerHTML="<label class=g>Group Apps</label>";this.sidebar_node.className="guideblock guidemenu";this.selector=new LinkOnlySelection(this.sidebar_node,bind(this,this.selection));this.selector.hook({sticky_selection:true,fast_clicks:true});for(C=0;A=B[C];C++){this.sidebar_node.appendChild(GMI.apply(A.cloneNode(true),"GroupEdit_AppMenuItem",{in_group_ops:true,selector:this.selector,gruser_id:this.gmi_args.gruser_id}).gmi_node)}if(this.gmi_args.ops_proxy){this.opsAfterWake(true);this.selection([],null,true)}else{this.sidebar_node.style.display="none";document.body.appendChild(this.sidebar_node)}E=document.createElement("div");E.className="gmbuttons";E.innerHTML="<a onclick=\"return DWait.readyLink(DWait.DiFi(false, 'GrusersPages', 'fetchPageList', ["+this.gmi_args.gruser_id+']), this, DWait.bind(GMI.up(this), GMI.up(this).menu, [this]))" href="" class="gmbutton2" style="height:23px;background-image:url(http://st.deviantart.com/minish/gruzecontrol/gmbuttonapp.gif?2);width:116px;margin-left:12px"></a>';this.sidebar_node.appendChild(E)},gmiDestructor:function(){this.selector.unhook();delete this.selector;GMI._delete(GMI.query(this.sidebar_node,"GroupEdit_AppMenuItem"));if(this.sidebar_node.parentNode){this.sidebar_node.parentNode.removeChild(this.sidebar_node)}},opsAfterWake:function(A){this.gmi_args.ops_proxy.clearSidebar().appendChild(this.sidebar_node);if(A!==true){this.selection(this.selector.getSelection())}},opsNeedsReload:function(){return this.hot},FORCED_ORDER:["frontroom","members","gallery","faves","blog","backroom"],getPosition:function(B){var D,A,C,E;for(D=0;D!=this.FORCED_ORDER.length;D++){if(this.FORCED_ORDER[D]==B){break}}C=GMI.query(this.sidebar_node,"GroupEdit_AppMenuItem");while(--D>=0){for(A=D;A&&C[A];A--){E=C[A].gmi_node;if((E.getAttribute("gpage_name")||E.getAttribute("g-pagetypename"))==this.FORCED_ORDER[D]){return{position:A+2,node:C[A+1].gmi_node}}}}return{position:C.length,node:C[C.length-1]}},selection:function(E,D,C){var F,B;E=E[0];if(!E){this.gmi_node.style.padding="26px 32px";this.gmi_node.innerHTML='<img src="http://st.deviantart.com/minish/topsecret/appspiel.png"/>';if(!C&&this.gmi_args.ops_proxy){this.gmi_args.ops_proxy.activateProcess(this.gmi_args.ops_pid)}return }F=Number(E.getAttribute("gpage_id")||E.getAttribute("rel"));B=E.getAttribute("gpage_name")||E.getAttribute("g-pagetypename");if(!F){return console.log("??? "+E)}var A={gallery:true,faves:true};if(B in A){this.gmi_node.style.backgroundColor="transparent";this.gmi_node.innerHTML='<div><h3 style="color:#778880;margin:100px">Options for this App Coming Soon!</h3></div>';if(!C&&this.gmi_args.ops_proxy){this.gmi_args.ops_proxy.activateProcess(this.gmi_args.ops_pid)}return }this.gmi_node.innerHTML="";if(this.gmi_args.ops_proxy){this.gmi_args.ops_proxy.activateProcess("appmain:"+F,this.gmi_args.ops_pid,"GroupEdit_AppEditor",{page_id:F,page_name:B},E)}this.hot=true},extractAppLinks:function(){var A;A=document.getElementById("pagemenu")||(this.gmi_args.gruser_proxy||GMI.query("Gruser")[0]).gmi_node.getElementsByTagName("table")[0];return A.getElementsByTagName("a")},menu:function(F,E){if(!DiFi.stdErrCallback.apply(DiFi,E)){return }var A,F,C,D,G,I,H,B;I=E[1].response.content;F.className+=" active";Popup.completeAll();A=Popup.create({className:"cruiser",no_shadow:true,callback:bind(this,this.menuDone,F)});A.node.setAttribute("gmi-redirect",this.gmi_node.getAttribute("gmindex"));D=[];B=GMI.query(this.sidebar_node,"GroupEdit_AppMenuItem");if(!(I instanceof Array)){for(C in I){G=I[C];for(H=0;H!=B.length;H++){if(G.name==B[H].page_name){H=-1;break}}if(G.installable&&H>=0){D.push('<a class="f" style="display:block;position:relative;padding-left:28px" href="" onclick="return GMI.up(this).addClick(\''+G.name+'\', this)"><i class="icon '+G.iconclass+'" style="position:absolute;left:3px;top:0"></i> '+G.title+"</a>")}}}if(!D.length){D.push('<div class="blockdisabled">No More Apps Available</div>')}else{D.unshift('<div class="blockdisabled">Add an App:</div>')}A.node.innerHTML=('<div class="blockmenu iconset-gruser">'+D.join("")+"</div>");A.node.style.width="190px";A.node.style.height=((D.length*24)+6)+"px";document.body.scrollTop=document.documentElement.scrollTop=0;Popup.show(A,Ruler.screen.node(F,false));if(window.event){event.cancelBubble=true}return false},addClick:function(A,B){var D;if(window.event){event.cancelBubble=true}if(this.busy){return false}this.busy=true;B.style.cursor="wait";var C=B.firstChild.nodeValue;B.innerHTML="<strong>Adding App...</strong>";Station.apply(B,"opacity",0.5);D=this.getPosition(A);DiFi.pushPost("GrusersPages","addPage",[this.gmi_args.gruser_id,A,D.position],bind(this,this.difiDone,D.node,B));DiFi.timer(1);return false},difiDone:function(B,C,F,D){var A,G,E;this.busy=false;if(!F){Popup.completeAll();return DiFi.stdErr(null,D)}E=D.response.content.page||{};if(!this.gmi_args.ops_proxy){C.innerHTML="Loading App...";window.location.href=E.path}Popup.completeAll();G=document.createElement("a");G.setAttribute("href","");G.setAttribute("gpage_name",E.name);G.setAttribute("gpage_id",E.pageid||0);G.innerHTML='<i class="icon '+E.iconclass+'"></i> '+E.title;A=GMI.apply(G,"GroupEdit_AppMenuItem",{gruser_id:this.gmi_args.gruser_id,link:G,selector:this.selector});Station.run(A.gmi_node,"opacity",{from:0.01,to:1,time:600,f:Interpolators.sineCurve});this.sidebar_node.insertBefore(A.gmi_node,B);this.selector.setSelection(A.gmi_node)},menuDone:function(B,A){B.className=B.className.replace(/\bactive\b/g,"");delete A},opsOfferSave:function(A){}});if(window.DWait){DWait.run("jms/pages/gruzecontrol/groupedit/apps_main.js")}});DWait.ready(["jms/pages/gruzecontrol/widgets/arranger.js"],function(){if(window.ModuleArranger){ModuleArranger.generateMapFromLayout=function(I,G,C){var N,E,F,D,H,L,A,K,B;if(N=(deviantART.pageData||{}).group_ad_type){switch(N){case"square":G.right_square_ad=1;break;case"tower_left":G.left_tower_ad=1;break;case"tower_right":G.right_tower_ad=1;break}}B=GMI.query("Gruser")[0];K=document.getElementById("super-secret-automap");F=[];F.push('<div class="mam-ch ch">');F.push('<i class="tl c mmch"><i></i><b></b></i><i class="tr c mmch"><i></i><b></b></i>');F.push('<div class="mam-ch-ctrl ch-ctrl">');F.push('<div class="mam-header" style="height:21px;_height:35;padding:6px 12px;border-bottom:1px solid #9EB1A2;background:#C1D1BC;border-top:1px solid #D8E2D6;position:relative;overflow:hidden;_margin-right:-4"><h3 style="float:left">#'+B.gmi_args.name+(C?'&nbsp; <span style="color:#4E6152">'+C+" Layout</span>":"")+"</h3>");if(Number(G.tabs)){F.push('<div class="warr-widget-filler" style="float:left;position:relative;top:-12px;width:200px;margin-bottom:-30px">Navigation</div>')}F.push("</div>");if(document.getElementById("pagemenu")){G.left_nav=true}if(!K){H=[];if(G.left_nav){if(!G.left_sidebar_widgets&&(B.gmi_args["super"])){H.push('<div class="warr-widget-filler">Navigation</div>')}}if(G.left_tower_ad&&!B.gmi_args["super"]){H.push('<div class="warr-widget-filler" style="height:56px;_height:64">Advertisement</div>')}if((G.left_sidebar_widgets)&&(B.gmi_args["super"]||(I.gmi_args.name in {faves:1,gallery:1}))){H.push("<div class=pp>");H.push("<div contains-zone=sidebar1></div>");if(!G.right_sidebar_widgets){H.push("<div contains-zone=sidebar2></div>")}H.push('<div class="recommend-link hh"><span style="font-size:8.25pt;color:#6E8172">Add More:</span><br/><a style="font-size:8.25pt" class=hax href="" onclick="GMI.up(this, \''+("Mutant_AppEditor")+"').mc.filterOn('sidebar1', this);return GMI.evCancel()\">Recommend Widgets</a></div>");H.push("</div>")}L=[];zone_buffer_html=[];D=G.zones||(["top_left","mid_left","bottom_left"].concat(G.left_sidebar_widgets||G.right_sidebar_widgets?[]:["sidebar1","sidebar2"]).concat(["split","top_right","ad_zone","mid_right","bottom_right"]));if(G.wide_middle){L.push("<div class=hh><div class=pp>")}else{L.push("<div class=hh><div class=ll><div class=pp>")}function M(){if(zone_buffer_html.length){L.push('<div class="warr-widget-filler" style="height:auto;overflow:visible;min-height:22px;_height:28;padding-right:8px">');L.push.apply(L,zone_buffer_html);L.push("</div>");zone_buffer_html=[]}}var O,J='<div class="hh recommend-link"><span style="font-size:8.25pt;color:#6E8172">Add More:</span><br/><a style="font-size:8.25pt" class=hax href="" onclick="GMI.up(this, \''+("Mutant_AppEditor")+"').mc.filterOn('mid_right', this);return GMI.evCancel()\">Recommend Widgets</a></div>";for(E=0;D[E];E++){if(D[E]!="split"){if(D[E] in (I.gmi_args.linked_zones||{})){zone_buffer_html.push("<div contains-zone="+D[E]+"></div>");O=true;continue}if(D[E] in (I.gmi_args.sticky_zones||{})){L.push('<div style="position:static;margin:0" class="gzone-label">Sticky Widgets:</div><div class="warr-widget-filler" style="height:auto;overflow:visible;min-height:22px;_height:28;padding-right:8px">');L.push.apply(L,zone_buffer_html);zone_buffer_html=[];L.push("<div contains-zone="+D[E]+"></div>");L.push("</div>");continue}if(D[E]!="ad_zone"){M()}L.push("<div contains-zone="+D[E]+"></div>")}else{if(!G.left_sidebar_widgets&&!G.right_sidebar_widgets&&B.gmi_args["super"]){L.push("<div contains-zone=sidebar1></div>");L.push("<div contains-zone=sidebar2></div>")}if(I.gmi_args.name in {members:1,blog:1}){L.push("</div></div><div class=rr><div class=pp>")}else{if(!G.wide_middle){if(O){O=false}else{L.push(J);J=""}L.push("</div></div><div class=rr><div class=pp>");if(G.right_square_ad){L.push('<div class="warr-widget-filler">Advertisement</div>')}}}continue}}M();L.push(J);J="";if(G.wide_middle){L.push("</div></div>")}else{L.push("</div></div></div>")}A=[];if(G.right_tower_ad){A.push('<div class="warr-widget-filler" style="height:56px;_height:64">Advertisement</div>')}if(G.right_sidebar_widgets&&B.gmi_args["super"]){A.push("<div class=pp>");if(!G.left_sidebar_widgets){A.push("<div contains-zone=sidebar1></div>")}A.push("<div contains-zone=sidebar2></div>");A.push('<div class="recommend-link hh"><span style="font-size:8.25pt;color:#6E8172">Add More:</span><br/><a style="font-size:8.25pt" class=hax href="" onclick="GMI.up(this, \''+("Mutant_AppEditor")+"').mc.filterOn('sidebar2', this);return GMI.evCancel()\">Recommend Widgets</a></div>");A.push("</div>")}if(D=G.right_sidebar_zones){A.push("<div class=pp>");for(E=0;E!=D.length;E++){if(D[E] in (I.gmi_args.linked_zones||{})){zone_buffer_html.push("<div contains-zone="+D[E]+"></div>");O=true;continue}if(D[E] in (I.gmi_args.sticky_zones||{})){A.push('<div style="position:static;margin:0" class="gzone-label">Sticky Widgets:</div><div class="warr-widget-filler" style="height:auto;overflow:visible;min-height:22px;_height:28;padding-right:8px">');A.push.apply(A,zone_buffer_html);zone_buffer_html=[];A.push("<div contains-zone="+D[E]+"></div>");A.push("</div>");continue}if(D[E]!="ad_zone"){M()}A.push("<div contains-zone="+D[E]+"></div>")}M();A.push("</div>")}}F.push('<table style="height:200px" class="gruze f full"><tr>');if(K){F.push(K.innerHTML)}else{if(H.length){F.push('<td class="f gruze-sidebar" style="width:150px">'+H.join(""))}F.push('<td class="f gruze-main"><div><mainmarker></mainmarker></div>'+L.join(""));if(A.length){F.push('<td class="f gruze-sidebar gruze-sidebar-end" style="width:150px">'+A.join(""))}}F.push("</table>");F.push("</div></div>");return F.join("")}}if(window.DWait){DWait.run("jms/pages/gruzecontrol/widgets/arranger_automap.js")}});DWait.ready(["jms/lib/bind.js","jms/lib/gmi.js","jms/lib/difi.js","jms/pages/gruzecontrol/widgets/arranger_automap.js"],function(){window.LayoutAutomapGuide=GMIBase.extend({gmiConstructor:function(){}});window.RoomLayoutChanger=GMIBase.extend({gmiConstructor:function(){this.gmi_node.className="layout-changer";this.arranger=this.gmi_args.arranger;this.fetchLayouts()},gmiDestructor:function(){this.unhook()},pages_with_layout:{frontroom:true},fetchLayouts:function(){var B,A="group";if(this.gmi_args.page_name in this.pages_with_layout){if(this.gmi_args.page_name!="frontroom"){A+="."+this.gmi_args.page_name}DiFi.pushPost("GrusersPages","fetchLayoutList",[this.gmi_args.gruser_id,A],bind(this,function(D,C){if(!D){this.gmi_node.innerHTML="Layout selection is unavailable";return }this.gmi_node.innerHTML=(C.response.content.html);gWebPage.update(C.response.content,null,this.gmi_node);this.layouts=deviantART.pageData.gruser_group_layouts;this.gmiCreate();this.hook();this.radioTimer();this.sync()}));DiFi.timer(1)}else{B=GMI.query("LayoutAutomapGuide");B=B[B.length-1];if(B){this.layouts=[B.gmi_args.layout]}else{B=Boolean(document.getElementById("pagemenu"));this.layouts=[{id:0,tabs:B,left_nav:!B}]}this.gmiCreate();this.hook();this.radioTimer();this.sync()}},BUTTON_LABELS:["Change Layout...","Hide..."],clickToggle:function(A){if(this.gmi_args.inline){return this.modal()}if(A.firstChild.nodeValue==this.BUTTON_LABELS[0]){A.firstChild.nodeValue=this.BUTTON_LABELS[1];A.nextSibling.style.display="block";this.scroll()}else{A.firstChild.nodeValue=this.BUTTON_LABELS[0];A.nextSibling.style.display="none"}},gmiCreate:function(){var D,C,I,H,G,A,E,K,J;D=[];if(this.gmi_args.minimized){D.push('<a href="" class="'+(this.gmi_args.inline?"gmbutton2c ":"gmbutton2d ")+'gmbutton2" style="width:180px" onclick="GMI.up(this).clickToggle(this);this.blur();return GMI.evCancel()">'+this.BUTTON_LABELS[0]+'<b></b></a><div style="display:none" class="layout-changer-block">')}if(this.gmi_args.page_name in this.pages_with_layout){if(typeof (this.arranger.gmi_args.page.gmi_args.layout_id)!="undefined"){G=Number(this.arranger.gmi_args.page.gmi_args.layout_id)||0}else{G=Number(this.gmi_args.gruser_proxy.gmi_args.layout)||0}}else{G=0}D.push('<div class="gzone-label">Choose Layout</div><div style="padding:16px 8px">');for(C=0;H=this.layouts[C];C++){K="";if(Number(H.priv)&&!this.gmi_args.gruser_proxy.gmi_args["super"]){E='<img src="http://st.deviantart.com/minish/gruzecontrol/padlock.gif" title="This layout selection will be available after a Super Group upgrade."/> ';J=true}else{E='<input style="vertical-align:top" '+(Number(H.id)==G?' checked="checked" ':"")+' type="radio" name="layout1" value="'+H.id+'"/>';if(Number(H.priv)){K='<span style="font:200% Brush Script MT;vertical-align:top;color:#6AAC01">*</span> '}}D.push('<label class="layout-label">'+E+'<span class="layout-label-img"><span class="layout-label-img2" style="background-position:2px '+(2-(100*[3,2,1,0][C]))+'px">');D.push("&nbsp;");var F=H.desc?"<br/>"+H.desc:"";D.push("</span></span> "+K+"<strong>"+H.label+"</strong> "+F+"</label>")}D.push("</div>");if(J){if($(".gup2sup").length){var B=$(".gup2sup")[0].href;D.push('<div style="color:#B43E64;text-indent:161px;margin-top:-12px;white-space:nowrap">&rarr; <a href="'+B+'" style="color:#B43E64">Upgrade to a Super Group Now</a> to get these great layouts!</div>')}}else{D.push('<div style="color:#67A031;text-indent:164px;margin-top:-16px;white-space:nowrap"><span style="font:180% Brush Script MT;vertical-align:top;color:#6AAC01">*</span> <strong>Super Group</strong> Layouts Available!</div>')}if(this.gmi_args.minimized){D.push("</div>")}A=document.createElement("div");A.className="layout-changer-core";A.innerHTML=D.join("");this.gmi_node.appendChild(A);this.core_node=this.gmi_node.getElementsByTagName("a")[0].nextSibling},scroll:function(){if(this.gmi_node.parentNode){this.gmi_node.parentNode.scrollTop=100000}},setArranger:function(A){this.arranger=A;if(this.layouts){this.sync()}},sync:function(){if(this.arranger){this.arranger.syncLayout(this.layouts[this.previously_selected_index]);if(this.gmi_args.minimized){this.scroll()}}},hook:function(){var B,A;setInterval(bind(this,this.radioTimer),100);this.findInputs()},findInputs:function(){this.inputs=[];inputs=this.core_node.getElementsByTagName("input");for(i=0;i!=inputs.length;i++){this.inputs[i]=inputs[i]}},unhook:function(){if(this.interval){clearInterval(this.interval)}},radioTimer:function(B){var A;for(A=0;A!=this.inputs.length;A++){if(this.inputs[A].checked){if(A!=this.previously_selected_index){this.previously_selected_index=A;if(B!==true){if(!this.gmi_args.inline){this.sync()}}}break}}},getSelectedLayoutValue:function(){this.findInputs();this.radioTimer(true);return this.inputs[this.previously_selected_index].value},offerSave:function(A){if(!(this.gmi_args.page_name in this.pages_with_layout)){return }DiFi.pushPost("GrusersPages","setPageLayout",[this.gmi_args.gruser_id,this.gmi_args.page_name,this.getSelectedLayoutValue()],A.pull());DiFi.timer(1)},saveAndReload:function(A){A.className+=" disabledbutton";A.style.cursor="wait";DiFi.pushPost("GrusersPages","setPageLayout",[this.gmi_args.gruser_id,this.gmi_args.page_name,this.getSelectedLayoutValue()],bind(this,this.saveDone));DiFi.timer(1)},saveDone:function(B,A){if(!B){Modals.pop();DiFi.stdErr("Unable to change layout at this time.",A.response.content)}else{window.location.reload()}},modal:function(){var A;A=document.createElement("div");A.setAttribute("gmi-redirect",this.gmi_node.getAttribute("gmindex"));A.style.padding="16px";A.style.background="#CCD9C8";A.innerHTML=('<h2>Choose a New Layout</h2><div></div><br><table align=center><tr><td class=f><div class="gmbutton2town"><a href="" onclick="GMI.up(this).saveAndReload(this);return GMI.evCancel();" class="gmbutton2 gmbutton2s">Save<b></b></a><a href="" onclick="Modals.pop();return GMI.evCancel();" class="gmbutton2 gmbutton2c">Cancel<b></b></a></div></table>');A.getElementsByTagName("div")[0].appendChild(this.core_node);Modals.lightfade=true;this.core_node.style.display="block";Modals.push(A)}});if(window.DWait){DWait.run("jms/pages/gruzecontrol/widgets/layout.js")}});DWait.ready(["jms/lib/gmi.js","jms/pages/gruzecontrol/gmframe_gruser.js"],function(){var A={gmframe:null,gmodule:null,gmiConstructor:function(){this.gmodule=GMI.up(this.gmi_node);this.gmframe=this.gmodule.gmframe},reinit:function(){this.gmodule=this.gmodule||GMI.up(this.gmi_node);this.gmframe=this.gmframe||GMI.up(this.gmi_node)},saveAndChangeView:function(){this.reinit();var B=this;var C={item_id:this.gmi_args.item_id};var D=function(F,E){B.saveCallback(F,E)};this.gmframe.justSave(D,this.gmi_node,C,"single")},popView:function(){var B="generic";this.reinit();this.gmframe.loadView(B,this.gmodule.gmi_args)},saveCallback:function(E,C){if(E){this.popView()}else{var B="save failed";try{B=C.response.content.error.human||C.response.content.error}catch(D){}alert(B)}}};window.GMultiModule_Item=GMIBase.extend(A);window.GMultiModule=GMIBase.extend({gmframe:null,edit_button_label:"Edit Item",edit_behavior:"edit_item",gmiConstructor:function(){this.gmframe=GMI.up(this.gmi_node);var C=$j(this.gmi_node);var B=this;setTimeout(function(){B.handleView(C,true)},1)},loadView:function(E,B,D,F){var C=this;this.gmframe.pretendView(true);this.gmframe.justLoadView(function(I,H){var G=H.response.content;G.view=G.view||B;C.handleView(E,I,G,F)},B,D)},handleView:function(G,K,E,B){this.gmframe.pretendView(false);var L=this;if(!K){alert("Failure loading.");return }var H=E&&E.view;if(E&&E.html){G.html(E.html)}switch(H){case"submit":$j(L.gmframe.gmi_node).find(".gm-chaos-multiedit").hide();L.hookupSubmit(G,E,B.gmi_args.submit_hookup_class);L.gmframe.importGWebPage(E);break;case"single":L.hookupSingle(G,E);if(L.gmframe.canBehave("edit")||(L.gmframe.canBehave(L.edit_behavior)&&L.canEditItem(G))){var F='<div class="gm-controls gm-chaos-multiedit"><b class="gm-chaos gm-chaos-edit gmbuttons"><a href="#" class="gmbutton2 gmbutton2chaos">Edit</a></b></div>';var J=$j(F);var D=J.prependTo(G).find("a");var I=GMI.up(D[0]);var C=function(N){Popup.completeAll();N.preventDefault();var M=I.gmi_args.item_id;L.loadView(G,"submit",{item_id:M},I)};D.click(function(M){M.preventDefault();L.gmframe.configClick(this,function(N){var O=$j(N).find(".blockmenu");O.find("a").css("font-weight","normal");$j('<a class="f" href="#" style="font-weight:bold">Edit this Member</a>').click(C).prependTo(O)})})}if(window.Keeper){Keeper.master_on()}break;case"generic":default:G.find(".GMulti-item").each(function(){L.handleView($j(this),true,{view:"single"})})}},hookupSubmit:function(E,D,B){try{E.find("select").selectpager()}catch(F){}var C='<table align="center" class="f"><tbody><tr><td style="padding: 0pt 8px;"><a onclick="GMI.up(this).saveAndChangeView();if (window.event)event.cancelBubble=true;try{this.blur()}catch(e){}return false;" class="gmbutton2 gmbutton2s" href="#">Save<b/></a></td><td style="padding: 0pt 8px;"><a onclick="GMI.up(this).popView();if (window.event)event.cancelBubble=true;try{this.blur()}catch(e){}return false;" class="gmbutton2 gmbutton2c" href="#">Cancel<b/></a></td></tr></tbody></table>';if(B==undefined){E.append(C)}else{E.find("."+B).addClass("gr-hijack").append(C)}},hookupSingle:function(C,B){},canEditItem:function(B){return true}});if(window.DWait){DWait.run("jms/pages/gruzecontrol/widgets/multiedit.js")}});DWait.ready(["jms/lib/gmi.js","jms/pages/gruzecontrol/widgets/gmegaframe.js"],function(){var A={gmiConstructor:function(){},edit:function(){if(this.editing){return }this.editing=true;var E=this.$node=this.$node||jQuery(this.gmi_node);var D=this.$editor=this.$editor||jQuery('<div class="gInPlace"></div>').css("margin","-2px");var F=this.$input=this.$input||jQuery('<input type="text"/>').appendTo(D);F.attr("name",this.gmi_args.name||"ginput");if(this.gmi_node.firstChild){this.hasChildren=true;this.cachedView=this.gmi_node.firstChild;var C=this.$val=jQuery(this.gmi_node).find("[rel=gmi-val]");var B=["font-size","font-weight"];jQuery.each(B,function(G,I){var H=C.css(I);if(H){F.css(I,H)}});F.width(this.gmi_args.width||C.width());this.orig=C.text();E.empty()}else{this.hasChildren=false;this.orig=E.text();E.text("")}F.val(this.orig);D.appendTo(E).show()},cancel:function(){if(!this.editing){return }if(this.hasChildren){this.$node.empty().append(this.cachedView);this.hasChildren=false}else{this.$node.text(this.orig)}this.$editor.hide().appendTo(this.$node);this.editing=false},toggle:function(){if(this.editing){this.cancel()}else{this.edit()}},syncVal:function(){if(!this.editing){return }if(this.hasChildren){this.$val.text(this.$input.val())}else{this.orig=this.$input.val()}},save:function(){}};window.GInPlace=GMIBase.extend(A);if(window.DWait){DWait.run("jms/pages/gruzecontrol/widgets/ginplace.js")}});DWait.ready(["jms/lib/gmi.js","jms/pages/gruzecontrol/gmframe_gruser.js"],function(){var A={previous_view:null,gmiConstructor:function(){this.base()},configClick:function(E,H){if(this.canBehave("button_editing")||E){return this.base(E,H)}Popup.completeAll();this.current_behavior.button_editing=true;this.previous_view="config";var G=GMI.query(this.gmi_node,"GMFrame_Gruser");for(var D=0;D<G.length;D++){var F=G[D];F.editInPlace(false);F.current_behavior.button_save_cancel=false;F.current_behavior["delete"]=true;var B=jQuery(F.gmi_node).find(".gr-body").get(0);F.addButtons(B,false);F.current_behavior["delete"]=false}this.addConfigStyle();var C=jQuery(this.gmi_node).find(".gr-bottom").show().get(0);if(!C.childNodes||C.childNodes.length<1){this.current_behavior.button_save_cancel=true;this.addButtons(C,true)}},addConfigStyle:function(){jQuery(this.gmi_node).addClass("gr-configbox").find(".gm-chaos-new").hide().end().find(".gm-controls").addClass("gm-controls-config")},removeConfigStyle:function(){jQuery(this.gmi_node).removeClass("gr-configbox").find(".gm-chaos-new").show().end().find(".gm-controls-config").removeClass("gm-controls-config")},popView:function(C){this.is_inplace_editing=false;this.current_behavior.button_editing=false;var D=jQuery(this.gmi_node);D.find(".gr-bottom").hide();var B=this;this.removeConfigStyle();if(!C){this.resetForms()}this.pretendView(false)},addView:function(H,D,C){D=D||"generic";C=C||1;this.pretendView(D);var I=this.gmiUp("GPage");var F=I.gmiUp("Gruser");var G=jQuery(this.gmi_node).find(".view_insertion_point");var E=this;var B=this.gmi_args.page_id||I.gmi_args.id;DiFi.pushPost(this.api,"addAndCommitModule",[F.gmi_args.id,B,H,"mid_left",C,D,true],function(K,J){if(K){jQuery(J.response.content.html).insertAfter(G);E.pretendView(null);E.addConfigStyle();setTimeout(function(){var N=GMI.query(E.gmi_node,"GMFrame_Gruser");var M=N[0];var L=jQuery(M.gmi_node).find(".gr-body .gr")[0];M.resetForms=E.resetForms;M.editInPlace(true);M.cancelView=function(){this.toast(true);E.popView()};M.saved_impl=M.saved;M.saved=function(O,Q,P){this.saved_impl(O,Q,P);E.popView(true)};M.current_behavior.button_save_cancel=true;M.addButtons(L,false)},100)}});DiFi.timer(1)},addViewPreview:function(E,B){B=B||"generic";var F=this.gmiUp("GPage");var C=F.gmiUp("Gruser");var D=jQuery(this.gmi_node).find(".view_insertion_point");DiFi.pushPost(this.api,"addPreviewModule",[C.gmi_args.id,F.gmi_args.id,E],function(H,G){if(H){jQuery(G.response.content.html).insertAfter(D)}});DiFi.timer(1)},cloneView:function(H){var B=this;this.pretendView(H);var E=GMI.query(this.gmi_node,"GMFrame_Gruser");var D=E[0];var G=jQuery(D.gmi_node).clone();G.removeAttr("gmindex");G.insertBefore(D.gmi_node).hide();var C=G.get(0);var F=GMI.getOne(C);F.isConfigView=function(I){return(I=="submit"||I=="edit")};F.popView=function(){try{this.gmiDestructor()}catch(I){}jQuery(this.gmi_node).slideUp("fast",function(){jQuery(this).remove()})};F.justLoadView(function(K,J){if(K){F.displayCachedBody(J.request.args[2],J.response.content.html||"<div>Something went wrong</div>",J.response.content.frame_behavior||"");G.slideDown("fast");B.importGWebPage(J.response.content)}else{alert("Failed to load submission form.");try{console.log(J)}catch(I){}}B.pretendView(null)},H,[])},resetForms:function(){jQuery.each(GMI.query(this.gmi_node,"GInPlace"),function(){this.cancel()});jQuery(this.gmi_node).find("a[disabled]").removeAttr("disabled").end().find(".gr-hijack").remove()},saveAndChangeView:function(){this.pretendView(true);this.current_behavior.button_editing=false;this.is_inplace_editing=false;jQuery(this.gmi_node).find(".gr-hijack").remove();var C=GMI.query(this.gmi_node,"GMFrame_Gruser");for(var B=0;B<C.length;B++){C[B].current_behavior["delete"]=false;C[B].is_inplace_editing=false;C[B].saveAndChangeView(false,"index")}this.popView(true)}};window.GMegaFrame=GMFrame_Gruser.extend(A);window.GMFrame_Imposter=GMFrame_Gruser.extend({});if(window.DWait){DWait.run("jms/pages/gruzecontrol/widgets/gmegaframe.js")}});DWait.ready(["jms/pages/gruzecontrol/widgets/multiedit.js"],function(){window.GAboutUsModule=window.GMultiModule.extend({canEditItem:function(A){try{return window.deviantART.deviant.id==A.attr("gmi-item_id")}catch(B){}return false},adminSearchPopupClick:function(A){jQuery("#aboutus-filter #aboutus-member-search").val("");jQuery("#aboutus-filter ul.filter-list li.filter").removeClass("selected");this.gmframe.loadView("generic",{userids:A},true)},clearResults:function(){jQuery("div.aboutus-clear-results").remove();jQuery("#aboutus-filter #aboutus-member-search").val("");jQuery("#aboutus-filter ul.filter-list li.filter").removeClass("selected");jQuery("#aboutus-filter ul.filter-list li.filter#0").addClass("selected");this.gmframe.loadView("generic",{},true)}});window.GAboutUsModule_Item=window.GMultiModule_Item.extend({saveAndChangeView:function(){jQuery("#aboutus-filter ul.filter-list li.filter").removeClass("selected");jQuery("#aboutus-filter ul.filter-list li.filter#0").addClass("selected");this.reinit();var A=this;var B={item_id:this.gmi_args.item_id};var C=function(E,D){A.saveCallback(E,D)};this.gmframe.justSave(C,this.gmi_node,B,"single")},popView:function(){jQuery(this.gmframe.gmi_node).children(".gm-controls").show();jQuery("#aboutus-filter ul.filter-list li.filter").removeClass("selected");jQuery("#aboutus-filter ul.filter-list li.filter#0").addClass("selected");var A=this.gmframe.gmi_args.view;this.reinit();this.gmframe.loadView(A,this.gmodule.gmi_args)}});if(window.DWait){DWait.run("jms/pages/gruzecontrol/widgets/module_aboutus.js")}});DWait.ready(["jms/legacy/modals.js","jms/lib/difi.js","jms/lib/gmi.js","jms/lib/gwebpage.js","jms/lib/deviation_picker.js"],function(){window.SkinPickerButton=(function(A){var B={gmiConstructor:function(){var F=this.frame=GMI.up(this.gmi_node,"GMFrame_Gruser");var C=this.$form=A(F.gmi_node);var E=A(this.gmi_node).find(".skinPickerButton");var D=this.picker=new SkinPicker(E,this.gmi_args);this.picker.skinLoaded=function(G){C.find('textarea[name="header"]').val(G.head);C.find('textarea[name="css"]').val(G.css);C.find('textarea[name="footer"]').val(G.foot);C.find('input[name="skinid"]').val(G.itemid)};E.click(function(G){G.preventDefault();D.show(this);return false})}};return GMIBase.extend(B)})(jQuery);window.SkinPicker=(function(A){var B={gmiConstructor:function(){this.skinClass=this.gmi_args.skinClass||this.skinClass;this.username=this.gmi_args.username||deviantART.deviant.username;this.userid=this.gmi_args.userid||deviantART.deviant.id;this.can_edit=this.gmi_args.can_edit||false;this.gruser_page=this.gmi_args.page||"blog";if(this.gmi_args.initSkin){alert("initskin not yet supported")}else{this.skin={};for(var C in this.defaultSkin){this.skin[C]=this.defaultSkin[C]}}this.skin.label=this.gmi_args.skin_label||this.skin.label;this.skin.itemid=this.gmi_args.skinid||this.skin.itemid},defaultSkin:{label:"Deviant Green (default)",modified:false,itemid:0},modalShowing:false,skinEditorLoaded:false,can_edit:false,editorDirty:false,closeAfterSave:false,skinClass:"journal",constructor:function(G,D){this.gmi_args=D;this.gmiConstructor();var C=this;this.$button=G?G:A(A(".skinPickerButton")[0]);if(window.event){window.event.cancelBubble=true}var F="installedby:"+this.username+"/"+this.skinClass;var E={title:"<b>Choose a Skin</b>",search:false,pager:false,resource_label:"skins",nav_extra:this.make_buttons(),onselect:function(H){C.hide_buttons();C.selectedElement=C.selection[H];if(this.can_edit){C.buttons["new"].show()}if(H=="33:1"){return }C.show_edit_buttons()},onunselect:function(H){C.hide_buttons()},onclose:function(H){C.modalShowing=false}};this.base(F,C.skinSelected,E)},show:function(){this.hide_button("save");this.hide_button("saveas");if(this.can_edit){this.show_button("new")}this.modalShowing=true;this.base()},close:function(C){if(C=="cancel"&&this.editorDirty){if(!confirm("Close without saving?")){return false}}return this.base(C)},_build_html:function(){this.base();this.gmi_node=this.$container[0];this.$container.attr({name:"gmi-SkinPicker",id:"gmi-SkinPicker"});var C=(++GMIBase.current_lookup);this.$container.attr("gmindex",C);GMIBase.index[C]=this},skinSelected:function(G,D){if(this.editorDirty){var F=confirm("This skin has unsaved changes, do you want to save?");if(!F){return false}else{this.closeAfterSave=true;this.saveSkin();return false}}var C=this;var H=G[0];if(H&&H[0]==33&&H[1]==1){return C.resetSkin()}var E=(H&&H[1])?H[1]:0;$j(".modal .deepee-box .action-buttons a").css({cursor:"wait"});DiFi.pushPost("CSS","loadskin",[C.userid,C.skinClass,E],function(J,I){Modals.close(C._modal);if(J){C.skin=I.response.content;C.skinLoaded(C.skin);C.skinLabelChanged(C.skin.label)}else{C.difiFail(I)}});DiFi.send();return false},getSelection:function(){try{for(var C in this.selection){return{id:C,deviationid:C.split(":")[1],node:this.selection[C][0]}}}catch(D){}return{}},editSkin:function(I){if(!this.can_edit){return }if(!this.modalShowing){this.show()}var D=this;var H=this.getSelection();var E=H.id||0;I=I||"Edit Skin";this.set_title("<b>"+I+"</b>");this.hide_buttons("all");this.buttons.back.show();this.custom(D.skinEditorLoaded?"":'<div id="SkinEditorTab"></div>');$j("#SkinEditorTab").html('<div style="padding:10px" class="loading"></div>');var G="config";var F={skinid:E,page:this.gruser_page};var C=function(L,K){if(!L){$j("#SkinEditorTab .loading").html("Failed to load skin editor:<br />"+K.response.content);return }var J=$j("#SkinEditorTab").html(K.response.content.html);GMI.query(J[0],"GMFrame_Gruser");D.skinEditorLoaded=true;D.show_button("save");D.show_button("saveas");D.hide_button("browse");D.show_button("back");gWebPage.update(K.response.content,null,J[0])};DiFi.pushPrivateGet("GrusersModules","findAndDisplayModule",[D.userid,"backroom","skin_manager",G,F],C);DiFi.timer(1);return false},cancelEdit:function(){this.set_title(this.options.title);this.buttons.browse.show();this.buttons.back.hide();this.buttons.save.hide();if(this.can_edit){this.buttons["new"].show()}this.$container.find("div.deepee-custom").hide();this.$container.find("div.deepee-searchbody").show();this.hide_edit_buttons()},saveSkinAs:function(){if(!this.can_edit){return }if(window.event){window.event.cancelBubble=true}var C=this.skin.label;if(C=="Unsaved Skin"){C="Untitled"}C=prompt("Enter a new name",C);if(C){return this.saveSkin(C,true)}return false},saveSkin:function(E,C){if(!this.can_edit){return }if(window.event){window.event.cancelBubble=true}var H=this.skin;if(E=="Unsaved Skin"){return this.saveSkinAs()}if(E){var G={};for(var F in H){G[F]=H[F]}G.label=E;if(!G.itemid||C){G.itemid=-1}H=G}else{if(H.label=="Unsaved Skin"||!H.label||H.label==this.defaultSkin.label){H.label=prompt("Please name your skin","Untitled")}}if(!H.label){return false}var D=this;H.head=$j('#SkinEditorTab textarea[name="header"]').val();H.css=$j('#SkinEditorTab textarea[name="css"]').val();H.foot=$j('#SkinEditorTab textarea[name="footer"]').val();DiFi.pushPost("CSS","saveskin",[this.userid,"journal",this.gruser_page,H],function(L,K){if(L){var J=K.response.content;if(J&&J.label){D.skin=J;D.skinLoaded(D.skin);D.skinLabelChanged(J.label);D.show_button("save");D.setDirty(false)}var I=$j('<div><div style="padding:20px">Skin Saved Successfully.</div></div>');Modals.push.call({},I.get(0),function(){if(D.closeAfterSaving){D.closeAfterSaving=false;D.$container.find(".dialog-ok").click()}})}else{alert(K.response.content.error)}});DiFi.send();return false},deleteSkin:function(){if(!this.can_edit){return }if(!confirm("Are you sure you want to delete this skin?")){return false}var C=this;var D=this.getSelection();if(!D.deviationid){return false}DiFi.pushPost("CSS","deleteskin",[this.userid,this.gruser_page,D.deviationid],function(F,E){if(F){$j(D.node).hide();C.selection={}}else{alert(E.response.content.error)}});DiFi.send();return false},newSkin:function(){this.resetSkin();this.selection={};this.editSkin("Unsaved Skin");this.hide_button("saveas")},resetSkin:function(){this.skin=this.defaultSkin;this.skin.itemid=0;this.skin.head="";this.skin.foot="";this.skin.css="";this.skin.modified=false;this.skinLabelChanged(this.defaultSkin.label);this.skinLoaded(this.skin)},renameSkin:function(){var G=this.getSelection();if(!G.deviationid){return false}var D=this;var H=$j(G.node);H.attr("block_deselect",1);var F=H.find("a.t");var E=F.html();F.html("");var C=$j("<input type='text' style='_border-width: 0px; font: 11px verdana;' />").val(E).appendTo(F).focus().keypress(function(J){if(J.which!=13){return }var I=C.val();F.html("Renaming...");H.removeAttr("block_deselect");DiFi.pushPost("CSS","renameskin",[D.userid,D.skinClass,D.gruser_page,G.deviationid,I],function(L,K){if(L){F.html(I)}else{alert(K.response.content.error)}});DiFi.send()}).blur(function(){H.removeAttr("block_deselect");F.html(E)});return false},setDirty:function(C){this.editorDirty=C;if(C){this.show_button("save")}else{this.hide_button("save");this.hide_button("saveas")}return this.editorDirty},skinLabelChanged:function(C){this.$button.find(".gmbutton2RevealOne").html("<em>*</em> <span>"+C+"</span>").css("fontSize",C.length>25?"11px":"1em");$j('input[name="skinlabel"]').val(C)},skinLoaded:function(C){},difiFail:function(D){alert(D.response.content.error);try{console.log("difi error response",D)}catch(C){}},make_buttons:function(){if(this.$buttons){return this.$buttons}var C=this;C.buttons={};var D=C.$buttons=$j('<div class="skinPickerButtons iconset-skin-picker gmbutton2town"></div>');C.buttons.browse=$j('<a class="gmbutton2" target="_blank" href="http://browse.deviantart.com/darelated/deviantartskin/#order=5"><i class="icon i1"></i> Browse for More Skins...<b></b></a>').appendTo(D);C.buttons.back=$j('<a class="gmbutton2" href="#" style="display: none">&#171; Back<b></b></a>').click(function(E){C.cancelEdit();E.preventDefault()}).appendTo(D);C.buttons["new"]=$j('<a class="gmbutton2" href="#" style="display: none"><i class="icon i3"></i> New Skin<b></b></a>').click(function(E){C.newSkin();E.preventDefault()}).appendTo(D);C.buttons.edit=$j('<a class="gmbutton2" href="#" style="display: none"><i class="icon i4"></i> Edit Skin<b></b></a>').click(function(E){C.editSkin();E.preventDefault()}).appendTo(D);C.buttons.save=$j('<a class="gmbutton2" href="#" style="display: none"><i class="icon i5"></i> Save Skin<b></b></a>').click(function(E){C.saveSkin(C.skin.label);E.preventDefault()}).appendTo(D);C.buttons.saveas=$j('<a class="gmbutton2" href="#" style="display: none"><i class="icon i5"></i> Save As<b></b></a>').click(function(E){C.saveSkin("Unsaved Skin");E.preventDefault()}).appendTo(D);C.buttons.rename=$j('<a class="gmbutton2" href="#" style="display: none"><i class="icon i6"></i> Rename Skin<b></b></a>').click(function(E){C.renameSkin();E.preventDefault()}).appendTo(D);C.buttons["delete"]=$j('<a class="gmbutton2" href="#" style="display: none"><i class="icon i7"></i> Delete Skin<b></b></a>').click(function(E){C.deleteSkin();E.preventDefault()}).appendTo(D);C.hide_buttons();return D},hide_buttons:function(C){$j.each(this.buttons,function(){this.hide()});if(C!="all"){this.buttons.browse.show()}},show_button:function(C){if(!this.buttons[C]){return }this.buttons[C].show()},show_edit_buttons:function(){if(!this.can_edit){return }this.buttons["new"].show();this.buttons["delete"].show();this.buttons.edit.show();this.buttons.rename.show()},hide_edit_buttons:function(){this.buttons["delete"].hide();this.buttons.edit.hide();this.buttons.rename.hide()},hide_button:function(C){if(!this.buttons[C]){return }this.buttons[C].hide()}};if(window.DeviationPicker){return DeviationPicker.extend(B)}})(jQuery);window.InitSkinPicker=function(A,C){var D=A.find(".skinPickerButton")[0];var B=new SkinPicker(D,C);B.skinLoaded=function(E){A.find('textarea[name="header"]').val(E.head);A.find('textarea[name="css"]').val(E.css);A.find('textarea[name="footer"]').val(E.foot);A.find('input[name="skinid"]').val(E.itemid)};A.find(".skinPickerButton").click(function(E){E.preventDefault();B.show(this);return false}).click()};if(window.DWait){DWait.run("jms/lib/skinpicker2.js")}});DWait.ready(["jms/lib/gmi.js","jms/pages/gruzecontrol/gpage.js","jms/pages/gruzecontrol/widgets/utils.js","jms/lib/popup.js","jms/pages/gallery/arrowmenu.js"],function(){var A={gmiConstructor:function(){this.gruser=this.gmiUp("Gruser")},menu:function(D,C){var B;if(!(B=this["cached_edit_"+C])){B=this["cached_edit_"+C]=Popup.create({className:"cruiser",bias:"right",no_shadow:true});B.node.setAttribute("gmi-redirect",this.gmi_node.getAttribute("gmindex"));$j("#button_menu_"+C).clone().addClass("blockmenu").appendTo(B.node).show()}D.className+=" active";B.options.callback=bind(this,this.menuDone,D);Popup.show(B,Ruler.screen.node(D));return },menuDone:function(B){B.className=B.className.replace(/\bactive\b/,"")}};window.AdminArea=GMIBase.extend(A);if(window.DWait){DWait.run("jms/pages/gruzecontrol/adminarea.js")}});DWait.count();