var forgot; function Forgot (){ } Forgot.prototype.section; Forgot.prototype.email; Forgot.prototype.answer; Forgot.prototype.checkEmail = function (){ this.section = document.getElementById('forgot').value; this.email = document.getElementById('fp_email').value; if (this.section == "") { this.section = document.getElementById('jobseeker_forgot').value; this.email = document.getElementById('jsfp_email').value; } if(this.email == ""){ if (this.section == "job-seeker") { document.getElementById('jsfp_error').innerHTML = "Email Address cannot be blank."; document.getElementById('jsfp_error').style.display = 'inline'; document.getElementById('jsfp_close').style.display = 'inline'; document.getElementById('jsfp_display').style.display = 'none'; } else { document.getElementById('fp_error').innerHTML = "Email Address cannot be blank."; document.getElementById('fp_error').style.display = 'inline'; document.getElementById('fp_close').style.display = 'inline'; document.getElementById('fp_display').style.display = 'none'; document.getElementById('fp_password').innerHTML = ''; } }else{ var inlineAjax = new InlineAjax(); inlineAjax.requestObject.onreadystatechange = function(){ if(inlineAjax.requestObject.readyState == 4){ if (typeof this.section == 'undefined') { this.section = document.getElementById('forgot').value; if (this.section == "") { this.section = document.getElementById('jobseeker_forgot').value; } } var response = inlineAjax.requestObject.responseText; if(response == "norecord"){ if (this.section == "job-seeker") { document.getElementById('jsfp_error').innerHTML = "Unfortunately we do not have your email address on record."; document.getElementById('jsfp_error').style.display = 'inline'; document.getElementById('jsfp_close').style.display = 'inline'; document.getElementById('jsfp_display').style.display = 'none'; } else { document.getElementById('fp_error').innerHTML = "Unfortunately we do not have your email address on record."; document.getElementById('fp_error').style.display = 'inline'; document.getElementById('fp_close').style.display = 'inline'; document.getElementById('fp_display').style.display = 'none'; document.getElementById('fp_password').innerHTML = ''; } }else{ if (this.section == "job-seeker") { document.getElementById('jsfp_display').innerHTML = response; document.getElementById('jsfp_display').style.display = 'inline'; document.getElementById('jsfp_error').style.display = 'none'; } else { document.getElementById('fp_question').innerHTML = response; document.getElementById('fp_display').style.display = 'inline'; document.getElementById('fp_error').style.display = 'none'; document.getElementById('fp_close').style.display = 'none'; } } } } url = "/packages/FormCheck/includes/forgot_password.php?sec="+this.section+"&email="+this.email; inlineAjax.requestObject.open("GET",url,true); inlineAjax.requestObject.send(null); } } Forgot.prototype.checkAnswer = function (){ this.section = document.getElementById('forgot').value; this.answer = document.getElementById('fp_answer').value; if(this.answer == ""){ document.getElementById('fp_error').innerHTML = "Answer cannot be blank."; document.getElementById('fp_error').style.display = 'inline'; document.getElementById('fp_close').style.display = 'inline'; }else{ var inlineAjax = new InlineAjax(); inlineAjax.requestObject.onreadystatechange = function(){ if(inlineAjax.requestObject.readyState == 4){ var response = inlineAjax.requestObject.responseText; if(response == "incorrect"){ document.getElementById('fp_error').innerHTML = "Unfortunately that is the incorrect answer."; document.getElementById('fp_error').style.display = 'inline'; document.getElementById('fp_close').style.display = 'inline'; }else{ document.getElementById('fp_error').innerHTML = response; document.getElementById('fp_error').style.display = 'inline'; document.getElementById('fp_close').style.display = 'inline'; } } } url = "/packages/FormCheck/includes/forgot_password.php?sec="+this.section+"&email="+this.email+"&answer="+this.answer; inlineAjax.requestObject.open("GET",url,true); inlineAjax.requestObject.send(null); } }