var id = "63386ef0d647d"; var load_method = 1; var querystr = ""; var afmlockerurl = "https:\/\/www.hubverify.com\/cl2\/contentlocker.php?" + 'o=' + encodeURIComponent(id) + querystr; var iframecontents; var old_display; window.onbeforeunload = function() { return 'Are you sure you want to leave?'; } function optionstoquery(options) { var query = ""; if (options.mt) query += "&mt=" + encodeURIComponent(options.mt); if (options.dt) query += "&dt=" + encodeURIComponent(options.dt); if (options.dd) query += "&dd=" + encodeURIComponent(options.dd); if (options.md) query += "&md=" + encodeURIComponent(options.md); return query; } function afm_locker_load(options) { if (options) afmlockerurl += optionstoquery(options); //preload var xhr = new XMLHttpRequest(); xhr.open('GET', afmlockerurl, true); xhr.onreadystatechange = function() { if (this.readyState!==4) return; if (this.status!==200) { iframecontents = false; return; } iframecontents = this.responseText; }; xhr.send(); afmChangeBody(); } function afmChangeBody() { var body = document.getElementsByTagName('body')[0]; if(document.getElementsByTagName('body')[0] === undefined) { setTimeout(afmChangeBody, 100); return; } var old_overflow = body.style.overflow; old_display = body.style.display; //body.style.display = 'none'; afmCreateLocker(); } function afmCreateLocker() { var body = document.getElementsByTagName('body')[0]; if(iframecontents === undefined) { setTimeout(afmCreateLocker, 100); return; } body.style.display = old_display; if(iframecontents !== false) { var body = document.getElementsByTagName('body')[0]; var iframe = document.createElement('iframe'); iframe.name = 'iframe'; iframe.scrolling = 'yes'; iframe.frameborder = '0'; iframe.style.border = 'none'; iframe.style.width = '100%'; iframe.style.height = '100%'; iframe.style.position = 'fixed'; iframe.style.top = 0; iframe.style.left = 0; iframe.style.zIndex = 16777271; iframe.id = 'test_iframe'; body.appendChild(iframe); iframe = document.getElementById("test_iframe"); iframe.contentDocument.write(iframecontents); } } function show_locker(options) { afm_locker_load(options); } afm_locker_load();