var sendedStats = {}; function ErrorLog(cookieName, cookieValue, errorSave) { cookieValue+='|'+((new Date()).getTime())/1000; if (errorSave) document.cookie = cookieName + '=' + encodeURIComponent(cookieValue) + '; path=/'; else if (document.cookie.indexOf(cookieName+'=')!=-1) document.cookie = cookieName + '=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; } function SendEvent(eventName) { if (eventName in sendedStats) return; // build url var vId = document.body.getAttribute("vId"); var msg = 'event='+eventName+'&eventPage='+encodeURIComponent(window.location.href)+'&visitId='+encodeURIComponent(vId?vId:0); var url = '/aux/collect.cgi'; // send info if (typeof navigator.sendBeacon !== "undefined") { var blob = new Blob([msg], {type : 'application/x-www-form-urlencoded'}); navigator.sendBeacon(url, blob); } // update sended stats (we send only uniq event) sendedStats[eventName]=true; } function CollectVideoEvents(videoElem) { videoElem.addEventListener('error',function(evt){SendEvent('videoBad');},false); if (/iphone|ipad|ipod/i.test(navigator.userAgent)) videoElem.addEventListener('webkitbeginfullscreen',function(evt){SendEvent('videoZoom');},false); else { var fullscreenEventName = ('onwebkitfullscreenchange' in document ? 'webkitfullscreenchange': 'onfullscreenchange' in document ? 'fullscreenchange' : 'onmozfullscreenchange' in document ? 'mozfullscreenchange' : 'MSFullscreenChange'); document.addEventListener(fullscreenEventName,function(evt){SendEvent('videoZoom');},false); } } function StartCollectEvents() { if (!document.addEventListener || !window.XMLHttpRequest) return; // add nav listener var nav = document.getElementById("topControls"); if (nav!=null) { var navAnchors = nav.getElementsByTagName("a"); for (var x=0;x