/*
HTTP Host: static.ak.fbcdn.net
Generated: March 21st 2010 12:50:52 AM PDT
Machine: 10.16.139.101
Locale: nu_ll
Path: js/video/histogram_monitor.js
*/

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/video\/histogram_monitor.js"]); }


function VideoHistogram(){this.videos={};this.video_payloads={};this.listening=false;this.checking=false;}
VideoHistogram.prototype.start=function(swf_id){var new_video=document[swf_id]||window[swf_id];this.videos[swf_id]=new_video;this.listening=true;}
VideoHistogram.prototype.videoFinished=function(swf_id,payload){this.videos[swf_id]=null;this.setPayload(swf_id,payload);this.updateServer();}
VideoHistogram.prototype.setPayload=function(swf_id,payload){this.video_payloads[swf_id]=payload;}
VideoHistogram.prototype.updateServer=function(){var big_payload=[];for(var swf_id in this.video_payloads){var video_report=this.video_payloads[swf_id];this.video_payloads[swf_id]=null;if(video_report){big_payload.push(video_report);}}
var json_payload=JSON.encode(big_payload);new AsyncSignal('/video/motion_log.php',{'h':json_payload}).send();this.listening=false;this.checking=false;}
VideoHistogram.prototype.checkStatus=function(){if(this.listening){this.checking=true;for(var v in this.videos){if(this.videos[v].reportTime){this.videos[v].reportTime();}}
this.updateServer();}}
copy_properties(VideoHistogram,{init:function(){if(!window.video_histogram){window.video_histogram=new VideoHistogram();}
onbeforeunloadRegister(function(){if(!window.video_histogram.checking){window.video_histogram.checkStatus();}});}});

if (window.Bootloader) { Bootloader.done(["js\/video\/histogram_monitor.js"]); }