var position = 0; var tStart = null; var c=0; var docHeight=null; var dateD; var dateid; var cnt=0; var install_dir = document.getElementById('includeJS').src; var a = document.getElementById('includeJS').src; var b = ''; var c = ''; a = a.split('//'); b = a[1].split('/'); for(i=1; i test2) { y = document.body.scrollHeight; } else { y = document.body.offsetHeight; } return(y); } function f_clientWidth() { return f_filterResults ( window.innerWidth ? window.innerWidth : 0, document.documentElement ? document.documentElement.clientWidth : 0, document.body ? document.body.clientWidth : 0 ); } function f_clientHeight() { return f_filterResults ( window.innerHeight ? window.innerHeight : 0, document.documentElement ? document.documentElement.clientHeight : 0, document.body ? document.body.clientHeight : 0 ); } function f_scrollLeft() { return f_filterResults ( window.pageXOffset ? window.pageXOffset : 0, document.documentElement ? document.documentElement.scrollLeft : 0, document.body ? document.body.scrollLeft : 0 ); } function f_scrollTop() { return f_filterResults ( window.pageYOffset ? window.pageYOffset : 0, document.documentElement ? document.documentElement.scrollTop : 0, document.body ? document.body.scrollTop : 0 ); } function f_filterResults(n_win, n_docel, n_body) { var n_result = n_win ? n_win : 0; if (n_docel && (!n_result || (n_result > n_docel))) n_result = n_docel; return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result; } function poll(){ if (document.body.scrollTop){var position = document.body.scrollTop;} else {var position = window.pageYOffset;} if (document.body.scrollHeight != 'undefined') { docHeight = document.body.scrollHeight; } var percentDown = Math.round(((f_scrollTop() + f_clientHeight()) / pageHeight())*100); var docHeight = f_clientHeight(); var position = f_scrollTop() + (Math.round(docHeight / 2)); if(!tStart) tStart = new Date(); var tDate = new Date(); var tDiff = tDate.getTime() - tStart.getTime(); tDate.setTime(tDiff); var curr_sec = tDate.getSeconds(); var curr_min = tDate.getMinutes(); var godi = position; godi += " " + curr_min + ":" + curr_sec + " - " + pageHeight(); if(cnt < 600){ sendRequest(position, dateid, percentDown, curr_sec); } cnt++; return true; } function createXMLHttpRequest() { var ua; if(window.XMLHttpRequest) { try { ua = new XMLHttpRequest(); } catch(e) { ua = false; } } else if(window.ActiveXObject) { try { ua = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { ua = false; } } return ua; } var req = createXMLHttpRequest(); function sendRequest(scriptAr, curr_min, percentDown, curr_sec) { req.open("GET", install_dir + "func.php?current_url=" + curr_loc + "&valstring=" + scriptAr + "&curr_min=" + curr_min + "&percentDown=" + percentDown + "&curr_sec=" + curr_sec); req.send(null); } function handleResponse() { if(req.readyState == 4){ var ni = document.getElementById('mydiv'); var newdiv = document.createElement('div'); var divIdName = 'mydiv'; var divst = 'z-index:100;position:float;left:0;top:0px'; var str; newdiv.setAttribute('id',divIdName); newdiv.setAttribute('style',divst); newdiv.setAttribute('id',divIdName); var response = req.responseText; newdiv.innerHTML = response; ni.appendChild(newdiv); } }