/*
 *  © 2000-2010 deviantART, Inc. All rights reserved.
 */
if(!window.AutoExec){AutoExec=[]}function GeckoRefresh(){if(browser.isGecko||browser.isChrome){with(document.body.style){height="1px";height="auto"}}}var InfoStatusBarDiv,InfoStatusTextDiv;function SetStatsProgress(A){document.getElementById("InfoStatusBarDiv").style.width=A+"px"}function SetStatsStatus(A){InfoStatusTextDiv.innerHTML=A}Number.prototype.isNumber=true;Array.prototype.executeSort=Array.prototype.sort;Array.prototype.formatString=function(A){return(A.toUpperCase)?A.toUpperCase():A};Array.prototype.formatNumber=function(A){return parseInt(A)};Array.prototype.compareSort=function(D,B){if(!this.type){this.setType("string")}var C=this.formatFunction;var A=this.type;return function(G,F){var E=B?G:C(G,A);var H=B?F:C(F,A);if(E<H){return D?-1:+1}if(E>H){return D?+1:-1}return 0}};Array.prototype.sort=function(B,A){if(!A){this.executeSort(this.compareSort(!B,A))}else{this.executeSort(A)}return this};Array.prototype.setType=function(A){this.type=A;this.formatFunction=(A=="string")?this.formatString:(A=="number")?this.formatNumber:this.formatDate};fn_log=function(A){if(window.console&&window.console.log){console.log(A)}};fn_ErrorOccurred=function(){fn_log("error")};fn_Onload=function(){if(window.deviantART.pageData.userstats==undefined){return fn_ErrorOccurred()}window.GalleryFeed=window.deviantART.pageData.userstats;window.GalleryFeed.deviations=window.deviantART.pageData.devstats;InfoStatusBarDiv=document.getElementById("InfoStatusBarDiv"),InfoStatusTextDiv=document.getElementById("InfoStatusTextDiv");gallery_stats=$j("#gallery-stats");if(browser.isIE5||!(browser.isIE||browser.isGecko||browser.isChrome||browser.isOpera||browser.isKHTML)){gallery_stats.addClass("failure");return }$j('<div id="HoverDiv">').css({position:$j.browser.msie?"absolute":"fixed","z-index":1000}).appendTo("body");UserHe=((GalleryFeed.gender=="m")?"he":(GalleryFeed.gender=="f"?"she":GalleryFeed.username)).toString();UserHis=((GalleryFeed.gender=="m")?"his":(GalleryFeed.gender=="f"?"her":"their")).toString();UserHim=((GalleryFeed.gender=="m")?"him":(GalleryFeed.gender=="f"?"her":GalleryFeed.username)).toString();gallery_stats.addClass("scripted");if(browser.isKHTML){gallery_stats.addClass("KHTML")}fn_RetrieveStats()};hookEvent(deviantART,"applicationready",fn_Onload,false,"GalleryStats");fn_RetrieveStats=function(A){GLOBAL_PAGE=0;GLOBAL_DATA=[];document.getElementById("InfoStatusDiv").style.display="block";InfoStatusTextDiv.style.display="block";InfoStatusTextDiv.style.visibility="visible";document.getElementById("InfoTextDiv").style.display="none";SetStatsProgress(0);SetStatsStatus("Retrieving data ...");fn_StartAnalyze()};fn_StartAnalyze=function(){months="JanFebMarAprMayJunJulAugSepOctNovDec";monthnames="January,February,March,April,May,June,July,August,September,October,November,December".split(",");weekday="Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(",");CATEGORY_COLORS={count:0,colors:["orange","Violet","red","firebrick","DarkSeaGreen","Gold","MediumSlateBlue","PeachPuff","MediumVioletRed","LightBlue","GreenYellow","LightCoral","LightSalmon","SlateBlue","BurlyWood","MediumOrchid","YellowGreen","LimeGreen","Coral","LightSteelBlue","Tomato","Thistle","CornflowerBlue","RoyalBlue","BurlyWood","AliceBlue","MediumSeaGreen"]};data=[];GLOBAL_REFERENCE={};TotalGivenComments=GalleryFeed.comments;TotalReceivedComments=GalleryFeed.comments_received;TotalPageViews=GalleryFeed.pageviews;TotalDeviations=TotalComments=TotalFavourites=TotalViews=TotalMobileDownloads=0;Mobiles=[];Earliest=null;Latest=null;Hours={};TopHour=null;Months={};TopMonth=null;Weeks={};TopWeek=null;Galleries={};TopGallery=null;Categories={};TopCategory=null;TopDeviation=TopDeviationByFav=TopDeviationByViews=false;global_index=0;if(GalleryFeed.subscribed){document.getElementById("TimelineTab").parentNode.onmouseup=function(A){try{var B=getEventTarget(A||event);if(B.innerHTML.toLowerCase()=="timeline"){setTimeout("fn_ColorByRating(); fn_SizeByComments();",1);this.onmouseup=null}}catch(A){}}}if(GalleryFeed.deviations.length){if(GalleryFeed.deviations.length>500){SetStatsStatus("Analyzing "+GalleryFeed.deviations.length.addComma()+" deviations...")}fn_Analyze()}else{fn_EndAnalyze()}};fn_Analyze=function(){var D=global_index;var A=GalleryFeed.deviations[D];if(A.category=="Scraps"){GalleryFeed.deviations.splice(D,1);if(D<GalleryFeed.deviations.length){return fn_Analyze()}else{return fn_EndAnalyze()}}data[D]={};data[D].title=A.title;data[D].gallery=A.category.split("/")[0];data[D].category=A.category.split("/");if(data[D].category.length>3){data[D].category.shift()}if(data[D].category.length>2){data[D].category.shift()}data[D].category=data[D].category.join(" > ");data[D].id=parseInt(A.id);data[D].thumb=A.ismature&&!deviantART.deviant.browseadult?"http://s.deviantart.net/misc/noentrythumb.gif":A.thumb;data[D].resolution=A.resolution;"";GLOBAL_REFERENCE[data[D].id]=data[D];var B=A.date.split(",");data[D].year=parseInt(B[1]);data[D].yearmonth=parseInt(B[0]);data[D].monthname=B[0].split(" ")[0];data[D].month=data[D].monthname+" "+data[D].year;data[D].day=parseInt(B[0].split(" ")[1]);data[D].date=new Date(A.date);data[D].week=weekday[data[D].date.getDay()];data[D].hour=data[D].date.getHours();if(data[D].hour<12){data[D].hour+="am"}else{data[D].hour-=12;data[D].hour+="pm"}data[D].comments=A.comments;data[D].favourites=A.favourites;data[D].views=A.views;data[D].mobilecount=A.mobilecount;data[D].age=((new Date()-data[D].date)/1000/60/60/24);data[D].commentsperday=data[D].comments/data[D].age;data[D].favouritesperday=data[D].favourites/data[D].age;data[D].commentsin2weeks=data[D].comments/14;data[D].favouritesin2weeks=data[D].favourites/14;data[D].rating=data[D].favourites/data[D].comments*100;if(data[D].favourites==0||data[D].comments==0){data[D].rating=0}TotalComments+=data[D].comments;TotalFavourites+=data[D].favourites;TotalViews+=data[D].views;TotalDeviations++;if(A.mobilecount){Mobiles.push([data[D].title,A.mobilecount]);if(!Mobiles.best){Mobiles.best=data[D]}if(A.mobilecount>Mobiles.best.mobilecount){Mobiles.best=data[D]}}TotalMobileDownloads+=data[D].mobilecount;if(!Earliest||data[D].date<Earliest.date){Earliest=data[D]}if(!Latest||data[D].date>Latest.date){Latest=data[D]}if(!TopDeviation){TopDeviation=data[D]}if(data[D].comments>TopDeviation.comments){TopDeviation=data[D]}if(!TopDeviationByFav){TopDeviationByFav=data[D]}if(data[D].favourites>TopDeviationByFav.favourites){TopDeviationByFav=data[D]}if(!TopDeviationByViews){TopDeviationByViews=data[D]}if(data[D].views>TopDeviationByViews.views){TopDeviationByViews=data[D]}if(!Months[data[D].month]){Months[data[D].month]=0}Months[data[D].month]++;if(!TopMonth){TopMonth=data[D].month}if(Months[data[D].month]>=Months[TopMonth]){TopMonth=data[D].month}if(!Weeks[data[D].week]){Weeks[data[D].week]=0}Weeks[data[D].week]++;if(!TopWeek){TopWeek=data[D].week}if(Weeks[data[D].week]>=Weeks[TopWeek]){TopWeek=data[D].week}if(!Hours[data[D].hour]){Hours[data[D].hour]=0}Hours[data[D].hour]++;if(!TopHour){TopHour=data[D].hour}if(Hours[data[D].hour]>=Hours[TopHour]){TopHour=data[D].hour}if(!Galleries[data[D].gallery]){Galleries[data[D].gallery]=0}Galleries[data[D].gallery]++;if(!TopGallery){TopGallery=data[D].gallery}if(Galleries[data[D].gallery]>=Galleries[TopGallery]){TopGallery=data[D].gallery}if(!Categories[data[D].category]){CATEGORY_COLORS[data[D].category]=CATEGORY_COLORS.colors[CATEGORY_COLORS.count++%CATEGORY_COLORS.colors.length];Categories[data[D].category]=0}Categories[data[D].category]++;if(!TopCategory){TopCategory=data[D].category}if(Categories[data[D].category]>=Categories[TopCategory]&&data[D].category!="Scraps"){TopCategory=data[D].category}if(global_index<GalleryFeed.deviations.length-1){SetStatsProgress(100+Math.round(global_index/GalleryFeed.deviations.length*180));var C=data[D].title?data[D].title.bold():"";if(GalleryFeed.deviations.length<1000){SetStatsStatus("Analyzing "+C)}global_index++;global_timeout=setTimeout("fn_Analyze()",1)}else{SetStatsStatus("Done calculations...");if(self.global_timeout){clearTimeout(global_timeout)}fn_EndAnalyze()}};fn_EndAnalyze=function(){SetStatsProgress(285);SetStatsStatus("Preparing summary...");setTimeout("fn_EndAnalyze2()",1)};fn_EndAnalyze2=function(){var B="";var I=GalleryFeed.deviations.length;if(!GalleryFeed.deviations.length){B="<div class='c'><strong>* There are no detailed stats for this artist, since "+UserHis+" gallery is empty. *</strong></div><br />";Latest={date:new Date()}}Earliest=new Date(GalleryFeed.since);var G=(Latest.date-Earliest)/1000/60/60/24;SetStatsStatus("Writing views summary...");document.getElementById("ViewsTotalDiv").innerHTML=B+GalleryFeed.username+" has "+TotalPageViews.addComma().bold()+" pageviews total and "+UserHis+" "+TotalDeviations.addComma().bold()+" deviations were viewed "+TotalViews.addComma().bold()+" times. "+UserHe.capitalize()+" watches "+GalleryFeed.friends.addComma().bold()+" people, while "+GalleryFeed.friendswatching.addComma().bold()+" people watch "+UserHim+".";SetStatsStatus("Writing comments summary...");var H="Overall, "+UserHis+" deviations received "+TotalComments.addComma().bold()+" comments and were added to deviants' favourites "+TotalFavourites.addComma().bold()+" times, while "+UserHe+" commented "+TotalGivenComments.addComma().bold()+" times, making about "+(TotalGivenComments/G).round(2).bold()+" comments per day since "+UserHe+" joined DA. This means that "+UserHe+" ";if(TotalGivenComments<TotalComments){H+=" received "+Math.round(TotalComments/TotalGivenComments*10).bold()+" comments for every 10 that "+UserHe+" gave."}else{if(TotalComments>0){H+=" gave "+Math.round(TotalGivenComments/TotalComments*10).bold()+" comments for every 10 that "+UserHe+" received."}else{H+=" gave "+TotalGivenComments+" comments and received none."}}document.getElementById("TotalCommentsFavouritesDiv").innerHTML=H;if(!GalleryFeed.deviations.length){var F=[];if(GalleryFeed.subscribed){F=Tree.gets(Tree.get("#gallerystats-tabs"),"a")}else{F=Tree.gets("a.dead")}for(var D=0;D<F.length;D++){Tree.addClass(F[D],"dead");F[D].href="#";F[D].setAttribute("href","#");F[D].onMouseOver=function(){fn_Hover_setup(Node,"There are no detailed stats for this user, since "+UserHis+" gallery is empty.");return true};F[D].onclick=function(){return cancelEvent()}}document.getElementById("InfoStatusTextDiv").innerHTML="Done.";SetStatsProgress(300);setTimeout("fn_EndAnalyze5()",400);return }SetStatsStatus("Writing averages summary...");document.getElementById("AveragesDiv").innerHTML="Comments per deviation: "+(TotalComments/TotalDeviations).round(TotalComments/TotalDeviations>5?0:2).bold()+"<br/>Favourites per deviation: "+(TotalFavourites/TotalDeviations).round(TotalFavourites/TotalDeviations>5?0:2).bold()+"<br/>Views per deviation: "+(TotalViews/TotalDeviations).round(TotalViews/TotalDeviations>10?0:2).addComma().bold()+"<br/>Comments per day: "+(TotalComments/G).round(TotalComments/G>5?0:2).bold()+"<br/>Favourites per day: "+(TotalFavourites/G).round(TotalFavourites/G>10?0:2).bold()+"<br/>Deviation views per day: "+(TotalViews/G).round(TotalViews/G>10?0:2).bold()+"<br/>Pageviews per day: "+(TotalPageViews/G).round(TotalPageViews/G>10?0:2).bold();SetStatsStatus("Writing favourites stats...");var H=UserHis.capitalize()+" deviation with the most comments is "+TopDeviation.title.link("http://www.deviantart.com/deviation/"+TopDeviation.id,{onmouseover:"fn_Hover_setup(this, '<img onerror=fn_ThumbOnError(this) src="+TopDeviation.thumb+">')"}).bold()+" with "+TopDeviation.comments.addComma().bold()+" comments,";if(TopDeviation.title==TopDeviationByFav.title){H+=" and it is also "+UserHis+" most favourited"}else{H+=" while "+UserHis+" most favourited one is "+TopDeviationByFav.title.link("http://www.deviantart.com/deviation/"+TopDeviationByFav.id,{onmouseover:"fn_Hover_setup(this, '<img onerror=fn_ThumbOnError(this) src="+TopDeviationByFav.thumb+">')"}).bold()}H+=", with "+TopDeviationByFav.favourites.addComma().bold()+" favourites. ";H+=UserHis.capitalize()+" most viewed deviation is "+TopDeviationByViews.title.link("http://www.deviantart.com/deviation/"+TopDeviationByViews.id,{onmouseover:"fn_Hover_setup(this, '<img onerror=fn_ThumbOnError(this) src="+TopDeviationByViews.thumb+">')"}).bold()+" with "+TopDeviationByViews.views.addComma().bold()+" views.";document.getElementById("TopDeviationDiv").innerHTML=H;try{SetStatsStatus("Writing mobile stats...");var H="";if(TotalMobileDownloads>0){H+=UserHis.capitalize()+" deviations were downloaded to mobile cellphones "+TotalMobileDownloads.bold()+" times.<br/>"}if(G&&TopWeek){H+="Every "+(G/TotalDeviations).round(1).bold()+" days "+UserHe+" uploads a new deviation, and it's usually on a "+TopWeek.bold()+", with "+Weeks[TopWeek].bold()+" ("+Math.round(Weeks[TopWeek]/TotalDeviations*100).bold()+"%) of "+UserHis+" deviations."}}catch(E){}SetStatsStatus("Writing date stats...");document.getElementById("UploadFrequencyDiv").innerHTML=H;document.getElementById("UploadTimesDiv").innerHTML=UserHis.capitalize()+" busiest month was "+TopMonth.bold()+" with "+Months[TopMonth].bold()+" ("+Math.round(Months[TopMonth]/TotalDeviations*100).bold()+"%) of "+UserHis+" deviations.";SetStatsStatus("Writing ratio stats...");if(TotalComments>0){var A;A=Math.round(TotalFavourites/TotalComments*10);document.getElementById("RatioFavouritesDiv").innerHTML=A.bold()+" favourite"+(A=="1"?" was":"s were")+" given for every 10 comments."}else{document.getElementById("RatioFavouritesDiv").innerHTML="0".bold()+" Favourites were given for every 10 Comments."}document.getElementById("ExtraInfo").innerHTML="The majority of "+UserHis+" deviations are uploaded to the "+TopGallery.bold()+" gallery ("+Galleries[TopGallery].bold()+"), while "+UserHis+" favourite category was "+TopCategory.bold()+" with "+Categories[TopCategory].bold()+" deviations.";SetStatsStatus("Writing Premium Member stats...");if(!GalleryFeed.subscribed){var C=Tree.gets("a.dead");for(var D=0;D<C.length;D++){C[D].onmouseover=function(){fn_Hover_setup(Node,"Extended stats are only available for the galleries of Premium Members");return true};C[D].onclick=function(){return false}}return fn_EndAnalyze5()}document.getElementById("InfoStatusTextDiv").innerHTML="Creating charts...";SetStatsProgress(290);setTimeout("fn_EndAnalyze3()",1)};fn_EndAnalyze3=function(){if(TotalMobileDownloads){var B=fn_ArrayToHTML(Mobiles,Mobiles.best.title);document.getElementById("MobileBreakdownDiv").innerHTML='<fieldset><legend>Mobile Downloads:</legend><ul class="simple">'+B+"</ul></fieldset>"}var E=fn_ProcessObject(Categories);var B=fn_ArrayToHTML(E,TopCategory);document.getElementById("CategoryBreakdownDiv").innerHTML='<fieldset><legend>Subcategories:</legend><ul class="simple">'+B+"</ul></fieldset>";var B=fn_ArrayToChart(E,Categories[TopCategory]);document.getElementById("CategoryChartDiv").innerHTML="<fieldset><legend>Subcategories:</legend>"+B+"</fieldset>";var F=fn_ProcessObject(Months,true);MonthsArraySort=function(I,H){m1=months.indexOf(I[0].substring(0,3))+1;if(m1<10){m1="0"+m1}m2=months.indexOf(H[0].substring(0,3))+1;if(m2<10){m2="0"+m2}return(I[0].split(" ")[1]+m1)<(H[0].split(" ")[1]+m2)?-1:1};F.sort(true,MonthsArraySort);var B=fn_ArrayToHTML(F,TopMonth);document.getElementById("MonthsBreakdownDiv").innerHTML='<fieldset><legend>Months:</legend><ul class="simple">'+B+"</ul></fieldset>";var B=fn_ArrayToChart(F,Months[TopMonth]);document.getElementById("MonthChartDiv").innerHTML="<fieldset><legend>Months:</legend>"+B+"</fieldset>";var D=fn_ProcessObject(Weeks,true);D.sort(true,function(I,H){return weekday.toString().indexOf(I[0])-weekday.toString().indexOf(H[0])});var B=fn_ArrayToHTML(D,TopWeek);document.getElementById("WeeksBreakdownDiv").innerHTML='<fieldset><legend>Days of the Week:</legend><ul class="simple">'+B+"</ul></fieldset>";var B=fn_ArrayToChart(D,Weeks[TopWeek]);document.getElementById("WeekChartDiv").innerHTML="<fieldset><legend>Days of the Week:</legend>"+B+"</fieldset>";var G=fn_ProcessObject(Hours,true);HoursArraySort=function(I,H){a2=(I[0].indexOf("pm")>0)?(parseInt(I[0])+12):parseInt(I[0]);b2=(H[0].indexOf("pm")>0)?(parseInt(H[0])+12):parseInt(H[0]);if(a2==24){a2=12.1}if(b2==24){b2=12.1}return a2>b2?1:-1};G.sort(true,HoursArraySort);var B=fn_ArrayToHTML(G,TopHour);document.getElementById("HoursBreakdownDiv").innerHTML='<fieldset><legend>Hours:</legend><ul class="simple">'+B+"</ul></fieldset>";var B=fn_ArrayToChart(G,Hours[TopHour]);document.getElementById("HourChartDiv").innerHTML="<fieldset><legend>Hours of the Day:</legend>"+B+"</fieldset>";SortByFavs=function(I,H){return I.favourites>H.favourites?1:-1};data.sort(true,SortByFavs);var A=data.slice(-500);fn_PopulateChart("favourites",document.getElementById("DeviationsByFavChartDataDiv"),TopDeviationByFav.favourites,"favourites",A);SortByComments=function(I,H){return I.comments>H.comments?1:-1};data.sort(true,SortByComments);var A=data.slice(-500);fn_PopulateChart("comments",document.getElementById("DeviationsByCommentsChartDataDiv"),TopDeviation.comments,"comments",A);var C=fn_ProcessObject(Galleries);var B=fn_ArrayToHTML(C,TopGallery);document.getElementById("GalleriesBreakdownDiv").innerHTML='<fieldset><legend>Galleries:</legend><ul class="simple">'+B+"</ul></fieldset>";var B=fn_ArrayToChart(C,Galleries[TopGallery]);document.getElementById("GalleryChartDiv").innerHTML="<fieldset><legend>Galleries:</legend>"+B+"</fieldset>";document.getElementById("InfoStatusTextDiv").innerHTML="Creating timeline chart...";SetStatsProgress(295);setTimeout("fn_EndAnalyze4()",1)};fn_EndAnalyze4=function(){var B=data.length>500?data.slice(-500):data;DateSort=function(D,C){return D.date>C.date?1:-1};B.sort(true,DateSort);var A=fn_ArrayToTree(B,"title","comments",(TotalComments-TopDeviation.comments)/(TotalDeviations-1)*2,"favourites",(TotalFavourites-TopDeviationByFav.favourites)/(TotalDeviations-1)*2,"rating",TopDeviation.rating);document.getElementById("TimelineDiv").innerHTML=A;if(data.length>500){document.getElementById("gallerystats-timeline-limit").style.display="block";document.getElementById("gallerystats-favourites-limit").style.display="block";document.getElementById("gallerystats-comments-limit").style.display="block"}document.getElementById("InfoStatusTextDiv").innerHTML="Done.";SetStatsProgress(300);setTimeout("fn_EndAnalyze5()",400)};fn_EndAnalyze5=function(){document.getElementById("InfoStatusDiv").style.display="none";document.getElementById("InfoTextDiv").style.display="block";GLOBAL_DATA=[]};fn_ProcessObject=function(B,D){var C=new Array();for(var A in B){if(B[A].isNumber){C[C.length]=[A,B[A]]}}if(!D){C.sort()}return C};fn_ArrayToHTML=function(D,B){var A="";for(var C=0;C<D.length;C++){var E=D[C][0];var F=D[C][1];if(E==B){E=E.bold();F=F.bold()}A+='<li><span class="aside-right">'+F+'<span class="visual-surplus">:</span></span> '+E+"</li>"}return A};fn_ArrayToChart=function(F,C,G,B,K,A,P){var R="";var G=G||0;var B=B||1;var D=D||0;var A=(A||280);var E=A/C;var K=K||false;sCursor=K?"pointer":"default";for(var O=0;O<F.length;O++){var N=Math.round(parseInt(F[O][B])*E);var I=F[O][B];var H=' <span class="ChartValue">'+I+"</span>";var J=F[O][G];var Q=B.isNumber?"":" "+B;var M=O%7+1;if(J&&J.length*6>N){J=J.substring(0,Math.round(N/6-2))+"..."}var L=F[O].id||F[O][G].bold()+" ("+F[O][B]+")";if(P=="date"||P=="date2"){P="month"}if((P=="category"||P=="month")&&(O==0||F[O][P]!=F[O-1][P])){if(O>0){R+="</div>"}R+='<div class="ChartSection"><div class="ChartLabel">'+F[O][P]+"</div>"}if(P===undefined){R+='<div class="ChartBar Bar'+M+'" style="width:'+N+"px; cursor:"+sCursor+'">'+J+"</div>"+H+"<br/>"}else{R+='<div class="ChartBar Bar'+M+'" style="width:'+N+"px; cursor:"+sCursor+'" onmouseover="fn_Hover_setup(this,\''+L+"')\">"+J+"</div>"+H+"<br/>"}if(!browser.isIE){R+="<br/>"}}return R};fn_ArrayToTree=function(G,L,H,M,C,A,B){var N="";var I=20;var D=200;for(var E=0;E<G.length;E++){var K=G[E][H]/M*200;K=Math.min(K,D);K=Math.max(K,I);var F=G[E][C]/A*200;F=Math.min(F,D);F=Math.max(F,I);var O=G[E][L];v=O;if(F>=30){v+="<br/>"+G[E][H]+H.substring(0,1).toUpperCase()+"<br/>"+G[E][C]+C.substring(0,1).toUpperCase()}var J=G[E].year;if(E==0||J!=G[E-1].year&&!B&&!browser.isOpera){N+='<div class="TimelineYear" onmouseover="fn_Hover_setup(this, \'Year '+J+" begins')\">"+J.substring(0,1)+" "+J.substring(1,2)+" "+J.substring(2,3)+" "+J.substring(3,4)+"</div>"}if(browser.isIE||browser.isOpera){N+='<div class="TimelineItem" ref="'+G[E].id+'" onmouseover="fn_Hover_setup(this, '+G[E].id+')" style="background-color:orange; background-position: center center; background-repeat: no-repeat; '+(browser.isOpera?"display:inline-block;":"")+" width:"+Math.round(K)+"px;height:"+Math.round(F)+'px;"><span class="TimelineLabel">'+v+"</span></div>"}else{N+=' <table class="TimelineItem" onmouseover="fn_Hover_setup(this, '+G[E].id+')" ref="'+G[E].id+'" align="left" style="width:'+Math.round(K)+"px; height:"+Math.round(F)+'px;"><tr><td><span class="TimelineLabel">'+v+"</span></td></tr></table>"}}return N};fn_ColorByRating=function(){document.getElementById("ColorByRatingRadio").checked=true;var A=document.getElementById("TimelineDiv").getElementsByTagName(browser.isIE||browser.isOpera?"div":"table");for(var D=0;D<A.length;D++){var F=A[D];if(F.className!="TimelineItem"){continue}var B=GLOBAL_REFERENCE[F.getAttribute("ref")];if(!browser.isIE){F.getElementsByTagName("span")[0].style.visibility="visible"}else{F.firstChild.style.visibility="visible"}var E=Math.min(B.rating/100*240,240);var C="rgb(255,"+Math.floor(240-E/1.7)+","+Math.floor(240-E)+")";F.style.backgroundColor=C;F.style.backgroundImage="none"}};fn_ColorByCategory=function(){document.getElementById("ColorByCategoryRadio").checked=true;var A=document.getElementById("TimelineDiv").getElementsByTagName(browser.isIE||browser.isOpera?"div":"table");for(var B=0;B<A.length;B++){var C=A[B];if(C.className!="TimelineItem"){continue}if(!browser.isIE){C.getElementsByTagName("span")[0].style.visibility="visible"}else{C.firstChild.style.visibility="visible"}C.style.backgroundImage="none";C.style.backgroundColor=CATEGORY_COLORS[GLOBAL_REFERENCE[C.getAttribute("ref")].category]||"MediumPurple"}};fn_ToggleBackgroundImage=function(C){var A=document.getElementById("TimelineDiv").getElementsByTagName(browser.isIE||browser.isOpera?"div":"table");for(var B=0;B<A.length;B++){if(A[B].className!="TimelineItem"){continue}A[B].style.backgroundImage=C.checked?"none":"url("+GLOBAL_REFERENCE[A[B].getAttribute("ref")].thumb+")"}};fn_SizeByViews=function(){document.getElementById("SizeByViewsRadio").checked=true;var A=document.getElementById("TimelineDiv").getElementsByTagName(browser.isIE||browser.isOpera?"div":"table");for(var B=0;B<A.length;B++){var C=A[B];if(C.className!="TimelineItem"){continue}var D=GLOBAL_REFERENCE[C.getAttribute("ref")];C.style.height=Math.max(Math.min(Math.round(D.views/5),200),20)+"px";C.style.width=Math.max(Math.min(Math.round(D.comments/2),200),20)+"px";C.style.clear="none";if((browser.isGecko||browser.isChrome)&&B>0&&C.offsetLeft<=A[B-1].offsetLeft){C.style.clear="left"}}GeckoRefresh()};fn_SizeByComments=function(){document.getElementById("SizeByCommentsRadio").checked=true;var B=document.getElementById("TimelineDiv").getElementsByTagName(browser.isIE||browser.isOpera?"div":"table");var A=200/((TotalComments-TopDeviation.comments)/(TotalDeviations-1)*2);var D=200/((TotalFavourites-TopDeviationByFav.favourites)/(TotalDeviations-1)*2);if(A==Infinity||isNaN(A)){A=1}if(D==Infinity||isNaN(D)){D=1}for(var C=0;C<B.length;C++){var E=B[C];if(E.className!="TimelineItem"){continue}var F=GLOBAL_REFERENCE[E.getAttribute("ref")];E.style.width=Math.min(Math.max(Math.round(F.comments*A),20),200)+"px";E.style.height=Math.min(Math.max(Math.round(F.favourites*D),20),200)+"px";E.style.clear="none";if((browser.isGecko||browser.isChrome)&&C>0&&E.offsetLeft<=B[C-1].offsetLeft){E.style.clear="left"}}GeckoRefresh()};fn_ColorByImages=function(){document.getElementById("ColorByImagesRadio").checked=true;var C=document.getElementById("TimelineDiv").getElementsByTagName(browser.isIE||browser.isOpera?"div":"table");var B=200/((TotalComments-TopDeviation.comments)/(TotalDeviations-1)*2);var E=200/((TotalFavourites-TopDeviationByFav.favourites)/(TotalDeviations-1)*2);for(var D=0;D<C.length;D++){var F=C[D];if(F.className!="TimelineItem"){continue}var G=GLOBAL_REFERENCE[F.getAttribute("ref")];F.style.backgroundColor="dimgray";if(browser.isIE||browser.isOpera){F.firstChild.style.visibility="hidden"}else{F.getElementsByTagName("span")[0].style.visibility="hidden"}var A=Math.min(Math.max(G.comments*B,20),200);if(A>100&&A<=150){F.style.backgroundImage="url("+G.thumb.replace("/100/","/150/")+")"}else{if(A>150){F.style.backgroundImage="url("+G.thumb.replace("/100/","/300W/")+")"}else{F.style.backgroundImage="url("+G.thumb+")"}}}};fn_SortTimeline=function(){SortByFavs=function(D,C){return D.favourites>C.favourites?-1:1};B.sort(true,SortByFavs);var B=data.slice(-500);var A=fn_ArrayToTree(B,"title","comments",(TotalComments-TopDeviation.comments)/(TotalDeviations-1)*2,"favourites",(TotalFavourites-TopDeviationByFav.favourites)/(TotalDeviations-1)*2,"rating",TopDeviation.rating,true);document.getElementById("TimelineDiv").innerHTML=A};fn_Hover_setup=function(F,E){var B=GLOBAL_REFERENCE[E];var D=document.getElementById("HoverDiv");D.style.width=browser.isIE?"auto":"none";if(!B){D.innerHTML=E}else{var C=B.resolution.split("x");D.style.width=(parseInt(C[0])<parseInt(C[1]))?"250px":"300px";var A='<img src="'+B.thumb+"\" style='float:right;'/>"+B.title.bold()+" / "+B.category+"<br/> Comments: "+B.comments+" ("+B.commentsperday.round(2)+"/day)";if(B.mobilecount){A+="<br/> Mobile: "+B.mobilecount}A+="<br/> Favourites: "+B.favourites+" ("+B.favouritesperday.round(2)+"/day)<br/> Views: "+B.views+"<br/> "+B.monthname+" "+B.day+", "+B.year;D.innerHTML=A;F.ref=E;F.onclick=function(){window.open("http://www.deviantart.com/deviation/"+this.ref)};status="Click to open up "+B.title}D.style.visibility="visible";F.onmousemove=fn_Hover_mousemove;F.onmouseout=fn_Hover_mouseout;if(browser.isIE||browser.isOpera){fn_Hover_mousemove()}};fn_Hover_mouseout=function(){if(browser.isIE&&this.contains(event.toElement)){return }document.getElementById("HoverDiv").style.visibility="hidden";status=""};fn_Hover_mousemove=function(B){var B=B||event;var A=(B.clientX||B.pageX)+(browser.isIE?document.body.scrollLeft:0);var C=(B.clientY||B.pageY)+(browser.isIE?document.body.scrollTop:0);if(A+18+document.getElementById("HoverDiv").offsetWidth>window.innerWidth){A=window.innerWidth-document.getElementById("HoverDiv").offsetWidth-18}document.getElementById("HoverDiv").style.left=(A+8)+"px";document.getElementById("HoverDiv").style.top=(C+18)+"px"};fn_ChartBar_onclick=function(A){window.open("http://www.deviantart.com/deviation/"+A)};fn_ChartBar_onmouseover=function(B,A){fn_Hover_setup(B,A)};fn_FavSortChange=function(A){fn_PopulateChart(A.options[A.selectedIndex].value,document.getElementById("DeviationsByFavChartDataDiv"),TopDeviationByFav.favourites,"favourites",data.slice(-500))};fn_CommentsSortChange=function(A){fn_PopulateChart(A.options[A.selectedIndex].value,document.getElementById("DeviationsByCommentsChartDataDiv"),TopDeviation.comments,"comments",data.slice(-500))};fn_PopulateChart=function(F,C,E,D,B){if(!B){B=data}if(F=="date2"){SortDate2=function(H,G){return H.date>G.date?1:-1};B.sort(true,SortDate2)}else{if(F=="title"){SortTitle=function(H,G){return H[F]>G[F]?1:-1};B.sort(true,SortTitle)}else{SortOther=function(H,G){return H[F]>G[F]?-1:1};B.sort(true,SortOther)}}var A=fn_ArrayToChart(B,E,"title",D,"id",window.innerWidth-100,F);C.innerHTML=A};fn_ThumbOnError=function(A){A.parentNode.style.visibility="hidden"};String.prototype.capitalize=function(){return this.substring(0,1).toUpperCase()+this.substring(1,this.length).toLowerCase()};String.prototype.bold=function(){return"<strong>"+this+"</strong>"};Number.prototype.substring=String.prototype.substring;Number.prototype.bold=String.prototype.bold;Number.prototype.round=function(C){var A=new String(this).split(".");var B=A[0];if(A[1]){B+="."+A[1].substring(0,C)}return Number(B)};Number.prototype.addComma=function(){D=""+this;var E=D.indexOf(".")>0;var A=E?D.substring(D.indexOf("."),D.length):"";var D=E?D.substring(0,D.indexOf(".")):D;if(D.length>3){var C=D.length%3;var B=(C>0?(D.substring(0,C)):"");for(i=0;i<Math.floor(D.length/3);i++){if((C==0)&&(i==0)){B+=D.substring(C+3*i,C+3*i+3)}else{B+=","+D.substring(C+3*i,C+3*i+3)}}return(B+A)}else{return this}};String.prototype.link=function(B,A){var E="";var D=new Object();for(var C in A){if(Object[C]==null){E+=C+'="'+A[C]+'" '}}return'<a href="'+B+'" '+E+">"+this+"</a>"};if(window.DWait){DWait.run("jms/pages/galleryStats/gallerystats-core.js")}DWait.count();