(function(c){var d=function(a){var b={level1:{labelcolor:"green",review:COM_JREALTIME_VERYFAST,lowerlimit:0,upperlimit:1,percentage:80,direction:COM_JREALTIME_SLOWER},level2:{labelcolor:"green",review:COM_JREALTIME_FAST,lowerlimit:1,upperlimit:2,percentage:60,direction:COM_JREALTIME_SLOWER},level3:{labelcolor:"green",review:COM_JREALTIME_AVERAGE,lowerlimit:2,upperlimit:3,percentage:50,direction:COM_JREALTIME_FASTER},level4:{labelcolor:"yellow",review:COM_JREALTIME_AVERAGE,lowerlimit:3,upperlimit:4,percentage:60,direction:COM_JREALTIME_FASTER},level5:{labelcolor:"yellow",review:COM_JREALTIME_SLOW,lowerlimit:4,upperlimit:6,percentage:80,direction:COM_JREALTIME_FASTER},level6:{labelcolor:"red",review:COM_JREALTIME_VERYSLOW,lowerlimit:6,upperlimit:99999,percentage:null,direction:COM_JREALTIME_SPEEDTEST_ADVICE}};this.getData=function(l){var m=c("#sitespeed_url").val();var o=m;if(a.useNoCache){o=o+"?time="+(new Date().getTime())}var r={};var n=new Date();var p=n.getTime();var q=c.ajax({type:"GET",async:true,url:o,dataType:"html"});q.always(function(){var j=new Date();var f=j.getTime();var e=(f-p)/1000;c.each(b,function(t,k){if(e>k.lowerlimit&&e<k.upperlimit){r.review=k.review+k.direction.replace("{percentage}",k.percentage);r.labelcolor=k.labelcolor;return false}});r.timeSpeed={label:COM_JREALTIME_PAGELOADED_TIME.replace("{seconds}",e),floatvalue:e};var g={idtask:"getPageSpeedScore",param:m};var i=JSON.stringify(g);var h=c.Deferred(function(k){c.ajax({type:"POST",url:"../administrator/index.php?option=com_jrealtimeanalytics&task=ajaxserver.display&format=json",dataType:"json",context:this,data:{data:i},}).done(function(w,v,x){if(w.result){k.resolve(w)}else{k.reject()}}).fail(function(y,w,x){var z=w[0].toUpperCase()+w.slice(1);k.reject("-"+z+"- "+x)})}).promise();h.then(function(k){r.pageSpeedResult=k}).always(function(){l.fire(r)})})}};window.JRealtimeModelSitespeed=d})(jQuery);