Jamendo.classes.Graph2=Class.create({findSWF:function(A){if(navigator.appName.indexOf("Microsoft")!=-1){return window[A]}else{return document[A]}},insertGraph:function(A,O,L,E,J){var H=$(E);var G=H.id;var B=H.getWidth();var M=H.getHeight();L=$H(L);L.set("graph_nocache",window.location.toString().match(/nocache\=1/)?"1":"0");if(O=="flotr"){H.innerHTML="<div id='"+H.id+"_flotr_title' style='position:relative;overflow:hidden;margin-left:25px;height:20px;font-weight:bold;font-size:16px;line-height:16px;'></div><div id='"+H.id+"_flotr_inner'>Loading...</div>";var F=$(H.id+"_flotr_inner");F.style.height=(M-20)+"px";var N=50;var I=Math.floor(parseInt(H.style.width)/N);L.set("graph_maxdateticks",I);Jamendo.jsonRequest("/graph2/"+A+"/flotr",L,function(P){P.options=Object.extend(P.options,{"mouse":{"track":true,"trackDecimals":0,"sensibility":40,"radius":3,"lineColor":"purple","trackFormatter":function(Q){return P._x2date[parseInt(Q.x)]+" =&gt "+Q.y}},"legend":{"position":"sw","noColumns":3}});$(H.id+"_flotr_title").innerHTML=P._title;f=Flotr.draw(F,P.series,P.options)},{"timeout":120000,"retryCount":1})}else{if(O=="openflashchart"){var G=H.id;var D=Jamendo.getEnv("HTTPHOSTI18N")+"graph2/"+A+"/openflashchart?"+L.toQueryString();if(Jamendo.getEnv("HTTPHOSTI18N").indexOf("localjamendo.com")>0){var C="/res/flash/open-flash-chart.swf"}else{var C="http://imgjam.com/widgets/open-flash-chart.swf"}swfobject.embedSWF(C,H.id,B,M,"8.0.0",false,{"loading":Jamendo.getStr("ARTISTSTATS_FLASH_LOADING_MESSAGE")+"...","data-file":encodeURIComponent(D)},{"allowScriptAccess":"always","allowNetworking":"all","menu":"false"},{"id":G,"name":G});if(J&&typeof (J.onComplete)=="function"){J.onComplete(G)}}else{if(O=="jpgraph"){L.set("graph_size",parseInt(H.style.width)+"x"+parseInt(H.style.height));H.innerHTML="Loading...";H.innerHTML="<img src='/graph2/"+A+"/jpgraph?"+L.toQueryString()+"' />";G=H.id;if(J&&typeof (J.onComplete)=="function"){J.onComplete(G)}}else{if(O=="htmltable"||O=="raw_table"){var G=H.id;var K=new Ajax.Request(Jamendo.getEnv("HTTPHOSTI18N")+"graph2/"+A+"/"+O+"?"+L.toQueryString(),{"onComplete":function(P){H.update(P.responseText);if(J&&typeof (J.onComplete)=="function"){J.onComplete(G)}}})}}}}}});Jamendo.classes.ArtistsStats=Class.create({initialize:function(B,A,C){this.StatsModules=B;this.singleblock=C;this.artistID=A},singleblock:false,artistID:null,titleholder:"artiststats_title",waitMessage:"",currentPeriod:"week",periods:{"weeks":{"graph_fromdays":14,"graph_xaxis":"dayshort","graph_n":"all"},"week2":{"graph_fromdays":30,"graph_xaxis":"dayshort","graph_n":"all"},"months":{"graph_fromdays":60,"graph_xaxis":"weekno","graph_n":"all"},"months2":{"graph_fromdays":126,"graph_xaxis":"weekno","graph_n":"all"},"all":{"graph_fromdays":"all","graph_xaxis":"monthshort","graph_n":"all"}},switchCharts:function(B,A,C){C=Object.extend({"graph_artistID":this.artistID,"graph_cumul":1,"graph_showemptymessage":0},Object.extend(Object.clone(Jamendo.ArtistsStats.selectedPeriod()),C));if(this.singleblock){$(this.titleholder).update(this.waitMessage)}if(!B){B=this.StatsModules.keys()}B.each(function(E){var D=this.StatsModules.get(E);if(typeof (A)=="undefined"||A==""){A=D.name}else{D.name=A}if(D.disabled_charts&&D.disabled_charts.indexOf(A)!=-1){if(D.titleholder){$(D.titleholder).update("")}$(D.holder).replace('<div id="'+D.holder+'"></div>');return false}this.setSubMenu(A);if(D.titleholder){$(D.titleholder).update(Jamendo.getStr("GRAPH_TITLE_"+A))}this.options=C;if(typeof (D.forceOptions)!="undefined"){Object.extend(C,D.forceOptions)}$(D.holder).setStyle(D.style);if(typeof (D.onLoading)=="function"){D.onLoading()}Jamendo.page.graph2(A,D.engine,C,D.holder,{"onComplete":function(F){D.holder=F;if(typeof (D.onComplete)=="function"){D.onComplete()}}})}.bind(this));if(this.singleblock){$(this.titleholder).update(Jamendo.getStr("GRAPH_TITLE_"+A))}},reload:function(){this.switchCharts()},previous:function(){var A=this.options;A.graph_fromdays+=this.periods[this.currentPeriod].graph_fromdays;this.switchCharts(null,null,A)},next:function(){var A=this.options;A.graph_fromdays-=this.periods[this.currentPeriod].graph_fromdays;this.switchCharts(null,null,A)},selectedPeriodKey:function(){return $("stats_period_selection").getValue()},selectedPeriod:function(){this.currentPeriod=$("stats_period_selection").getValue();return this.periods[this.currentPeriod]},setSubMenu:function(C){var A=$("stats_sous_nav");if(!A){return false}var D=A.down("#"+C);var B=A.down(".selected");if(B){B.toggleClassName("selected")}if(D){D.toggleClassName("selected")}return(!!D)}});function ofc_ready(){$(newContainerID).set_error_handler("Jamendo.log")}