function LookUpEmail(email) { //alert("Your email address is: "+email); url = "http://www.point-of-reference.com/mm/app_logic/LookUpUser.php"; loadXMLDoc(url,email); } function sendEmail(email) { ab = "action=authenticate_user&email="+email; return ab; } var req; function loadXMLDoc(url,email) { xmlMessage = sendEmail(email); //alert(xmlMessage); // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = processReqChange; req.open("POST", url, true); req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); req.send(xmlMessage); // branch for IE/Windows ActiveX version } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = processReqChange; req.open("POST", url, true); req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); req.send(xmlMessage); } } } //****************************************************************************** // processReqChange() checks for, receives and parses the XML response. function processReqChange() { // only if req shows "complete" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { //alert('200'); response = req.responseXML.documentElement; method = response.getElementsByTagName('method')[0].firstChild.data; if(method == 'redirectToLongForm') { RedirectLocation = response.getElementsByTagName('RedirectLocation')[0].firstChild.data; eval(method + '(RedirectLocation)'); } else if(method == 'postToMM') { fname = response.getElementsByTagName('fname')[0].firstChild.data; lname = response.getElementsByTagName('lname')[0].firstChild.data; company = response.getElementsByTagName('company')[0].firstChild.data; title = response.getElementsByTagName('title')[0].firstChild.data; revenue = response.getElementsByTagName('revenue')[0].firstChild.data; email = response.getElementsByTagName('email')[0].firstChild.data; eval(method + '(fname,lname,company,title,revenue,email)'); } } else { alert("There was a problem retrieving the XML data:\n" + req.statusText); } } } function redirectToLongForm(RedirectLocation) { document.location.href = RedirectLocation; } function postToMM(fname,lname,company,title,revenue,email) { document.forms[1].fname.value = fname; document.forms[1].lname.value = lname; document.forms[1].company.value = company; document.forms[1].title.value = title; document.forms[1].revenue.value = revenue; document.forms[1].email.value = email; document.forms[1].submit(); }