var LOGSCRIPT="/p-contentpluginssimple-flash-videostats/logger.php",stats=null,current_filenames=[];function tdiff(a){a=((new Date).getTime()-a)/1E3;return Math.round(a)}function get_swf_object(a){return navigator.appName.indexOf("Microsoft")!==-1?window[a]:document[a]}
function getUpdate(a,b,d,e,f){if(a==="item"||current_filenames.hasOwnProperty(e)){var c=null;stats===null&&(stats=[]);typeof f==="undefined"&&(f=3);if(a==="item"){a=get_swf_object(e);d=null;f===3?d=a.itemData(b):f===4&&(d=a.getPlaylist()[b]);typeof d==="undefined"&&alert("Movie object not found "+a+" "+b);current_filenames[e]=d.file;stats.hasOwnProperty(e)||(stats[e]={});stats[e].hasOwnProperty(d.file)||(stats[e][d.file]={});c=stats[e][d.file];c.timer=(new Date).getTime();c.hasOwnProperty("hits")?
c.hits+=1:c.hits=1;c.item=b;c.title=d.title;if(!c.hasOwnProperty("states"))c.states=[];if(!c.hasOwnProperty("elapsed"))c.elapsed=0;if(!c.hasOwnProperty("elapsed_previous"))c.elapsed_previous=0;if(!c.hasOwnProperty("volume"))c.volume=[];if(!c.hasOwnProperty("client")&&f===4)c.client=a.getConfig().client.replace(",",".");if(!c.hasOwnProperty("version")&&f===4)c.version=a.getConfig().version}else if(c=stats[e][current_filenames[e]],a==="load")c.percent=b;else if(a==="size")c.width=b,c.height=d;else if(a===
"state"){if(f==4)if(b==="IDLE")b=0;else if(b==="BUFFERING")b=1;else if(b==="PLAYING")b=2;else if(b==="COMPLETED")b=3,a=="state"&&b=="3"&&setTimeout("parent.Shadowbox.close()",3E3);else return;c.states.push(b+":"+c.elapsed_previous+":"+tdiff(c.timer))}else a==="time"?(Math.round(b)!=c.elapsed_previous&&(c.elapsed+=1),c.elapsed_previous=Math.round(b),c.remaining=Math.round(d),c.duration=Math.round(b+d)):a==="volume"&&c.volume.push(b+":"+c.elapsed_previous+":"+tdiff(c.timer))}}
function getXmlHttpRequestObject(){if(window.XMLHttpRequest)return new XMLHttpRequest;else if(window.ActiveXObject)return new ActiveXObject("Microsoft.XMLHTTP");return null}
function stats_to_params(){var a="stats=",b;for(b in stats)if(stats.hasOwnProperty(b)){a+="playerid="+b+"`";for(var d in stats[b])if(stats[b].hasOwnProperty(d)){a+="filename="+d+"`";for(var e in stats[b][d])if(stats[b][d].hasOwnProperty(e)&&!(e==="elapsed_previous"||e==="timer"))if(e==="states"||e==="volume"){a+=e+"=";for(var f in stats[b][d][e])a+=stats[b][d][e][f]+".";a=a.substr(0,a.length-1);a+="`"}else a+=e+"="+stats[b][d][e]+"`";a=a.substr(0,a.length-1);a+="`"}a=a.substr(0,a.length-1);a+="`"}return a=
a.substr(0,a.length-1)}function log_status(){if(stats!==null){var a=getXmlHttpRequestObject();if(a!==0&&(a.readyState===4||a.readyState===0)){var b=stats_to_params(),d=!1;window.ActiveXObject&&(d=!0);a.open("POST",LOGSCRIPT,d);a.setRequestHeader("Content-Type","application/x-www-form-urlencoded");a.setRequestHeader("Content-Length",b.length);a.setRequestHeader("Connection","close");a.send(b)}}}
function playerReady(a){a=get_swf_object(a.id);a.getConfig().state!="IDLE"&&getUpdate("item",a.getConfig().item,null,a.id,4);a.addControllerListener("ITEM","function (obj) { getUpdate('item', obj.index, null, obj.id, 4); }");a.addModelListener("LOADED","function (obj) { getUpdate('load', obj.loaded, null, obj.id, 4); }");a.addControllerListener("RESIZE","function (obj) { getUpdate('size', obj.width, obj.height, obj.id, 4); }");a.addModelListener("STATE","function (obj) { getUpdate('state', obj.newstate, null, obj.id, 4); }");
a.addModelListener("TIME","function (obj) { getUpdate('time', obj.position, obj.duration - obj.position, obj.id, 4); }");a.addControllerListener("VOLUME","function (obj) { getUpdate('volume', obj.percentage, null, obj.id, 4); }")}function closeSB(a,b){a=="state"&&b=="COMPLETED"&&setTimeout("parent.Shadowbox.close()",2E3)}navigator.appName.indexOf("Microsoft")!==-1?window.attachEvent("onunload",log_status):window.addEventListener("unload",log_status,!1);
