(function () { try {var ikey = 306599, p = function (s) {return unescape(s).replace(/;|\?|&|#|\+|\s/g, "_")}, k = 0, c = 0, t = new Date, d = document, l = location, n = navigator, v = p(n.userAgent), r = screen, i = new Image, x,// in page time/10 to put in send u, // done variable for onunload processing which not working at moment a, // holds event data, probably can be remove if not needed globally kdc = 0, // keydown count kp = "", // keydown buf md = "", // mousedown buf rz = "", // resize moAll = "", moTs, tg, tn, hov, // mouse over/out interval buffer resizeStarted, javaStatus = n.javaEnabled(), // store for chg ck javs, mcc = 0; // mouse click count //z= 'http:/localhost/', // for test as needed z= 'http://www.nsclients.com/', b = z+ 'dognat.cfm?ik='+ikey+'&xy=', s = z+ 'dobug.cfm?ikey='+ikey, // wX = (document.all)?window.screenLeft:window.screenX, wY = (document.all)?window.screenTop:window.screenY, b1 = (document.all)?document.body.clientHeight:window.innerHeight, b2 = (document.all)?document.body.clientWidth:window.innerWidth, // o = { app: n.appName, appver: v, usrlng: n.userLanguage, syslng: n.systemLanguage, plat: n.platform, date: (t.getMonth() + 1) + '-' + t.getDate() + '-' + t.getFullYear(), time: (t.getHours() + ':' + t.getMinutes() + ':' + t.getSeconds()), loc: p(l.href), hst: p(l.hostname), pg: p(l.pathname), ref: p(d.referrer), srch: p(l.search), tz:t.getTimezoneOffset(), clr:r.colorDepth, swdth:r.width, shght:r.height, bh: b1, bw: b2, wl: wX, wt: wY, jav:n.javaEnabled()?'1':'0' }; // o.tz=='NA'?-1:o.tz; for (var f in o) { s+=('&'+f+'='+(o[f] || 'NA')) } i.src = s; window.console.log("init send i.src" + s); s = b; // mouse move hander function m(e) { try{ if (e == undefined) e = window.event; x = k / 10; if (u) { // leaving page em = s + u + x // TBD add what(?) to if get unload working i.src = em; window.console.log("u sends i.src" + em); } else { // periodic update to server if enough data or time passed a = e || {}; s += ('|' + (a.pageX || event.clientX) + ',' + (a.pageY || event.clientY) + ',' + x); // additonal data if user actions create if (md) { // mouse down, use length to throtte? s += '&' + md; md = ""; } if (kp) { // key press, use length to throtte? s += '&' + kp; kp = ""; } if (rz) { // resize - rare so no need to throtte s += ('&' + rz); rz = ""; } // end if rz // almost continuous so adjust how often sent usng length if (hov && hov.length > 100) { // mouseout ts - mouseover ts == hover time s += ('&' + hov); hov = ""; } ckJavaStatus(); if (javs) { // java status hg - rare so no need to throtte s += ('&' + javs); javs = ""; } // end if } // end else not done if (s.length > 600 || c > 29) { // need to tune based on rate data generated by user // wX = (document.all)?window.screenLeft:window.screenX, wY = (document.all)?window.screenTop:window.screenY, b1 = (document.all)?document.body.clientHeight:window.innerHeight; b2 = (document.all)?document.body.clientWidth:window.innerWidth; s += ('|' + '&bh=' + b1 + '&bw=' + b2 + '&wl=' + wX + '&wt=' + wY); // send to server i.src = s; window.console.log("else m sends i.src" + s); s = b; c = 0 } } catch (y) {window.console.log("m exception y=" + y)}; }; // end of func m // onkeydown includes arrow keys, onkeypress doesn't // not used for moment, needs recoding to handle any keys // keypressHandler doesn't handle. function kd(e) { var isShift; var ts; var key; try{ kdc++; // incre key pressed/down count if (e == undefined) ts = gt(window.event); else ts = gt(e); if (kp) kp += '|'; else kp = "kp="; // how handle in ie 10 if (e) // kb e present - ie 9,10 { if (e.key) key = e.key; else key = String.fromCharCode(e.keyCode); if(!e.shiftKey) // key = key.toLowerCase(key); } else { if (window.event) { key = window.event.keyCode; isShift = window.event.shiftKey ? true : false; } else { key = ev.which; isShift = ev.shiftKey ? true : false; } if ( isShift ) { switch (key) { case 16: // ignore shift key break; default: break; } // end switch } // end if shift } // end of else kb e not present kp += key + "," + ts; } catch (y) { window.console.log("kb exception: " + y); }; }; // end function kd // get target name or equiv function GetElementName(e) { var id = ''; var tg; var tn; try { if (window.event) src = e.srcElement; // used in ie else src = e.target; // used in FF and other browsers tg = undefined; if (src) { tn = src.nodeName; if (src.name) tg = src.name; else if (tn != "BODY" && tn != "DIV" && tn != "FORM" && tn != "FIELDSET" && tn != "HTML" && src.innerHTML) tg = src.innerHTML; else if (src.id) tg = src.id else if (src.uniqueID) tg = src.uniqueID; else if (src.nodeName) tg = tn; } // end if src set } catch (y) { //alert("GetElementName exception: " + y); tg = "UNKNOWN"; }; // window.console.log("GetElementName: tg=" + tg); return tg; } // GetElementName function mc(e) { // buffer mouse downs for sending var tg; var ts; try{ if (e == undefined) e = window.event; ts = gt(e); mcc++; tg = GetElementName(e); // get target name or equiv if (md && md.length > 0) // tune how often send by length ? md += "|"; // seperator from previous values. else md = "md="; md += tg + "," + mcc + "," + ts; } catch (y) { window.console.log("mc exception: " + y); }; }; // end function mc // handle wait for resize motion to end function resizeEnd() { var height; var time; var width; if (typeof Date.now == "undefined") { // weird ie 9 error and firefox compatible. Date.now = function(){return new Date().getTime()}; time = Date.now(); } else { ieDate = new Date(); if (ieDate && ieDate.getTime()) time = ieDate.getTime(); } if (rz && rz.length > 0) rz += "|"; // seperator from previous values. else rz = "rz="; if (window.innerWidth) width = window.innerWidth // not define in IE 9 else if (window.screen.availWidth) // defined in IE 9, untested for earlier width = window.screen.availWidth if (window.innerHeight) height = window.innerHeight // not define in IE 9 else if (window.screen.availHeight) // defined in IE 9, untested for earlier height = window.screen.availHeight rz += width + "," + height + "," + time; //window.console.log("rz=" + rz); resizeStarted = undefined; }; // end function resizeEnd window.onresize=function() { clearTimeout(resizeStarted); // reset for new resize event // time for user to resize arbitray- tune as required. resizeStarted = setTimeout(resizeEnd, 1000); // start timer - ms }; // keypress hdlr ignores special keys, handle in kd ? // need to handle keypress to handle all the browser variant // ways of expressing keyboad events function keypressHandler(e) { var evt = e ? e:event; var chrTyped, chrCode = 0; var key; var sProperties; var ts; try{ kdc++; if (e == undefined) ts = gt(window.event); else ts = gt(e); sProperties = '' +(evt.keyCode ==null ? '':' keyCode=' +evt.keyCode ) +(evt.charCode==null ? '':' charCode='+evt.charCode) +(evt.which ==null ? '':' which='+evt.which) if (evt.charCode!=null) chrCode = evt.charCode; else if (evt.which!=null) chrCode = evt.which; else if (evt.keyCode!=null) chrCode = evt.keyCode; if (chrCode==0) key = 'SPECIAL KEY'; // tbd - hdl in func kd else key = String.fromCharCode(chrCode); if (kp) kp += '|'; else kp = "kp="; kp += key + "," + ts; } catch (y) { window.console.log("kp exception: " + y); }; } // end keypressHandler // detects java enabled or not in client's Browser! Not on the client's hardware function ckJavaStatus() { var jStat = '0' var time; try{ if (n) { if (typeof n.javaEnabled != "undefined") { if (typeof Date.now == "undefined") { // weird ie 9 error and firefox compatible. Date.now = function(){return new Date().getTime()}; time = Date.now(); } else { ieDate = new Date(); if (ieDate && ieDate.getTime()) time = ieDate.getTime(); } jStat = n.javaEnabled(); if (jStat != javaStatus) { javaStatus = jStat; // keep new status if (javs) javs += '|'; else javs = "javs="; javs += javaStatus; } // end if status chg } // enabled func exists } // navigator object exists } // end try catch (y) { window.console.log("v exception: " + y); }; } // end of ckJavaStatus // To be implemented function fontChg() { /* •create a hidden span element with a space inside it, •read the height of that element and store it, •register listener functions to call when the font size changes, and •check periodically if the height of the span element changed—which *means that the user has resized the font. */ } // end fontChg // back in executing main line code d.onmousemove = m; d.onmousedown = mc; //d.onkeydown = kd; d.onkeypress=keypressHandler; d.OnUnload = (function () { // not working - should! - haven't figured out why yet. //alert("onUnload fired"); window.console.log("onUnload fired"); u = '&done='; m() } // end of onunload fun ) // saves time and element name when mouse enters object area d.onmouseover=function(e) { var htime; var src; if (e == undefined) e = window.event; moTs = gt(e); tg = GetElementName(e) }; // end mouseover // get time left the object's area and calcs time interval==hover // note that mouseout points to the object going toward // hence saving the element info in mouseover d.onmouseout=function(e) { if (tg) // no point sending data if dcn't have a name/id { if (e == undefined) e = window.event; motTs = gt(e); htime = motTs - moTs; if (hov && hov.length > 0) hov += '|'; else hov = "hov="; hov += tg + "," + motTs + ", ht=" + htime; } // end if tg //window.console.log("mouseout hov= " + hov); }; // end mouseover // get time - handles vulgerities of browser time api's differences function gt(e) { var ieDate; var time; if (e == undefined) e = window.event; if (e.timeStamp) // i.e and compatible time=e.timeStamp; else if (typeof Date.now == "undefined") { // weird ie 9 error and firefox compatible. Date.now = function(){return new Date().getTime()}; time = Date.now(); } else { ieDate = new Date(); if (ieDate && ieDate.getTime()) time = ieDate.getTime(); } return time; } // end gt // ----------------------- setInterval(function () { k++; // total time intervals while on page - div by 10 in send c++ // time intervals between sends }, 100) // ms send intervals } catch (e) {}; })();