;(function(){  var QT = { conf: { url: "http://d.seznam.cz/hit/?", pingDelay: [100000, 300000, 600000], scrollDelay: 800, version: 101, slowPing: 1200000, id: "a" + new Date().getTime().toString() + Math.random().toString(), service: "", app: "" },  send: function(action, data) { var obj = {}; this._commonData(obj); var userAction = false;  switch (action) { case "impress": obj["referer"] = document.referrer; obj["url"] = document.location.href; var plugins = QT._getPlugins(); if (plugins.length) { obj["plugin"] = plugins; } break;  case "mousedown": var target = data.target || data.srcElement; this._customData(obj, target);  if (target.form && target.name) { obj["fieldname"] = target.name; obj["fieldvalue"] = this._formValue(target); }  while (target && target.nodeName.toLowerCase() != "a") { target = target.parentNode; } if (target) { obj["href"] = target.href; obj["text"] = target.innerHTML; } var pos = this._pos(data); this._coords = pos; obj["x"] = pos[0]; obj["y"] = pos[1]; break;  case "mouseup": var pos = this._pos(data); if (pos[0] == this._coords[0] && pos[1] == this._coords[1]) { return; }  var target = data.target || data.srcElement; this._customData(obj, target); obj["x"] = pos[0]; obj["y"] = pos[1]; break;  case "submit": var target = data.target || data.srcElement; this._customData(obj, target); obj["formaction"] = target.action; break;  case "unload": var t = new Date().getTime(); obj["time"] = t-this._time; break;  case "scroll": case "resize": obj["count"] = this._delayedCount; break;  case "ping": case "focus": case "blur": break;  default: userAction = true; if (data) { for (var p in data) { obj["_" + p] = data[p]; } } break; }  var ALLOWED = ["mousedown", "submit", "impress"]; var found = false; for (var i = 0; i < ALLOWED.length; i++) { if (ALLOWED[i] == action) { found = true; break; } } if (!found) { return; }  if (userAction) { obj["action"] = "_" + action; } else { obj["action"] = action; }  var arr = []; for (var p in obj) { var val = obj[p]; if (!(val instanceof Array)) { val = [val]; } for (var i=0;i<val.length;i++) { arr.push(encodeURIComponent(p) + "=" + encodeURIComponent(val[i])); } } this._request(arr.join("&"));  this._schedulePing(); },  init: function(service, app) { this.conf.service = service || ""; this.conf.app = app || "";  if (!window.name) { window.name = this.conf.id; }  this._attach(window, "load", function() { QT.send("impress"); }); this._attach(document, "mousedown", function(e) { QT.send("mousedown", e); }); this._attach(document, "mouseup", function(e) { QT.send("mouseup", e); }); this._attach(document, "submit", function(e) { QT.send("submit", e); }); this._attach(window, "resize", function(e) { QT._delayed(e); }); this._attach(window, "unload", function(e) { QT.send("unload"); }); this._attach(window, "scroll", function(e) { QT._delayed(e); });  this._attach(window, "focus", function(e) { QT._startPing(e); }); this._attach(window, "blur", function(e) { QT._stopPing(e); }); },  _pos: function(e) { return [ e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft || 0), e.clientY + (document.documentElement.scrollTop || document.body.scrollTop || 0) ]; },  _commonData: function(obj) { obj["name"] = window.name; obj["v"] = this.conf.version; obj["service"] = this.conf.service; if (this.conf.app) { obj["app"] = this.conf.app; } obj["id"] = this.conf.id; obj["ts"] = new Date().getTime();  var ch = (document.characterSet || document.charset || "").toLowerCase(); if (ch != "utf-8") { obj["charset"] = ch; }  var sx = document.documentElement.scrollLeft || document.body.scrollLeft || 0; var sy = document.documentElement.scrollTop || document.body.scrollTop || 0; obj["scroll"] = sx + "," + sy;  var w = document.documentElement.clientWidth || document.body.clientWidth || 0; var h = document.documentElement.clientHeight || document.body.clientHeight || 0; obj["port"] = w + "," + h;  obj["page"] = document.body.offsetWidth + "," + document.body.offsetHeight; obj["screen"] = screen.width + "," + screen.height + "," + screen.colorDepth;  var h = document.getElementsByTagName("body"); if (h.length) { this._customData(obj, h[0]); } },  _request: function(url) { var img = document.createElement("img"); img.src = this.conf.url + url; },  _customData: function(obj, elm) { var arr = []; var node = elm; while (node && node != document) { var value = node.getAttribute("data-dot"); if (value) { arr.unshift(value); } node = node.parentNode; } if (arr.length) { obj["data"] = arr; } },  _attach: function(elm, event, cb) { if (elm.addEventListener) { elm.addEventListener(event, cb, false); } else { elm.attachEvent("on"+event, cb); } },  _ping: function() { if (!QT._slowPing && QT.conf.pingDelay.length > 1) { QT.conf.pingDelay.shift(); } QT.send("ping"); },  _schedulePing: function() { if (QT._pingTimeout) { clearTimeout(QT._pingTimeout); } var timeout = (QT._slowPing ? QT.conf.slowPing : QT.conf.pingDelay[0]); QT._pingTimeout = setTimeout(QT._ping, timeout); },  _startPing: function() { QT._slowPing = false; QT.send("focus"); },  _stopPing: function() { QT._slowPing = true; QT.send("blur"); },  _delayed: function(e) { this._delayedName = e.type; if (this._delayedTimeout) { clearTimeout(this._delayedTimeout); this._delayedTimeout = null; }  this._delayedCount++;  this._delayedTimeout = setTimeout(function(){ QT.send(QT._delayedName); QT._delayedCount = 0; }, this.conf.scrollDelay); },  _getPlugins: function() { var data = []; if (navigator.plugins && navigator.plugins.length) { for (var i=0;i<navigator.plugins.length;i++) { var plug = navigator.plugins[i]; var name = (plug.name.match(/[0-9]/) ? plug.name : plug.description); data.push(name); } } else if (window.ActiveXObject) { var DEF = { "AcroPDF.PDF": function() { return this.GetVersions(); }, "PDF.PdfCtrl": function() { return this.GetVersions(); }, "ShockwaveFlash.ShockwaveFlash": function() { return this.GetVariable("$version"); }, "QuickTime.QuickTime": function() { return this.QuickTimeVersion; }, "rmocx.RealPlayer G2 Control": function() { return this.GetVersionInfo(); }, "rmocx.RealPlayer G2 Control.1": function() { return this.GetVersionInfo(); }, "RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)": function() { return this.GetVersionInfo(); }, "RealVideo.Rep.CalVideo(tm) ActiveX Control (32-bit)": function() { return this.GetVersionInfo(); }, "RealPlayer": function() { return this.GetVersionInfo(); }, "WMPlayer.OCX": function() { return this.versionInfo; }, "AgControl.AgControl": function() { return (this.IsVersionSupported("3.0") && "3") || (this.IsVersionSupported("2.0") && "2") || (this.IsVersionSupported("1.0") && "1"); } }; var o, name; for (var p in DEF) { try { o = new ActiveXObject(p); name = p; } catch (e) { continue; } try { v = DEF[p].call(o); name += " " + v; } catch (e) { } data.push(name); } } return data; },  _formValue: function(elm) { if (elm.nodeName.toLowerCase() == "select") { var arr = []; var options = elm.getElementsByTagName("option"); for (var i=0;i<options.length;i++) { var o = options[i]; if (o.selected) { arr.push(o.value); } } return arr; } else  { return elm.value; } },  _pingTimeout: null, _time: new Date().getTime(), _delayedTimeout: null, _delayedCount: 0, _delayedName: "", _slowPing: false, _coords: []  };  window.QT = QT;  })();
