/*
 *  (c) 2000-2013 deviantART, Inc. All rights reserved.
 */
window.Gruser=GMIBase.extend({}),window.GMFrame_BluesBar||(window.GMFrame_BluesBar=GMIBase.extend({})),window.DWait&&DWait.run("jms/pages/gruzecontrol/gruser.js");
DWait.ready(["jms/lib/gmi.js","jms/lib/browser.js","jms/lib/popup2.js","jms/lib/station.js"],function(){window.GPage||(window.GPage=GMIBase.extend({gmiConstructor:function(){}})),window.BluesBar={hiddenMenu:function(e,t,i,s){if($(".popup2-gruser").length)return Popup2.hideAll(),!1;var n,a,r,o,u,l;if(window.event&&(event.cancelBubble=!0),this.menu_on||!t&&this.treshold&&this.treshold>(new Date).valueOf())return!1;if(this.ieFix(e),this.gmi_called||(this.gmi_called=!0,DWait.ready(["jms/lib/gmi.js","jms/pages/gruzecontrol/gmframe_bluesbar.js"],bind(this,this.frameReady))),a=e.getAttribute("href").split("#").pop(),l=a.split("-").pop(),"give"!=l&&(e.className+=" active"),this.menu_on=e,n=new Popup2("BluesBar","body",{classes:"gruser-"+l+" popup2-gruser popup2-bluesbar",content:$("#"+a).clone(!0).show(),destroy:!0,created:function(){(e.offsetWidth>257||i)&&this.$node.css("width",$(e).width()+13+"px")},hidden:this.hiddenMenuDone.bindTo(this)}),l in{stats:1,stats2:1,activity:1}&&(n.render(),this.verify(l,n.$node.first().get(0),e)),r=n.position($(e)),u=n.position($(e).parent().parent()),o=u.bottom-r.bottom-2,o>10||l in{give:1,stats2:1}||Glbl("Site.is_mobile")||this.zNodes(e,120),l in{stats:1,stats2:1}&&!GMI.query("GMFrame_BluesBar")[0]&&(r.left=190,r.right=191),"buttons"==l&&(r.left-=192,r.right-=192),n.show(r),s)try{s(n)}catch(d){}return this.callFrame(n),!1},verify:function(e,t,i){var s,n,a;if(s=(t.getElementsByTagName("difi")||[])[0]){if(!this[e+"_node"]){switch(e in{stats:1,stats2:1}?(n=document.createElement("span"),n.className="bars"):(n=document.createElement("div"),n.className="ploading",n.style.paddingTop="16px",n.innerHTML="Loading..."),this[e+"_node"]=n,a=(n=GMI.query("GMFrame_BluesBar")[0])?n.gmi_args.id:GMI.up(i,"GMFrame_Gruser").gmi_args.id,e){case"activity":DiFi.pushPrivateGet("GrusersUserpageinfoModule","getActivityDetails",[GMI.query("Gruser")[0].gmi_args.id,a],bind(this,this.difiReady,e));break;case"stats":case"stats2":DiFi.pushPrivateGet("GrusersModules","displayModule",[GMI.query("Gruser")[0].gmi_args.id,a,"stats_pageviews",{}],bind(this,this.difiReady,e));break;default:throw Error("?? "+e)}DiFi.timer(1)}s.parentNode.replaceChild(this[e+"_node"],s)}},difiReady:function(e,t,i){"activity"==e&&(this[e+"_node"].className=""),this[e+"_node"].innerHTML=t?i.response.content.html:"[error: "+i.response.content+"]",e in{stats:1,stats2:1}&&this.animateGraph(this[e+"_node"])},animateGraph:function(e){var t;for(t=e.getElementsByTagName("span"),i=0;i!=t.length;i++)"bar"==t[i].className&&(23>i?Station.push(t[i],"top",{from:44,to:44,time:25*(t.length-i)},{from:44,to:0,time:150,f:Interpolators.pulse}):t[i].setAttribute("style","display:hidden"))},hiddenMenuMouse:function(e){if(Glbl("Site.is_mobile"))return!1;var t;BluesBar.mouseover_timer&&(clearTimeout(BluesBar.mouseover_timer),BluesBar.mouseover_timer=null),t=(e.getElementsByTagName("span")||[])[0],this.ieFix(e),!this.menu_on&&t&&"bluestip"==t.className&&t!=BluesBar.last_mouseover&&(BluesBar.last_mouseover=t,Station.run(t,"opacity",{from:0,to:1,time:155,f:Interpolators.sineCurve}),e.onmouseout=this.hiddenMenuOut),this.menu_on&&this.menu_on!=e&&(Popup2.hideAll(),this.hiddenMenu(e,!0))},hiddenMenuClick:function(e){return(window.event||{}).cancelBubble=!0,Glbl("Site.is_mobile")&&this.hiddenMenu(e),!1},ieFix:function(e){var t;Browser.isIE&&(t=(e.getElementsByTagName("span")||[])[0],t&&!t.style.width&&(t.style.width=t.parentNode.offsetWidth+"px"))},hiddenMenuOut:function(){BluesBar.mouseover_timer=setTimeout("BluesBar.last_mouseover = null",10)},hiddenMenuDone:function(){this.menu_on.className=this.menu_on.className.replace(/\s*active\b/g,""),this.zNodes(this.menu_on,20),this.treshold=(new Date).valueOf()+200,this.menu_on=!1,this.callFrame(null)},zNodes:function(e,t){var s,n,a;if(!Browser.isIE)for(GMI.up(e,"GPage")?s=[e.parentNode.parentNode]:(n=GMI.up(e,"Gruser").gmi_node,s=[n.getElementsByTagName("div")[1]],s.push((document.getElementById("top")||document.getElementById("overhead")).lastChild),a=GMI.query(n,"GPage")[0],a.findBluesBar&&s.push(a.findBluesBar("gmbutton2admin"))),i=0;i!=s.length;i++)s[i]&&1==s[i].nodeType&&(s[i].style.zIndex=t+i)},frameReady:function(){this.linked_frame||(this.linked_frame=GMI.query("GMFrame_BluesBar")[0])},callFrame:function(e){this.linked_frame&&this.linked_frame.currentPopupIs&&this.linked_frame.currentPopupIs(e)},graphHover:function(e,t){var i,s,n;if(i=t.target||t.srcElement,i&&1==i.nodeType){for(s=e.getElementsByTagName("span")[0],s.innerHTML=(i.getAttribute("title")||"").split(":").join(":<strong>")+"</strong>",n=-15;i=i.nextSibling;n++);s.style.left=Math.min(80,Math.max(-20,7*n))+"px"}},graphOut:function(e){e.getElementsByTagName("span")[0].innerHTML=""}},window.DWait&&DWait.run("jms/pages/gruzecontrol/bluesbar.js")});
window.GUserPoll=GMIBase.extend({}),window.DWait&&DWait.run("jms/pages/gruzecontrol/guserpoll.js");
window.GBadge=GMIBase.extend({}),window.DWait&&DWait.run("jms/pages/gruzecontrol/gbadge.js");
window.Linkify=function(){function t(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/>/g,"&gt;")}function a(a,r){var e,s,u=r.match(n),c=a?t(r):r;return u&&(s=a?t(u[1]):u[1],e=i.test(s)?s:"http://"+s,c=c.replace(s,'<a href="'+e+'">'+s+"</a>")),c}var n=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i,i=/^[a-z][\w-]+:/;return function(t,n){return jQuery.map((t+"").split(/\s+/),bind(this,a,n)).join(" ")}}(),window.DWait&&DWait.run("jms/lib/linkify.js");if(window.DWait){DWait.count()}