lgurlinf_bnr_0 = "/web/banner" + "inf?lg=1&f=fdmlib&bt=fdm728&l=en&cn=&rf=&pl=0"; var bidinf_bnr_0 = false; lgcurlinf_bnr_0 = lgurlinf_bnr_0 + "&a=click"; lgvpinf_bnr_0 = lgurlinf_bnr_0 + "&a=viewport"; var inf_bnr_0_sc=0; function ifScrollTo(id) { if (document.getElementById(id) == null) { return false; } hT = document.getElementById(id).getBoundingClientRect().top; if (document.getElementById(id).offsetTop > hT) { hT = document.getElementById(id).offsetTop; } hH = document.getElementById(id).offsetHeight; wH = window.screen.height; wS = window.scrollY; //console.log(id + ' scrolling ' + wS + ' wH ' + wH + ' element ' + hH + ' at ' + hT); if ( (wS > (hT+1.5*hH-wH)) && (wS < (hT+hH)) ) { return true; } else return false; } function checkViewBegin(id) { if (window[id+'_sc'] == 2) { return; } if (ifScrollTo(id)) { if (window[id+'_sc'] == 0) { //console.log('Begin view of '+id); window[id+'_sc'] = 1; setTimeout(function() { checkViewEnd(id); }, 1000); } } else { if (window[id+'_sc'] == 1) { //console.log('End view of '+id); window[id+'_sc'] = 0; } } } function checkViewEnd(id) { if ( (window[id+'_sc']==1) && ifScrollTo(id) ) { window[id+'_sc'] = 2; console.log('Lgv '+id); window['lgvp_'+id](); } } document.addEventListener( "scroll", function() { checkViewBegin('inf_bnr_0'); } ); function getid_inf_bnr_0(e) { x = e.srcElement || e.target; if (x.readyState == 4 && x.status == 200) { var response = x.responseText; bidinf_bnr_0 = response; //console.log('R: '+response); checkViewBegin('inf_bnr_0'); } } function go_inf_bnr_0(e) { return true; x = e.srcElement || e.target; if (x.readyState == 4 && x.status == 200) { //console.log('lg'); var win = window.open('https://freedownloadmanager.org/landing.htm?from=b_fdmlib', '_blank'); if (win) { win.focus(); } } } function ec(e) {} function httpGetAsync(theUrl, callback) { var xmlHttp = new XMLHttpRequest(); xmlHttp.onreadystatechange = callback; xmlHttp.open("GET", theUrl, true); // true for asynchronous xmlHttp.send(null); } function lgcl_inf_bnr_0(event) { u = lgcurlinf_bnr_0 + '&bid=' + bidinf_bnr_0; httpGetAsync(u, go_inf_bnr_0); //event.preventDefault(); //return false; } function lgvp_inf_bnr_0() { u = lgvpinf_bnr_0 + '&bid=' + bidinf_bnr_0; httpGetAsync(u, ec); } document.getElementById("inf_bnr_0").innerHTML = '\ \ \ '; httpGetAsync(lgurlinf_bnr_0, getid_inf_bnr_0);