var MAX_PROFILER_TIME=3;
function Profiler(profiler_threshold)
{
this.Start=Profiler__Start;
 this.Stop=Profiler__Stop;
 this.ReportProblem=Profiler__ReportProblem;
 this.Threshold=profiler_threshold&&
 typeof(profiler_threshold)!='undefined'&&
!isNaN(profiler_threshold)?
 parseInt(profiler_threshold,10):
 MAX_PROFILER_TIME;
 this.LastDiff=0;
this.Start();
}
function Profiler__Start()
{
 if((document.all&&navigator.appVersion.toLowerCase().indexOf('mac')==-1)||document.getElementById){
 this.__Timer=new Date();
}
}
function Profiler__Stop()
{
 if((document.all&&navigator.appVersion.toLowerCase().indexOf('mac')==-1)||document.getElementById){
 var start_date=this.__Timer;
 var stop_date=new Date();
 var start_ms=start_date.getTime();
 var stop_ms=stop_date.getTime();
 var diff=stop_ms-start_ms;
this.LastDiff=diff;
}
}
function Profiler__ReportProblem()
{
 if(this.LastDiff > this.Threshold*1000){
 var info=new Object();
 info.URL=document.location+"";
 info.RawTime=this.LastDiff;
 info.HRTime=this.LastDiff+"ms ("+parseInt(this.LastDiff/1000,10)+" sec)";
 info.Message="User experienced slow load. URL ["+info.URL+"], Time: "+info.HRTime;
 return info;
}
 return null;
}