function showResponse(result) { //sets the payment type window.payment_options = document.getElementById('payment_div').innerHTML; document.getElementById('payment_div').innerHTML = result; document.getElementById('back_to_payment_options').style.display = 'block'; window.last_payment_amount = document.getElementById('amount').value; //check ok + do action if(result.indexOf('RES:OK:wechat')>-1) { tmp = result.split('RES:OK:wechat[:]'); tmp = tmp[1].split('[:]'); AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=create_payment_request&provider=wechat&local_id='+window.uniqueid+'&item_name='+tmp[0]+'&item_id='+tmp[1]+'&item_amount='+tmp[2]+'&item_currency='+tmp[3],false,'qrCodeHandling'); setInterval(function() { checkUpdate(purchase_desc,purchase_id,currency); }, 1000); } if(result.indexOf('RES:OK:card')>-1) { tmp = result.split('RES:OK:card[:]'); tmp = tmp[1].split('[:]'); } if(result.indexOf('RES:OK:paypal')>-1) { //start pinging atf every 2 seconds for an update window.paid = false; setInterval(function() { AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=check_payment&uniqueid='+window.uniqueid,false,'paymentResponse'); }, 2000); } if(result.indexOf('RES:OK:alipay')>-1) { //start pinging atf every 2 seconds for an update window.paid = false; setInterval(function() { AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=check_payment&uniqueid='+window.uniqueid,false,'paymentResponse'); }, 2000); } } function checkUpdate() { if(window.last_payment_amount!=document.getElementById('amount').value) { clearInterval(window.check_payment_handle); AjaxCall('?new_payment_request&type='+window.last_payment_type+'&price='+document.getElementById('amount').value+'&desc='+document.getElementById('purchase_desc').value+'¤cy='+document.getElementById('currency').value+'&id='+document.getElementById(purchase_id).value,false,'showResponse'); } } function cardPaymentHandling(result) { //it worked or it didnt if(result.indexOf('<[RES[OK')>-1) { paymentSuccessful(); } else { document.getElementById('status_image').src = 'https://cdn.atfgroup.com.cn/l4CK7K7N5YpGfJwKnyRXLOQLGgA9Eq7R.png'; document.getElementById('status_image').width = '110'; document.getElementById('status_image').height = '100%'; document.getElementById('payment_status').innerHTML = 'Sorry, your payment was not accepted. try again'; } } function paymentSuccessful() { document.getElementById('status_image').src = 'https://cdn.atfgroup.com.cn/FtaTgKhXMlAlecKoiKky3J6TzYQ0i7Ct.png'; document.getElementById('status_image').width = '115'; document.getElementById('status_image').height = '115'; document.getElementById('payment_status').innerHTML = 'Payment successful!'; document.getElementById('back_to_payment_options').style.display = 'none'; window.paid = true; clearInterval(); } function reloadPaymentOptions() { if(window.payment_options!='') { document.getElementById('payment_div').innerHTML = window.payment_options; //reload stripe scripts showCardPayment(); } } function checkPaymentSuccess(payment_id) { //ping paymentid back, is it paid yet? payment_id AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=check_payment&payment_id='+payment_id,false,'paymentResponse'); } function paymentResponse(payload) { if(payload.indexOf('<[RES[PAID')>-1) { if(!window.paid) { paymentSuccessful(); } } } function qrCodeHandling(payload) { if(payload.indexOf('<[RES[SUCCESS[[')>-1) { tmp = payload.split('SUCCESS[['); tmp = tmp[1].split(']]]'); payload = JSON.parse(tmp[0]); document.getElementById('status_image').src = payload['qr_code']; //ping every 2 seconds for an update for payment window.paid = false; window.check_payment_handle = setInterval(function() { checkPaymentSuccess(payload.payment_id); }, 4000); } } function showCardPayment() { window.paymentHandler = StripeCheckout.configure({ key: 'pk_live_c6Pocns6JlCg5svExofTLjbP', image: 'https://stripe.com/img/documentation/checkout/marketplace.png', locale: 'auto', token: function(token) { //show charging card message and send token to core document.getElementById('payment_status').innerHTML = 'Charging your card... please wait'; AjaxCall('?type=charge_card&uniqueid='+window.uniqueid+'&token='+token.id,false,'cardPaymentHandling'); } }); document.getElementById('cardPayment').addEventListener('click', function(e) { window.last_payment_type='card'; // Open Checkout with further options: window.paymentHandler.open({ name: document.getElementById('purchase_desc').value, description: document.getElementById('purchase_desc').value, currency: document.getElementById('currency').value, amount: parseFloat(document.getElementById('amount').value+"00") }); // send update to us AjaxCall('?new_payment_request&type=card&price='+document.getElementById('amount').value+'&desc='+document.getElementById('purchase_desc').value+'¤cy='+document.getElementById('currency').value+'&id='+document.getElementById('purchase_id').value,false,'showResponse'); e.preventDefault(); }); // Close Checkout on page navigation: window.addEventListener('popstate', function() { window.paymentHandler.close(); }); } function loadScript(url, callback){ var script = document.createElement("script"); script.type = "text/javascript"; if (script.readyState){ //IE script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function(){ callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); } window.job_title = ''; window.account_id = 0; window.stored_html = ''; function showLogin() { window.login_div = createWindow("Login", '

Login
Haven\'t registered yet? register.

Username:
Password:
'); //detect enter key press detectKeyPress('lbpass','doLogin'); //login leadbox animate start /**var current = null; document.getElementById('lbemail').addEventListener('focus', function(e) { if (current) current.pause(); current = anime({ targets: '.check1', strokeDashoffset: { value: 0, duration: 700, easing: 'easeOutQuart' }, strokeDasharray: { value: '240 1386', duration: 700, easing: 'easeOutQuart' } }); }); document.getElementById('lbpass').addEventListener('focus', function(e) { if (current) current.pause(); current = anime({ targets: '.check1', strokeDashoffset: { value: -336, duration: 700, easing: 'easeOutQuart' }, strokeDasharray: { value: '240 1386', duration: 700, easing: 'easeOutQuart' } }); }); **/ //login leadbox animate end }; function doLogin() { window.username = document.getElementById('lbemail').value; password = document.getElementById('lbpass').value; if(window.username.length>3&&password.length>3) { //show waiting window.stored_html = document.getElementById('login_div').innerHTML; if(document.getElementById('login_button')){ //if login_button, just change that document.getElementById('login_button').value = "Logging in..."; document.getElementById('login_button').disabled = true; } else { document.getElementById('login_div').innerHTML = '



Checking credentials...'; } AjaxCall("?atf_do_login&username="+btoa(encodeURIComponent(window.username))+"&password="+btoa(encodeURIComponent(password)),false,"loginReply"); } else { if(document.getElementById('lbpass').value==''&&/^\d+$/.test(document.getElementById('lbemail').value)&&document.getElementById('lbemail').value.length>6) { sendCode(); } else { message = 'Please enter your phone number / username and password.'; if(document.getElementById('lbpass').placeholder=='密码'||window.lang=='cn') { window.lang = 'cn'; message = '请输入您的电话号码和密码。'; } document.getElementById('code_error').innerHTML = message; } } }; function loginReply(data) { if(data.indexOf('[RES[OK')>-1) { //show success //document.getElementById('biscuitsDialog').style.textAlign = 'center'; //document.getElementById('biscuitsDialog').style.padding = '8px'; if(document.getElementById('login_success')){ document.getElementById('login_success').innerHTML = "
Login successful!
"; document.getElementById('login_success').style.textAlign = 'center'; } else { document.getElementById('login_div').innerHTML = "


Login successful!
"; document.getElementById('login_div').style.textAlign = 'center'; } window.loggedin = true; //get the account_id tmp = data.split('[OK:'); tmp = tmp[1].split(']]'); window.account_id = tmp[0]; if(window.job_id>0) { sendAccountDetailsToClient(window.job_id,window.employer_id,window.job_title); } //wait 1 seconds and reload setTimeout(function(){ window.location.reload(1); }, 1000); } else { document.getElementById('login_div').innerHTML = window.stored_html; document.getElementById('lbemail').value = window.username; window.stored_html = ''; document.getElementById('code_error').innerHTML = "Sorry your username or password is incorrect."; } }; function sendAccountDetailsToClient(job_id,employer_id,account_id,job_title) { //show applying closeRegister(); var div = document.createElement('div'); div.setAttribute('id','biscuitsDialog'); div.style.position = 'fixed'; div.style.zIndex = '20'; div.style.background = '#fff'; div.style.color = 'black'; div.style.boxShadow = '2px 3px 2px #dde2ea'; div.style.textAlign = 'center'; div.style.padding = '8px'; div.style.paddingBottom = '25px'; document.body.appendChild(div); document.getElementById('biscuitsDialog').innerHTML = "



Sending your application to the employer..."; try { centerDialog('biscuitsDialog'); } catch(err) {} account_details = ""; if(typeof account_id != null&&account_id>0) { account_details = "&account_id="+account_id; } if(typeof job_title != null&&job_title!='') { account_details += "&title="+btoa(job_title); } if(typeof window.subject_prefix != null&&window.subject_prefix!='') { account_details += "&subject_prefix="+btoa(window.subject_prefix); } AjaxCall("?atf_send_application&job_id="+job_id+"&employer_id="+employer_id+account_details,false,"applicationReply"); }; function applicationReply(reply) { if(reply.indexOf('ERROR:notloggedin')>-1) { showLogin(); } else if(reply.indexOf('RES[nocv]')>-1) { showFinalStep(); } else if(reply.indexOf('RES[alreadyapplied]')>-1) { document.getElementById('biscuitsDialog').innerHTML = "

You\'ve already applied for this job. Please wait for a reply from the employer shortly."; } else if(reply.indexOf('RES[OK')>-1) { document.getElementById('biscuitsDialog').innerHTML = "



Application sent successfully!"; } else { document.getElementById('biscuitsDialog').innerHTML = "

Sorry, we couldnt process your application right now, please try again."; } if(reply.indexOf('ERROR:notloggedin')==-1) { window.loggedin = true; } try { centerDialog('biscuitsDialog'); } catch(err) { console.log("Dialog Error check") } }; function isLoggedIn() { if(!window.loggedin) { return window.loggedin; } else { return true; } }; function closeRegister() { if(document.getElementById('biscuitsDialog')) { var elem = document.getElementById("biscuitsDialog"); elem.parentElement.removeChild(elem); } }; function doFinalizeAccount() { //handle file var fileSelect = document.getElementById('cv'); var files = fileSelect.files; var formData = new FormData(); var validated = true; var validationErrors = ''; // Loop through each of the selected files. var filesAttachedCount = 0; for (var i = 0; i < files.length; i++) { var file = files[i]; // Check the file type. if (file.name.indexOf('.doc')==-1&&file.name.indexOf('.docx')==-1&&file.name.indexOf('.pdf')==-1&&file.name.indexOf('*.txt')==-1&&file.name.indexOf('.odt')==-1) { validationErrors += 'Sorry, could not add file: '+file.name+' because it is not a .doc, .docx, .pdf, .odt or .txt file'; continue; } // Add the file to the request. formData.append('cvs[]', file, file.name); filesAttachedCount++; } //sort out qualification and nationality nationality = document.getElementById('lbnationality').value; if(document.getElementById('lbnationality').value=='other') { nationality = document.getElementById('lbnationalitycustom').value; } qualification = document.getElementById('lbqualification').value; if(document.getElementById('lbqualification').value=='other') { qualification = document.getElementById('lbqualificationcustom').value; } //validation if(!(qualification.length>1)) { validated = false; validationErrors += 'You must select a qualification
'; } else if(!(nationality.length>3)) { validated = false; validationErrors += 'You must select your nationality
'; } else if(!(filesAttachedCount>0)) { validated = false; validationErrors += 'You must choose your C.V. or resume
'; } if(validated) { // add nationality and qualification formData.append('nationality', nationality); formData.append('qualification', qualification); formData.append('id', window.account_id); //send data AjaxPostCall('?upload_cv_nationality_qualification',formData,'doAccountFinalStep'); } else { document.getElementById('code_error').innerHTML = "Sorry, please check the following and click done again: "+validationErrors; } }; function doAccountFinalStep(res) { if (res.indexOf('RES[OK')>-1) { //handle final action if(window.job_id>0) { sendAccountDetailsToClient(window.job_id,window.employer_id,window.account_id); } else { //show success message document.getElementById('biscuitsDialog').style.textAlign = 'center'; document.getElementById('biscuitsDialog').style.padding = '8px'; document.getElementById('biscuitsDialog').innerHTML = "


Registration success!"; } } else { document.getElementById('code_error').innerHTML = 'Sorry, that didn\'t work, please try again.'; } }; function doNationality() { if(document.getElementById('lbnationality').value=='other') { document.getElementById('lbnationality').style.display = 'none'; document.getElementById('lbnationalitycustom').style.display = 'block'; } }; function doQualification() { if(document.getElementById('lbqualification').value=='other') { document.getElementById('lbqualification').style.display = 'none'; document.getElementById('lbqualificationcustom').style.display = 'block'; } }; function showFinalStep() { //go to next step div_html = "Your nationality:
Highest qualification:
Upload C.V. or Resume

"; try { document.getElementById('registration_fields').innerHTML = div_html; } catch(err) { document.getElementById('biscuitsDialog').innerHTML = '
Please complete your details to continue:

'+div_html; document.getElementById('biscuitsDialog').style.width = '200px'; document.getElementById('biscuitsDialog').style.textAlign = 'left'; } detectKeyPress('cv','doFinalizeAccount'); }; function _accountSettings(title, contentHtmlorLink) { //open a popup and point it at core createWindow(title, contentHtmlorLink); }; function codeReply(res) { if (res.indexOf('RES[ERROR:wait 60 seconds')>-1) { if(document.getElementById('code_error')) { document.getElementById('code_error').innerHTML = 'Code was sent, Please wait 60 seconds before sending another code'; } else { alert('Code was sent, Please wait 60 seconds before sending another code'); } } }; function sendCode() { phone = document.getElementById('lbemail').value; if(phone.startsWith("+")) { phone = phone.replace('+',"00"); } if(/^\d+$/.test(phone)&&phone.length>6) { document.getElementById('lbpass').setAttribute('type','text'); //type=text needed for tulkan, add support on other sites, need to detect type=input placeholder = 'Enter the code sent to your phone'; sent_message = 'Code Sent!'; if(document.getElementById('lbpass').placeholder=='密码'||window.lang=='cn') { placeholder = '输入发送到您手机的代码'; sent_message = '验证码已发送至您的手机,请查收!'; window.lang = 'cn'; } document.getElementById('lbpass').setAttribute('placeholder',placeholder); document.getElementById('code_error').innerHTML = ""+sent_message+""; AjaxCall("?new_code_request&contact="+btoa(encodeURIComponent(phone))+(window.lang?"&lang="+window.lang:""),false,"codeReply"); } else { message = "Please enter a numeric value for the Phone number, at least 6 digits long"; if(document.getElementById('lbpass').placeholder=='密码'||window.lang=='cn') { message = "请输入电话号码的数值,至少6位数字"; } if(document.getElementById('code_error')) { document.getElementById('code_error').innerHTML = message; } else { alert(message); } } }; function showConversation(html) { $('#previous_conversations').hide(); document.getElementById('result').innerHTML = JSON.parse(atob(html)); } function previousConversations(res) { killWindows(); windowShow('previous_conversations'); document.getElementById('previous_conversations_content').innerHTML = res; } function handleCode() { document.getElementById('login_div_password_div').style.display = 'block'; document.getElementById('login_div_new_password_div').style.display = 'block'; document.getElementById('lbpass').type = 'text'; document.getElementById('login_button').value = (window.lang=='en'?"Register":"注册"); document.getElementById('login_div1').setAttribute('onsubmit','checkCode();event.preventDefault();'); sendCode(); } function checkCode() { error = ''; if(document.getElementById('new_lbpass').value.length<5) { error += 'Password must be longer than 4 characters
'; } if(document.getElementById('new_lbpass_2').value!=document.getElementById('new_lbpass').value) { error += 'Password and Confirm Password must be the same
'; } if(document.getElementById('lbpass').value.length!=4) { error += "Code must be 4 characters long, please check"; } if(error=='') { //login AjaxCall("/?atf_do_login&username="+btoa(document.getElementById('lbemail').value)+"&password="+btoa(document.getElementById('lbpass').value),false,'setPassword'); document.getElementById('login_button').value = (window.lang=='en'?"Saving...":"请稍等。。。"); } else { document.getElementById('code_error').innerHTML = error; } } function setPassword() { AjaxCall("?atf_resetpassword="+document.getElementById('lbemail').value+"&code="+document.getElementById('new_lbpass').value,false,"passwordSetFinish"); } function passwordSetFinish() { window.location.href = '/'; } function registerReply(res) { //+"&new_password="+btoa(encodeURIComponent(document.getElementById('new_lbpass').value) if(res.indexOf('[OK:')>-1) { tmp = res.split('[OK:'); tmp = tmp[1].split(']]'); AjaxCall("?atf_resetpassword="+document.getElementById('lbemail').value+"&reset_code="+tmp[0]+"&new_password="+document.getElementById('lbpass').value,false,"registerReply"); } else { document.getElementById('code_error').innerHTML = (window.lang=='en'?"Sorry, an error occured, please try again":"抱歉,发生错误,请重试"); } } function showRegister() { windowShow('login_div'); document.getElementById('login_div_title').innerHTML = (window.lang=='en'?"Register":"注册账户"); document.getElementById('code_text').innerHTML = (window.lang=='en'?"Enter the code sent to your phone":"输入发送到您手机的验证码"); document.getElementById('lbpass').placeholder = (window.lang=='en'?"Enter code":"输入验证码"); windowHide("login_div_password_div"); document.getElementById('register_text').style.display = 'none'; document.getElementById('login_button').value = (window.lang=='en'?"Send Code":"发送验证码"); document.getElementById('login_div1').setAttribute('onsubmit', 'handleCode();event.preventDefault();'); } function windowShow(id){ document.getElementById(id).style.display='flex'; } function windowHide(id){ document.getElementById(id).style.display='none'; } function createWindow(title, contentHtmlorLink) { var div = document.createElement('div'); var div_id = 'contentDiv_'+Date.now(); div.setAttribute('id',div_id); div.style.position = 'fixed'; div.style.zIndex = '2000'; div.style.background = '#fff'; div.style.boxShadow = '2px 3px 2px #dde2ea'; div.style.color = 'black'; div.style.transform = 'scale(1)'; div.style.transition = 'opacity .2s ease-in-out,transform .2s ease-in-out,-webkit-transform .2s ease-in-out'; div.style.outline = '0'; div.style.backgroundColor = '#fff'; div.style.opacity = '1'; div.style.WebkitTapHighlightColor = 'transparent'; div.style.boxShadow = '0 12px 50px 0 rgba(37,32,31,.25)'; div.style.borderRadius = '.375rem'; div.style.padding = '1rem'; document.body.appendChild(div); if(contentHtmlorLink.substring(0,4)=='http') { //fetching link AjaxCall(contentHtmlorLink,"content_"+div_id,"centerContentWindow"); contentHtmlorLink = "Loading... Please wait"; } document.getElementById(div_id).innerHTML = '
'+title+'
X
'+contentHtmlorLink+'
'; if(window.is_mobile) { initializeMoveToCenter("lbemail",div_id); initializeMoveToCenter("lbpass",div_id); } try { centerDialog(div_id); } catch(err) {} //save the id for later if we need to clear everything if(typeof window.div_id_log == "undefined") { window.div_id_log = ''; } window.div_id_log += div_id+','; showNewOverlay(); return div_id; } function centerContentWindow() { tmp = window.div_id_log.split(','); for(i=0; i-1&&typeof document.getElementById(tmp[i]) != "null") { centerDialog(tmp[i]); } } } function showNewOverlay() { var div = document.createElement('div'); var div_id = 'overlayDiv_'+Date.now(); div.setAttribute('id',div_id); div.style.position = 'fixed'; div.style.top = '0'; div.style.right = '0'; div.style.bottom = '0'; div.style.left = '0'; div.style.zIndex = '1900'; div.style.WebkitTransition = 'opacity .2s ease-in-out'; div.style.OTransition = 'opacity .2s ease-in-out'; div.style.transition = 'opacity .2s ease-in-out'; div.style.backgroundColor = '#b2aebd'; div.style.opacity = '.7'; div.style.overflow = 'hidden'; document.body.appendChild(div); window.div_id_log += div_id+','; document.getElementById(div_id).onclick = function() { killNewWindows(); } } function killNewWindows() { tmp = window.div_id_log.split(','); for(i=0; i '; } function accountSaveEdit(field,secret) { //disable the field //show a loading document.getElementById('update_'+field).disabled = true; document.getElementById('save_button_'+field).innerHTML = ''; window.last_field = field; AjaxCall("?atf_edit_account&update="+field+"&value="+document.getElementById('update_'+field).value+"&secret="+secret,false,"accountFieldUpdateResult"); } function accountFieldUpdateResult(res) { if(res.indexOf('[OK]')>-1) { //ok document.getElementById('save_button_'+window.last_field).innerHTML = ''; document.getElementById('save_button_'+window.last_field).innerHTML = 'saved'; } else { //fail document.getElementById('save_button_'+window.last_field).innerHTML = 'failed to save'; } } function imageUploadWait(width) { showOverlay(); var div = document.createElement('div'); div.setAttribute('id', 'biscuitsDialog'); div.setAttribute('class','ajaxDialog'); if(typeof width != 'undefined') { div.style.width = width+"%"; } div.style.position = "absolute"; div.style.zIndex = "20"; div.innerHTML = '
Please Wait...<\/div>'; div.style.background = "#fff"; window.scrollTo(0,0); document.body.appendChild(div); centerDialog('biscuitsDialog'); } /////////////////////////OLD FUNCTIONS//////////////////////////// function centerDialog(id) { var win = getWindowSize(); var dialog = document.getElementById(id); n_top = (win.height / 2) - (dialog.offsetHeight / 2); if(window.is_mobile==1) { n_top = (n_top*0.7); } dialog.style.top = n_top + 'px'; /*dialog.style.left = (win.width / 2) - (dialog.offsetWidth / 2) + 'px';*/ dialog.style.width='100%'; } function getWindowSize() { var winW; var winH; if (navigator.appName.indexOf("Microsoft")!=-1) { winW = document.documentElement.clientWidth; winH = document.documentElement.clientHeight; } else { winW = window.innerWidth; winH = window.innerHeight; } return {width:winW, height:winH}; } /** * Moves a box input to the viewable part of the screen on mobile * Call with: if(window.is_mobile) { initializeMoveToCenter(\"element_on_click_do_action_id\",\"container_div_id\"); } **/ function initializeMoveToCenter(action_id,move_id) { var footer = document.getElementById(move_id); var ftInput = document.getElementById(action_id); ftInput.onfocus = function(){ setTimeout(function(){ /** footer.style.position = "relative"; **/ footer.style.position = "fixed"; /** footer.style.top= "80%"; **/ footer.style.top = "-5%"; ftInput.scrollIntoView(); document.addEventListener("touchmove",function(ev){ev.preventDefault()}); },10); }; ftInput.onblur = function(){ /**footer.style.position = "relative";**/ /**footer.style.top = "47px";**/ document.removeEventListener("touchmove",function(ev){ev.preventDefault()}); } /**window.onclick = function(){ document.removeEventListener("touchmove",handleScroll); }**/ } function killWindows(goReload) { var d1 = document.body; d1.removeChild(document.getElementById("biscuitsDialog")); if(typeof document.getElementById("biscuitsOverlay") != null) { d1.removeChild(document.getElementById("biscuitsOverlay")); } document.body.style.overflow = "auto"; if(goReload) { window.location.reload(); } } function cursorPointer(id) { if(typeof document.getElementById(id) != null) { document.getElementById(id).style.cursor = 'pointer'; document.getElementById(id).onmouseout = document.getElementById(id).style.cursor = ''; } } function showOverlay() { var div = document.createElement('div'); div.setAttribute('id', 'biscuitsOverlay'); div.style.width = "100%"; div.style.height = "100%"; div.style.position = "fixed"; div.style.top = "0px"; div.style.left = "0px"; div.style.background = "#000"; div.style.opacity = ".7"; div.style.filter = "alpha(opacity=70)"; div.style.cursor = "not-allowed"; div.style.zIndex="15"; document.body.style.overflow = "hidden"; document.body.appendChild(div); //add on click on overlay and hide document.getElementById("biscuitsOverlay").addEventListener("click", killWindows); } function detectKeyPress(input_key_id,trigger_function) { const node = document.getElementById(input_key_id); node.addEventListener("keyup", function(event,input_key_id) { if (event.key === "Enter") { // Do work if(typeof window[trigger_function] != null) { window[trigger_function](); } } }); } function ajaxRequest(){ var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; //activeX versions to check for in IE if(window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken) for (var i=0; i maybe use this later, for now pass directly to returnFunction if setActive if (typeof window[returnFunction] == 'function') { window[returnFunction](this.response); } }; // Send the Data. xhr.send(formData); } function AjaxCall(url,returnId,returnFunction,append) { var mygetrequest=new ajaxRequest(); mygetrequest.onreadystatechange=function(){ if (mygetrequest.readyState==4){ if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1){ if(typeof returnId != 'undefined'&returnId!=false) { if(typeof append != 'undefined'&append!=false) { document.getElementById(returnId).innerHTML=document.getElementById(returnId).innerHTML+mygetrequest.responseText; } else { document.getElementById(returnId).innerHTML=mygetrequest.responseText; } } if (typeof window[returnFunction] == 'function') { window[returnFunction](mygetrequest.responseText); } } } }; mygetrequest.open("GET", url, true); mygetrequest.send(null); }